From 767c45080f057669c01e41ff4c43fdcbc63d4c3f Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 14 Oct 2024 16:44:57 -0700 Subject: [PATCH] update openai --- extensions/void/src/common/sendLLMMessage.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/void/src/common/sendLLMMessage.ts b/extensions/void/src/common/sendLLMMessage.ts index 6d083979..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; }; - let openai = 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({ baseURL:apiConfig.openAICompatible.endpoint,apiKey: apiConfig.openAICompatible.apikey, dangerouslyAllowBrowser: true }); + openai = new OpenAI({ apiKey: apiConfig.openAI.apikey, dangerouslyAllowBrowser: true }); options = { model: apiConfig.openAICompatible.model, messages: messages, stream: true, } } else {