Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[BUG] A dollar sign in the result of a chat message results in italics in some parts of the response

Open automaton82 opened this issue 2 years ago • 4 comments

Describe the bug If the chatbot message includes a dollar sign $, the text results become italic in a weird way.

To Reproduce Steps to reproduce the behavior:

  1. Build a chatflow where the result ends up with a dollar sign Here is an example prompt:

give me a response that includes a dollar sign, such as "bananas are at least $2 in Canada and $1 in the US"

Expected behavior The text you entered and the response should be regularly formatted, not adding italics.

Screenshots image

Flow Any flow that uses any chatbot will generally work.

automaton82 avatar Dec 05 '23 17:12 automaton82

Cause appears to be use of remarkMath and rehypeMathjax in the react markdown use. The message could be cleansed before given, but that doesn't seem great. Ideally a central message class would be used that could offer a cleansed message, or this component has a hook to cleanse beforehand.

This is further complicated because the ChatEmbed repo seems to use something else as well but probably suffers the same (I didn't check), so there's at least 3 places where the code is somewhat duplicated but also different.

automaton82 avatar Dec 05 '23 17:12 automaton82

ChatEmbed repo is not using react-markdown, but will be in future, to have the markdown formatting. Any suggestion of cleansing method?

HenryHengZJ avatar Dec 06 '23 02:12 HenryHengZJ

Not yet I'd have to investigate if there's any clean way to do it. Easiest way is to remove the math stuff, but I assume you put it there for a reason?

Also Bing Chat GPT suffers the exact same issue so I think this might be a common problem.

automaton82 avatar Dec 06 '23 02:12 automaton82

Yeah its to support some cases where LaTex is being returned in the response

HenryHengZJ avatar Dec 07 '23 19:12 HenryHengZJ