mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(chat): tolerate animated legacy tool feedback parsing
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user