feat(web): add copy button to assistant messages#392
Merged
tiann merged 1 commit intotiann:mainfrom Apr 5, 2026
Merged
Conversation
There was a problem hiding this comment.
Findings
- No diff-attributable issues found in the modified lines after checking the assistant message rendering/copy path against adjacent web code.
Summary
- Review mode: initial
- No issues found in the latest diff. Residual risk: coverage here is helper-level only; I did not find a component-level web test for the assistant copy button interaction in repo/docs.
Testing
- Not run (automation):
bunis not available in this runner, sobun run test -- web/src/components/AssistantChat/messages/assistantCopyText.test.tsandbun typecheckcould not be executed.
HAPI Bot
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.
Summary / 概述
This PR adds a copy button to assistant chat messages in the hub web UI.
When a message contains visible reply text, a copy button appears on hover, matching the existing user-message interaction.
这个 PR 为 hub 的 Web 聊天界面补充了 assistant 消息的复制按钮。
当消息包含可见回复正文时,悬停会显示 copy 按钮,交互方式与现有 user 消息保持一致。
Changes / 变更内容
Add a hover-only copy button to assistant messages
Reuse the existing clipboard hook and copied-state feedback
Extract assistant copy text into a small helper
Ignore tool cards, reasoning blocks, and CLI output when copying
Add focused unit tests for assistant copy-text extraction
为 assistant 消息新增仅悬停显示的 copy 按钮
复用现有剪贴板 hook 和复制成功反馈
抽出 assistant 正文复制文本的辅助函数
复制时忽略 tool card、reasoning 和 CLI output
为 assistant 文本提取补充聚焦单测
Verification / 验证
bun run test -- src/components/AssistantChat/messages/assistantCopyText.test.tsbun run typecheckNotes / 说明
This PR only includes assistant-side copy support.
The existing user-message copy button remains unchanged.
这个 PR 只补充 assistant 侧的复制能力。
现有 user 消息复制按钮未改动。