IAIChat.SendMessage(String, ChatRole, List<AIChatUploadFileInfo>) Method
OBSOLETE
The 'SendMessage' method is obsolete and will be removed in a future release. Use SendMessageAsync instead.
Sends a message to the AI service.
Namespace: DevExpress.AIIntegration.Blazor.Chat
Assembly: DevExpress.AIIntegration.Blazor.Chat.v26.1.dll
NuGet Package: DevExpress.AIIntegration.Blazor.Chat
Declaration
[Obsolete("The 'SendMessage' method is obsolete and will be removed in a future release. Use SendMessageAsync instead.")]
Task SendMessage(
string messageContent,
ChatRole role,
List<AIChatUploadFileInfo> files = null
)
Parameters
| Name | Type | Description |
|---|---|---|
| messageContent | String | The message text. |
| role | Microsoft.Extensions.AI.ChatRole | The intended purpose of the message within a chat interaction. |
Optional Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| files | List<AIChatUploadFileInfo> | null | A collection of files attached to the message. |
Returns
| Type | Description |
|---|---|
| Task | The task completed when the message is sent. |
Remarks
Call the SendMessage method to send a message to the AI service.
<DxAIChat MessageSending="OnMessageSending" />
@code {
private async Task OnMessageSending(MessageSendingEventArgs args) {
args.Cancel = true;
StringBuilder sb = new StringBuilder();
sb.AppendLine("Hello!");
sb.AppendLine(args.Content);
await args.Chat.SendMessage(sb.ToString(), ChatRole.User);
}
}
Tip
The MessageSending event automatically sends a message to the AI service. To block automatic message delivery and send the message to the AI service manually, set the Cancel property of the event argument to true.