This commit is contained in:
josc146
2024-03-24 14:05:42 +08:00
parent e3006b0abf
commit a3b7d2c1f9
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -67,6 +67,7 @@ export async function generateAnswersWithCustomApi(port, question, session, apiK
pushRecord(session, question, answer)
console.debug('conversation history', { content: session.conversationRecords })
port.postMessage({ answer: null, done: true, session: session })
return
}
if (data.response) answer = data.response
+2
View File
@@ -75,6 +75,7 @@ export async function generateAnswersWithGptCompletionApi(
pushRecord(session, question, answer)
console.debug('conversation history', { content: session.conversationRecords })
port.postMessage({ answer: null, done: true, session: session })
return
}
answer += data.choices[0].text
@@ -170,6 +171,7 @@ export async function generateAnswersWithChatgptApiCompat(
pushRecord(session, question, answer)
console.debug('conversation history', { content: session.conversationRecords })
port.postMessage({ answer: null, done: true, session: session })
return
}
const delta = data.choices[0]?.delta?.content