langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
45.84k stars 6.46k forks source link

Any plan for better math / latex format support? #7607

Open xukp20 opened 3 weeks ago

xukp20 commented 3 weeks ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

It seems that the response block of the chatbot cannot render the inline math expression between a pair of single "$" signs.

Also, the type of math expressions between "[" and "]" which is often used by OpenAI's models faces the same problem. Although I've found that issue #2646 has mentioned the same problem, it only provides me with a workaround by forcing the model to use double $ instead of responding in the way it liked. Maybe it is better to solve this problem by modifying the frontend a little bit. Rendering each block as markdown may help?

2. Additional context or comments

image

3. Can you help us with this feature?

crazywoola commented 3 weeks ago

https://github.com/langgenius/dify/blob/603a89055cb6746650171969fbb59a310e717a8e/web/app/components/base/markdown.tsx

Well I think we better refactor this once we have some spare time. :)