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
No known key found for this signature in database
GPG key ID: 53C61B42FEC71D6D
2 changed files with 7 additions and 3 deletions

View file

@ -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">

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
}