Skip to content

AI Chat UX#511

Closed
petervachon wants to merge 35 commits into
mainfrom
chatUX_040826
Closed

AI Chat UX#511
petervachon wants to merge 35 commits into
mainfrom
chatUX_040826

Conversation

@petervachon
Copy link
Copy Markdown
Collaborator

@petervachon petervachon commented Apr 14, 2026

Summary

This PR delivers the next wave of AI Chat UX improvements for Apollo Vertex: a new multi-step guided flow interaction, richer input with file/image attachments, context-menu "Ask Autopilot" selection, message actions, and a full-coverage component preview page.


What's new

Multi-step flow (AiChatFlow)

  • New AiChatFlow component renders a guided, step-by-step interaction card docked above the input
  • Card visually wraps the input — input floats in front with 8px inset gap on left/right/bottom, creating a connected "Claude co-work" style layout
  • Numbered badges (secondary styling), dividers between options, animated question text
  • Chevron back/forward navigation always visible, dimmed at boundaries; step counter (e.g. 2/4) inline with controls
  • Free-text answers supported at every step — input placeholder changes to "Or type your own answer..." when flow is active, and submitting routes the text directly into the flow without needing a "Something else" option
  • LLM prompts updated to prohibit catch-all options ("Something else", "Other", "None of the above") — the free-text input handles that case
  • flowTool wired into AiChatAgentHubMode alongside choicesTools
  • Stale resolver ref bug fixed — "Ask Autopilot" context menu no longer hangs after a flow completes

File & image attachments

  • + menu in the input opens a file picker (multiple files)
  • Paste an image directly into the input to attach it
  • File chips show name + remove button for documents; image files render a 40×40 thumbnail with a 1px border
  • Click a thumbnail to open a full lightbox overlay (backdrop blur, close button top-right, Escape to dismiss)
  • Object URLs are properly revoked on remove and submit to prevent memory leaks
  • Note: files are UI-only for now — LLM integration deferred until the target model/endpoint is confirmed

Context menu — "Ask Autopilot"

  • Select text anywhere in the chat and a context menu appears with "Ask Autopilot"
  • Quoted text is shown as a chip inside the input; clear button removes it
  • Selecting text in a new location replaces the previous quote

Message actions

  • Copy, quote reply, and regenerate actions on assistant messages

Preview page

  • /vertex-components/ai-chat/preview now covers all isolated sub-components with live demos: loading states, thinking animation, suggestion chips, multi-step flow, message actions, error banner, empty state
  • Link added to the /patterns/ai-chat documentation page

Bug fixes (PR review)

  • Restored useTranslation and aria-label in PreviewFullScreen
  • Reverted import type * as Reactimport * as React in accordion.tsx
  • Fixed {icon && icon}{icon} in AiChatEmptyState (CodeQL)
  • Removed accidental re-export file at app/patterns/ai-chat/preview/page.tsx and its orphaned _meta.ts

How to test

Multi-step flow

  • Start the chat and type "help me choose a process automation tool" (or similar) — the LLM should trigger the flow card
  • Click through options — card navigates forward, back chevron becomes active
  • Use back/forward chevrons to navigate between steps
  • At any step, type a custom answer in the input instead of clicking — it should be accepted and the flow continues
  • Complete the flow — card dismisses, chat resumes normally
  • After the flow, type a follow-up and hit send — it should send normally (no stale resolver intercept)

File attachments

  • Click + → "Upload files" — select a non-image file; chip should show filename with remove button
  • Select an image file — chip should show a 40×40 thumbnail with a 1px border
  • Paste an image from clipboard — thumbnail chip appears
  • Click the thumbnail — lightbox opens; click outside or press Escape to close; click the X button top-right to close
  • Remove a file — chip disappears
  • Submit with a file attached — chips clear, no console errors about revoked URLs

Context menu

  • Select any text in an assistant message — "Ask Autopilot" context menu appears
  • Click it — quoted text chip appears in the input
  • Click the X on the chip — quote clears
  • Select different text — chip updates to new selection

Preview page

  • Navigate to /vertex-components/ai-chat/preview — all sub-component sections render
  • Check the flow demo card renders with mock steps and navigation works
  • Verify the link from /patterns/ai-chat docs page points to the preview

petervachon and others added 24 commits April 13, 2026 14:40
- Remove compact/embedded variants — consolidate to single default
- Fix empty-state alignment (header/input both px-4, no double-padding)
- Wire onFeedback through context with messageId bridging
- Fix user message actions visibility (isLatest not role-gated)
- Fix Autopilot header icon (AutopilotGradientIcon)
- Export MessageSource/MessageAttachment from types
- Add fullscreen expand to preview cards (Dialog pattern)
- Add Message Actions and Edit Mode sections to preview
- Fix 'Thinking...' descender clipping (lineHeight 1→1.3)
- Fix dark code block bg (github-dark-dimmed, transparent bg)
- Fix input button alignment (items-end, pb-[8px])
- Add Components nav item under Patterns > AI Chat
- Fix lint: no-undefined, no-array-callback-reference, max-lines

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

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

Project Deployment Review Updated (PT)
apollo-design 🟢 Ready Preview, Logs Apr 17, 2026, 04:06:58 AM
apollo-landing 🟢 Ready Preview, Logs Apr 17, 2026, 04:04:01 AM
apollo-ui-react 🟢 Ready Preview, Logs Apr 17, 2026, 04:05:53 AM
apollo-vertex 🟢 Ready Preview, Logs Apr 17, 2026, 04:05:38 AM

@github-actions github-actions Bot added app:apollo-vertex size:XXL 1,000+ changed lines. labels Apr 14, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Dependency License Review

  • 1941 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 3 package(s) excluded (see details below)
License distribution
License Packages
MIT 1701
ISC 89
Apache-2.0 61
BSD-3-Clause 28
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 5
MIT OR Apache-2.0 3
MIT-0 3
CC0-1.0 3
LGPL-3.0-or-later 2
(MIT OR Apache-2.0) 2
Unlicense 2
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
@img/sharp-libvips-linuxmusl-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

Copy link
Copy Markdown

@VKravchuk VKravchuk left a comment

Choose a reason for hiding this comment

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

Could you please add screenshots and descriptions what are included in this PR? There are a lot of changes and it's hard to track

Comment on lines +56 to +55
aria-label={t("exit_full_screen")}
title={t("exit_full_screen")}
aria-label="Exit full screen"
title="Exit full screen"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we shouldn't remove translation functions

Comment on lines +1 to +7
"use client";

import AiChatPreviewPage from "@/app/vertex-components/ai-chat/preview/page";

export default function PreviewPage() {
return <AiChatPreviewPage />;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

what is the purpose of this file?

Comment on lines -5 to 6
import * as React from "react";
import type * as React from "react";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we shouldn't fix all warning in this PR

@petervachon
Copy link
Copy Markdown
Collaborator Author

petervachon commented Apr 16, 2026

image image image image

The components from the chat can be viewed here: https://apollo-vertex-oeyahl5dg-uipath.vercel.app/vertex-components/ai-chat/preview

Also included changes to the initial commit

@petervachon petervachon marked this pull request as ready for review April 16, 2026 21:12
@petervachon petervachon requested a review from a team as a code owner April 16, 2026 21:12
@petervachon petervachon requested review from 0xr3ngar and VKravchuk and removed request for a team April 16, 2026 21:12
- Fix TypeScript build error: use globalThis.KeyboardEvent for DOM listener
- Add uid to PendingFile and move makePendingFile outside component
- Wrap async onClick handlers in void (no-misused-promises)
- Replace dangerouslySetInnerHTML with ref-based innerHTML in code block
- Remove unsafe type assertions; use instanceof/type narrowing instead
- Replace no-undefined violations with null checks and conditional spreads
- Fix no-array-index-key with stable uid/label/url keys
- Extract tryParseFlow helper to reduce nesting depth in ai-chat-utils
- Type MOCK_SOURCES_BASIC/ATTACHMENTS_BASIC as Record<string, ...>
- Remove unused FlowStep and ToolResultChoices imports
- Fix jsx-no-literals violations and no-negated-condition in paste handler

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@0xr3ngar 0xr3ngar left a comment

Choose a reason for hiding this comment

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

I’m sorry, but I can’t reasonably review this PR in its current form

At 4k+ lines changed, 97 files, and 30+ commits, this is far beyond what I can review with the level of care and confidence we should expect from code review. I can’t properly validate correctness, architecture, regressions, or maintainability at this size without spending days on it, which defeats the purpose of a normal PR review.

I’m going to ask that this be redone as a series of stacked PRs

By stacked PRs, I mean breaking the work into multiple smaller, focused PRs, where each PR builds on the previous one and contains a single logical layer of change. For example:

  • setup / scaffolding
  • shared components or tokens
  • feature-specific UI changes
  • cleanup or follow-up refactors

That makes the review process manageable, makes the intent of each change clearer, and reduces risk

If helpful, here’s a good overview of the approach: https://www.stacking.dev/ ( do not use the tools that they propose there, just tell your AI to create a manual stacked PR with followup PRs just referencing the previous branch )

@petervachon
Copy link
Copy Markdown
Collaborator Author

This PR has been split up / stacked PR's, starting with #544 1 of 6

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

This PR has been stale for over 2 weeks with no new commits. Closing — feel free to reopen if you'd like to continue this work. To keep a PR exempt from this automation, add the do-not-close label.

@github-actions github-actions Bot closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:apollo-vertex size:XXL 1,000+ changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants