Skip to content

Chat: Add suggestions API Description#8674

Open
arman-boyakhchyan wants to merge 3 commits intoDevExpress:26_1from
arman-boyakhchyan:chat-suggestions-api-26-1
Open

Chat: Add suggestions API Description#8674
arman-boyakhchyan wants to merge 3 commits intoDevExpress:26_1from
arman-boyakhchyan:chat-suggestions-api-26-1

Conversation

@arman-boyakhchyan
Copy link
Copy Markdown
Contributor

No description provided.

@arman-boyakhchyan arman-boyakhchyan self-assigned this Apr 17, 2026
Copilot AI review requested due to automatic review settings April 17, 2026 08:18
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 API reference content for dxChat.Options.suggestions to describe how to configure suggestion buttons above the Chat input field.

Changes:

  • Documented how suggestions maps to a DevExtreme ButtonGroup configuration (including ignored/overridden options).
  • Added multi-framework code snippets (jQuery/Angular/Vue/React) demonstrating suggestion buttons that populate inputFieldText.

Comment thread api-reference/10 UI Components/dxChat/1 Configuration/suggestions.md Outdated
Comment thread api-reference/10 UI Components/dxChat/1 Configuration/suggestions.md Outdated
Copilot AI review requested due to automatic review settings April 18, 2026 13:04
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.

Comment on lines +125 to +129
return (
<Chat
inputFieldText={inputFieldText}
suggestions={chatSuggestions}
/>
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

In the React sample, inputFieldText is supplied from React state, but there is no onInputFieldTextChange handler to keep that state updated when the user types. This can lead to state/UI divergence (and the value being reset on re-render). Add the change handler (see the existing inputFieldText option example for the pattern).

Copilot uses AI. Check for mistakes.
{ text: 'Fix my writing' },
],
onItemClick: handleSuggestionClick,
}
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

Missing semicolon after the chatSuggestions object literal; most TypeScript/React samples in this section terminate statements with semicolons. Add the semicolon to avoid lint/style inconsistencies in the snippet.

Suggested change
}
};

Copilot uses AI. Check for mistakes.
Comment on lines +34 to +43
$('#chat').dxChat({
suggestions: {
items: [
{ text: 'Summarize text' },
{ text: 'Write an email' },
{ text: 'Fix my writing' },
],
onItemClick(e) {
$('#chat').dxChat('instance').option('inputFieldText', e.itemData.text);
},
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

In the jQuery snippet, the handler calls $('#chat').dxChat('instance') on every click, which repeats DOM lookup and instance retrieval. Store the Chat instance once during initialization (or keep it in a variable/closure) and reuse it inside onItemClick.

Copilot uses AI. Check for mistakes.
</dx-chat>

<!-- tab: app.component.ts -->
import { DxChatModule, type DxChatTypes } from "devextreme-angular/ui/chat";
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

The Angular example imports DxChatModule, but the snippet does not use it anywhere (and it is not paired with an app.module.ts tab). Consider removing this import or adding the module-setup snippet where DxChatModule is actually used to avoid confusion and unused-import warnings.

Suggested change
import { DxChatModule, type DxChatTypes } from "devextreme-angular/ui/chat";
import { type DxChatTypes } from "devextreme-angular/ui/chat";

Copilot uses AI. Check for mistakes.

<!-- tab: app.component.html -->
<dx-chat ...
[inputFieldText]="inputFieldText"
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

The Angular template binds [inputFieldText] one-way, so the component field will not reflect user edits in the input. If the intent is to keep inputFieldText in sync with the UI (as in the existing inputFieldText option docs), use two-way binding ([(inputFieldText)]) or handle the corresponding change event.

Suggested change
[inputFieldText]="inputFieldText"
[(inputFieldText)]="inputFieldText"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants