Add Copy Message Thread to Clipboard feature #150

Closed
opened 2025-12-25 19:16:22 +00:00 by rwachters · 0 comments
rwachters commented 2025-12-25 19:16:22 +00:00 (Migrated from github.com)

Feature Request

Add functionality to copy the entire currently displayed message thread to clipboard via a "More" actions menu in the chat top bar.

Requirements

  • Display a "More" actions menu icon (MoreVert) in the chat top bar (center section, near other actions)
  • The menu should contain a "Copy Thread" option with a ContentCopy icon
  • When clicked, copy all displayed messages to clipboard formatted as plain text
  • Format messages with role labels (e.g., "User: content\n\nAssistant: content")
  • Use double newlines between messages for readability
  • Display "No messages to copy" snackbar when displayedMessages is empty
  • Display success/error notifications using existing NotificationService

Implementation Plan

  1. ChatViewModel: Add copyThreadToClipboard() function that:

    • Formats all messages in displayedMessages as text (role + content)
    • Uses existing ClipboardService to copy
    • Handles empty thread case with appropriate notification
  2. ChatAreaActions: Add onCopyThread: () -> Unit action callback to interface

  3. ChatScreen: Wire the action by connecting chatViewModel.copyThreadToClipboard() to chatAreaActions.onCopyThread()

  4. ChatTopBarContent:

    • Add onCopyThread parameter
    • Create "More" actions menu with Icons.Default.MoreVert
    • Add menu item with Icons.Default.ContentCopy for "Copy Thread"
    • Position in center section near other actions (model selector, settings, tools)

Technical Details

  • Use existing ClipboardService (already has platform implementations)
  • Leverage existing displayedMessages: StateFlow<List<ChatMessage>> from ChatViewModel
  • Follow existing patterns for clipboard operations (see copyMessageToClipboard())
  • Use NotificationService for user feedback

Message Format Example

User: How do I format code in Kotlin?
## Feature Request Add functionality to copy the entire currently displayed message thread to clipboard via a "More" actions menu in the chat top bar. ## Requirements - Display a "More" actions menu icon (`MoreVert`) in the chat top bar (center section, near other actions) - The menu should contain a "Copy Thread" option with a `ContentCopy` icon - When clicked, copy all displayed messages to clipboard formatted as plain text - Format messages with role labels (e.g., `"User: content\n\nAssistant: content"`) - Use double newlines between messages for readability - Display "No messages to copy" snackbar when `displayedMessages` is empty - Display success/error notifications using existing `NotificationService` ## Implementation Plan 1. **ChatViewModel**: Add `copyThreadToClipboard()` function that: - Formats all messages in `displayedMessages` as text (role + content) - Uses existing `ClipboardService` to copy - Handles empty thread case with appropriate notification 2. **ChatAreaActions**: Add `onCopyThread: () -> Unit` action callback to interface 3. **ChatScreen**: Wire the action by connecting `chatViewModel.copyThreadToClipboard()` to `chatAreaActions.onCopyThread()` 4. **ChatTopBarContent**: - Add `onCopyThread` parameter - Create "More" actions menu with `Icons.Default.MoreVert` - Add menu item with `Icons.Default.ContentCopy` for "Copy Thread" - Position in center section near other actions (model selector, settings, tools) ## Technical Details - Use existing `ClipboardService` (already has platform implementations) - Leverage existing `displayedMessages: StateFlow<List<ChatMessage>>` from ChatViewModel - Follow existing patterns for clipboard operations (see `copyMessageToClipboard()`) - Use `NotificationService` for user feedback ## Message Format Example ``` User: How do I format code in Kotlin?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Torvian.eu/chatbot#150
No description provided.