diff --git a/extensions/void/src/common/sendLLMMessage.ts b/extensions/void/src/common/sendLLMMessage.ts index 343bea3a..39c38fee 100644 --- a/extensions/void/src/common/sendLLMMessage.ts +++ b/extensions/void/src/common/sendLLMMessage.ts @@ -119,14 +119,15 @@ const sendOpenAIMsg: SendLLMMessageFnTypeInternal = ({ messages, onText, onFinal didAbort = true; }; - //const openai = new OpenAI({ apiKey: apiConfig.openAI.apikey, dangerouslyAllowBrowser: true }); - const openai = apiConfig.whichApi === 'openAICompatible' ? new OpenAI({ baseURL: apiConfig.openAICompatible.endpoint, apiKey: apiConfig.openAICompatible.apikey, dangerouslyAllowBrowser: true }) : new OpenAI({ apiKey: apiConfig.openAI.apikey, dangerouslyAllowBrowser: true }); - + let openai: OpenAI let options: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming + if (apiConfig.whichApi === 'openAI') { + openai = new OpenAI({ baseURL: apiConfig.openAICompatible.endpoint, apiKey: apiConfig.openAICompatible.apikey, dangerouslyAllowBrowser: true }) options = { model: apiConfig.openAI.model, messages: messages, stream: true, } } else if (apiConfig.whichApi === 'openAICompatible') { + openai = new OpenAI({ apiKey: apiConfig.openAI.apikey, dangerouslyAllowBrowser: true }); options = { model: apiConfig.openAICompatible.model, messages: messages, stream: true, } } else {