From fa99b6036237d919f0ca7aaa1c0671e78f9cca71 Mon Sep 17 00:00:00 2001 From: anc95 <1481988258@qq.com> Date: Fri, 24 May 2024 10:52:29 +0800 Subject: [PATCH] chore: use createChatCompletion always --- src/common/api/openai.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/common/api/openai.ts b/src/common/api/openai.ts index 8043953..8e641ac 100644 --- a/src/common/api/openai.ts +++ b/src/common/api/openai.ts @@ -67,10 +67,6 @@ export const useQueryOpenAIPrompt = () => { ) => { const isWritelyService = settings.serviceProvider === ServiceProvider.Writely - const isChat = - isWritelyService || - settings.model.includes('turbo') || - settings.model === 'gpt-4' const commonOption = { // max_tokens: 4000 - prompt.replace(/[\u4e00-\u9fa5]/g, 'aa').length, @@ -85,7 +81,7 @@ export const useQueryOpenAIPrompt = () => { chatgptWeb.sendMsg(prompt, onData) return chatgptWeb.abort - } else if (isChat) { + } else { openAI?.current?.createChatCompletion( { ...commonOption, @@ -96,17 +92,6 @@ export const useQueryOpenAIPrompt = () => { signal: abortController.signal, } ) - } else { - openAI?.current?.createCompletion( - { - ...commonOption, - prompt: prompt, - }, - { - ...(axiosOptionForOpenAI(onData) as any), - signal: abortController.signal, - } - ) } return () => {