Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxAIChat.SendMessage(String, ChatRole) Method

Sends a message to the chat.

Namespace: DevExpress.AIIntegration.Blazor.Chat

Assembly: DevExpress.AIIntegration.Blazor.Chat.v24.2.dll

NuGet Package: DevExpress.AIIntegration.Blazor.Chat

#Declaration

C#
public Task SendMessage(
    string messageContent,
    ChatRole role
)

#Parameters

Name Type Description
messageContent String

The message text to be sent.

role Microsoft.Extensions.AI.ChatRole

The role of the message owner.

#Returns

Type Description
Task

A task that is completed when the message is sent.

#Remarks

Call the SendMessage method to send a message to the chat.

razor
<DxAIChat @ref="Chat" CssClass="demo-chat" />
<DxButton Text="Start dialog" Click="StartDialog" />

@code {
    DxAIChat Chat { get; set; }
    IEnumerable<BlazorChatMessage> History { get; set; }

    void StartDialog(MouseEventArgs args) {
        Chat.SendMessage("Hello, AI. How can you help me?", Microsoft.Extensions.AI.ChatRole.User);
    }
}

AI Chat

See Also