minor improvement

This commit is contained in:
josc146
2024-08-08 15:04:25 +08:00
parent ca8d02027f
commit 0ee357d03e
3 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -397,7 +397,7 @@ export async function generateAnswersWithChatgptWebApi(port, question, session,
function handleMessage(data) {
if (data.error) {
throw new Error(data.error)
throw new Error(JSON.stringify(data.error))
}
if (data.conversation_id) session.conversationId = data.conversation_id
+3
View File
@@ -405,6 +405,9 @@ export class Conversation {
console.debug('json error', error)
return
}
if (parsed.error) {
throw new Error(message)
}
if (parsed.event === 'cmpl' && parsed.text) fullResponse += parsed.text
const PROGRESS_OBJECT = {
...parsed,
+3
View File
@@ -610,6 +610,9 @@ export class Conversation {
console.debug('json error', error)
return
}
if (parsed.error) {
throw new Error(message)
}
if (parsed.completion) fullResponse += parsed.completion
const PROGRESS_OBJECT = {
...parsed,