mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-10-01 12:01:10 +08:00
feat: support for non-streamed responses (#294)
This commit is contained in:
1 parent
004ae8723c
commit
b886d7e944
2 files changed
+17
-5
No files matched your search
@@ -132,10 +132,12 @@ export async function generateAnswersWithChatgptApi(port, question, session, api
|
||||
console.debug('json error', error)
|
||||
return
|
||||
}
|
||||
if ('content' in data.choices[0].delta) {
|
||||
answer += data.choices[0].delta.content
|
||||
port.postMessage({ answer: answer, done: false, session: null })
|
||||
}
|
||||
answer +=
|
||||
data.choices[0]?.delta?.content ||
|
||||
data.choices[0]?.message?.content ||
|
||||
data.choices[0]?.text ||
|
||||
''
|
||||
port.postMessage({ answer: answer, done: false, session: null })
|
||||
},
|
||||
async onStart() {},
|
||||
async onEnd() {
|
||||
|
||||
Reference in new issue
Block a user