menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfAIAssistView - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfAIAssistView

    Inheritance
    System.Object
    SfBaseComponent
    SfAIAssistView
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(Boolean)
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    Namespace: Syncfusion.Blazor.InteractiveChat
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfAIAssistView : SfBaseComponent
    Examples
     
    <SfAIAssistView>
        <ChildContent>
            <AssistViews>
                <AssistView Header="AI Generation"></AssistView>
                <CustomView Header="NoteBook"></CustomView>
            </AssistViews>
        </ChildContent>
    </SfAIAssistView>

    Constructors

    SfAIAssistView()

    Declaration
    public SfAIAssistView()

    Properties

    ActiveView

    Gets or sets the index of the active view in the SfAIAssistView component.

    Declaration
    public int ActiveView { get; set; }
    Property Value
    Type Description
    System.Int32

    An integer representing the index of the active view. The default value is 0.

    Remarks

    This property determines which view is currently active and visible in the SfAIAssistView component.

    ChildContent

    Gets or sets a value that indicates the child content for the AIAssist.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.RenderFragment

    Created

    Event raised when the SfAIAssistView is created.

    Declaration
    public EventCallback<object> Created { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<System.Object>
    Remarks

    This event is triggered when the SfAIAssistView component is created.

    CssClass

    Gets or sets custom CSS classes for the SfAIAssistView component.

    Declaration
    public string CssClass { get; set; }
    Property Value
    Type Description
    System.String

    A string containing CSS class names to customize the appearance. The default is String.Empty.

    Remarks

    This property allows adding custom CSS classes for styling the SfAIAssistView component.

    Height

    Gets or sets the height of the SfAIAssistView component.

    Declaration
    public string Height { get; set; }
    Property Value
    Type Description
    System.String

    The height of the SfAIAssistView component. The default is "100%".

    Remarks

    This property specifies the height of the SfAIAssistView component.

    ID

    Sets id attribute for the AI Prompt.

    Declaration
    public string ID { get; set; }
    Property Value
    Type Description
    System.String

    Accepts the string value.

    Prompt

    Gets or sets the prompt text in the SfAIAssistView component. Supports two-way binding.

    Declaration
    public string Prompt { get; set; }
    Property Value
    Type Description
    System.String

    The text to be used as the prompt. The default is String.Empty.

    Remarks

    This property represents the text input prompt for the SfAIAssistView component. Define @bind-Prompt to use two-way binding.

    PromptChanged

    Event raised when the prompt text is changed in the SfAIAssistView.

    Declaration
    public EventCallback<string> PromptChanged { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<System.String>
    Remarks

    This event is triggered when the prompt text is changed in the SfAIAssistView component.

    PromptIconCss

    Gets or sets the CSS class for the prompter avatar in the SfAIAssistView component.

    Declaration
    public string PromptIconCss { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the CSS class for styling the avatar of each prompt. The default value is an empty string.

    Remarks

    Use this property to apply custom styles to the prompt avatar in the SfAIAssistView component.

    PromptPlaceholder

    Gets or sets the placeholder text for the prompt input text area in the SfAIAssistView component.

    Declaration
    public string PromptPlaceholder { get; set; }
    Property Value
    Type Description
    System.String

    The placeholder text displayed in the prompt input text area field. The default is "Type prompt for assistance...".

    Remarks

    This property provides placeholder text to guide users on what to input in the prompt text area field in the SfAIAssistView component.

    PromptRequested

    Event raised when a prompt request is made in the SfAIAssistView.

    Declaration
    public EventCallback<AssistViewPromptRequestedEventArgs> PromptRequested { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<AssistViewPromptRequestedEventArgs>
    Remarks

    This event is triggered when a prompt request is made in the SfAIAssistView component.

    Prompts

    Gets or sets the collection of prompts and their responses in the SfAIAssistView component.

    Declaration
    public List<AssistViewPrompt> Prompts { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<AssistViewPrompt>

    A list of AssistViewPrompt representing the prompts. The default is an empty list.

    Remarks

    This property holds the collection of provided prompts and their responses for the SfAIAssistView component.

    PromptSuggestions

    Gets or sets the list of prompt suggestions in the SfAIAssistView component.

    Declaration
    public List<string> PromptSuggestions { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<System.String>

    A list of strings representing the prompt suggestions. The default is an empty list.

    Remarks

    This property contains the suggestions that can be used as prompts in the SfAIAssistView component.

    PromptSuggestionsHeader

    Gets or sets the header text for the prompt suggestions in the SfAIAssistView component.

    Declaration
    public string PromptSuggestionsHeader { get; set; }
    Property Value
    Type Description
    System.String

    The header text displayed above the prompt suggestions list. The default is String.Empty.

    Remarks

    This property provides a header for the list of prompt suggestions in the SfAIAssistView component.

    ResponseIconCss

    Gets or sets the CSS class for the responder avatar in the SfAIAssistView component.

    Declaration
    public string ResponseIconCss { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the CSS class for styling the avatar of each response. The default value is an empty string.

    Remarks

    Use this property to apply custom styles to the responder avatar in the SfAIAssistView component.

    ResponseStopped

    Event triggered when the "Stop Responding" button is clicked during an ongoing prompt response.

    Declaration
    public EventCallback<ResponseStoppedEventArgs> ResponseStopped { get; set; }
    Property Value
    Type
    Microsoft.AspNetCore.Components.EventCallback<ResponseStoppedEventArgs>
    Remarks
    • The event is raised when a user explicitly clicks "Stop Responding."
    • Use this event to stop AI processing and handle UI updates, ensuring a smooth user experience.
    • The event provides ResponseStoppedEventArgs to access details such as the associated prompt and its index.

    ShowHeader

    Gets or sets a value indicating whether the header is displayed in the SfAIAssistView component.

    Declaration
    public bool ShowHeader { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the header is displayed; otherwise, false. The default is true.

    Remarks

    This property controls the visibility of the header in the SfAIAssistView component.

    Width

    Gets or sets the width of the SfAIAssistView component.

    Declaration
    public string Width { get; set; }
    Property Value
    Type Description
    System.String

    The width of the SfAIAssistView component. The default is "100%".

    Remarks

    This property specifies the width of the SfAIAssistView component.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    ExecutePromptAsync(String)

    Executes the prompts at dynamically to generate the respective output.

    Declaration
    public Task ExecutePromptAsync(string Prompt)
    Parameters
    Type Name Description
    System.String Prompt
    Returns
    Type Description
    System.Threading.Tasks.Task

    System.Threading.Tasks.Task.

    OnAfterRenderAsync(Boolean)

    Method invoked after each time the component has been rendered.

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender

    Set to true for the first time component rendering; otherwise gets false.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfBaseComponent.OnAfterRenderAsync(Boolean)

    OnInitializedAsync()

    Method invoked when the component is ready to start.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing any asynchronous operation.

    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type
    System.Threading.Tasks.Task

    ScrollToBottomAsync()

    Scrolls the SfAIAssistView component to the bottom asynchronously.

    Declaration
    public Task ScrollToBottomAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous scrolling operation.

    Remarks

    Ensures the latest content is visible by programmatically scrolling to the bottom of the view.

    UpdateResponseAsync(String)

    Asynchronously updates the streaming response of a prompt by appending the latest chunk and rendering it in real-time within the SfAIAssistView component.

    Declaration
    public Task UpdateResponseAsync(string response)
    Parameters
    Type Name Description
    System.String response

    The full accumulated response, including all previously received chunks. Each chunk is appended externally (before calling this method), ensuring a progressive update of the response in the UI.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A System.Threading.Tasks.Task representing the asynchronous operation. This method executes in a non-blocking manner, ensuring that UI updates occur smoothly without freezing the main thread.

    Remarks
    • This method is designed to handle AI-generated streaming responses efficiently.
    • It enables real-time response rendering by progressively updating the SfAIAssistView component as new chunks arrive.
    • Asynchronous execution ensures a smooth UI experience, allowing updates without blocking user interactions.
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved