hackerai-tech / PentestGPT

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

Display Error Message for Last User Message Exceeding CHUNK_SIZE #256

Open RostyslavManko opened 4 months ago

RostyslavManko commented 4 months ago

Description

To improve user experience and ensure AI understands the conversation better, we need to display an error message in the form of an AI response when the user's last message is longer than the CHUNK_SIZE for a specific model. This error message should be deleted from the chat history in the future to avoid confusion and maintain context for the AI.

Objective

Our goal is to implement a feature that displays an error message when the user's last message exceeds the CHUNK_SIZE limit and automatically removes the error message from the chat history in the future.

Actions and Considerations (ACC)

  1. Detect Exceeded CHUNK_SIZE:

    • [x] Implement a check to determine if the user's last message is longer than the CHUNK_SIZE for the specific model.
  2. Display Error Message:

    • [ ] If the user's last message exceeds the CHUNK_SIZE limit, display an error message in the form of an AI response.
  3. Remove Error Message from Chat History:

    • [ ] Implement a mechanism to automatically delete the error message from the chat history in the future to maintain context for the AI.
  4. Testing and Quality Assurance:

    • [ ] Conduct thorough testing to ensure that the error message is displayed correctly when the user's last message exceeds the CHUNK_SIZE limit and is removed from the chat history as expected.
    • [ ] Test various scenarios, including potential edge cases, to guarantee a robust and reliable solution.
    • [ ] Verify that the changes work correctly both locally and on Vercel preview.

Expected Outcomes

RostyslavManko commented 3 months ago

I have made progress in completing this task. I have created a code to detect and display an error message if the user's last message exceeds the Chunk Size: https://github.com/Hacker-GPT/HackerGPT-2.0/pull/347. Now, we need to work on creating an AI error message that will not be saved in the chat history. It will continue to display until the user decides to regenerate the response with a shorter message or if the user reloads the page, which will remove the message with the error entirely.