You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const abortController = new AbortController()
await fetchEventSource(
`https://xxx/xx/xx/xx?query=${questionSended}&dialog_id=${this.currentDialogID}&is_stream=1`,
{
headers: {
Authorization: userinfo.token
},
signal: abortController.signal,
openWhenHidden: true,
onopen: async response => {
console.log('onopen', response)
if (response.status !== 200) {
throw new Error(`${response.status}(${response.statusText})`)
}
return
},
onmessage: res => {
const data = JSON.parse(res.data)
console.log(data)
if (data.plugin_id) return
if (data.error_code) {
throw new Error(`${data.error_code}(${data.error_msg})`)
}
if (data.prompt) {
this.relatedQuestion = data.prompt
} else {
}
},
onclose: () => {
console.log('closed')
},
onerror: err => {
console.log('err', err)
if (abortController.signal.aborted) return
this.dialogDetailList[contextIndex].answer =
'error'
abortController.abort()
}
}
)
The error occured in the middle of request, and the browser start another request to continue receiving stream data. And the same error occured. such back and forth
And l can read true value of 'abortController.signal.aborted' in error callback, but the request still continue
The text was updated successfully, but these errors were encountered:
The error occured in the middle of request, and the browser start another request to continue receiving stream data. And the same error occured. such back and forth
And l can read true value of 'abortController.signal.aborted' in error callback, but the request still continue
The text was updated successfully, but these errors were encountered: