hackerai-tech / PentestGPT

AI-Powered Automated Penetration Testing Tool
https://pentestgpt.ai/
GNU General Public License v3.0
851 stars 40 forks source link

Fix Inline LaTeX for AI Responses #498

Closed RostyslavManko closed 3 months ago

RostyslavManko commented 4 months ago

Description

To improve the display of mathematical equations in AI responses, we need to fix the handling of Inline LaTeX provided by OpenAI. Currently, AI responses do not handle Inline LaTeX correctly, which makes mathematical equations appear incorrectly for users. We need to figure out how to correctly handle OpenAI responses to ensure that we display the inline LaTeX format properly, enhancing the user experience.

Objective

Our goal is to improve the display of mathematical equations in AI responses by correctly handling Inline LaTeX provided by OpenAI.

Actions and Considerations (ACC)

  1. Research Inline LaTeX Handling:

    • [ ] Investigate the current handling of Inline LaTeX in AI responses and understand the issue.
    • [ ] Research potential solutions for correctly rendering Inline LaTeX in AI responses.
  2. Implement Inline LaTeX Rendering:

    • [ ] Update the AI response handling to correctly render Inline LaTeX provided by OpenAI.
    • [ ] Ensure that the updated handling does not negatively impact other markdown elements in AI responses.
  3. Testing and Quality Assurance:

    • [ ] Conduct thorough testing to ensure that Inline LaTeX is rendered correctly in AI responses, including various mathematical equations and symbols.
    • [ ] Test the feature in different scenarios and environments to guarantee robustness and reliability.
    • [ ] Verify that the changes work correctly both locally and on Vercel preview.

Expected Outcomes

RostyslavManko commented 4 months ago

Here are some math delimiters for llm if needed, "display" means show on a new line const mathDelimiters = [ { left: "$$", right: "$$", display: true }, { left: "$", right: "$", display: false }, { left: "\(", right: "\)", display: false }, { left: "\[", right: "\]", display: true }, { left: '[', right: ']', display: false }, { left: '[\n', right: '\n]', display: true } ];

RostyslavManko commented 4 months ago

rehype-katex plugin now correctly displays mathematical equations for both HGPT 3.5 AND HGPT 4, but not for GPT4o.

RostyslavManko commented 4 months ago

https://github.com/Hacker-GPT/HackerGPT-2.0/pull/527