Skip to content

Commit

Permalink
fix: user cancel conversation show error (langgenius#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjoel authored and Octivian committed Aug 8, 2023
1 parent 217040c commit 4e3906d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/service/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,16 @@ export const ssePost = (url: string, fetchOptions: any, { isPublicAPI = false, o
return handleStream(res, (str: string, isFirstMessage: boolean, moreInfo: IOnDataMoreInfo) => {
if (moreInfo.errorMessage) {
onError?.(moreInfo.errorMessage)
Toast.notify({ type: 'error', message: moreInfo.errorMessage })
if (moreInfo.errorMessage !== 'AbortError: The user aborted a request.')
Toast.notify({ type: 'error', message: moreInfo.errorMessage })
return
}
onData?.(str, isFirstMessage, moreInfo)
}, onCompleted)
}).catch((e) => {
Toast.notify({ type: 'error', message: e })
if (e.toString() !== 'AbortError: The user aborted a request.')
Toast.notify({ type: 'error', message: e })

onError?.(e)
})
}
Expand Down

0 comments on commit 4e3906d

Please sign in to comment.