diff --git a/src/config/settings/index.ts b/src/config/settings/index.ts index 34e5648d..4330967f 100644 --- a/src/config/settings/index.ts +++ b/src/config/settings/index.ts @@ -16,10 +16,10 @@ export enum AvailableModels { } export enum Mode { - HIGHLY_PRECISE = '0', - PRECISE = '0.5', - BALANCED = '1', - CREATIVE = '1.5', + HIGHLY_PRECISE = 0, + PRECISE = 0.5, + BALANCED = 1, + CREATIVE = 1.5, } export type Settings = { diff --git a/src/hooks/useChatCompletion.tsx b/src/hooks/useChatCompletion.tsx index acacaf2f..aefc838f 100644 --- a/src/hooks/useChatCompletion.tsx +++ b/src/hooks/useChatCompletion.tsx @@ -29,6 +29,8 @@ export const useChatCompletion = ({ const chat = useMemo(() => new ChatOpenAI({ streaming: true, openAIApiKey: apiKey, + modelName: model, + temperature: mode, }), []) const submitQuery = async (query: string) => { @@ -44,7 +46,7 @@ export const useChatCompletion = ({ } }) setGenerating(true) - const response = await chat.call([...previousMessages, new HumanMessage(query)], { + const response = await chat.call([new SystemMessage(systemPrompt), ...previousMessages, new HumanMessage(query)], { signal: controller.signal, callbacks: [ { diff --git a/src/hooks/useCurrentChat.tsx b/src/hooks/useCurrentChat.tsx index 309472d7..985c4ac2 100644 --- a/src/hooks/useCurrentChat.tsx +++ b/src/hooks/useCurrentChat.tsx @@ -3,9 +3,9 @@ import { useStorage } from "./useStorage" export enum ChatRole { - "USER", - "ASSISTANT", - "SYSTEM" + "USER" = "USER", + "ASSISTANT" = "ASSISTANT", + "SYSTEM" = "SYSTEM", } export type ChatMessage = {