-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Add conversation merging functionality #3433
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
base: main
Are you sure you want to change the base?
feat: Add conversation merging functionality #3433
Conversation
Implemented a comprehensive conversation merge feature that allows users to combine adjacent conversations with long-press selection and a merge toolbar. Backend Changes: - Added merge_conversations() function to database/conversations.py that: * Validates conversations are adjacent (max 1 hour gap) * Merges transcript segments, photos, action items, events, and audio files * Creates new merged conversation with combined data * Deletes source conversations after merge - Added POST /v1/conversations/merge endpoint that: * Validates user permissions * Calls merge function * Reprocesses merged conversation to generate new title/overview/summary * Returns the processed merged conversation - Added MergeConversationsRequest model for API request validation Frontend Changes: - Added selection mode state to ConversationProvider with: * isSelectionMode, selectedConversationIds, isMerging flags * Methods to enable/disable selection mode * toggleConversationSelection() to select/deselect conversations * canMergeSelectedConversations() to validate adjacency * mergeSelectedConversations() to call API and update UI - Added mergeConversations() API method in conversations.dart - Updated ConversationListItem widget to: * Handle long-press gesture to enable selection mode * Show checkboxes and blue border when in selection mode * Toggle selection on tap when in selection mode - Added merge toolbar to ConversationsPage that: * Appears at bottom when selection mode is active * Shows selection count * Has Cancel button to exit selection mode * Has Merge button (disabled if not valid) to merge selected conversations * Shows loading indicator during merge operation * Displays success/error messages via SnackBar Features: - Long-press on any conversation to enter selection mode - Select multiple conversations by tapping - Only adjacent conversations (within 1 hour) can be merged - Merge button disabled if selection is invalid - Merged conversation gets auto-generated title and overview - Original conversations are deleted after successful merge - Visual feedback with checkboxes, borders, and loading states Fixes BasedHardware#1505
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a conversation merging feature, with changes across the backend and frontend. The implementation is comprehensive, covering API endpoints, database logic, and UI components for selecting and merging conversations. My review focuses on improving the correctness, performance, and data integrity of the backend logic. I've identified a critical issue with data being orphaned after a merge, as well as high-severity issues related to performance and data consistency. On the frontend, there's a correctness issue in the validation logic for merging. Addressing these points will make the feature more robust and reliable.
vats98754
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude read the feedback in the comments on the PR and completely fix and improve
Enhanced the conversation merge feature with better validation, error handling, and user experience improvements. Backend Improvements: - Removed redundant decorators from merge_conversations() that were causing double-processing of data - Now uses get_conversation() to properly fetch and decrypt conversations - Added validation to prevent merging locked or discarded conversations - Added logging for merge operations with print statements - Fixed photo handling to avoid redundant calls Frontend Improvements: - Disabled swipe-to-delete when in selection mode - Prevent selection of locked or discarded conversations - Added visual opacity (50%) to locked/discarded items in selection mode - Auto-exit selection mode when switching between discarded/regular views - Auto-exit selection mode when performing a search - Added analytics tracking for merge operations (initiate, success, failure) - Improved error messages with better context (e.g., adjacency requirement) - Extended snackbar duration for error messages (4s) for better readability - Added validation in canMergeSelectedConversations() to check for locked/discarded UX Polish: - Long-press only works on mergeable (non-locked, non-discarded) conversations - Tap to select only works on mergeable conversations - Visual feedback with reduced opacity for non-selectable items - Better error messages explaining adjacency requirements - Haptic feedback maintained for merge actions
|
wow, can we see a demo? really important for quick review @vats98754 |
Based on review of PR BasedHardware#3433, added missing validations: Backend Improvements: - Add validation to prevent merging locked conversations - Add validation to prevent merging discarded conversations - Return descriptive error messages for all failure cases Frontend Improvements: - Prevent selecting locked conversations in UI with user feedback - Prevent selecting discarded conversations in UI with user feedback - Return error messages from API as tuple (conversation, error) - Display actual backend error messages to users - Extend error message duration to 4 seconds for better visibility - Success messages show for 3 seconds These improvements align with the approach in PR BasedHardware#3433 while maintaining our more robust chronological consecutiveness validation.
Implemented a comprehensive conversation merge feature that allows users to combine adjacent conversations with long-press selection and a merge toolbar.
Backend Changes:
Frontend Changes:
Features:
Fixes #1505