-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Grids AI Assistant: Add API Descriptions Part 2 #8767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arman-boyakhchyan
wants to merge
6
commits into
DevExpress:26_1
Choose a base branch
from
arman-boyakhchyan:grids-ai-assistant-api-part-2-26-1
base: 26_1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
71f8377
Grids AI Assistant: Add API Descriptions Part 2
arman-boyakhchyan 6229fdd
Add Initial Fixes
arman-boyakhchyan 6ba4f7e
Add Minor Type Fix
arman-boyakhchyan 91938b7
Add Type Links
arman-boyakhchyan ac898f3
Add Minor Code & Text Fixes
arman-boyakhchyan c775071
Update Following Feedback
arman-boyakhchyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
...dxDataGrid/1 Configuration/aiAssistant.md → ... Configuration/aiAssistant/aiAssistant.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| --- | ||
| id: dxDataGrid.Options.aiAssistant | ||
| type: AIAssistant | ||
| inheritsType: AIAssistant | ||
| --- | ||
| --- | ||
| ##### shortDescription | ||
| <!-- Description goes here --> | ||
| Configures the {WidgetName} AI Assistant. | ||
|
|
||
| --- | ||
| <!-- Description goes here --> |
145 changes: 145 additions & 0 deletions
145
...0 UI Components/dxDataGrid/1 Configuration/aiAssistant/customizeResponseText.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| --- | ||
| id: dxDataGrid.Options.aiAssistant.customizeResponseText | ||
| type: function(command) | ||
| --- | ||
| --- | ||
| ##### shortDescription | ||
| Customizes AI Assistant response texts for each requested command. | ||
|
|
||
| ##### param(command): DataGridCommandInfo | ||
| Information about the command. | ||
|
|
||
| ##### return: ResponseStatusTexts | ||
| Custom texts for **success** and **failure** response statuses. | ||
|
|
||
| --- | ||
| Use this function to customize response message texts for AI Assistant commands. **customizeResponseText** is called for each requested command. The AI Assistant chat displays these texts below the response title. When a response includes multiple commands, the chat displays each command's text on separate lines. | ||
|
|
||
| When a command succeeds, the AI Assistant chat displays the response text in green and prefixes the text with a checkmark button emoji (✅). When a command fails, the AI Assistant chat displays the text in red and prefixes with a cross mark emoji (❌) instead. | ||
|
|
||
| The **command** parameter contains the following fields: | ||
|
|
||
| - **name**: The command's name ([DataGridPredefinedCommandNames]({basewidgetpath}/Types/DataGridPredefinedCommandNames/)). | ||
| - **args**: Command arguments. Refer to [DataGridPredefinedCommands]({basewidgetpath}/Types/DataGridPredefinedCommands/) for information about the arguments of each available command. | ||
|
|
||
| Configure **customizeResponseText** to return an object with the following fields: | ||
|
|
||
| - **success**: Text to display when the command succeeds. | ||
| - **failure**: Text to display when the command fails. | ||
|
|
||
| Omit a field in the return object to use default texts. | ||
|
|
||
| You can use this function to translate response texts. The following code snippet uses the [locale()](/Documentation/ApiReference/Common/Utils/localization/#locale) method to specify texts for multiple locales: | ||
|
|
||
| --- | ||
|
|
||
| ##### jQuery | ||
|
|
||
| <!-- tab: index.js --> | ||
| const currentLocale = DevExpress.localization.locale(); | ||
|
|
||
| $('#{widget-name}-container').dx{WidgetName}({ | ||
| aiAssistant: { | ||
| customizeResponseText(command) { | ||
| switch (currentLocale) { | ||
| case 'en': | ||
| return { | ||
| success: `Command succeeded: ${command.name}`, | ||
| failure: `Command failed: ${command.name}`, | ||
| }; | ||
| case 'fr': | ||
| return { /* Translated texts */ }; | ||
| } | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| ##### Angular | ||
|
|
||
| <!-- tab: app.component.html --> | ||
| <dx-{widget-name}> | ||
| <dxo-{widget-name}-ai-assistant | ||
| [enabled]="true" | ||
| [customizeResponseText]="customizeResponseText" | ||
| ></dxo-{widget-name}-ai-assistant> | ||
| </dx-{widget-name}> | ||
|
|
||
| <!-- tab: app.component.ts --> | ||
| import { Dx{WidgetName}Module, type Dx{WidgetName}Types } from 'devextreme-angular/ui/{widget-name}'; | ||
| import { locale } from "devextreme/localization"; | ||
|
|
||
| export class AppComponent { | ||
| currentLocale = locale(); | ||
| customizeResponseText = (command) => { | ||
| switch (this.currentLocale) { | ||
| case 'en': | ||
| return { | ||
| success: `Command succeeded: ${command.name}`, | ||
| failure: `Command failed: ${command.name}`, | ||
| }; | ||
| case 'fr': | ||
| return { /* Translated texts */ }; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| ##### Vue | ||
|
|
||
| <!-- tab: App.vue --> | ||
| <template> | ||
| <Dx{WidgetName}> | ||
| <DxAIAssistant | ||
| :customize-response-text="customizeResponseText" | ||
| /> | ||
| </Dx{WidgetName}> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { Dx{WidgetName}, DxAIAssistant, type Dx{WidgetName}Types } from 'devextreme-vue/{widget-name}'; | ||
| import { locale } from "devextreme/localization"; | ||
|
|
||
| const currentLocale = locale(); | ||
| function customizeResponseText(command) { | ||
| switch (currentLocale) { | ||
| case 'en': | ||
| return { | ||
| success: `Command succeeded: ${command.name}`, | ||
| failure: `Command failed: ${command.name}`, | ||
| }; | ||
| case 'fr': | ||
| return { /* Translated texts */ }; | ||
| } | ||
| }; | ||
| </script> | ||
|
|
||
| ##### React | ||
|
|
||
| <!-- tab: App.tsx --> | ||
| import { {WidgetName}, AIAssistant, type {WidgetName}Types } from 'devextreme-react/{widget-name}'; | ||
| import { locale } from "devextreme/localization"; | ||
|
|
||
| const currentLocale = locale(); | ||
| function customizeResponseText(command) { | ||
| switch (currentLocale) { | ||
| case 'en': | ||
| return { | ||
| success: `Command succeeded: ${command.name}`, | ||
| failure: `Command failed: ${command.name}`, | ||
| }; | ||
| case 'fr': | ||
| return { /* Translated texts */ }; | ||
| } | ||
| }; | ||
|
|
||
| function App() { | ||
| return ( | ||
| <{WidgetName}> | ||
| <AIAssistant | ||
| enabled={true} | ||
| customizeResponseText={customizeResponseText} | ||
| /> | ||
| </{WidgetName}> | ||
| ); | ||
| }; | ||
|
|
||
| --- | ||
215 changes: 215 additions & 0 deletions
215
... UI Components/dxDataGrid/1 Configuration/aiAssistant/customizeResponseTitle.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| --- | ||
| id: dxDataGrid.Options.aiAssistant.customizeResponseTitle | ||
| type: function(status, commandNames) | ||
| --- | ||
| --- | ||
| ##### shortDescription | ||
| Customizes AI Assistant response titles. | ||
|
|
||
| ##### param(status): Enums.ResponseStatus | ||
| The response status. If a response includes multiple requested commands, all must succeed for this parameter's value to equal *"success"*. | ||
|
|
||
| ##### param(commandNames): Array<String> | ||
| An array of requested commands ([DataGridPredefinedCommandNames]({basewidgetpath}/Types/DataGridPredefinedCommandNames/)). | ||
|
|
||
| ##### return: String | ||
| The custom response title. | ||
|
|
||
| --- | ||
| Use this function to customize the titles of AI Assistant response messages. The following code snippet adds response statuses to titles: | ||
|
|
||
| --- | ||
|
|
||
| ##### jQuery | ||
|
|
||
| <!-- tab: index.js --> | ||
| $('#{widget-name}-container').dx{WidgetName}({ | ||
| aiAssistant: { | ||
| customizeResponseTitle(status, commandNames) { | ||
| switch (status) { | ||
| case 'success': | ||
| return `Completed: ${commandNames.join(', ')}`; | ||
| case 'failure': | ||
| return `Failed: ${commandNames.join(', ')}`; | ||
| } | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| ##### Angular | ||
|
|
||
| <!-- tab: app.component.html --> | ||
| <dx-{widget-name}> | ||
| <dxo-{widget-name}-ai-assistant | ||
| [enabled]="true" | ||
| [customizeResponseTitle]="customizeResponseTitle" | ||
| ></dxo-{widget-name}-ai-assistant> | ||
| </dx-{widget-name}> | ||
|
|
||
| <!-- tab: app.component.ts --> | ||
| import { Dx{WidgetName}Module, type Dx{WidgetName}Types } from 'devextreme-angular/ui/{widget-name}'; | ||
|
|
||
| export class AppComponent { | ||
| customizeResponseTitle = (status, commandNames) => { | ||
| switch (status) { | ||
| case 'success': | ||
| return `Completed: ${commandNames.join(', ')}`; | ||
| case 'failure': | ||
| return `Failed: ${commandNames.join(', ')}`; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| ##### Vue | ||
|
|
||
| <!-- tab: App.vue --> | ||
| <template> | ||
| <Dx{WidgetName}> | ||
| <DxAIAssistant | ||
| :customize-response-title="customizeResponseTitle" | ||
| /> | ||
| </Dx{WidgetName}> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { Dx{WidgetName}, DxAIAssistant, type Dx{WidgetName}Types } from 'devextreme-vue/{widget-name}'; | ||
|
|
||
| function customizeResponseTitle(status, commandNames) { | ||
| switch (status) { | ||
| case 'success': | ||
| return `Completed: ${commandNames.join(', ')}`; | ||
| case 'failure': | ||
| return `Failed: ${commandNames.join(', ')}`; | ||
| } | ||
| }; | ||
| </script> | ||
|
|
||
| ##### React | ||
|
|
||
| <!-- tab: App.tsx --> | ||
| import { {WidgetName}, AIAssistant, type {WidgetName}Types } from 'devextreme-react/{widget-name}'; | ||
|
|
||
| function customizeResponseTitle(status, commandNames) { | ||
| switch (status) { | ||
| case 'success': | ||
| return `Completed: ${commandNames.join(', ')}`; | ||
| case 'failure': | ||
| return `Failed: ${commandNames.join(', ')}`; | ||
| } | ||
| }; | ||
|
|
||
| function App() { | ||
| return ( | ||
| <{WidgetName}> | ||
| <AIAssistant | ||
| enabled={true} | ||
| customizeResponseTitle={customizeResponseTitle} | ||
| /> | ||
| </{WidgetName}> | ||
| ); | ||
| }; | ||
|
|
||
| --- | ||
|
|
||
| You can use this function to translate response titles. The following code snippet uses the [locale()](/Documentation/ApiReference/Common/Utils/localization/#locale) method to specify texts for multiple locales: | ||
|
|
||
| --- | ||
|
|
||
| ##### jQuery | ||
|
|
||
| <!-- tab: index.js --> | ||
| const currentLocale = DevExpress.localization.locale(); | ||
|
|
||
| $('#{widget-name}-container').dx{WidgetName}({ | ||
| aiAssistant: { | ||
| customizeResponseTitle(status, commandNames) { | ||
| switch (currentLocale) { | ||
| case 'en': | ||
| return `${status.toUpperCase()}: ${commandNames.join(', ')}`; | ||
| case 'fr': | ||
| return /* Translated texts */; | ||
| } | ||
|
arman-boyakhchyan marked this conversation as resolved.
|
||
| }, | ||
|
dmirgaev marked this conversation as resolved.
|
||
| }, | ||
| }); | ||
|
|
||
| ##### Angular | ||
|
|
||
| <!-- tab: app.component.html --> | ||
| <dx-{widget-name}> | ||
| <dxo-{widget-name}-ai-assistant | ||
| [enabled]="true" | ||
| [customizeResponseTitle]="customizeResponseTitle" | ||
| ></dxo-{widget-name}-ai-assistant> | ||
| </dx-{widget-name}> | ||
|
|
||
| <!-- tab: app.component.ts --> | ||
| import { Dx{WidgetName}Module, type Dx{WidgetName}Types } from 'devextreme-angular/ui/{widget-name}'; | ||
| import { locale } from "devextreme/localization"; | ||
|
|
||
| export class AppComponent { | ||
| currentLocale = locale(); | ||
| customizeResponseTitle = (status, commandNames) => { | ||
| switch (this.currentLocale) { | ||
| case 'en': | ||
| return `${status.toUpperCase()}: ${commandNames.join(', ')}`; | ||
| case 'fr': | ||
| return /* Translated texts */; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| ##### Vue | ||
|
|
||
| <!-- tab: App.vue --> | ||
| <template> | ||
| <Dx{WidgetName}> | ||
| <DxAIAssistant | ||
| :customize-response-title="customizeResponseTitle" | ||
| /> | ||
| </Dx{WidgetName}> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { Dx{WidgetName}, DxAIAssistant, type Dx{WidgetName}Types } from 'devextreme-vue/{widget-name}'; | ||
| import { locale } from "devextreme/localization"; | ||
|
|
||
| const currentLocale = locale(); | ||
| function customizeResponseTitle(status, commandNames) { | ||
| switch (currentLocale) { | ||
| case 'en': | ||
| return `${status.toUpperCase()}: ${commandNames.join(', ')}`; | ||
| case 'fr': | ||
| return /* Translated texts */; | ||
| } | ||
| }; | ||
| </script> | ||
|
|
||
| ##### React | ||
|
|
||
| <!-- tab: App.tsx --> | ||
| import { {WidgetName}, AIAssistant, type {WidgetName}Types } from 'devextreme-react/{widget-name}'; | ||
| import { locale } from "devextreme/localization"; | ||
|
|
||
| const currentLocale = locale(); | ||
| function customizeResponseTitle(status, commandNames) { | ||
| switch (currentLocale) { | ||
| case 'en': | ||
| return `${status.toUpperCase()}: ${commandNames.join(', ')}`; | ||
| case 'fr': | ||
| return /* Translated texts */; | ||
| } | ||
| }; | ||
|
|
||
| function App() { | ||
| return ( | ||
| <{WidgetName}> | ||
| <AIAssistant | ||
| enabled={true} | ||
| customizeResponseTitle={customizeResponseTitle} | ||
| /> | ||
| </{WidgetName}> | ||
| ); | ||
| }; | ||
|
|
||
| --- | ||
16 changes: 16 additions & 0 deletions
16
.../10 UI Components/dxDataGrid/9 Types/DataGridCommandInfo/DataGridCommandInfo.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| id: DataGridCommandInfo | ||
| module: ui/data_grid | ||
| export: DataGridCommandInfo | ||
| type: CommandInfo | ||
| generateTypeLink: | ||
| --- | ||
| --- | ||
| ##### shortDescription | ||
| Information about a predefined DataGrid command. | ||
|
|
||
| --- | ||
| **DataGridCommandInfo** contains the following fields: | ||
|
|
||
| - **name**: The predefined command's name ([DataGridPredefinedCommandNames]({basewidgetpath}/Types/DataGridPredefinedCommandNames/)). | ||
| - **args**: Command arguments. Refer to [DataGridPredefinedCommands]({basewidgetpath}/Types/DataGridPredefinedCommands/) for information about the arguments of each available command. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.