Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export const AI_SERVICE_CONFIG = {

export const EMPTY_VIEW_MESSAGE = 'AI Assistant is ready to help you';

export const EMPTY_VIEW_PROMPT = 'Update employee <b>Form</b> fields.\nFilter or sort tasks, display or hide <b>DataGrid</b> columns, or clear all filters and sorting.';
export const EMPTY_VIEW_PROMPT = 'Update employee information in the <b>Form</b>.\nChange task presentation in the <b>DataGrid</b>: filter and sort data, change column visibility.';

export const SMART_PASTE_TIMEOUT_MS = 30000;
export const MAX_USER_MESSAGE_LENGTH = 2000;
Expand Down Expand Up @@ -220,8 +220,8 @@ export const tasks: Task[] = [
];

export const chatSuggestions = [
{ text: 'Show Completed Tasks', prompt: 'Show Completed Tasks' },
{ text: 'Change State to Texas', prompt: 'Change State to Texas' },
{ text: 'Review Completed Tasks', prompt: 'Review Completed Tasks' },
];

export const formFieldsConfig: DxFormTypes.SimpleItem[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { emptyViewMessage } from './data.ts';
import type { AiAssistantProps, PushMessage } from './data.ts';

const chatSuggestionItems = [
{ text: 'Show Completed Tasks', prompt: 'Show Completed Tasks' },
{ text: 'Change State to Texas', prompt: 'Change State to Texas' },
{ text: 'Review Completed Tasks', prompt: 'Review Completed Tasks' },
];
const chatUser = { id: 'user' };
const popupWrapperAttr: PopupTypes.Properties['wrapperAttr'] = { class: 'chat-popup' };
Expand All @@ -22,8 +22,8 @@ function EmptyView(): React.JSX.Element {
<div className="dx-chat-messagelist-empty-image dx-ai-chat__empty-image" />
<div className="ai-chat-empty-message">{emptyViewMessage}</div>
<div className="ai-chat-empty-prompt">
<div>Update employee <b>Form</b> fields.</div>
<div>Filter or sort tasks, display or hide <b>DataGrid</b> columns, or clear all filters and sorting.</div>
<div>Update employee information in the <b>Form</b>.</div>
<div>Change task presentation in the <b>DataGrid</b>: filter and sort data, change column visibility.</div>
</div>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { routeMessage } from './chat-router.js';
import { emptyViewMessage } from './data.js';

const chatSuggestionItems = [
{ text: 'Show Completed Tasks', prompt: 'Show Completed Tasks' },
{ text: 'Change State to Texas', prompt: 'Change State to Texas' },
{ text: 'Review Completed Tasks', prompt: 'Review Completed Tasks' },
];
const chatUser = { id: 'user' };
const popupWrapperAttr = { class: 'chat-popup' };
Expand All @@ -21,11 +21,11 @@ function EmptyView() {
<div className="ai-chat-empty-message">{emptyViewMessage}</div>
<div className="ai-chat-empty-prompt">
<div>
Update employee <b>Form</b> fields.
Update employee information in the <b>Form</b>.
</div>
<div>
Filter or sort tasks, display or hide <b>DataGrid</b> columns, or clear all filters and
sorting.
Change task presentation in the <b>DataGrid</b>: filter and sort data, change column
visibility.
</div>
</div>
</>
Expand Down
4 changes: 2 additions & 2 deletions apps/demos/Demos/Chat/PageLevelAIAssistant/Vue/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const RATE_LIMIT_RETRY_DELAY_MS = 30000;

export const EMPTY_VIEW_MESSAGE = 'AI Assistant is ready to help you';

export const EMPTY_VIEW_PROMPT = 'Update employee <b>Form</b> fields.\nFilter or sort tasks, display or hide <b>DataGrid</b> columns, or clear all filters and sorting.';
export const EMPTY_VIEW_PROMPT = 'Update employee information in the <b>Form</b>.\nChange task presentation in the <b>DataGrid</b>: filter and sort data, change column visibility.';

export const SMART_PASTE_TIMEOUT_MS = 30000;
export const MAX_USER_MESSAGE_LENGTH = 2000;
Expand Down Expand Up @@ -229,8 +229,8 @@ export const tasks: Task[] = [
];

export const chatSuggestions = [
{ text: 'Show Completed Tasks', prompt: 'Show Completed Tasks' },
{ text: 'Change State to Texas', prompt: 'Change State to Texas' },
{ text: 'Review Completed Tasks', prompt: 'Review Completed Tasks' },
];

export const formFieldsConfig: DxFormTypes.SimpleItem[] = [
Expand Down
14 changes: 7 additions & 7 deletions apps/demos/Demos/Chat/PageLevelAIAssistant/description.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
This demo uses the DevExtreme [Chat](/Documentation/ApiReference/UI_Components/dxChat/) component as a page-level AI assistant. Users type requests using natural language, and the assistant updates [Form](/Documentation/ApiReference/UI_Components/dxForm/) and [DataGrid](/Documentation/ApiReference/UI_Components/dxDataGrid/) components on the page. The demo uses [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) as the AI service.
This demo uses the DevExtreme [Chat](/Documentation/ApiReference/UI_Components/dxChat/) component as a page-level AI assistant. Users enter requests using natural language and the assistant updates [Form](/Documentation/ApiReference/UI_Components/dxForm/) and [DataGrid](/Documentation/ApiReference/UI_Components/dxDataGrid/) components on the page. The demo uses [Azure OpenAI](https://azure.microsoft.com/en-us/products/ai-services/openai-service) as the AI service.

Click the floating **AI Assistant** button to open the Chat. Try prompts such as "Change State to Texas", "Show completed tasks", or "Sort by due date descending".
Click the floating **AI Assistant** button to open the Chat. Try prompts such as "Change State to Texas", "Review completed tasks", or "Sort by due date descending".
<!--split-->

## Chat in a Popup

In this demo a [SpeedDialAction](/Documentation/ApiReference/UI_Components/dxSpeedDialAction/) button opens displays a [Popup](/Documentation/ApiReference/UI_Components/dxPopup/) that contains the Chat component. The popup is draggable and resizable, so users can keep the Form and DataGrid visible while they work with the assistant. A toolbar button within the popup header allows you to clear the conversation.
In this demo a [SpeedDialAction](/Documentation/ApiReference/UI_Components/dxSpeedDialAction/) button opens displays a [Popup](/Documentation/ApiReference/UI_Components/dxPopup/) that contains our Chat component. The popup is draggable and resizable, so users can keep the Form and DataGrid visible while working with the assistant. A toolbar button within the popup header allows you to clear the conversation.

The Chat also leverages the following features:

Expand All @@ -19,14 +19,14 @@ The [onMessageEntered](/Documentation/ApiReference/UI_Components/dxChat/Configur

## Form Updates (Smart Paste)

The Form uses the [Smart Paste](/Documentation/ApiReference/UI_Components/dxForm/Configuration/#aiIntegration) feature to fill editors based on free-form text. The Chat calls the Form's [smartPaste(text)](/Documentation/ApiReference/UI_Components/dxForm/Methods/#smartPastetext) method and handles the [smartPasted](/Documentation/ApiReference/UI_Components/dxForm/Configuration/#onSmartPasted) event to indicate which fields the AI updated. The assistant can also clear a single field or reset the entire Form.
The Form uses the [Smart Paste](/Documentation/ApiReference/UI_Components/dxForm/Configuration/#aiIntegration) feature to populate editors based on free-form text. The Chat calls the Form's [smartPaste(text)](/Documentation/ApiReference/UI_Components/dxForm/Methods/#smartPastetext) method and handles the [smartPasted](/Documentation/ApiReference/UI_Components/dxForm/Configuration/#onSmartPasted) event to indicate which fields the AI updated. The assistant can also clear a single field or reset the entire Form.

## DataGrid Commands

The AI service translates grid-related requests into a list of structured commands that the demo executes using DataGrid APIs:

- **Filtering** - sets [filterValue](/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/#filterValue) for a column, or calls [clearFilter()](/Documentation/ApiReference/UI_Components/dxDataGrid/Methods/#clearFilter) to remove filters.
- **Sorting** - sets a column's `sortOrder`, or calls [clearSorting()](/Documentation/ApiReference/UI_Components/dxDataGrid/Methods/#clearSorting).
- **Filtering** - sets [filterValue](/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/#filterValue) for a column or calls [clearFilter()](/Documentation/ApiReference/UI_Components/dxDataGrid/Methods/#clearFilter) to remove filters.
- **Sorting** - sets a column's `sortOrder` or calls [clearSorting()](/Documentation/ApiReference/UI_Components/dxDataGrid/Methods/#clearSorting).
- **Column visibility** - displays/hides a column.

The `gridCommands` object in the demo code defines the available commands and their parameters. Add a new command to this object to extend the assistant. A single request can include multiple commands (for example, "Show completed tasks and sort by priority").
The `gridCommands` object in the demo code defines the available commands and associated parameters. Add a new command to this object to extend the assistant. A single request can include multiple commands (for example, "Show completed tasks and sort by priority").
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const apiKey = 'DEMO';

const emptyViewMessage = 'AI Assistant is ready to help you';
const emptyViewPrompt =
'Update employee <b>Form</b> fields.\nFilter or sort tasks, display or hide <b>DataGrid</b> columns, or clear all filters and sorting.';
'Update employee information in the <b>Form</b>.\nChange task presentation in the <b>DataGrid</b>: filter and sort data, change column visibility.';

const SMART_PASTE_TIMEOUT_MS = 30000;
const MAX_USER_MESSAGE_LENGTH = 2000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ $(() => {
speechToTextEnabled: true,
suggestions: {
items: [
{ text: 'Show Completed Tasks', prompt: 'Show Completed Tasks' },
{
text: 'Change State to Texas',
prompt: 'Change State to Texas',
},
{ text: 'Review Completed Tasks', prompt: 'Review Completed Tasks' },
],
onItemClick(e) {
const { prompt } = e.itemData;
Expand Down
Loading