Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
fix(webui): avoid parsing currency as math
Xubin Ren9ceacc540c1d
diff --git a/webui/src/lib/remark-tex-math.ts b/webui/src/lib/remark-tex-math.tsindex c9a304357..b8c78e319 100644--- a/webui/src/lib/remark-tex-math.ts+++ b/webui/src/lib/remark-tex-math.ts@@ -14,7 +14,6 @@ const CARET = 94;const UNDERSCORE = 95;const EQUALS = 61;const PLUS = 43;-const SLASH = 47;const LESS_THAN = 60;const GREATER_THAN = 62;const LEFT_BRACE = 123;@@ -71,7 +70,6 @@ function isMathSignal(code: Code): boolean {|| code === UNDERSCORE|| code === EQUALS|| code === PLUS- || code === SLASH|| code === LESS_THAN|| code === GREATER_THAN|| code === LEFT_BRACEdiff --git a/webui/src/tests/markdown-text-renderer.test.tsx b/webui/src/tests/markdown-text-renderer.test.tsxindex 8feeda300..53221fb4a 100644--- a/webui/src/tests/markdown-text-renderer.test.tsx+++ b/webui/src/tests/markdown-text-renderer.test.tsx@@ -530,6 +530,21 @@ describe("MarkdownTextRenderer", () => {expect(container.querySelector(".katex")).toBeNull();});+ it("keeps currency rates and later totals out of one inline math span", () => {+ const { container } = render(+ <MarkdownTextRenderer>+ {+ "费用预估为 **$0.10/5秒(720p)**,在余额内。我选择做一条 **8秒、16:9、带自然环境音** 的电影感梦幻片,预计约 **$0.16**,现在开始生成。"+ }+ </MarkdownTextRenderer>,+ );++ expect(container.querySelector(".katex")).toBeNull();+ expect(container).toHaveTextContent("$0.10/5秒(720p)");+ expect(container).toHaveTextContent("$0.16");+ expect(container.querySelectorAll("strong")).toHaveLength(3);+ });+it("renders guarded single-dollar inline math", () => {const { container } = render(<MarkdownTextRenderer>