Skip to content

Commit a418889

Browse files
authored
πŸ› Mathematical formulas are replaced by the number 1 #1389
2 parents f08f936 + fbf2ab3 commit a418889

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

β€Žbackend/consts/const.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,4 @@
265265
os.getenv("LLM_SLOW_TOKEN_RATE_THRESHOLD", "10.0")) # tokens per second
266266

267267
# APP Version
268-
APP_VERSION = "v1.7.4"
268+
APP_VERSION = "v1.7.4.1"

β€Žfrontend/components/ui/markdownRenderer.tsxβ€Ž

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,14 @@ const convertLatexDelimiters = (content: string): string => {
336336
if (!content.includes('\\(') && !content.includes('\\[')) {
337337
return content;
338338
}
339-
340-
return content
341-
// Convert \( ... \) to $ ... $ (inline math)
342-
.replace(/\\\(([\s\S]*?)\\\)/g, '$$1$')
343-
// Convert \[ ... \] to $$ ... $$ (display math)
344-
.replace(/\\\[([\s\S]*?)\\\]/g, '$$$$1$$\n');
339+
340+
return (
341+
content
342+
// Convert \( ... \) to $ ... $ (inline math)
343+
.replace(/\\\(([\s\S]*?)\\\)/g, (_match, inner) => `$${inner}$`)
344+
// Convert \[ ... \] to $$ ... $$ (display math)
345+
.replace(/\\\[([\s\S]*?)\\\]/g, (_match, inner) => `$$${inner}$$\n`)
346+
);
345347
};
346348

347349
export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({

0 commit comments

Comments
Β (0)