Skip to content

[Widget] Render agent rich content - #935

Merged
giannagerton merged 3 commits into
mainfrom
gianna/rich-content-buttons
Aug 13, 2026
Merged

[Widget] Render agent rich content#935
giannagerton merged 3 commits into
mainfrom
gianna/rich-content-buttons

Conversation

@giannagerton

@giannagerton giannagerton commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Adds the widget-side consumer of the onRichContent SDK callback (#912). Adds rich content rendering to the chat widget. The agent can display components inline in the transcript starting with quick reply buttons. It's inert on merge, since nothing on the server emits the event yet.

Starting with buttons rather than cards, for two reasons:

  • ButtonGroup is the primitive other components build on. A card or carousel renders its own buttons through the same component.
  • Going through the customer analysis, clickable links and guided options came up far more often than product cards.
Screenshot 2026-08-12 at 2 39 13 PM

Button types

Type Behaviour
message Sends its text as the user's own turn
link Opens its url in a new tab

Max 3 buttons per row. Buttons that can run actions directly to follow.


Note

Medium Risk
New user-facing transcript paths and outbound links/message sends, mitigated by strict https-only link validation and safe fallbacks for bad payloads.

Overview
Adds inline rich content in the convai widget transcript, wired from the SDK onRichContent callback into new rich_content transcript entries and display rows.

The first supported component is buttons: message buttons call sendUserMessage with the payload text; link buttons use an extended Button (as="a", outline, target="_blank"). Props are validated with zod/mini (caps, trimming, https-only links); unknown or invalid payloads show rich_content_unavailable instead of breaking the UI.

Display transcript behavior is covered by new tests so rich content stays in arrival order relative to agent replies, tool-status placeholders, and the typing indicator.

Reviewed by Cursor Bugbot for commit 73cdfb9. Bugbot is set up for automated code reviews on this repo. Configure here.

@giannagerton
giannagerton force-pushed the gianna/rich-content-buttons branch from 0ea58f4 to 694ee7f Compare August 12, 2026 19:18
@giannagerton
giannagerton requested a review from kamilk-11 August 13, 2026 13:58

@kamilk-11 kamilk-11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

Comment thread packages/convai-widget-core/src/rich-content/ButtonGroup.tsx Outdated
Comment thread packages/convai-widget-core/src/rich-content/validate.ts
@giannagerton
giannagerton force-pushed the gianna/rich-content-buttons branch from 694ee7f to b6cbe7f Compare August 13, 2026 17:28
@giannagerton
giannagerton force-pushed the gianna/rich-content-buttons branch from b6cbe7f to 73cdfb9 Compare August 13, 2026 17:31
@giannagerton
giannagerton merged commit c7afdba into main Aug 13, 2026
5 checks passed
@giannagerton
giannagerton deleted the gianna/rich-content-buttons branch August 13, 2026 17:36
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