Skip to content

feat(chat-messages): add follow-up prompts#2082

Open
robertwilde wants to merge 1 commit into
mainfrom
feat/ai/follow-up-prompts
Open

feat(chat-messages): add follow-up prompts#2082
robertwilde wants to merge 1 commit into
mainfrom
feat/ai/follow-up-prompts

Conversation

@robertwilde
Copy link
Copy Markdown
Collaborator

@robertwilde robertwilde commented May 19, 2026

Closes #2066

Adds follow-up prompt support to SiChatInputComponent. A new followUpPrompts input (string[]) renders suggested next actions as pill buttons above the chat input; clicking a prompt inserts its text into the input field and emits a followUpPromptSelected output so the consuming application can react (e.g. clear the list). The si-chat-container example is updated to demonstrate the feature with three realistic prompts. Documentation is updated in both the chat input component page and the AI chat pattern page.


Documentation.
Examples.
Dashboards Demo.
Playwright report.

Coverage Reports:

Code Coverage

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces follow-up prompts to the SiChatInputComponent, enabling users to select suggested actions that populate the chat input field. The implementation includes new input and output signals, template updates for rendering prompt buttons, and corresponding documentation and styling. Feedback from the review suggests using $index for tracking in the @for loop to avoid issues with duplicate strings, disabling prompt buttons while a message is being sent, and ensuring the textarea height is recalculated after a prompt is selected.

Comment thread projects/element-ng/chat-messages/si-chat-input.component.html Outdated
Comment thread projects/element-ng/chat-messages/si-chat-input.component.html Outdated
Comment thread projects/element-ng/chat-messages/si-chat-input.component.ts
@robertwilde robertwilde force-pushed the feat/ai/follow-up-prompts branch 3 times, most recently from f3d97be to 0ff44dd Compare May 19, 2026 14:32
@robertwilde robertwilde marked this pull request as ready for review May 19, 2026 14:32
@robertwilde robertwilde requested review from a team as code owners May 19, 2026 14:32
@robertwilde
Copy link
Copy Markdown
Collaborator Author

@panch1739 check this out :)

Copy link
Copy Markdown
Member

@panch1739 panch1739 left a comment

Choose a reason for hiding this comment

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

@robertwilde Nice! One only note, the button should have a total height of 32px and the gap between them, 8px :)

Image

Thank you so much!

@robertwilde robertwilde force-pushed the feat/ai/follow-up-prompts branch 2 times, most recently from c8c7230 to b0f5be7 Compare May 22, 2026 08:17
}

protected selectFollowUpPrompt(prompt: string): void {
this.value.set(prompt);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we set the value here but expect consumer to reset the followUpPromptSelected. IMO either we should do both or delegate that responsibility to consumer

this.value.set(value);
}

protected selectFollowUpPrompt(prompt: string): void {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please add test coverage for this

@for (prompt of followUpPrompts(); track $index) {
<button
type="button"
class="btn btn-secondary-ghost btn-sm follow-up-prompt-btn"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think what you need here is:
class="btn btn-secondary-ghost fw-normal"

and then you also don't need those custom styles of follow-up-prompt-btn

this.value.set(prompt);
this.followUpPromptSelected.emit(prompt);
this.focus();
setTimeout(() => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do not use setTimeout can you propose an alternative?

@if (followUpPrompts().length) {
<div class="follow-up-prompts d-flex flex-wrap gap-4 mb-4">
@for (prompt of followUpPrompts(); track $index) {
<button
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should discuss whether we want input/output or a declarative approach which use content projection. A directive could handle the disabled state and applyy the default classes

@robertwilde robertwilde changed the title feat(ai-chat): add follow-up prompts feat(chat-messages): add follow-up prompts May 27, 2026
@robertwilde robertwilde force-pushed the feat/ai/follow-up-prompts branch 3 times, most recently from c5b46a4 to 3c054ee Compare May 27, 2026 15:44
@robertwilde robertwilde force-pushed the feat/ai/follow-up-prompts branch from 3c054ee to 2bdc707 Compare May 27, 2026 16:59
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.

AI patterns: Add follow-up prompts

4 participants