omi icon indicating copy to clipboard operation
omi copied to clipboard

feat: Add conversation merging functionality

Open vats98754 opened this issue 1 month ago • 2 comments

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 #1505

vats98754 avatar Nov 14 '25 22:11 vats98754

wow, can we see a demo?

really important for quick review @vats98754

aaravgarg avatar Nov 15 '25 06:11 aaravgarg

>> https://github.com/BasedHardware/omi/issues/1505#issuecomment-3578526884

beastoin avatar Nov 26 '25 02:11 beastoin