Skip to content

Conversation

@eulicesl
Copy link
Owner

@eulicesl eulicesl commented Nov 16, 2025

Note

Implements merging consecutive conversations with a new multi-select UI on the conversations page and a backend POST endpoint that validates, merges data, runs LLM structuring, and deletes originals.

  • Frontend (Flutter)
    • Conversations list:
      • Add selection mode with long-press to select conversations; shows count and merge action bar.
      • Disable selecting locked/discarded items; visual selection state and checkbox overlay.
      • Prevent swipe-to-delete while selecting; highlight selected with border; dim non-eligible items.
    • Merge action:
      • Validate adjacency (chronologically contiguous and within 1 hour) and eligibility; calls mergeConversations() API.
      • On success, replaces selected items with merged conversation; snackbars for success/error; loading state.
    • Page structure: Wrap in Scaffold with overlayed selection toolbar.
  • Backend (FastAPI/DB)
    • New POST /v1/conversations/merge accepting MergeConversationsRequest:
      • Validates existence, non-locked/non-discarded, and chronological consecutiveness (no in-between conversations).
      • Merges transcript segments, photos, action items, events, and audio; computes timestamps; creates new conversation.
      • Runs LLM to generate title/overview/emoji/category; saves merged convo; deletes originals and their vectors (delete_vector(uid, id)).
    • Add merge_conversations in DB layer and MergeConversationsRequest model.
    • Fix vector deletion call to include uid in delete route.

Written by Cursor Bugbot for commit 9a800a9. This will update automatically on new commits. Configure here.

Frontend:
- Multi-select merge UI with selection mode and bottom action bar
- Conversation list updates for selection indicators and guarded taps
- Provider support for mergeSelectedConversations with API integration
- Analytics tracking for conversationsMerged event

Backend:
- MergeConversationsRequest model and POST /v1/conversations/merge endpoint
- DB helper merge_conversations with validation and LLM structuring
- Merges segments, photos, events, action items, and audio files
…nd UX

- Move selection state to ConversationProvider for better state management
- Implement true adjacency validation: contiguous list position + 1-hour time gap
- Add tap-to-deselect functionality for selected conversations
- Block long-press selection for locked/discarded conversations
- Disable swipe-to-delete during selection mode
- Add canMergeSelectedConversations() validation method
- Improve merge error messages with specific validation feedback
- Add Mixpanel analytics tracking for merge operations
- Keep selection mode active until explicit cancel (no auto-exit on empty)
- Proper state cleanup on merge success/failure
…earch guards

Complete implementation of conversation merge feature with all UX improvements:

Selection Mode:
- Long-press enters selection with locked/discarded guards
- Tap to toggle selection (fast deselect for already-selected items)
- Swipe-to-delete disabled during selection mode
- 50% opacity for locked/discarded conversations (visual feedback)
- Checkbox indicators show selection state
- Purple border highlights selected conversations

Merge Bar UX:
- Positioned above bottom navigation using Stack + Positioned (bottom: 90)
- Shows selection count and Cancel/Merge buttons
- Merge button enabled only when canMergeSelectedConversations() passes
- Inline spinner during merge (no blocking dialog)
- Success toast (green) on successful merge
- Error toast (red) with specific validation messages

Validation & Safety:
- True adjacency: contiguous list position + ≤1-hour time gaps
- Locked/discarded conversations blocked from selection and merge
- Search automatically clears selection to prevent stale state
- Selection cleared after successful merge
- No count cap on merge (unlimited adjacent conversations)

Analytics:
- Track merge initiated, successful, and failed events
- Include conversation count and IDs in tracking

Backend Integration:
- mergeConversations API call with sorted conversation IDs
- Error message extraction from backend responses
- Local state updates after successful merge
The delete_vector function signature is delete_vector(uid, conversation_id) and it deletes
the Pinecone vector using the prefixed ID format: f'{uid}-{conversation_id}'.

Updated the merge endpoint to correctly call delete_vector(uid, conv_id) matching the
function signature and ensuring vectors are properly deleted with the correct ID prefix.
Copilot AI review requested due to automatic review settings November 16, 2025 22:43
Copilot finished reviewing on behalf of eulicesl November 16, 2025 22:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements a conversation merge feature that allows users to combine multiple consecutive conversations into a single conversation. The feature includes both backend API endpoints and frontend UI components with validation to ensure only chronologically adjacent conversations can be merged.

  • Backend API endpoint (/v1/conversations/merge) that validates, merges, and regenerates metadata for conversations using LLM
  • Frontend selection mode UI that allows users to select and merge conversations with visual feedback
  • Analytics tracking for merge operations and validation to prevent merging locked or discarded conversations

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
backend/routers/conversations.py Adds merge endpoint and updates delete_conversation to pass uid to delete_vector
backend/models/conversation.py Adds MergeConversationsRequest model for API request validation
backend/database/conversations.py Implements merge_conversations function with validation logic for consecutive conversations
app/pubspec.yaml Removes deprecated Swift package manager configuration
app/lib/utils/analytics/mixpanel.dart Adds conversationsMerged analytics tracking method
app/lib/providers/conversation_provider.dart Implements selection mode state management and merge logic with validation
app/lib/pages/conversations/widgets/conversations_group_widget.dart Updates widget to support selection mode with callbacks
app/lib/pages/conversations/widgets/conversation_list_item.dart Adds selection mode UI with checkboxes and long-press handling
app/lib/pages/conversations/conversations_page.dart Adds merge action bar UI overlay when in selection mode
app/lib/backend/http/api/conversations.dart Adds mergeConversations API client method with error handling
Comments suppressed due to low confidence (2)

backend/routers/conversations.py:143

    delete_vector(uid, conversation_id)

backend/routers/conversations.py:696

            delete_vector(uid, conv_id)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@eulicesl eulicesl merged commit c2d6eaf into main Nov 17, 2025
1 check passed
@eulicesl eulicesl deleted the feat/conversation-merge-improved branch November 17, 2025 12:19
eulicesl added a commit that referenced this pull request Nov 18, 2025
* feat: Add conversation merging functionality

Frontend:
- Multi-select merge UI with selection mode and bottom action bar
- Conversation list updates for selection indicators and guarded taps
- Provider support for mergeSelectedConversations with API integration
- Analytics tracking for conversationsMerged event

Backend:
- MergeConversationsRequest model and POST /v1/conversations/merge endpoint
- DB helper merge_conversations with validation and LLM structuring
- Merges segments, photos, events, action items, and audio files

* fix: remove invalid config section from pubspec.yaml

* feat: enhance conversation merge with improved adjacency validation and UX

- Move selection state to ConversationProvider for better state management
- Implement true adjacency validation: contiguous list position + 1-hour time gap
- Add tap-to-deselect functionality for selected conversations
- Block long-press selection for locked/discarded conversations
- Disable swipe-to-delete during selection mode
- Add canMergeSelectedConversations() validation method
- Improve merge error messages with specific validation feedback
- Add Mixpanel analytics tracking for merge operations
- Keep selection mode active until explicit cancel (no auto-exit on empty)
- Proper state cleanup on merge success/failure

* feat: complete conversation merge UX with Stack-based merge bar and search guards

Complete implementation of conversation merge feature with all UX improvements:

Selection Mode:
- Long-press enters selection with locked/discarded guards
- Tap to toggle selection (fast deselect for already-selected items)
- Swipe-to-delete disabled during selection mode
- 50% opacity for locked/discarded conversations (visual feedback)
- Checkbox indicators show selection state
- Purple border highlights selected conversations

Merge Bar UX:
- Positioned above bottom navigation using Stack + Positioned (bottom: 90)
- Shows selection count and Cancel/Merge buttons
- Merge button enabled only when canMergeSelectedConversations() passes
- Inline spinner during merge (no blocking dialog)
- Success toast (green) on successful merge
- Error toast (red) with specific validation messages

Validation & Safety:
- True adjacency: contiguous list position + ≤1-hour time gaps
- Locked/discarded conversations blocked from selection and merge
- Search automatically clears selection to prevent stale state
- Selection cleared after successful merge
- No count cap on merge (unlimited adjacent conversations)

Analytics:
- Track merge initiated, successful, and failed events
- Include conversation count and IDs in tracking

Backend Integration:
- mergeConversations API call with sorted conversation IDs
- Error message extraction from backend responses
- Local state updates after successful merge

* fix: correct delete_vector calls to pass both uid and conversation_id

The delete_vector function signature is delete_vector(uid, conversation_id) and it deletes
the Pinecone vector using the prefixed ID format: f'{uid}-{conversation_id}'.

Updated the merge endpoint to correctly call delete_vector(uid, conv_id) matching the
function signature and ensuring vectors are properly deleted with the correct ID prefix.

* Update backend/database/conversations.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants