feat(chat-messages): add source chip AI pattern#2266
Conversation
5b5ace3 to
d7aa7ea
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces inline and summary source chips (SiSourceChipInlineComponent and SiSourceChipSummaryComponent) for AI messages, allowing citations to be displayed either inline at the end of the text or as a summary alongside action buttons. The review feedback points out two correctness issues in the DOM manipulation logic of SiAiMessageComponent: a caching bug that prevents dynamic updates of inline chips (e.g., during streaming), and a layout bug where chips are incorrectly appended if the message does not end with a paragraph element. A code suggestion is provided to resolve both issues.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
ad67a41 to
01ebb90
Compare
c9773b4 to
320192f
Compare
spike-rabbit
left a comment
There was a problem hiding this comment.
Just had a discussion with @panch1739, we need a few changes here:
- the chips should reuse the summary-chip style, so at first you need to extract the summary-chip styling into element-theme (in another PR).
- then we need a chip-sm size which has modified paddings for inline source (in another PR)
- the inline source and the summary source can exist at the same time
- no need to have any logic around whether the response is currently streamed or not
- the inline source can be at the end of any paragraph, so we can currently not integrate this into the ai-chat-message, just show how it can be used in the normal chat message. We need to think about a solution later
- I guess splitting summary and inline sources in different PRs would be a good idea too
Closes #2064
Add two new components for surfacing AI message source citations in the chat messages.
What
SiSourceChipInlineComponentA compact inline pill rendered at the end of the AI message body. Shows the title of the first cited source, with a "+N" suffix when there are multiple. Opens a CDK popover listing all sources (title, excerpt, link) on click. Optionally shows a prefix icon.
SiSourceChipSummaryComponentA summary pill for the actions row. Renders a globe icon and a translatable "Sources" label. Same popover behaviour as the inline chip. Intended to be used alongside the
siAiMessageActiondirective.SiAiMessageActionDirectiveA new marker directive (
[siAiMessageAction]) that enables projecting arbitrary action elements into thesi-ai-messageactions row viacontentChildren. Fixes the case where the actions bar would not render when only a source chip (and no built-in actions) was present.SiAiMessagechangessourcesinput (SiAiSource[]) — the inline chip is now rendered internally bysi-ai-messageand does not need to be projected by consumers.chipClickedoutput forwarded from the inline chip.siAiMessageActioncontent.SiAiSourcemodelNew exported interface:
{ title: string; excerpt: string; url: string }.Usage
Documentation.
Examples.
Dashboards Demo.
Playwright report.
Coverage Reports: