chat-ui icon indicating copy to clipboard operation
chat-ui copied to clipboard

Add full-text search in chat history

Open kadykov opened this issue 1 year ago • 4 comments

Describe your feature request

Allow users to search for specific keywords or phrases within the chat history, making it easier to find and recall previous conversations.

Screenshots (if relevant)

An example of the search bar placement could be found in #1079

Implementation idea

One possible implementation could be to use a library to index the chat history data. This would allow for efficient and scalable search functionality. The search bar could be added to the chat history interface, and when a user enters a search query, it would send a request to the search index to retrieve relevant results. The results could be displayed in a dropdown list or a separate search results page, with links to the original chat messages.

Previous proposals and why this one is different

I'm aware that a similar proposal was made in the past #243, but it was rejected in favor of using the browser's page search functionality (ctrl + F). However, I'd like to argue that page search does not provide the same functionality as a dedicated full-text search in chat history. Here's why:

  • Page search is limited to the currently loaded chat history and previous chat names, whereas a dedicated search would allow users to search across the entire conversation history, even if it's not currently loaded on the page.
  • Page search does not provide any contextual information, such as the date and time of the message, or the conversation, whereas a dedicated search could provide this information and make it easier for users to understand the context of the search results.

Given these differences, I believe that a dedicated full-text search in chat history is a valuable feature that would greatly improve the user experience, and I'd like to propose it again for consideration.

Personally, I tend to create a new chat for each small problem to keep the LLM focused on what's important. As a result, I end up with too many chats with similar names, which makes the browser page search nearly useless.

kadykov avatar Nov 01 '24 19:11 kadykov

I second this 👍 This would be a great addition. ChatGPT also allows to search ⌘ K combination.

siddharthgoel88 avatar Nov 04 '24 05:11 siddharthgoel88

Hi,

Myself and @hongantran3804 are thinking of working on this feature if it's still available and I just wanted to confirm and check my understanding.

So far I've looked through the codebase about where this feature would be implemented and also did some research about how to get started on this feature. I think in the codebase, where the main changes would take place for this feature are in src/lib/components/chat/ChatInput.svelte.

I'm thinking to tackle this, this feature could be broken down into two parts.

-First in src/lib/components/chat/ChatInput.svelte an event similar to chatGPT's command + k would be implemented and a UI to show user input and relevant results.

-From there, I'm thinking I could use the fuzzy search algorithm based on user input to match with results from chat log stored in the database for that user and also have to make the relevant api calls.

As mentioned before, this feature would work every similar to chatGPT's command + k feature which I didn't know about, but is highly useful.

kramosss avatar Dec 23 '24 05:12 kramosss

Hi @nsarrazin, would you mind taking a look at the comment I left about how I might get started on this?

kramosss avatar Jan 22 '25 01:01 kramosss

I added a comment link to this issue in the official HF discord channel #give-hf-feedback, for convenience.

bennmann avatar Feb 14 '25 22:02 bennmann

It's implemented as of latest main! Still some tasks left #1836 but it should be working, it's already live on HuggingChat.

nsarrazin avatar May 28 '25 15:05 nsarrazin