Skip to content

feat(apollo-vertex): ai-chat text selection — Ask AI floating pill + quote chip [5/5]#632

Merged
pieman1313 merged 1 commit into
mainfrom
feat/ai-chat-5-text-selection
May 20, 2026
Merged

feat(apollo-vertex): ai-chat text selection — Ask AI floating pill + quote chip [5/5]#632
pieman1313 merged 1 commit into
mainfrom
feat/ai-chat-5-text-selection

Conversation

@petervachon
Copy link
Copy Markdown
Collaborator

What this does

Lets users ask the AI about specific text they've selected — a natural way to go from reading a response to asking a follow-up about a particular part of it.

  • "Ask AI" floating pill — appears above any selected text within the chat container, with the Autopilot icon and a gradient background to make it feel intentional
  • Quote chip in the input — when the user clicks "Ask AI", the selected text appears as a small truncated chip above the textarea so they can see the context they're referencing before they type their question
  • Dismiss — clicking × on the chip removes the quoted context; submitting the message clears it automatically
  • Scoped to the chat container — selecting text elsewhere on the page (browser UI, other panels) doesn't trigger the pill
  • Enabled via enableTextSelection prop (off by default) so teams can opt in only where it makes sense

Test plan

  • Select text in an assistant message — "Ask AI" pill appears above the selection
  • Click pill — quote chip appears in input with the selected text, input is focused
  • Long quoted text truncates with ellipsis rather than wrapping to two lines
  • × on chip clears the quote
  • Submitting clears the chip and sends the message
  • Selecting text outside the chat container does not show the pill
  • enableTextSelection={false} (default) — pill never appears

🤖 Generated with Claude Code

@petervachon petervachon requested a review from a team as a code owner April 30, 2026 13:51
@petervachon petervachon requested review from angeloaltamiranom and frankkluijtmans and removed request for a team April 30, 2026 13:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (PT)
apollo-design 🟢 Ready Preview, Logs May 20, 2026, 08:18:48 AM
apollo-docs 🟢 Ready Preview, Logs May 20, 2026, 08:18:48 AM
apollo-landing 🟢 Ready Preview, Logs May 20, 2026, 08:18:48 AM
apollo-ui-react 🟢 Ready Preview, Logs May 20, 2026, 08:18:48 AM
apollo-vertex 🟢 Ready Preview, Logs May 20, 2026, 08:18:48 AM

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

Dependency License Review

  • 1901 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1671
ISC 89
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

@petervachon petervachon force-pushed the feat/ai-chat-5-text-selection branch from d7825bc to 81ea0f5 Compare April 30, 2026 16:56
@petervachon petervachon force-pushed the feat/ai-chat-4-attachments branch from a27c80c to 30bd3d9 Compare April 30, 2026 16:56
@petervachon petervachon force-pushed the feat/ai-chat-5-text-selection branch from 81ea0f5 to cbb42da Compare April 30, 2026 17:36
@petervachon petervachon force-pushed the feat/ai-chat-4-attachments branch from 30bd3d9 to 8012d26 Compare April 30, 2026 17:36
@petervachon petervachon force-pushed the feat/ai-chat-5-text-selection branch from cbb42da to e056918 Compare May 1, 2026 13:11
@petervachon petervachon force-pushed the feat/ai-chat-4-attachments branch 2 times, most recently from 405b118 to ce7867d Compare May 1, 2026 13:22
@petervachon petervachon force-pushed the feat/ai-chat-5-text-selection branch 2 times, most recently from 8cdb31f to fa624d3 Compare May 1, 2026 13:42
@petervachon petervachon force-pushed the feat/ai-chat-4-attachments branch 2 times, most recently from 7e4b0e5 to 873677f Compare May 1, 2026 13:57
@petervachon petervachon force-pushed the feat/ai-chat-5-text-selection branch from fa624d3 to 549b6d0 Compare May 1, 2026 13:57
@frankkluijtmans
Copy link
Copy Markdown
Contributor

I think this is part of a PR stack? Seems like [feat/ai-chat-4-attachments](https://github.com/UiPath/apollo-ui/tree/feat/ai-chat-4-attachments) needs to go in first. Let's keep this in draft until then.

@petervachon petervachon force-pushed the feat/ai-chat-5-text-selection branch from 549b6d0 to 11b444a Compare May 4, 2026 14:34
@petervachon petervachon marked this pull request as draft May 4, 2026 14:38
@pieman1313 pieman1313 force-pushed the feat/ai-chat-4-attachments branch 5 times, most recently from 48009fd to 34906a0 Compare May 18, 2026 13:42
Base automatically changed from feat/ai-chat-4-attachments to main May 19, 2026 08:12
@pieman1313 pieman1313 force-pushed the feat/ai-chat-5-text-selection branch from 11b444a to 0af048f Compare May 20, 2026 10:55
@github-actions github-actions Bot added the size:XL 500-999 changed lines. label May 20, 2026
@pieman1313 pieman1313 marked this pull request as ready for review May 20, 2026 11:01
Copilot AI review requested due to automatic review settings May 20, 2026 11:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds opt-in “text selection → Ask AI” UX to the Apollo Vertex AiChat experience, enabling users to quote selected chat text into the composer and ask a follow-up with that context.

Changes:

  • Introduces enableTextSelection on AiChat, showing a floating “Ask AI” pill on selection and inserting the selected text as a markdown blockquote in the next user message.
  • Enhances markdown rendering to optionally preserve soft line breaks (remark-breaks) and renders user bubbles via markdown to support quoted blockquotes.
  • Refactors AI chat UI into smaller components (empty suggestions, error banner, scroll-to-bottom button) and updates AgentHub template to enable the feature.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Adds lock entries for remark-breaks and lockfile reshuffles.
apps/apollo-vertex/package.json Adds remark-breaks dependency.
apps/apollo-vertex/registry.json Registers the new dependency and newly added UI components in the registry.
apps/apollo-vertex/templates/ai-chat/AiChatAgentHubMode.tsx Enables text selection in the AgentHub chat template; updates assistant naming.
apps/apollo-vertex/registry/ai-chat/hooks/use-sticky-scroll.ts Exposes scroll element ref and merged listener ref for consumers (selection menu positioning).
apps/apollo-vertex/registry/ai-chat/content-parts.ts Adds helpers for visible-assistant detection and blockquote composition.
apps/apollo-vertex/registry/ai-chat/components/ai-chat.tsx Wires selection menu, quoted text state, and new subcomponents; composes quoted blockquote into submitted content.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-selection-menu.tsx New floating “Ask AI” pill shown for in-container selections.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-scroll-to-bottom-button.tsx New extracted scroll-to-bottom button component.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-error-banner.tsx New extracted error banner component.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-empty-suggestions.tsx New extracted empty-state suggestion buttons component.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-message.tsx Renders user messages using markdown (with preserved line breaks) to display blockquote quotes.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-markdown.tsx Adds preserveLineBreaks support via remark-breaks and a wrapper className prop.
apps/apollo-vertex/registry/ai-chat/components/ai-chat-input.tsx Adds quote chip UI and remove-quote affordance.
apps/apollo-vertex/registry/ai-chat/animations.ts Adds “pop” animation constants used by the selection menu.
apps/apollo-vertex/locales/en.json Adds i18n strings for “Ask AI” and quote removal.
apps/apollo-vertex/app/patterns/ai-chat/page.mdx Documents the new enableTextSelection behavior and usage.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread apps/apollo-vertex/registry/ai-chat/components/ai-chat.tsx
Comment thread apps/apollo-vertex/registry/ai-chat/components/ai-chat-markdown.tsx
@pieman1313 pieman1313 force-pushed the feat/ai-chat-5-text-selection branch from 0af048f to 570cfbc Compare May 20, 2026 11:46
Comment thread apps/apollo-vertex/registry/ai-chat/components/ai-chat-selection-menu.tsx Outdated
@pieman1313 pieman1313 force-pushed the feat/ai-chat-5-text-selection branch from 570cfbc to 45e21dc Compare May 20, 2026 14:14
@pieman1313 pieman1313 force-pushed the feat/ai-chat-5-text-selection branch from 45e21dc to 025646d Compare May 20, 2026 15:14
@pieman1313 pieman1313 merged commit 35e9ba1 into main May 20, 2026
52 of 54 checks passed
@pieman1313 pieman1313 deleted the feat/ai-chat-5-text-selection branch May 20, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:apollo-vertex size:XL 500-999 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants