Open
Conversation
…AIAssistant-aiIntegration
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the DevExtreme AI Integration surface with a new executeGridAssistant command intended to translate natural-language grid requests into structured grid actions, and introduces internal grid-side command execution scaffolding.
Changes:
- Added
executeGridAssistantto the publicAIIntegrationAPI and TypeScript declarations. - Implemented
ExecuteGridAssistantCommandwith a new prompt template and Jest coverage for prompt building / response parsing. - Introduced internal grid AI assistant command abstractions (
GridCommands, command registry, and an initialsortcommand).
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/js/common/ai-integration.d.ts | Adds public types + AIIntegration.executeGridAssistant method signature and associated request/response shapes. |
| packages/devextreme/js/__internal/core/ai_integration/core/prompt_manager.ts | Extends prompt template name union with executeGridAssistant. |
| packages/devextreme/js/__internal/core/ai_integration/templates/index.ts | Adds executeGridAssistant prompt template. |
| packages/devextreme/js/__internal/core/ai_integration/core/ai_integration.ts | Wires the new command into internal command registry and exposes executeGridAssistant method. |
| packages/devextreme/js/__internal/core/ai_integration/commands/executeGridAssistant.ts | Implements the new command (prompt data + response parsing). |
| packages/devextreme/js/__internal/core/ai_integration/commands/executeGridAssistant.test.ts | Adds Jest tests for the new command behavior. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/types.ts | Introduces internal types for grid assistant command handling. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands.ts | Adds command registry, validation, and execution pipeline for grid assistant commands. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/base.ts | Defines internal grid command interface. |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/index.ts | Registers default grid commands (currently sorting only). |
| packages/devextreme/js/__internal/grids/grid_core/ai_assistant/commands/sorting.ts | Implements initial sort command validation/execution. |
| return { | ||
| user: { | ||
| text: params.text, | ||
| context: JSON.stringify(params.context), |
Comment on lines
+45
to
+46
| system: 'You are a helpful AI assistant for a data grid component. The user sends a natural language request describing an operation on the grid (e.g., sorting, filtering, grouping). You receive the user\'s message, a context object describing the current grid state, and a JSON schema describing the available commands and their arguments. Your task is to interpret the user\'s request and return a JSON object with one field: "actions" — an array of command objects, each with "name" (the command name) and "args" (an object of arguments matching the schema). Output must be a valid JSON string, directly parsable by JSON.parse. Do not include any markdown, formatting, or extra text — only the raw JSON object.', | ||
| user: 'User request: {{text}}. Grid context: {{context}}.', |
Comment on lines
+17
to
+22
| validateArgs(args: Record<string, unknown>): boolean { | ||
| const { columnName, sortOrder } = args; | ||
|
|
||
| if (typeof columnName !== 'string' || columnName.length === 0) { | ||
| return false; | ||
| } |
| @@ -0,0 +1,20 @@ | |||
| export interface CommandResponse { | |||
| commands: Command[]; | |||
Comment on lines
+15
to
+40
| public validate(commands: Command[]): boolean { | ||
| for (const item of commands) { | ||
| const gridCommand = this.commandsMap.get(item.name); | ||
|
|
||
| if (!gridCommand) { | ||
| return false; | ||
| } | ||
|
|
||
| if (!gridCommand.validateArgs(item.args)) { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| public executeCommands(commands: Command[]): ProcessedCommands { | ||
| const results: ProcessedCommands = []; | ||
|
|
||
| for (const item of commands) { | ||
| const result = this.executeCommand(item.name, item.args); | ||
| results.push(result); | ||
| } | ||
|
|
||
| return results; | ||
| } |
Comment on lines
+246
to
+255
| public executeGridAssistant( | ||
| params: ExecuteGridAssistantCommandParams, | ||
| callbacks: RequestCallbacks<ExecuteGridAssistantCommandResult>, | ||
| ): () => void { | ||
| return this.executeCommand( | ||
| CommandNames.ExecuteGridAssistant, | ||
| params, | ||
| callbacks, | ||
| ); | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.