Skip to content

feat(agent): add a copy button to agent messages in the AI agent chat #371

Closed

Description

@gkhngyk

Summary

On the in-product AI agent page (/dashboard/agent), there's no way to copy an assistant reply. Users often ask the assistant to draft/generate content and then want to reuse it — right now they have to hand-select the text. Add a copy button to each assistant message that copies the reply to the clipboard.

What to change

In web/src/app/[locale]/(dashboard)/dashboard/agent/page.tsx, in the MessageBubble component (renders each message; assistant messages go through <Markdown>):

  • For assistant messages only (!isUser), add a small copy icon button in an unobtrusive spot — e.g. the bottom-right of the bubble, or just below it.
  • Clicking it copies the message's text to the clipboard via navigator.clipboard.writeText(...), and briefly flips to a "copied" state (a check icon / "Copied" tooltip), like the existing copy affordances in the app (e.g. the team invite link copy in settings/team-section.tsx, which uses the lucide Copy icon + a toast.success('Link copied')).
  • Copy the raw text the assistant produced — concatenate the text parts: (message.parts ?? []).filter((p) => p.type === 'text').map((p) => p.text).join('\n\n'). (Copy the markdown source, so lists/bold survive a paste into a doc.)

Scope / non-goals

  • Only the text parts — skip tool-call disclosures and rendered charts (tool-* / tool-render_chart parts).
  • Only assistant messages; user messages don't need a copy button.
  • No streaming concern needed beyond showing the button once the message is present (it can show while streaming too; it copies whatever text has arrived).

How to test

  1. /dashboard/agent → ask the assistant something (e.g. "draft a short intro paragraph") → a copy button appears on the assistant reply.
  2. Click it → the reply text is on the clipboard (paste into a doc → the markdown/text matches), and the button shows a brief "copied" confirmation.
  3. User messages and tool/chart parts have no copy button.

Notes

  • Small, self-contained UI change — good first issue. Reuses the existing Copy-icon + clipboard pattern already used elsewhere in the app.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Jul 7, 2026
  2. changed the title [-]feat(agent): add a copy button to assistant messages in the AI assistant chat[/-] [+]feat(agent): add a copy button to agent messages in the AI agent chat[/+] on Jul 7, 2026
  3. d180 commented on Jul 7, 2026

    @d180
    Contributor

    Hi @gkhngyk , I would like to work on this issue.

  4. added a commit that references this issue on Jul 9, 2026
    5625386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions