AI Assistant: DataGrid - write JS frameworks demos (Angular)#33665
AI Assistant: DataGrid - write JS frameworks demos (Angular)#33665Raushen wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an Angular-based DataGrid “AI Assistant” demo to the DevExtreme demos app, including an OpenAI/AzureOpenAI-backed AIIntegration implementation and a demo UI that wires DataGrid’s AI assistant to a chat/suggestions configuration.
Changes:
- Added a new Angular demo entry for DataGrid AI Assistant (standalone Angular bootstrap + DataGrid configuration).
- Implemented an Angular
AiServicethat providesAIIntegrationand calls the demo Azure OpenAI endpoint (with retry behavior). - Updated the Angular SystemJS config to load
zodandzod-to-json-schemafromnode_modulespaths.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/demos/Demos/DataGrid/AIAssistant/Angular/index.html | Adds the Angular demo host page (SystemJS bootstrapping). |
| apps/demos/Demos/DataGrid/AIAssistant/Angular/app/app.component.ts | Adds the standalone Angular component wiring DataGrid + chat suggestions behavior. |
| apps/demos/Demos/DataGrid/AIAssistant/Angular/app/app.component.html | Defines the DataGrid configuration including dxo-data-grid-ai-assistant. |
| apps/demos/Demos/DataGrid/AIAssistant/Angular/app/ai/ai.service.ts | Adds AIIntegration implementation calling the demo Azure OpenAI endpoint (with retry). |
| apps/demos/configs/Angular/config.js | Adjusts SystemJS mappings for zod and zod-to-json-schema. |
…AIAssistant-Demo-Angular
| }; | ||
| } | ||
|
|
||
| onSuggestionItemClick(e: DxButtonGroupTypes.ItemClickEvent) { |
There was a problem hiding this comment.
ItemClickEvent is generic, DxButtonGroupTypes.ItemClickEvent should work without necessity of assserion
There was a problem hiding this comment.
Let's leave it as is as it writes the ItemClickEvent is not generic
| }, | ||
| }; | ||
|
|
||
| const response = await service.chat.completions.create(params as any, { signal }); |
There was a problem hiding this comment.
Just a reminder about any which we want to get rid of (=
| @@ -0,0 +1,119 @@ | |||
| import { AzureOpenAI, OpenAI } from 'openai'; | |||
| import type { ChatCompletionCreateParamsNonStreaming } from 'openai/resources/chat/completions'; | |||
There was a problem hiding this comment.
use OpenAI.ChatCompletionCreateParamsNonStreaming instead, as that is unsafe import (=
| sendRequest({ prompt, data }: RequestParams): Response { | ||
| const isValidRequest = JSON.stringify(prompt.user).length < MAX_PROMPT_SIZE; | ||
|
|
||
| if (!isValidRequest) { | ||
| return { | ||
| promise: Promise.reject(new Error('Request is too long. Specify a shorter prompt.')), | ||
| abort: () => {}, | ||
| }; | ||
| } | ||
|
|
||
| const controller = new AbortController(); | ||
| const signal = controller.signal; | ||
|
|
||
| if (!prompt.user || !prompt.system) { | ||
| throw new Error('Invalid prompt data'); | ||
| } |
No description provided.