Ubeyidah/ubeyida 13 add persistent chat memory#1
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request implements persistent JSON-based chat history functionality. The changes add memory file configuration, introduce load and save methods to serialize chat history, integrate history loading during session creation, and call save_history() on exit or keyboard interrupt in the main loop. A duplicate constant definition is removed from config. Changes
Sequence DiagramsequenceDiagram
participant User
participant Main as main.py
participant Assistant as assistant.py
participant Memory as JSON File
User->>Main: Start application
Main->>Assistant: Create assistant instance
Assistant->>Assistant: _load_history()
Assistant->>Memory: Read MEMORY_FILE
Memory-->>Assistant: Return history (or [])
Assistant->>Assistant: Reconstruct Content/Part objects
Note over Assistant: Chat session initialized with history
User->>Main: Send messages
Main->>Assistant: stream_message()
Assistant-->>User: Stream response
User->>Main: Exit or Ctrl+C
Main->>Assistant: save_history()
Assistant->>Assistant: Serialize chat_session.history
Assistant->>Memory: Write JSON to MEMORY_FILE
Memory-->>Assistant: File saved
Main->>User: Print goodbye message
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Areas requiring extra attention:
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Bug Fixes