Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
💲 fix: Prevent Single-dollar LaTeX for abbrev. Currency (K, M, B) (#9293)
Danny Avilaa820863e8bda
diff --git a/client/src/utils/latex.spec.ts b/client/src/utils/latex.spec.tsindex d223edbd8e..f044f4de53 100644--- a/client/src/utils/latex.spec.ts+++ b/client/src/utils/latex.spec.ts@@ -239,4 +239,16 @@ y$ which spans lines`;const expected = 'Bitcoin: \\$0.00001234, Gas: \\$3.999, Rate: \\$1.234567890';expect(preprocessLaTeX(content)).toBe(expected);});++ test('escapes abbreviated currency notation', () => {+ const content = '$250k is 25% of $1M';+ const expected = '\\$250k is 25% of \\$1M';+ expect(preprocessLaTeX(content)).toBe(expected);+ });++ test('handles various abbreviated currency formats', () => {+ const content = 'Revenue: $5M to $10M, funding: $1.5B, price: $5K';+ const expected = 'Revenue: \\$5M to \\$10M, funding: \\$1.5B, price: \\$5K';+ expect(preprocessLaTeX(content)).toBe(expected);+ });});diff --git a/client/src/utils/latex.ts b/client/src/utils/latex.tsindex 11438245c1..4467c2a5e3 100644--- a/client/src/utils/latex.ts+++ b/client/src/utils/latex.ts@@ -3,7 +3,8 @@ const MHCHEM_CE_REGEX = /\$\\ce\{/g;const MHCHEM_PU_REGEX = /\$\\pu\{/g;const MHCHEM_CE_ESCAPED_REGEX = /\$\\\\ce\{[^}]*\}\$/g;const MHCHEM_PU_ESCAPED_REGEX = /\$\\\\pu\{[^}]*\}\$/g;-const CURRENCY_REGEX = /(?<![\\$])\$(?!\$)(?=\d+(?:,\d{3})*(?:\.\d+)?(?:\s|$|[^a-zA-Z\d]))/g;+const CURRENCY_REGEX =+ /(?<![\\$])\$(?!\$)(?=\d+(?:,\d{3})*(?:\.\d+)?(?:[KMBkmb])?(?:\s|$|[^a-zA-Z\d]))/g;const SINGLE_DOLLAR_REGEX = /(?<!\\)\$(?!\$)((?:[^$\n]|\\[$])+?)(?<!\\)(?<!`)\$(?!\$)/g;/**