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
46.24k stars 6.52k forks source link

My Dify conversation page cannot render successfully LaTex formula #8379

Open BryceWG opened 1 week ago

BryceWG commented 1 week ago

Self Checks

Dify version

0.8.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Recently, I found that my Dify conversation page cannot render latex formulas properly, but markdown format can be rendered normally. I am not sure if I changed any settings that caused this issue, and there are no clear errors in the docker logs. Below is the display situation of latex in my current conversation: Clip_2024-09-13_19-39-00 I have been waiting for several versions to fix this issue, but I have not found any users with the same situation, and there is no clear relevant setting found in the env configuration. I should not have modified any files other than .env and nginx configuration.

✔️ Expected Behavior

In the conversation page, the latex formula can be rendered correctly

❌ Actual Behavior

The latex formula in the dialogue page is not rendered, but the markdown rendering seems fine: Clip_2024-09-13_19-49-21

dosubot[bot] commented 1 week ago

The issue with LaTeX formulas not rendering on your Dify conversation page might be related to the dependencies responsible for LaTeX rendering. Dify uses the following libraries for this purpose:

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Check Dependencies: Ensure that these dependencies are correctly installed in your environment. You can verify this by checking your package.json file and running npm install or yarn install to reinstall the dependencies.

  2. Configuration: Verify if there are any specific configurations required for these libraries in your project. Sometimes, additional configuration might be needed to enable LaTeX rendering.

  3. Inspect Logs: Although you mentioned there are no clear errors in the Docker logs, it might be helpful to increase the logging verbosity or check the browser console for any client-side errors related to LaTeX rendering.

  4. Update Dify: Ensure you are using the latest version of Dify. Sometimes, issues are resolved in newer releases.

  5. Custom Modifications: Since you mentioned modifying .env and nginx configurations, double-check these changes to ensure they do not interfere with the rendering process.

If the issue persists after these steps, it might be helpful to provide more detailed logs or error messages to further diagnose the problem.

To continue talking to Dosu, mention @dosu.

BryceWG commented 1 week ago

The issue with LaTeX formulas not rendering on your Dify conversation page might be related to the dependencies responsible for LaTeX rendering. Dify uses the following libraries for this purpose:

  • katex: "^0.16.10"
  • rehype-katex: "^6.0.2"
  • remark-math: "^5.1.1" [1].

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Check Dependencies: Ensure that these dependencies are correctly installed in your environment. You can verify this by checking your package.json file and running npm install or yarn install to reinstall the dependencies.
  2. Configuration: Verify if there are any specific configurations required for these libraries in your project. Sometimes, additional configuration might be needed to enable LaTeX rendering.
  3. Inspect Logs: Although you mentioned there are no clear errors in the Docker logs, it might be helpful to increase the logging verbosity or check the browser console for any client-side errors related to LaTeX rendering.
  4. Update Dify: Ensure you are using the latest version of Dify. Sometimes, issues are resolved in newer releases.
  5. Custom Modifications: Since you mentioned modifying .env and nginx configurations, double-check these changes to ensure they do not interfere with the rendering process.

If the issue persists after these steps, it might be helpful to provide more detailed logs or error messages to further diagnose the problem.

To continue talking to Dosu, mention @dosu.

I found that my node.js version is 16 and my os is centos 7. It's hard for me to upgrade node.js to 18