mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-06-27 17:47:56 +08:00
minor improvement
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user