Events in Blazor AI AssistView component
19 Sep 20242 minutes to read
This section describes the AI AssistView events that will be triggered when appropriate actions are performed. The following events are available in the AI AssistView component.
Created
The AI AssistView component triggers the Created event when the component rendering is completed.
@using Syncfusion.Blazor.InteractiveChat
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView Created="Created" PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private void Created()
{
// Your required action here
}
private async Task PromptRequest(AssistViewPromptRequestedEventArgs args)
{
await Task.Delay(1000);
var defaultResponse = "For real-time prompt processing, connect the AI AssistView component to your preferred AI service, such as OpenAI or Azure Cognitive Services. Ensure you obtain the necessary API credentials to authenticate and enable seamless integration.";
args.Response = defaultResponse;
}
}
PromptRequested
The PromptRequested event is triggered when the prompt request is made in the AI AssistView component.
@using Syncfusion.Blazor.InteractiveChat
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private async Task PromptRequest(AssistViewPromptRequestedEventArgs args)
{
await Task.Delay(1000);
var defaultResponse = "For real-time prompt processing, connect the AI AssistView component to your preferred AI service, such as OpenAI or Azure Cognitive Services. Ensure you obtain the necessary API credentials to authenticate and enable seamless integration.";
args.Response = defaultResponse;
}
}
PromptChanged
The PromptChanged event is triggered when the prompt text is changed in the AI AssistView component.
@using Syncfusion.Blazor.InteractiveChat
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView PromptChanged="PromptChange" PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private void PromptChange()
{
// Your required action here
}
private async Task PromptRequest(AssistViewPromptRequestedEventArgs args)
{
await Task.Delay(1000);
var defaultResponse = "For real-time prompt processing, connect the AI AssistView component to your preferred AI service, such as OpenAI or Azure Cognitive Services. Ensure you obtain the necessary API credentials to authenticate and enable seamless integration.";
args.Response = defaultResponse;
}
}