Skip to content

Commit

Permalink
chore: use createChatCompletion always
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed May 24, 2024
1 parent 3faed52 commit fa99b60
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/common/api/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -85,7 +81,7 @@ export const useQueryOpenAIPrompt = () => {
chatgptWeb.sendMsg(prompt, onData)

return chatgptWeb.abort
} else if (isChat) {
} else {
openAI?.current?.createChatCompletion(
{
...commonOption,
Expand All @@ -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 () => {
Expand Down

0 comments on commit fa99b60

Please sign in to comment.