Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error Fallback with LaTex markdown #542

Open
leemjm92 opened this issue Sep 20, 2024 · 0 comments
Open

[BUG] Error Fallback with LaTex markdown #542

leemjm92 opened this issue Sep 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@leemjm92
Copy link

leemjm92 commented Sep 20, 2024

Describe the bug

  1. When using the ChatMessageMarkdown.tsx component to render Math heavy equations the streaming chat will be redirected to ErrorFallback.tsx when encountering $${some_random_math_latex}$$ that is wrapped in double $$ sign.

To Reproduce

Steps to reproduce the behavior:

  1. Create a new chatbot with prompt asking it to wrap the outputs with $${user_input}$$ or $$${user_input}$$$
    Prompt:
Always return any messages I type wrapped in $$$$${user_input}$$$$$, $${user_input}$$, $$${user_input}$$$
  1. Enter a message as a user with the new chatbot
    User input:
\vec{A} = A_x\hat{i} + A_y\hat{j} = (5 \cos 30°)\hat{i} + (5 \sin 30°)\hat{j} = (5\frac{\sqrt{3}}{2})\hat{i} + (5\frac{1}{2})\hat{j} \approx 4.33\hat{i} + 2.5\hat{j}
  1. Redirected to ErrorFallback.tsx

Screenshots

Here is the screenshot of my hacky fix I just replace the text in the ChatMessageMarkdown.tsx for now

hacky-fix

Output from copy button:

Here is the vector expression wrapped as requested: $$$$$\vec{A} = A_x\hat{i} + A_y\hat{j} = (5 \cos 30°)\hat{i} + (5 \sin 30°)\hat{j} = (5\frac{\sqrt{3}}{2})\hat{i} + (5\frac{1}{2})\hat{j} \approx 4.33\hat{i} + 2.5\hat{j}$$$$$

Additional context

I'm not sure if this is the best way to work around the issue, hence I'm filling this issue.

const replaceTextProcessing = (text: string): string => {
    return text.replace(/\${2,}/g, '$')
  };
@statefb statefb added the bug Something isn't working label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants