AIChatResource Class
Defines a user-selectable context for a chat session.
Namespace: DevExpress.AIIntegration.Blazor.Chat
Assembly: DevExpress.AIIntegration.Blazor.Chat.v25.2.dll
NuGet Package: DevExpress.AIIntegration.Blazor.Chat
Declaration
public class AIChatResource
Remarks
Use AIChatResource to define a reusable, named chat context that users can select in the AI Chat UI. The resource establishes the conversation environment: defines the assistant role, adds instructions, and attaches a dataset (including binary content). When a user selects the resource, its context applies to the active chat session and guides subsequent AI responses.
Note
A binary resource is processed only if the configured AI provider and model support it.
The following code snippet binds three files as AI chat resources to the DxAIChat control:
<DxAIChat Resources="Resources" />
@code {
List<AIChatResource> Resources { get; set; } = [];
protected override async Task OnInitializedAsync() {
AIChatResource instructions = await FileResourceProvider.GetTextResourceAsync("instructions",
"Technical Support",
"An assistant that helps troubleshoot technical issues and provides step-by-step solutions.");
AIChatResource documentation = await FileResourceProvider.GetTextResourceAsync("ai-chat-doc.md",
"API Reference",
"DevExpress Blazor AI Chat API Reference.");
AIChatResource screenshot = await FileResourceProvider.GetBinaryResourceAsync("ai-chat-image.png",
"AI Chat Screenshot",
"An annotated screenshot of the AI Chat component.",
"image/png");
Resources.Add(instructions);
Resources.Add(documentation);
Resources.Add(screenshot);
await base.OnInitializedAsync();
}
}

