bitcoinsearch / chat-btc

A conversational AI based on technical bitcoin sources
https://chat.bitcoinsearch.xyz/
MIT License
15 stars 13 forks source link

Question search params doesn't have context after second message/query #71

Open Extheoisah opened 6 months ago

Extheoisah commented 6 months ago

This is a follow-up issue to #64 We need to find a way around the question that is appended as search params in the URL. It currently updates to the latest question. So for a chat with the question history below:

the question in the URL will be "Do they have any advantages" and if that is shared with another user, chat wouldn't know what reply to give.

kouloumos commented 5 months ago

I believe using URL parameters for the chain of questions is not a scalable solution.

To facilitate question sharing, we could utilize our existing Supabase setup. When a user wishes to share a chat, we could generate a unique ID and store the corresponding message history. The user would then share a link containing this ID, allowing the recipient to access the chat history directly.

This brings us to a broader consideration: our policy on storing chat histories. Access to past conversations can significantly enhance user experience by enabling features like chat restoration and history review. If we're open to storing chat histories, we can not only address the sharing issue more effectively but also explore other valuable improvements.

What are your thoughts on implementing chat history storage? This decision will impact our approach to both the sharing functionality and potential future enhancements.

Extheoisah commented 5 months ago

I believe using URL parameters for the chain of questions is not a scalable solution.

To facilitate question sharing, we could utilize our existing Supabase setup. When a user wishes to share a chat, we could generate a unique ID and store the corresponding message history. The user would then share a link containing this ID, allowing the recipient to access the chat history directly.

This brings us to a broader consideration: our policy on storing chat histories. Access to past conversations can significantly enhance user experience by enabling features like chat restoration and history review. If we're open to storing chat histories, we can not only address the sharing issue more effectively but also explore other valuable improvements.

What are your thoughts on implementing chat history storage? This decision will impact our approach to both the sharing functionality and potential future enhancements.

@Emmanuel-Develops and I theoretically explored this option. However, we don't want to store user chat histories in the db, and is one of the ethos of chat-btc. This was clearly stated by @adamjonas So we had to explore other options which was the URL params.

kouloumos commented 5 months ago

Emmanuel-Develops and I theoretically explored this option. However, we don't want to store user chat histories in the db, and is one of the ethos of chat-btc. This was clearly stated by adamjonas So we had to explore other options which was the URL params.

But if we already cache the question-answer pair, aren't we indirectly store chat history? https://github.com/bitcoinsearch/chat-btc/blob/6a896d26571d504419c47c2b73694cd3d5cec2b3/src/pages/index.tsx#L220-L227 If we add a process where the user chooses that they want to share the chat (same as chatGPT does), then they agree to leave some of that privacy in order to get the sharing feature that I described above. An extra addition to that could be to add some encryption into the mix, but that could only be possible if we were using some sort of user accounts that could be paired with a public-private key.

Extheoisah commented 5 months ago

But if we already cache the question-answer pair, don't we indirectly store chat history?

In a sense, yes. But the cached responses are deleted after 24hrs. We do not persist them in the db. Only the default responses on the homepage are persisted.

If we add a process where the user chooses that they want to share the chat (same as chatGPT does), then they agree to leave some of that privacy in order to get the sharing feature that I described above.

This seems viable short term. This would mean we store the chat history for every query starting from the 1st query. Overall, I'll leave @adamjonas to decide on this issue