-
Notifications
You must be signed in to change notification settings - Fork 672
AI Assistant: Integration between AiIntegration, GridCommands, AiAssistant and AiChat #33564
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import { AIAssistantController } from '@ts/grids/grid_core/ai_assistant/ai_assistant_controller'; | ||
| import type { GridCommand } from '@ts/grids/grid_core/ai_assistant/types'; | ||
|
|
||
| import { DataGridAIAssistantIntegrationController } from './ai_assistant_integration_controller'; | ||
| import { dataGridCommands } from './commands/index'; | ||
|
|
||
| export class DataGridAIAssistantController extends AIAssistantController { | ||
| protected aiAssistantIntegrationController?: DataGridAIAssistantIntegrationController; | ||
|
|
||
| protected getAiAssistantIntegrationController(): DataGridAIAssistantIntegrationController { | ||
| return new DataGridAIAssistantIntegrationController(this.component); | ||
| } | ||
|
|
||
| protected getGridCommandList(): GridCommand[] { | ||
| const coreCommands = super.getGridCommandList(); | ||
|
|
||
| return [ | ||
| ...coreCommands, | ||
| ...dataGridCommands, | ||
| ]; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { AIAssistantIntegrationController } from '@ts/grids/grid_core/ai_assistant/ai_assistant_integration_controller'; | ||
| import type { GridContext } from '@ts/grids/grid_core/ai_assistant/types'; | ||
| import type { Column } from '@ts/grids/grid_core/columns_controller/types'; | ||
|
|
||
| export class DataGridAIAssistantIntegrationController extends AIAssistantIntegrationController { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add test for grid context |
||
| protected getGridExtraContext(): GridContext { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need method to add extra content, just overload buildContext, buildColumnContext |
||
| const context = super.getGridExtraContext(); | ||
|
|
||
| context.summary = { | ||
| totalItems: this.option('summary.totalItems'), | ||
| groupItems: this.option('summary.groupItems'), | ||
| }; | ||
|
|
||
| return context; | ||
| } | ||
|
|
||
| protected getGridColumnExtraContext(column: Column): GridContext { | ||
| const context = super.getGridColumnExtraContext(column); | ||
|
|
||
| context.summary = { | ||
| groupIndex: column.groupIndex, | ||
| }; | ||
|
|
||
| return context; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type { GridCommand } from '@ts/grids/grid_core/ai_assistant/types'; | ||
|
|
||
| import { clearGroupingCommand, groupingCommand } from './grouping'; | ||
| import { clearSummaryCommand, summaryCommand } from './summary'; | ||
|
|
||
| export const dataGridCommands = [ | ||
| groupingCommand, | ||
| clearGroupingCommand, | ||
| summaryCommand, | ||
| clearSummaryCommand, | ||
| // TODO: try to remove "as GridCommand[]" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this todo, please, it is obvious, and it is easy to forget it in the code |
||
| ] as GridCommand[]; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test for commands list