Skip to content

Commit 25f0fdd

Browse files
feat: create readme
1 parent df0d704 commit 25f0fdd

4 files changed

Lines changed: 93 additions & 17 deletions

File tree

Angular/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Start dev server:
1313
```sh
1414
npm start
1515
```
16-
Open: http://localhost:4200/
16+
Open: http://localhost:5050/
1717

1818
Build production bundle:
1919
```sh

README.md

Lines changed: 91 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,127 @@
44
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
55
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
66
<!-- default badges end -->
7-
# DevExtreme Examples Template
7+
# DevExtreme DataGrid - AI Integration
88

9-
This is the repository template for creating new examples.
9+
This example demonstrates how to enhance the [DevExtreme DataGrid](https://js.devexpress.com/Documentation/Guide/UI_Components/DataGrid/Overview/) with two AI-powered features: an [AI column](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/columns/#type) that fills cells with values generated from row context, and the [AI Assistant](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/aiAssistant/) chat that lets end users control the grid (sort, filter, search, group, page, etc.) through natural-language requests.
1010

1111
![Example image](images/image-template.png)
1212

13-
Use **DevExtreme _Product_ - _Task_** template for a title.
13+
## Implementation Details
1414

15-
Describe the solved task in this section.
15+
### Setup the AI Integration Server
1616

17-
Put a screenshot/gif that illustrates the result here.
17+
This example includes a pre-configured ASP.NET Core Web API server (see [AIIntegrationServer](/AIIntegrationServer/)) that acts as a proxy between the client and [Azure OpenAI](https://azure.microsoft.com/en-us/pricing/details/azure-openai/). The server runs at `http://localhost:5005` and exposes the following endpoints:
18+
- `/api/ai/grid-column` (POST) - Used by the DataGrid AI column to generate cell values.
19+
- `/api/ai/assistant` (POST) - Used by the AI Assistant to translate chat messages into DataGrid commands. When the request body contains a `responseSchema`, the server forwards it to Azure OpenAI as a structured JSON response format.
1820

19-
Then, add implementation details (steps, code snippets, and other technical information in a free form), or add a link to an existing document with implementation details.
21+
Credentials are read from [appsettings.json](AIIntegrationServer/appsettings.json) under the `AzureOpenAI` section (`Endpoint`, `ApiKey`, `ModelName`). The sample is preconfigured to use the public DevExpress demo endpoint; replace those values with your own Azure OpenAI deployment for production use. CORS is enabled for `http://localhost:5050` (the ASP.NET Core front-end) and the framework client dev servers.
22+
23+
### Configure the AIIntegration object
24+
25+
All framework projects share the same client-side pattern:
26+
27+
1. A `sendRequest` factory wraps `fetch` and posts `{ prompt, data }` to the chosen endpoint. The request is aborted via `AbortController` if the user cancels, and oversized prompts (≥ 5000 characters) are rejected before any network call.
28+
29+
2. Two separate [AIIntegration](https://js.devexpress.com/Documentation/ApiReference/Common/Utils/aiIntegration/) instances are created with `new DevExpress.aiIntegration.AIIntegration({ sendRequest })` - one bound to the column endpoint, one to the assistant endpoint. They are passed to the DataGrid via the [aiIntegration](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/#aiIntegration) option and the [aiAssistant.aiIntegration](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/aiAssistant/#aiIntegration) sub-option respectively.
30+
31+
### Configure the DataGrid AI column
32+
33+
A column with `type: 'ai'` enables automatic cell value generation. The [ai](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/columns/ai/) sub-options describe how the model should fill values:
34+
35+
- `prompt` - The natural-language instruction sent to the model with row data as context.
36+
- `mode` - `'auto'` runs the AI for every visible row automatically; `'manual'` waits for user action.
37+
- `noDataText` - Placeholder shown while values are being generated.
38+
39+
### Configure the DataGrid AI Assistant
40+
41+
The [aiAssistant](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/aiAssistant/) option turns on a chat panel that issues structured commands to the grid. The embedded [Chat](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxChat/) is configured with:
42+
43+
- `user` - Identifies the end user in the chat data source.
44+
- `suggestions.items` - Quick-action chips (Help, Filter, Sort, Group). Each item carries a `prompt` payload.
45+
- `suggestions.onItemClick` - Pushes the suggestion's prompt into the chat data source as a new user (or `help`) message.
46+
- `onInitialized` - Stores the chat instance reference so suggestions can append messages directly to its data source.
47+
48+
## Run the Example
49+
50+
### Angular, React, Vue, and jQuery
51+
52+
1. **Start the AI Integration Server**
53+
54+
```bash
55+
cd AIIntegrationServer
56+
dotnet run
57+
```
58+
59+
The server starts on `http://localhost:5005`.
60+
61+
2. **Run the Client Application**
62+
63+
- **Angular:** `cd Angular && npm install && npm start`
64+
- **React:** `cd React && npm install && npm run dev`
65+
- **Vue:** `cd Vue && npm install && npm run dev`
66+
- **jQuery:** `cd jQuery && npm install && npm start`
67+
68+
### ASP.NET Core
69+
70+
1. **Start the AI Integration Server**
71+
72+
```bash
73+
cd AIIntegrationServer
74+
dotnet run
75+
```
76+
77+
2. **Run the ASP.NET Core front-end** in a separate terminal:
78+
79+
```bash
80+
cd "ASP.NET Core"
81+
dotnet run
82+
```
83+
84+
The front-end starts on `http://localhost:5050`.
2085

2186
## Files to Review
2287

88+
- *AI Integration Server*
89+
- [Program.cs](AIIntegrationServer/Program.cs) - App startup, Azure OpenAI client, CORS, and routing
90+
- [AIIntegrationController.cs](AIIntegrationServer/Controllers/AIIntegrationController.cs) - `/api/ai/grid-column` and `/api/ai/assistant` endpoints
91+
- [AIIntegrationRequest.cs](AIIntegrationServer/Models/AIIntegrationRequest.cs) - Request/response payload models
92+
- [AzureOpenAIOptions.cs](AIIntegrationServer/Configuration/AzureOpenAIOptions.cs) - Azure OpenAI configuration binding
2393
- **Angular**
2494
- [app.component.html](Angular/src/app/app.component.html)
2595
- [app.component.ts](Angular/src/app/app.component.ts)
96+
- [ai.service.ts](Angular/src/app/ai.service.ts)
2697
- **React**
2798
- [App.tsx](React/src/App.tsx)
99+
- [service.ts](React/src/service.ts)
28100
- **Vue**
29101
- [App.vue](Vue/src/App.vue)
30-
- [Home.vue](Vue/src/components/HomeContent.vue)
102+
- [HomeContent.vue](Vue/src/components/HomeContent.vue)
103+
- [service.ts](Vue/src/service.ts)
31104
- **jQuery**
32105
- [index.html](jQuery/src/index.html)
33106
- [index.js](jQuery/src/index.js)
34-
- **ASP.NET Core**
107+
- **ASP.NET Core**
35108
- [Index.cshtml](ASP.NET%20Core/Views/Home/Index.cshtml)
109+
- [grid-ai-service.js](ASP.NET%20Core/wwwroot/js/grid-ai-service.js)
110+
- [Program.cs](ASP.NET%20Core/Program.cs)
36111

37112
## Documentation
38113

39-
- link
40-
- link
41-
- ...
114+
- [DataGrid - AI-Powered Features Overview](https://js.devexpress.com/Documentation/Guide/UI_Components/DataGrid/AI-Powered_Features/)
115+
- [DataGrid - AI Column](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/columns/#type)
116+
- [DataGrid - AI Assistant](https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/aiAssistant/)
117+
- [AIIntegration Utility](https://js.devexpress.com/Documentation/ApiReference/Common/Utils/aiIntegration/)
42118

43119
## More Examples
44120

45-
- link
46-
- link
47-
- ...
121+
- [DevExtreme Chat - AI Integration with Microsoft Agent Framework](https://github.com/DevExpress-Examples/devextreme-chat-ai-integration-ms-agent-framework)
122+
- [DevExtreme Chat - Integration with OpenAI](https://github.com/DevExpress-Examples/devextreme-chat-openai-integration)
123+
48124
<!-- feedback -->
49125
## Does This Example Address Your Development Requirements/Objectives?
50126

51-
[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=devextreme-examples-template&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=devextreme-examples-template&~~~was_helpful=no)
127+
[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=devextreme-datagrid-ai-integration&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=devextreme-datagrid-ai-integration&~~~was_helpful=no)
52128

53129
(you will be redirected to DevExpress.com to submit your response)
54130
<!-- feedback end -->

React/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Start dev server:
1313
```sh
1414
npm run dev
1515
```
16-
Open: http://localhost:5173/
16+
Open: http://localhost:5050/
1717

1818
Build production bundle:
1919
```sh

images/image-template.png

114 KB
Loading

0 commit comments

Comments
 (0)