From 1b9e7e32bdd7ad1e2c8559a3f7552df880095755 Mon Sep 17 00:00:00 2001 From: LC <64722907+lc6464@users.noreply.github.com> Date: Sun, 26 Apr 2026 19:59:55 +0800 Subject: [PATCH] fix(chat): add `\r?` for regular expressions Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- web/frontend/src/features/chat/tool-calls.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/frontend/src/features/chat/tool-calls.ts b/web/frontend/src/features/chat/tool-calls.ts index c3b9b4777..bf306c5e5 100644 --- a/web/frontend/src/features/chat/tool-calls.ts +++ b/web/frontend/src/features/chat/tool-calls.ts @@ -12,9 +12,9 @@ function parseLegacyToolFeedbackContent( const toolName = match[1]?.trim() ?? "" const body = match[2]?.trim() ?? "" - const codeFence = /```(?:json)?\n([\s\S]*?)\n```/m.exec(body) + const codeFence = /```(?:json)?\r?\n([\s\S]*?)\r?\n```/m.exec(body) const argumentsText = codeFence?.[1]?.trim() ?? "" - const explanation = body.replace(/```(?:json)?\n[\s\S]*?\n```/gm, "").trim() + const explanation = body.replace(/```(?:json)?\r?\n[\s\S]*?\r?\n```/gm, "").trim() return [ {