You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AIIntegrationServer is an API-only Web API that acts as a proxy between a DevExtreme DataGrid `AIIntegration` component and [Azure OpenAI](https://azure.microsoft.com/en-us/pricing/details/azure-openai/). It exposes endpoints for AI-powered grid column transformations and an assistant chat, forwarding prompts to Azure OpenAI and returning the model response.
3
+
AIIntegrationServer is an API-only backend that connects [Azure OpenAI](https://azure.microsoft.com/en-us/pricing/details/azure-openai/) with the following AI-powered DevExtreme DataGrid features:
-**Feature-specific endpoints** - Separate routes for AI columns and AI assistant
10
15
-**Stateless** - No session storage, each request is independent
11
16
-**CORS enabled** - Allows cross-origin requests from client applications
12
-
-**snake_case JSON** - Request/response payloads use `snake_case` property naming
13
-
-**Port 5005** - Runs on HTTP port 5005 and HTTPS port 5006
17
+
-**HTTP/HTTPS Support** - Runs on 5005 HTTP port and 5006 HTTPS port
14
18
15
19
## Project Structure
16
20
@@ -35,11 +39,11 @@ AIIntegrationServer/
35
39
36
40
### POST /api/ai/grid-column
37
41
38
-
Runs a chat completion for grid column transformations (temperature`0.7`).
42
+
Runs chat completions for AI columns. Uses a`0.7` temperature value.
39
43
40
44
### POST /api/ai/assistant
41
45
42
-
Runs a chat completion for the AI assistant (temperature `0.0`). If the request `data` contains a `responseSchema` property, it is forwarded to Azure OpenAI as a JSON schema response format; otherwise the response is returned as plain JSON.
46
+
Runs chat completions for the AI assistant. Uses a `0.0` temperature value. Returns responses in JSON schemas (specified in a request `responseSchema` parameter). If `responseSchema`is not specified, returns dynamic JSON responses.
43
47
44
48
**Request Body (application/json):**
45
49
@@ -63,9 +67,9 @@ Runs a chat completion for the AI assistant (temperature `0.0`). If the request
63
67
}
64
68
```
65
69
66
-
## Configuration
70
+
## Configure an AI Service
67
71
68
-
Update `appsettings.json` with your Azure OpenAI credentials:
72
+
Add your Azure OpenAI credentials to `appsettings.json`:
69
73
70
74
```json
71
75
{
@@ -89,4 +93,4 @@ The server will start on:
89
93
90
94
## CORS Policy
91
95
92
-
The server allows all HTTP methods and headers for requests from `http://localhost:5050`. This configuration is for development purposes only. For production, restrict allowed origins in [Program.cs](AIIntegrationServer/Program.cs) to specific domains.
96
+
The server allows all HTTP methods and headers for requests from `http://localhost:5050`. This configuration is for development purposes only. For production, update allowed origins in [Program.cs](AIIntegrationServer/Program.cs) to your production domains.
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/ai/) 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.
9
+
This example uses an ASP.NET Web API backend to configure the following AI-powered [DevExtreme DataGrid](https://js.devexpress.com/Documentation/Guide/UI_Components/DataGrid/Overview/) features:
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.
20
-
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_Types/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:
18
+
The [AIIntegrationServer](/AIIntegrationServer/) backend exposes separate endpoints for AI columns and the AI Assistant:
34
19
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.
20
+
```js
21
+
const_SERVER_URL='http://localhost:5005/api/ai';
38
22
39
-
### Configure the DataGrid AI Assistant
23
+
constAI_COLUMN_URL=`${_SERVER_URL}/grid-column`;
24
+
constAI_ASSISTANT_URL=`${_SERVER_URL}/assistant`;
25
+
```
40
26
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:
27
+
This example uses endpoint URLs in a factory function to configure two [AIIntegration](https://js.devexpress.com/Documentation/ApiReference/Common_Types/AIIntegration) instances:
42
28
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.
0 commit comments