From e7c05bf6dd47c8eed78f94566d805ae13d816ecc Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Tue, 17 Dec 2024 17:05:09 -0800 Subject: [PATCH] clean up --- web/src/app/chat/message/Messages.tsx | 12 ++---- web/src/app/test/page.tsx | 62 --------------------------- 2 files changed, 3 insertions(+), 71 deletions(-) delete mode 100644 web/src/app/test/page.tsx diff --git a/web/src/app/chat/message/Messages.tsx b/web/src/app/chat/message/Messages.tsx index 9f6e2846880..1a7f885cbd1 100644 --- a/web/src/app/chat/message/Messages.tsx +++ b/web/src/app/chat/message/Messages.tsx @@ -75,7 +75,7 @@ import SourceCard, { import remarkMath from "remark-math"; import rehypeKatex from "rehype-katex"; -import "katex/dist/katex.min.css"; // Add this import for KaTeX styles +import "katex/dist/katex.min.css"; const TOOLS_WITH_CUSTOM_HANDLING = [ SEARCH_TOOL_NAME, @@ -365,14 +365,8 @@ export const AIMessage = ({ {finalContent as string} diff --git a/web/src/app/test/page.tsx b/web/src/app/test/page.tsx deleted file mode 100644 index b7526275174..00000000000 --- a/web/src/app/test/page.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import ReactMarkdown from "react-markdown"; -import remarkGfm from "remark-gfm"; -import remarkMath from "remark-math"; -import rehypeKatex from "rehype-katex"; -import rehypePrism from "rehype-prism-plus"; - -import "katex/dist/katex.min.css"; // for KaTeX -import "prismjs/themes/prism.css"; // for code highlighting (if you want it) - -export const preprocessLaTeX = (content: string) => { - // Replace block-level LaTeX delimiters \[ \] with $$ $$ - const blockProcessedContent = content.replace( - /\\\[([\s\S]*?)\\\]/g, - (_, equation) => `$$${equation}$$` - ); - // Replace inline LaTeX delimiters \( \) with $ $ - const inlineProcessedContent = blockProcessedContent.replace( - /\\\(([\s\S]*?)\\\)/g, - (_, equation) => `$${equation}$` - ); - return inlineProcessedContent; -}; - -export default function MyPage() { - // Example: Notice that \( … \) and \[ … \] are not in code fences. - const rawContent = ` -Here is some inline math with backslash delimiters: \\( 5 \\times 10 \\). - -Here is display math: -\\[ -\\oint_S \\vec{E} \\cdot d\\vec{A} = \\frac{Q_{\\text{enc}}}{\\epsilon_0} -\\] - -And more display math: -\\[ -\\nabla \\cdot E = \\frac{\\rho}{\\epsilon_0} -\\] - -Also show the $$ version: -$$ -\\nabla \\cdot E = \\frac{\\rho}{\\epsilon_0} -$$ -`; - - const content = preprocessLaTeX(rawContent); - - return ( - - {content} - - ); -}