fix(chat): tolerate animated legacy tool feedback parsing
This commit is contained in:
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 {
|
||||||
import { parseToolCallsFromContent, parseToolCallsValue } from "./tool-calls.ts"
|
parseToolCallsFromContent,
|
||||||
|
parseToolCallsValue,
|
||||||
|
} from "@/features/chat/tool-calls.ts"
|
||||||
|
import type { AssistantMessageKind, ChatMessage } from "@/store/chat.ts"
|
||||||
|
|
||||||
type AssistantToolCalls = ChatMessage["toolCalls"]
|
type AssistantToolCalls = ChatMessage["toolCalls"]
|
||||||
type ExistingAssistantMessageState = Pick<ChatMessage, "kind" | "toolCalls">
|
type ExistingAssistantMessageState = Pick<ChatMessage, "kind" | "toolCalls">
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ function parseLegacyToolFeedbackContent(
|
||||||
content: string,
|
content: string,
|
||||||
): ChatToolCall[] | undefined {
|
): ChatToolCall[] | undefined {
|
||||||
const trimmed = content.trim()
|
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) {
|
if (!match) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue