mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-12 10:55:03 +00:00
fix(ai-assistant): 修复 SSE 流式响应 done 事件错误处理
- 解析 done 事件的 payload 检查是否携带错误信息 - 移除错误提示中对 response.error 的直接展示
This commit is contained in:
parent
ad66811f49
commit
bc460f0da8
@ -56,7 +56,7 @@
|
|||||||
class="ai-assistant-output-item">
|
class="ai-assistant-output-item">
|
||||||
<div class="ai-assistant-output-apply">
|
<div class="ai-assistant-output-apply">
|
||||||
<template v-if="response.status === 'error'">
|
<template v-if="response.status === 'error'">
|
||||||
<span class="ai-assistant-output-error">{{ response.error || $L('发送失败') }}</span>
|
<span class="ai-assistant-output-error">{{ $L('发送失败') }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="response.rawOutput">
|
<template v-else-if="response.rawOutput">
|
||||||
<Button
|
<Button
|
||||||
@ -661,7 +661,11 @@ export default {
|
|||||||
this.handleStreamChunk(responseEntry, type, event);
|
this.handleStreamChunk(responseEntry, type, event);
|
||||||
break;
|
break;
|
||||||
case 'done':
|
case 'done':
|
||||||
if (responseEntry && responseEntry.status !== 'error' && responseEntry.rawOutput) {
|
// 检查 done 事件是否携带错误信息
|
||||||
|
const donePayload = this.parseStreamPayload(event);
|
||||||
|
if (donePayload && donePayload.error) {
|
||||||
|
this.markResponseError(responseEntry, donePayload.error);
|
||||||
|
} else if (responseEntry && responseEntry.status !== 'error' && responseEntry.rawOutput) {
|
||||||
responseEntry.status = 'completed';
|
responseEntry.status = 'completed';
|
||||||
}
|
}
|
||||||
this.releaseSSEClient(sse);
|
this.releaseSSEClient(sse);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user