Skip to content

feat(web): add copy action for assistant messages#1426

Open
byrafael wants to merge 4 commits intopingdotgg:mainfrom
byrafael:feature/assistant-message-copy
Open

feat(web): add copy action for assistant messages#1426
byrafael wants to merge 4 commits intopingdotgg:mainfrom
byrafael:feature/assistant-message-copy

Conversation

@byrafael
Copy link
Copy Markdown

@byrafael byrafael commented Mar 26, 2026

What Changed

This adds a copy action for assistant messages in the chat timeline when the assistant text is non-empty.

The implementation reuses the existing message copy button and clipboard behavior already used elsewhere in the UI, and places the action next to the assistant message timestamp/duration metadata. Empty assistant responses still render as (empty response) but do not expose a copy action.

Tests were added to cover:

  • copy action shown for assistant messages with text
  • copy action shown for streaming assistant messages with buffered text
  • no copy action for empty non-streaming assistant messages

Why

Assistant responses were not directly copyable from the timeline, which made it harder to reuse agent output. This change keeps the scope tight by reusing the existing copy control rather than introducing a new interaction pattern.

Keeping empty responses uncopiable avoids copying placeholder UI text instead of real assistant content.

UI Changes

Before:

  • assistant responses could not be copied, only user content would show a copy button.
image

After:

  • assistant responses show a copy button beside the timestamp/duration metadata when text is present
  • empty assistant responses still show (empty response) with no copy button
image

^ On hover.

Video

Screen.Recording.2026-03-25.at.18.17.05.mov

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Low risk UI-only change that conditionally exposes an existing clipboard action on assistant timeline entries; main risk is minor layout/hover behavior regressions around message metadata.

Overview
Adds a hover/focus-visible MessageCopyButton to assistant messages in MessagesTimeline, positioned next to the timestamp/duration metadata.

The copy action only renders when the assistant message text is non-empty (including buffered text while streaming), avoiding copying the (empty response) placeholder.

Extends MessagesTimeline.test.tsx with coverage for copy button visibility for non-empty, empty, and streaming assistant messages.

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

Note

Add copy button to assistant messages in chat timeline

Adds a MessageCopyButton to assistant messages in MessagesTimeline.tsx that appears on hover or focus near the timestamp. The button is only rendered when the message has non-empty text, hiding it for empty responses and active streaming with no buffered content.

Macroscope summarized 77eb6c0.

- Show copy action for non-empty assistant text
- Keep empty responses uncopiable and covered by tests
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fffd3861-9f99-453a-8365-52ba6b971f78

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 26, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

- scope the assistant message group for hover state
- reveal the copy action only when hovering that message
@byrafael
Copy link
Copy Markdown
Author

My apologies. The commit messages were generated wrong 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant