MessageSendingEventArgs.Contexts Property
Returns the collection of AI resources and files attached to the chat message.
Namespace: DevExpress.AIIntegration.Blazor.Chat
Assembly: DevExpress.AIIntegration.Blazor.Chat.v26.1.dll
Declaration
public List<IAIChatMessageContextItem> Contexts { get; }
Property Value
| Type | Description |
|---|---|
| List<IAIChatMessageContextItem> | The collection of resources. |
Remarks
Use the Contexts property to access the collection of AI resources and files attached to the chat message.
Note
The Contexts collection is populated only when a user explicitly attaches resources or files to a message. Subsequent messages can access previously provided contexts from the chat history, but their Contexts collection remains empty.
The following code snippet logs each resource attached to the message:
<DxAIChat MessageSending="OnMessageSending"
FileUploadEnabled="true" />
@code {
private async Task OnMessageSending(MessageSendingEventArgs args) {
if(args.Contexts != null) {
foreach(var resource in args.Contexts)
Console.WriteLine($"Resource: {resource.Name}");
}
}
}
See Also