diff --git a/src/components/Settings/Sections/ChatSettings.tsx b/src/components/Settings/Sections/ChatSettings.tsx index 1e272ab0..c3178561 100644 --- a/src/components/Settings/Sections/ChatSettings.tsx +++ b/src/components/Settings/Sections/ChatSettings.tsx @@ -161,6 +161,31 @@ const ChatSettings = () => { ))} + + + ) } diff --git a/src/config/settings/index.ts b/src/config/settings/index.ts index 0066646c..e991ee03 100644 --- a/src/config/settings/index.ts +++ b/src/config/settings/index.ts @@ -24,6 +24,7 @@ export type Settings = { model: string | null mode: Mode openAiBaseUrl: string | null + embeddingModel: string | null } general: { theme: ThemeOptions @@ -42,6 +43,7 @@ export const defaultSettings: Settings = { model: null, mode: Mode.BALANCED, openAiBaseUrl: null, + embeddingModel: null, }, general: { theme: ThemeOptions.SYSTEM, diff --git a/src/lib/getMatchedContent.ts b/src/lib/getMatchedContent.ts index 81e86031..5ce3362a 100644 --- a/src/lib/getMatchedContent.ts +++ b/src/lib/getMatchedContent.ts @@ -3,6 +3,7 @@ import { RecursiveCharacterTextSplitter } from 'langchain/text_splitter' import { MemoryVectorStore } from 'langchain/vectorstores/memory' import { createSHA256Hash } from './createSHA256Hash' import { readStorage, setStorage } from '../hooks/useStorage' +import { useSettings } from '../hooks/useSettings' export const getMatchedContent = async ( query: string, @@ -21,8 +22,11 @@ const getContextVectorStore = async ( apiKey: string, baseURL: string, ) => { + const [settings] = useSettings() + const embeddingModel = settings.chat.embeddingModel || 'text-embedding-ada-002' const embeddings = new OpenAIEmbeddings({ openAIApiKey: apiKey, + modelName: embeddingModel, configuration: { baseURL: baseURL, },