Events in Blazor AI AssistView component
23 Jun 20256 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;
}
}
AttachmentUploadStart
The AttachmentUploadStart event is triggered before the attached files upload begins in the AI AssistView
@using Syncfusion.Blazor.InteractiveChat
@using Syncfusion.Blazor.Inputs
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView AttachmentUploadStart="AttachmentUploadStart" AttachmentSettings="attachmentSettings" PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private void AttachmentUploadStart(UploadingEventArgs args)
{
// Your required action here
}
private AssistViewAttachmentSettings attachmentSettings = new AssistViewAttachmentSettings()
{
Enable = true,
SaveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Save",
RemoveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Remove"
};
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;
}
}
AttachmentUploadSuccess
The AttachmentUploadSuccess event is triggered when the attached file is successfully uploaded in the AI AssistView.
@using Syncfusion.Blazor.InteractiveChat
@using Syncfusion.Blazor.Inputs
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView AttachmentUploadSuccess="AttachmentUploadSuccess" AttachmentSettings="attachmentSettings" PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private void AttachmentUploadSuccess(SuccessEventArgs args)
{
// Your required action here
}
private AssistViewAttachmentSettings attachmentSettings = new AssistViewAttachmentSettings()
{
Enable = true,
SaveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Save",
RemoveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Remove"
};
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;
}
}
AttachmentUploadFailed
The AttachmentUploadFailed event is triggered when the attached file upload fails in the AI AssistView.
@using Syncfusion.Blazor.InteractiveChat
@using Syncfusion.Blazor.Inputs
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView AttachmentUploadFailed="AttachmentUploadFailed" AttachmentSettings="attachmentSettings" PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private void AttachmentUploadFailed(FailureEventArgs args)
{
// Your required action here
}
private AssistViewAttachmentSettings attachmentSettings = new AssistViewAttachmentSettings()
{
Enable = true,
SaveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Save",
RemoveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Remove"
};
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;
}
}
AttachmentRemoved
The AttachmentRemoved event is triggered when an attached file is removed in the AI AssistView.
@using Syncfusion.Blazor.InteractiveChat
@using Syncfusion.Blazor.Inputs
<div class="aiassist-container" style="height: 350px; width: 650px;">
<SfAIAssistView AttachmentRemoved="AttachmentRemoved" AttachmentSettings="attachmentSettings" PromptRequested="PromptRequest"></SfAIAssistView>
</div>
@code {
private void AttachmentRemoved(RemovingEventArgs args)
{
// Your required action here
}
private AssistViewAttachmentSettings attachmentSettings = new AssistViewAttachmentSettings()
{
Enable = true,
SaveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Save",
RemoveUrl = "https://blazor.syncfusion.com/services/production/api/FileUploader/Remove"
};
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;
}
}