From b022cd63e5f6c84dc0a18232c8e0abb385837792 Mon Sep 17 00:00:00 2001 From: Syngnat Date: Thu, 2 Apr 2026 10:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(ai-chat):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=E6=97=B6=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E7=8A=B6=E6=80=81=E8=BF=87=E6=B8=A1=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - handleRetryMessage 补齐 connecting 过渡消息(波纹动画),与 handleSend 流程一致 - 重试时同步重置工具调用计数器,防止继承旧计数导致过早熔断 --- frontend/src/components/AIChatPanel.tsx | 14 ++++++++++++++ frontend/wailsjs/runtime/package.json | 0 frontend/wailsjs/runtime/runtime.d.ts | 0 frontend/wailsjs/runtime/runtime.js | 0 4 files changed, 14 insertions(+) mode change 100644 => 100755 frontend/wailsjs/runtime/package.json mode change 100644 => 100755 frontend/wailsjs/runtime/runtime.d.ts mode change 100644 => 100755 frontend/wailsjs/runtime/runtime.js diff --git a/frontend/src/components/AIChatPanel.tsx b/frontend/src/components/AIChatPanel.tsx index 5602056..ed58511 100644 --- a/frontend/src/components/AIChatPanel.tsx +++ b/frontend/src/components/AIChatPanel.tsx @@ -674,7 +674,21 @@ export const AIChatPanel: React.FC = ({ if (lastUserMsgIndex >= 0) { const userMsg = historyLocal[lastUserMsgIndex]; truncateAIChatMessages(sid, userMsg.id); + + // 重置计数器(与 handleSend 保持一致) + toolCallRoundRef.current = 0; + totalToolRoundRef.current = 0; + nudgeCountRef.current = 0; + setSending(true); + + // 插入 connecting 过渡消息(波纹动画),与 handleSend 保持一致 + const connectingMsg: AIChatMessage = { + id: genId(), role: 'assistant', phase: 'connecting', content: '', + timestamp: Date.now(), loading: true + }; + addAIChatMessage(sid, connectingMsg); + const truncatedHistory = historyLocal.slice(0, lastUserMsgIndex + 1); const messagesPayload = truncatedHistory.map(m => ({ role: m.role, content: m.content, images: m.images })); diff --git a/frontend/wailsjs/runtime/package.json b/frontend/wailsjs/runtime/package.json old mode 100644 new mode 100755 diff --git a/frontend/wailsjs/runtime/runtime.d.ts b/frontend/wailsjs/runtime/runtime.d.ts old mode 100644 new mode 100755 diff --git a/frontend/wailsjs/runtime/runtime.js b/frontend/wailsjs/runtime/runtime.js old mode 100644 new mode 100755