Skip to content

feat: add copy button to assistant messages#212

Merged
premiumjibles merged 2 commits intomainfrom
ss-5109/copy-button-assistant-message
Mar 14, 2026
Merged

feat: add copy button to assistant messages#212
premiumjibles merged 2 commits intomainfrom
ss-5109/copy-button-assistant-message

Conversation

@premiumjibles
Copy link
Contributor

@premiumjibles premiumjibles commented Mar 13, 2026

Summary

  • Adds a copy button below assistant response messages so users can copy the full text to clipboard
  • Reuses existing CopyButton component and text extraction pattern from UserMessage.tsx
  • Button is hidden on tool-only messages (no text content)

Test plan

  • Send a message in chat, verify copy button appears below assistant response
  • Click copy button, paste to confirm correct content
  • Verify tool-only responses do not show the button
  • Verify code blocks still have their own copy buttons

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a copy button to assistant messages that appears on hover, allowing users to easily copy the full message text to their clipboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shapeshift-agentic Ready Ready Preview, Comment Mar 13, 2026 6:29am

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5eacf92f-0b80-46a9-8337-c5eb7c18b809

📥 Commits

Reviewing files that changed from the base of the PR and between e96a7d0 and b0d0e62.

📒 Files selected for processing (1)
  • apps/agentic-chat/src/components/AssistantMessage.tsx

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Walkthrough

Modifies AssistantMessage component to aggregate text content from all text parts and display a copy button alongside the final text part. Updates container styling to enable hover-group effects and adjusts memo dependencies accordingly.

Changes

Cohort / File(s) Summary
Copy Button on Final Text Part
apps/agentic-chat/src/components/AssistantMessage.tsx
Aggregates textContent across all text parts, computes lastTextIndex, and conditionally wraps the final text part with a CopyButton. Updates container class for group styling, adds CopyButton import, and adjusts renderedParts memo dependencies.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A button that copies with hop and with cheer,
The final text snippet from messages clear,
With group styling magic for hover delight,
We render the copy—oh what a sight! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ss-5109/copy-button-assistant-message
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Position copy button inline at end of last text paragraph,
hidden by default with smooth opacity transition on hover.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@premiumjibles premiumjibles marked this pull request as ready for review March 14, 2026 00:51
@premiumjibles premiumjibles merged commit ceee93e into main Mar 14, 2026
3 of 4 checks passed
@premiumjibles premiumjibles deleted the ss-5109/copy-button-assistant-message branch March 14, 2026 00:51
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.

1 participant