fix(ai-assistant): 修复 SSE 连接失败时状态未正确更新的问题

当 SSE 连接一开始就失败时,响应状态保持 'waiting' 而非 'streaming',
导致 onFailed 回调不会更新状态,UI 一直显示 loading。

现在同时处理 'streaming' 和 'waiting' 状态,并标记为错误状态显示失败提示。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kuaifan 2026-01-20 14:20:50 +00:00
parent cb5e7e2cc7
commit 07b99c6e75

View File

@ -945,8 +945,8 @@ export default {
}
}, () => {
// SSE
if (responseEntry && responseEntry.status === 'streaming') {
responseEntry.status = 'completed';
if (responseEntry && ['streaming', 'waiting'].includes(responseEntry.status)) {
this.markResponseError(responseEntry, this.$L('连接失败,请重试'));
}
this.releaseSSEClient(sse);
this.saveCurrentSession();