Skip to content

Ai assistant ai integration#33314

Open
Raushen wants to merge 3 commits intoDevExpress:26_1from
Raushen:AIAssistant-aiIntegration
Open

Ai assistant ai integration#33314
Raushen wants to merge 3 commits intoDevExpress:26_1from
Raushen:AIAssistant-aiIntegration

Conversation

@Raushen
Copy link
Copy Markdown
Contributor

@Raushen Raushen commented Apr 16, 2026

No description provided.

@Raushen Raushen self-assigned this Apr 16, 2026
Copilot AI review requested due to automatic review settings April 16, 2026 12:09
@Raushen Raushen requested a review from a team as a code owner April 16, 2026 12:09
@Raushen Raushen added WIP Work in progress 26_1 labels Apr 16, 2026
@github-actions github-actions bot added the .d.ts label Apr 16, 2026
Copy link
Copy Markdown
Contributor

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

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 executeGridAssistant to the public AIIntegration API and TypeScript declarations.
  • Implemented ExecuteGridAssistantCommand with a new prompt template and Jest coverage for prompt building / response parsing.
  • Introduced internal grid AI assistant command abstractions (GridCommands, command registry, and an initial sort command).

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,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

26_1 .d.ts WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants