From 9d42282672ec85c7777fba28af27d34a8acc832b Mon Sep 17 00:00:00 2001 From: lc6464 <64722907+lc6464@users.noreply.github.com> Date: Sun, 26 Apr 2026 01:19:19 +0800 Subject: [PATCH] fix(chat): tolerate animated legacy tool feedback parsing --- web/frontend/src/features/chat/assistant-message-state.ts | 7 +++++-- web/frontend/src/features/chat/tool-calls.ts | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/frontend/src/features/chat/assistant-message-state.ts b/web/frontend/src/features/chat/assistant-message-state.ts index 9c9bf0428..b38b9c3a4 100644 --- a/web/frontend/src/features/chat/assistant-message-state.ts +++ b/web/frontend/src/features/chat/assistant-message-state.ts @@ -1,5 +1,8 @@ -import type { AssistantMessageKind, ChatMessage } from "../../store/chat.ts" -import { parseToolCallsFromContent, parseToolCallsValue } from "./tool-calls.ts" +import { + parseToolCallsFromContent, + parseToolCallsValue, +} from "@/features/chat/tool-calls.ts" +import type { AssistantMessageKind, ChatMessage } from "@/store/chat.ts" type AssistantToolCalls = ChatMessage["toolCalls"] type ExistingAssistantMessageState = Pick diff --git a/web/frontend/src/features/chat/tool-calls.ts b/web/frontend/src/features/chat/tool-calls.ts index e92dca1bb..c3b9b4777 100644 --- a/web/frontend/src/features/chat/tool-calls.ts +++ b/web/frontend/src/features/chat/tool-calls.ts @@ -4,7 +4,8 @@ function parseLegacyToolFeedbackContent( content: string, ): ChatToolCall[] | undefined { const trimmed = content.trim() - const match = /^🔧\s+`([^`]+)`(?:\n([\s\S]*))?$/.exec(trimmed) + const match = + /^🔧\s+`([^`\n\r]*?)(?:\.{1,2})?`[^\n\r]*(?:\r?\n([\s\S]*))?$/.exec(trimmed) if (!match) { return undefined }