[FEATURE] Add copy button to code blocks in assistant messages (#363)#365
Conversation
|
@adikulkarni006 is attempting to deploy a commit to the Darshan's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR adds a UI affordance for copying fenced code blocks from assistant messages, by parsing assistant message content for triple-backtick code fences and rendering them with a dedicated “copy” control. It also introduces additional message-selection and per-message export functionality (plus a new backend export endpoint), which expands the PR scope beyond the linked feature request.
Changes:
- Added
CodeBlockWithCopyReact component to render code blocks with a hover/focus copy button and “Copied!” feedback. - Updated
ChatWindowto parse assistant messages for fenced code blocks and render those blocks viaCodeBlockWithCopy. - Added new “export selected messages” UI and a new backend
POST /api/export/messagesroute to export arbitrary message subsets.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| frontend/src/components/CodeBlockWithCopy.jsx | New component for rendering a code block with a copy-to-clipboard button. |
| frontend/src/components/ChatWindow.jsx | Adds parsing/rendering of code fences; adds message selection and export UI/requests. |
| backend/routes/export.py | Adds a new /messages export endpoint to support exporting selected messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@adikulkarni006 CI failing |
|
i do right👀 |
|
@imDarshanGK All Copilot comments resolved. CI is green (Vercel failure is authorization – not a blocker). Please merge when ready. Thanks! |
|
@adikulkarni006 Resolve conflicts |
|
@imDarshanGK All conflicts resolved, CI is green (Vercel is just authorization). Please review and approve again so we can merge. Thanks! |
|
@adikulkarni006 resolve conflicts |
Closes #363
Adds a copy button (📋) to every code block in assistant responses.
Files changed:
frontend/src/components/CodeBlockWithCopy.jsx(new)frontend/src/components/ChatWindow.jsx(parse + render)Ready for review.