Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add chat history backup and restore functionality" #280

Closed
wants to merge 0 commits into from

Conversation

sidbetatester
Copy link

Added chat history backup and restore functionality:

  • Added export button to download chat history as JSON
  • Added import button to restore chat history from backup
  • Added proper error handling and user feedback
  • Implemented version checking and data validation
  • Added logging for debugging

Features and Usage

Export Chat History

  1. Look for the download icon (↓) next to "Your Chats" in the sidebar
  2. Click the icon to download your chat history
  3. A JSON file named bolt-chat-history-[date].json will be downloaded
  4. You'll see a success notification when the export is complete

Import Chat History

  1. Look for the upload icon (↑) next to "Your Chats" in the sidebar
  2. Click the icon to open the file picker
  3. Select a previously exported JSON backup file
  4. The page will automatically reload after successful import
  5. You'll see your imported chats in the sidebar

Technical Changes

  • Modified Menu.client.tsx to add import/export buttons
  • Used existing persistence layer for data handling
  • Added user feedback via toast notifications
  • Implemented proper error handling and validation

Error Handling

  • Shows error messages if:
    • File format is invalid
    • Database is not initialized
    • File reading fails
    • Import/export operation fails

Notes

  • The page will reload after successful import to show the restored chats
  • All existing chats are preserved during import
  • Exported files include version information for future compatibility

Chat_history_backup_restore

@sidbetatester
Copy link
Author

sidbetatester commented Nov 14, 2024

This is a simple feature to backup and restore the projects, mainly helpful if you need to clear browser history and restore on the same system, or to take it around different systems. I kept the changes very minimal to not affect any existing code.

one way to use it is also you could edit the backed up chat history in case you want to remove unwanted information to reduce the chat length and hence meet the context length when it gets too big. I might make this possible in the future.

@wonderwhy-er
Copy link
Collaborator

Was thinking to add this too, but do it per one chat, not all of them
Though I guess doing it for all of them is good too, will review now

@wonderwhy-er
Copy link
Collaborator

  1. Something broken around deleting chats, there is not item and description. Try to delete a chat

  2. I also think that you need to split that large function in to smaller parts. Harder to understand what it does.

  3. There were couple of typescheck issues when I runned workflows

  4. Also there is empty app/utils/backup.ts file?

@coleam00
Copy link
Collaborator

@sidbetatester Could you reply to @wonderwhy-er feedback when you get the chance? Thanks for that by the way Eduard!

@dustinwloring1988 dustinwloring1988 added enhancement New feature or request question Further information is requested labels Dec 2, 2024
@sidbetatester
Copy link
Author

@coleam00 Thanks for the follow-up! Hope you all had a wonderful Thanksgiving holiday!

Hi Eduard (@wonderwhy-er),

Sorry I was a little busy the last couple of weeks and couldn't respond sooner. Thank you for the review and feedback. I just downloaded the latest main branch and see a lot of improvements. It seems like someone was kind enough to clean up the conflicts and incorporate the improvements suggested above, and it looks a lot more polished now! What should we do now? Is there anything else you need me to do?

@thecodacus
Copy link
Collaborator

can you resolve this conflicts, I will review and merge

@sidbetatester
Copy link
Author

Hi Anirban @thecodacus
The conflicts must be resolved now, can you verify please.

@sidbetatester
Copy link
Author

continuing in #871

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants