feat(ui): add copy button to assistant text responses#7874
Open
IamCoder18 wants to merge 2 commits intoKilo-Org:mainfrom
Open
feat(ui): add copy button to assistant text responses#7874IamCoder18 wants to merge 2 commits intoKilo-Org:mainfrom
IamCoder18 wants to merge 2 commits intoKilo-Org:mainfrom
Conversation
Wire up the pre-existing text-part-copy-wrapper slot with a copy button in TextPartDisplay. The button reveals on hover over the text part (via CSS opacity transition) and is always visible for the active/last text part (via data-is-turn-copy). Uses existing i18n keys (ui.message.copyResponse, ui.message.copied) and follows the same pattern used by UserMessageDisplay, bash copy, and shell copy in the same file.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Reviewed by gpt-5.4-20260305 · 186,545 tokens |
Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
Assistant text responses in the chat UI have no copy button. User messages, code blocks inside markdown, and bash tool output all have copy buttons — but assistant text parts don't. This adds one.
Closes #7870
Implementation
The rendering chain
ChatView → MessageList → VscodeSessionTurn → AssistantMessage → Part → TextPartDisplayis shared across the sidebar, Agent Manager, and subagent viewer, so a single change in the sharedTextPartDisplaycomponent covers all three surfaces.Most of the infrastructure was already in place:
[data-slot="text-part-copy-wrapper"]selector withdisplay: none— pre-wired but never connectedui.message.copyResponseandui.message.copiedalready translated in 16+ languagesTooltip,IconButton,createSignal,useI18n) already in the fileshowAssistantCopyPartIDprop already plumbed through the component chainCSS (
message-part.css): Changed the wrapper fromdisplay: nonetodisplay: flexwithopacity: 0; pointer-events: noneand a0.15sopacity transition. Hover over the parent[data-component="text-part"]reveals the button. Whendata-is-turn-copyis set (active/last text part), the button is always visible.TSX (
message-part.tsx): Added toTextPartDisplay—useI18n()call,copiedsignal,isLastTextPartmemo (finds last text part in message),showCopymemo (usesshowAssistantCopyPartIDprop or falls back toisLastTextPart),handleCopyhandler with 2s check icon toggle, and a<Tooltip>+<IconButton>block inside a<div data-slot="text-part-copy-wrapper">.Zero new imports, zero new i18n keys, zero new CSS selectors, zero new props.
Screenshots
Before (no copy button):
After:
after.mp4
How to Test
Get in Touch
My discord is
@iamcoder18and I am in the Kilo Code discord server.