Skip to content

feat(web): add copy button to assistant messages#392

Merged
tiann merged 1 commit intotiann:mainfrom
nerdneilsfield:main
Apr 5, 2026
Merged

feat(web): add copy button to assistant messages#392
tiann merged 1 commit intotiann:mainfrom
nerdneilsfield:main

Conversation

@nerdneilsfield
Copy link
Copy Markdown
Contributor

Summary / 概述

image

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.ts
  • bun run typecheck

Notes / 说明

This PR only includes assistant-side copy support.
The existing user-message copy button remains unchanged.

这个 PR 只补充 assistant 侧的复制能力。
现有 user 消息复制按钮未改动。

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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): bun is not available in this runner, so bun run test -- web/src/components/AssistantChat/messages/assistantCopyText.test.ts and bun typecheck could not be executed.

HAPI Bot

@tiann tiann merged commit 139a21c into tiann:main Apr 5, 2026
2 checks passed
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.

2 participants