mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-10 01:48:11 +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">
|
||||
<div class="ai-assistant-output-apply">
|
||||
<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 v-else-if="response.rawOutput">
|
||||
<Button
|
||||
@ -661,7 +661,11 @@ export default {
|
||||
this.handleStreamChunk(responseEntry, type, event);
|
||||
break;
|
||||
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';
|
||||
}
|
||||
this.releaseSSEClient(sse);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user