neokd / NeoGPT

Chat effortlessly, execute commands, and interpret code with Llama3, Phi3, and more - your local AI assistant. Enjoy seamless interaction while ensuring ultimate privacy
https://neogpt.dev
MIT License
68 stars 62 forks source link

Add `/search [keyword]` Magic Command to Search Chat History #210

Closed ayushmorbar closed 3 months ago

ayushmorbar commented 4 months ago

Is your feature request related to a problem? Please describe.

Yes, currently there is no way to quickly search for specific keywords in the chat history. This can be frustrating when trying to recall specific parts of a conversation.

Describe the solution you'd like

I would like a new magic command /search [keyword] to be added. This command should search the chat history for a specific keyword and return all messages containing that keyword.

Describe alternatives you've considered

An alternative could be to manually scroll through the chat history, but this can be time-consuming and inefficient, especially for long chat sessions.

Additional context

This feature would greatly enhance the user experience by providing a quick and easy way to retrieve specific parts of the conversation.

neokd commented 4 months ago

Can you explain how are you planning to add it

ayushmorbar commented 4 months ago

Sure, here's the plan:

  1. We will modify the magic_commands function in the magic_commands.py file.
  2. We will add a new condition to check if the user input starts with /search.
  3. If it does, we will extract the keyword from the user input.
  4. We will then iterate over the chat history, which is stored in chain.combine_documents_chain.memory.chat_memory.messages.
  5. For each message in the chat history, we will check if the keyword is in the message content.
  6. If it is, we will print the message.
  7. If no messages are found with the keyword, we will print a message saying "No messages found with the provided keyword."
neokd commented 4 months ago

@ayushmorbar are you working on. this?

ayushmorbar commented 4 months ago

yes, I'll get it done... Currently, entangled with exams and some community stuff right now~

neokd commented 4 months ago

Okay okay.