fix(chat): tolerate animated legacy tool feedback parsing

This commit is contained in:
lc6464
2026-04-26 01:19:19 +08:00
parent 303ff8137d
commit 9d42282672
2 changed files with 7 additions and 3 deletions
@@ -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<ChatMessage, "kind" | "toolCalls">
+2 -1
View File
@@ -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
}