Skip to content

Commit 49e5fc3

Browse files
committed
fix:【AI 大模型】fetchEventSource 失败时,无限重试的问题
1 parent 47c2e74 commit 49e5fc3

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/views/ai/chat/index/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,8 @@ const doSendMessageStream = async (userMessage: ChatMessageVO) => {
462462
(error) => {
463463
message.alert(`对话异常! ${error}`)
464464
stopStream()
465+
// 需要抛出异常,禁止重试
466+
throw error
465467
},
466468
() => {
467469
stopStream()

src/views/ai/mindmap/index/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ const submit = (data: AiMindMapGenerateReqVO) => {
8080
onError(err) {
8181
console.error('生成思维导图失败', err)
8282
stopStream()
83+
// 需要抛出异常,禁止重试
84+
throw error
8385
},
8486
ctrl: ctrl.value
8587
})

src/views/ai/write/index/index.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ const submit = (data: WriteVO) => {
5757
},
5858
ctrl: abortController.value,
5959
onClose: stopStream,
60-
onError: (...err) => {
61-
console.error('写作异常', ...err)
60+
onError: (error) => {
61+
console.error('写作异常', error)
6262
stopStream()
63+
// 需要抛出异常,禁止重试
64+
throw error
6365
}
6466
})
6567
}

0 commit comments

Comments
 (0)