From 1eb6228923bc319527455f9316d955ced7a41732 Mon Sep 17 00:00:00 2001 From: navaneethkrishnansuresh Date: Wed, 8 Apr 2026 20:00:39 +0530 Subject: [PATCH] Strip tool-call XML blocks from markdown output Filter out function_calls, invoke, and parameter XML tags (including antml: namespaced variants) that some models/proxies emit as plain text. Co-Authored-By: Claude Opus 4.6 --- .../client_web/src/components/markdown/MarkdownContent.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builds/typescript/client_web/src/components/markdown/MarkdownContent.tsx b/builds/typescript/client_web/src/components/markdown/MarkdownContent.tsx index d2d5c77..30a37bd 100644 --- a/builds/typescript/client_web/src/components/markdown/MarkdownContent.tsx +++ b/builds/typescript/client_web/src/components/markdown/MarkdownContent.tsx @@ -26,10 +26,14 @@ function CopyButton({ code }: { code: string }) { } export default function MarkdownContent({ content }: { content: string }) { - // Strip / blocks that some models emit as text + // Strip tool-call XML blocks that some models/proxies emit as plain text + // Covers: , , , , const cleaned = content .replace(/[\s\S]*?<\/tool_call>/g, "") .replace(/[\s\S]*?<\/tool_response>/g, "") + .replace(/<\/?(?:antml:)?function_calls>[\s\S]*?(?:<\/(?:antml:)?function_calls>|$)/g, "") + .replace(/<(?:antml:)?invoke[\s\S]*?(?:<\/(?:antml:)?invoke>|$)/g, "") + .replace(/<(?:antml:)?parameter[\s\S]*?(?:<\/(?:antml:)?parameter>|$)/g, "") .trim(); return (