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
> We do not guarantee compatibility or correct operation with higher versions.
24
25
@@ -76,20 +77,28 @@ Files to Review:
76
77
77
78
#### AI Assistant Provider
78
79
79
-
On the server side, the `AIAssistantProvider` service manages assistants. An `IAIAssistantFactory` instance creates assistants with keys specified in previous steps.
80
+
On the server side, the `AIAssistantProvider` service manages assistants.
The `AIAssistantCreator.CreateAssistantAsync` method uploads a file to OpenAI, configures tool resources, creates an assistant with specified instructions and tools, initializes a new thread, and returns the assistant and thread IDs. The generated assistant and thread IDs are then passed to the `IAIAssistantFactory.GetAssistant` method, which returns an `IAIAssistant` instance. The created instance is added to the application's assistant collection and is referenced by its unique name.
92
+
93
+
For information on OpenAI Assistants, refer to the following documents:
94
+
-[OpenAI Assistants API overview](https://platform.openai.com/docs/assistants/overview)
95
+
-[Azure OpenAI: OpenAI Assistants client library for .NET](https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.openai.assistants-readme?view=azure-dotnet-preview)
96
+
-[OpenAI .NET API library](https://github.com/openai/openai-dotnet)
@@ -132,7 +141,7 @@ On the `BeforeRender` event, add a new tab (a container for the assistant interf
132
141
133
142
#### Access the Assistant
134
143
135
-
Once the document is ready, the `DocumentReady` event handler sends a request to the server and obtains the assistant's ID:
144
+
Once the document is ready, the `DocumentReady` event handler sends a request to the server and obtains the assistant name:
136
145
137
146
```js
138
147
asyncfunctionDocumentReady(sender, args) {
@@ -144,7 +153,27 @@ async function DocumentReady(sender, args) {
144
153
}
145
154
```
146
155
147
-
The [`PerformCustomDocumentOperation`](https://docs.devexpress.com/XtraReports/js-ASPxClientWebDocumentViewer?p=netframework#js_aspxclientwebdocumentviewer_performcustomdocumentoperation) method exports the report to PDF and creates an assistant based on the exported document. See [AIDocumentOperationService.cs](./CS/ReportingApp/Services/AIDocumentOperationService.cs) for implementation details.
156
+
The [`PerformCustomDocumentOperation`](https://docs.devexpress.com/XtraReports/js-ASPxClientWebDocumentViewer?p=netframework#js_aspxclientwebdocumentviewer_performcustomdocumentoperation) method exports the report to PDF and creates an assistant based on the exported document:
157
+
158
+
```cs
159
+
// ...
160
+
public override async Task<DocumentOperationResponse>PerformOperationAsync(DocumentOperationRequestrequest, PrintingSystemBaseprintingSystem, PrintingSystemBaseprintingSystemWithEditingFields) {
@@ -239,21 +268,9 @@ async function BeforeRender(sender, args) {
239
268
}
240
269
```
241
270
242
-
The `AIAssistantProvider` service creates an assistant using the provided PDF documentation (the *documentation.pdf* file):
271
+
The `AIAssistantProvider.CreateUserAssistant` method creates an assistant using the *documentation.pdf* file ([end-user documentation for Web Reporting Controls](https://github.com/DevExpress/dotnet-eud) in the PDF format) and the specified prompt. See the [AIAssistantProvider.cs](./CS/ReportingApp/Services/AIAssistantProvider.cs) file for implementation details.
var assistant =awaitassistantFactory.CreateAssistant(assistantName);
249
-
Assistants.TryAdd(assistantName, assistant);
250
-
var prompt =GetPrompt(assistantType);
251
-
if(assistantType ==AssistantType.UserAssistant) {
252
-
awaitLoadDocumentation(assistant, prompt);
253
-
}
254
-
return assistantName;
255
-
}
256
-
```
257
274
#### Communicate with the Assistant
258
275
259
276
Each time a user sends a message, the [`onMessageEntered`](https://js.devexpress.com/jQuery/Documentation/24_2/ApiReference/UI_Components/dxChat/Configuration/#onMessageEntered) event handler passes the request to the assistant:
0 commit comments