Skip to content

Commit

Permalink
minor improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Aug 8, 2024
1 parent ca8d020 commit 0ee357d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/apis/chatgpt-web.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/services/apis/moonshot-web.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/services/clients/claude/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

1 comment on commit 0ee357d

@Admin-Author

This comment was marked as spam.

Please sign in to comment.