fix(chat): add \r? for regular expressions

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
LC 2026-04-26 19:59:55 +08:00 committed by GitHub
parent 1acab59fc7
commit 1b9e7e32bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,9 +12,9 @@ function parseLegacyToolFeedbackContent(
const toolName = match[1]?.trim() ?? "" const toolName = match[1]?.trim() ?? ""
const body = match[2]?.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 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 [ return [
{ {