feat: add OpenAI model support

Adds support for OpenAI models, allowing users to leverage various OpenAI models directly from the application. This includes custom OpenAI models and OpenAI-specific configurations for seamless integration.
This commit is contained in:
n4ze3m
2024-09-29 19:57:26 +05:30
parent 2a2610afb8
commit c8620637f8
9 changed files with 97 additions and 31 deletions

View File

@@ -4,6 +4,7 @@ import { urlRewriteRuntime } from "../libs/runtime"
import { getChromeAIModel } from "./chrome"
import { setNoOfRetrievedDocs, setTotalFilePerKB } from "./app"
import fetcher from "@/libs/fetcher"
import { ollamaFormatAllCustomModels } from "@/db/models"
const storage = new Storage()
@@ -193,9 +194,13 @@ export const fetchChatModels = async ({
}
})
const chromeModel = await getChromeAIModel()
const customModels = await ollamaFormatAllCustomModels()
return [
...chatModels,
...chromeModel
...chromeModel,
...customModels
]
} catch (e) {
console.error(e)
@@ -207,10 +212,11 @@ export const fetchChatModels = async ({
}
})
const chromeModel = await getChromeAIModel()
const customModels = await ollamaFormatAllCustomModels()
return [
...models,
...chromeModel
...chromeModel,
...customModels
]
}
}