Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenAIChat

    RadzenAIChat component that provides a modern chat interface with AI integration and conversation memory.

    Inheritance
    object
    ComponentBase
    RadzenComponent
    RadzenAIChat
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(MouseEventArgs)
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, int)
    RadzenComponent.OnInitialized()
    RadzenComponent.SetParametersAsync(ParameterView)
    RadzenComponent.RaiseContextMenu(MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.Reference
    RadzenComponent.CurrentStyle
    ComponentBase.OnParametersSet()
    ComponentBase.StateHasChanged()
    ComponentBase.ShouldRender()
    ComponentBase.OnAfterRender(bool)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.DispatchExceptionAsync(Exception)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenAIChat : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
    Examples
    <RadzenAIChat Title="AI Assistant" Placeholder="Type your message..." @bind-Messages="@chatMessages" SessionId="@sessionId" />

    Constructors

    RadzenAIChat()

    RadzenAIChat component that provides a modern chat interface with AI integration and conversation memory.

    Declaration
    public RadzenAIChat()
    Examples
    <RadzenAIChat Title="AI Assistant" Placeholder="Type your message..." @bind-Messages="@chatMessages" SessionId="@sessionId" />

    Properties

    AssistantAvatarText

    Gets or sets the text displayed in the assistant avatar.

    Declaration
    [Parameter]
    public string AssistantAvatarText { get; set; }
    Property Value
    Type Description
    string

    ChatCleared

    Event callback that is invoked when the chat is cleared.

    Declaration
    [Parameter]
    public EventCallback ChatCleared { get; set; }
    Property Value
    Type Description
    EventCallback

    Disabled

    Gets or sets whether the chat is disabled.

    Declaration
    [Parameter]
    public bool Disabled { get; set; }
    Property Value
    Type Description
    bool

    EmptyMessage

    Gets or sets the message displayed when there are no messages.

    Declaration
    [Parameter]
    public string EmptyMessage { get; set; }
    Property Value
    Type Description
    string

    InputAttributes

    Specifies additional custom attributes that will be rendered by the input.

    Declaration
    [Parameter]
    public IReadOnlyDictionary<string, object> InputAttributes { get; set; }
    Property Value
    Type Description
    IReadOnlyDictionary<string, object>

    The attributes.

    MaxMessages

    Gets or sets the maximum number of messages to keep in the chat.

    Declaration
    [Parameter]
    public int MaxMessages { get; set; }
    Property Value
    Type Description
    int

    MessageAdded

    Event callback that is invoked when a new message is added.

    Declaration
    [Parameter]
    public EventCallback<ChatMessage> MessageAdded { get; set; }
    Property Value
    Type Description
    EventCallback<ChatMessage>

    MessageSent

    Event callback that is invoked when a message is sent.

    Declaration
    [Parameter]
    public EventCallback<string> MessageSent { get; set; }
    Property Value
    Type Description
    EventCallback<string>

    Placeholder

    Gets or sets the placeholder text for the input field.

    Declaration
    [Parameter]
    public string Placeholder { get; set; }
    Property Value
    Type Description
    string

    ReadOnly

    Gets or sets whether the input is read-only.

    Declaration
    [Parameter]
    public bool ReadOnly { get; set; }
    Property Value
    Type Description
    bool

    ResponseReceived

    Event callback that is invoked when the AI response is received.

    Declaration
    [Parameter]
    public EventCallback<string> ResponseReceived { get; set; }
    Property Value
    Type Description
    EventCallback<string>

    SessionId

    Gets or sets the session ID for maintaining conversation memory. If null, a new session will be created.

    Declaration
    [Parameter]
    public string SessionId { get; set; }
    Property Value
    Type Description
    string

    SessionIdChanged

    Event callback that is invoked when a session ID is created or retrieved.

    Declaration
    [Parameter]
    public EventCallback<string> SessionIdChanged { get; set; }
    Property Value
    Type Description
    EventCallback<string>

    ShowClearButton

    Gets or sets whether to show the clear chat button.

    Declaration
    [Parameter]
    public bool ShowClearButton { get; set; }
    Property Value
    Type Description
    bool

    Title

    Gets or sets the title displayed in the chat header.

    Declaration
    [Parameter]
    public string Title { get; set; }
    Property Value
    Type Description
    string

    UserAvatarText

    Gets or sets the text displayed in the user avatar.

    Declaration
    [Parameter]
    public string UserAvatarText { get; set; }
    Property Value
    Type Description
    string

    Methods

    AddMessage(string, bool)

    Adds a message to the chat.

    Declaration
    public ChatMessage AddMessage(string content, bool isUser = false)
    Parameters
    Type Name Description
    string content

    The message content.

    bool isUser

    Whether the message is from the user.

    Returns
    Type Description
    ChatMessage

    The created message.

    BuildRenderTree(RenderTreeBuilder)

    RadzenAIChat component that provides a modern chat interface with AI integration and conversation memory.

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    RenderTreeBuilder __builder
    Overrides
    ComponentBase.BuildRenderTree(RenderTreeBuilder)

    ClearChat()

    Clears all messages from the chat.

    Declaration
    public Task ClearChat()
    Returns
    Type Description
    Task

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    string
    Overrides
    RadzenComponent.GetComponentCssClass()

    GetMessages()

    Gets the current list of messages.

    Declaration
    public IReadOnlyList<ChatMessage> GetMessages()
    Returns
    Type Description
    IReadOnlyList<ChatMessage>

    GetSessionId()

    Gets the current session ID.

    Declaration
    public string GetSessionId()
    Returns
    Type Description
    string

    LoadConversationHistory()

    Loads conversation history from the AI service session.

    Declaration
    public Task LoadConversationHistory()
    Returns
    Type Description
    Task

    OnAfterRenderAsync(bool)

    Called by the Blazor runtime.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    bool firstRender
    Returns
    Type Description
    Task
    Overrides
    RadzenComponent.OnAfterRenderAsync(bool)

    OnInitializedAsync()

    RadzenAIChat component that provides a modern chat interface with AI integration and conversation memory.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    Task
    Overrides
    ComponentBase.OnInitializedAsync()

    OnParametersSetAsync()

    RadzenAIChat component that provides a modern chat interface with AI integration and conversation memory.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    Task
    Overrides
    ComponentBase.OnParametersSetAsync()

    SendMessage(string)

    Sends a message programmatically.

    Declaration
    public Task SendMessage(string content)
    Parameters
    Type Name Description
    string content

    The message content to send.

    Returns
    Type Description
    Task

    SendMessage(string, string, string, double?, int?)

    Sends a message programmatically with custom AI parameters.

    Declaration
    public Task SendMessage(string content, string model = null, string systemPrompt = null, double? temperature = null, int? maxTokens = null)
    Parameters
    Type Name Description
    string content

    The message content to send.

    string model

    Optional model name to override the configured model.

    string systemPrompt

    Optional system prompt to override the configured system prompt.

    double? temperature

    Optional temperature to override the configured temperature.

    int? maxTokens

    Optional maximum tokens to override the configured max tokens.

    Returns
    Type Description
    Task

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT