feat(addie): add "Copy response" button to web chat interface#4269
Draft
feat(addie): add "Copy response" button to web chat interface#4269
Conversation
4 tasks
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.
Closes #4266
Adds a "Copy" button to each Addie assistant message bubble in the web chat UI. Clicking it writes the raw markdown response to the clipboard and briefly shows "Copied!" for 1.5 s. Works on desktop and mobile (always-visible, not hover-only), sits in the existing feedback bar alongside the thumbs-up/down controls.
Non-breaking justification: Purely additive UI change to
server/public/chat.html. No protocol surface touched; no schema changes; changeset is--empty. Existing messages, feedback UI, and streaming behavior are unaffected — the copy button only appends to the feedback container after finalization.Scope note: The issue requested a "plain text vs markdown toggle." That is explicitly out of scope here. Practitioners copying schema examples, bid request snippets, or certification content want the raw markdown intact (fences, list syntax, field names). A toggle adds decision friction at exactly the wrong moment and would require fragile round-trip DOM parsing. If the need resurfaces, it should be a follow-up issue.
Implementation notes:
createFeedbackUI(messageId, rawContent)— new optionalrawContentparam; copy button is appended viacreateElement(never viainnerHTML), so no CodeQL XSS vector.fallbackCopy()— textarea-based execCommand fallback for non-HTTPS or older browser contexts, withfinallycleanup to ensure the element is always removed.addMessagepassescontent(raw markdown param);finalizeStreamingMessagepassesfullContent.var(--color-border),var(--color-brand),var(--color-success-*));margin-left: auto; flex-shrink: 0right-aligns the button in the flex feedback row.Pre-PR review:
finallyblock for textarea cleanup added; no XSS path; pre-existing build errors confirmed unrelated to this diff. Nit: post-copy state transition is duplicated across both clipboard paths (not fixed — extraction would be premature abstraction for two callers).Session: https://claude.ai/code/session_01UoAgNhNUnrKHaXAZqHjHyg
Generated by Claude Code