From 32e3bf848e2bf1ae0eec4c96a82224279df38e25 Mon Sep 17 00:00:00 2001 From: thzxx Date: Sun, 5 Apr 2026 01:32:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20RAG=E4=B8=B4=E6=97=B6=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=BB=B6=E8=BF=9F=E5=88=B0=E9=A6=96=E4=B8=AA?= =?UTF-8?q?token=E5=88=B0=E8=BE=BE=E6=97=B6=E6=89=8D=E6=B8=85=E9=99=A4?= =?UTF-8?q?=EF=BC=8C=E6=B6=88=E9=99=A4=E5=9B=9E=E5=A4=8D=E5=89=8D=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/components/input-area.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/components/input-area.js b/js/components/input-area.js index 77c1a10..65bb46a 100644 --- a/js/components/input-area.js +++ b/js/components/input-area.js @@ -477,10 +477,14 @@ ${ragContext} console.log('[RAG] numCtx:', numCtx, 'system长度:', chatParams.system?.length || 0); console.log('[RAG] 开始调用 chatStream...'); - // 开始回复时清除 RAG 临时状态消息 - document.querySelectorAll('.rag-status').forEach(el => el.remove()); + let ragStatusCleared = false; await api.chatStream(chatParams, (chunk) => { + // 首个有效内容到达时才清除 RAG 状态,避免检索完到开始回复之间的空白 + if (!ragStatusCleared && chunk.message?.content) { + ragStatusCleared = true; + document.querySelectorAll('.rag-status').forEach(el => el.remove()); + } if (chunk.message) { if (chunk.message.content) { assistantContent += chunk.message.content;