- created
- promptRequest
- promptChanged
- beforeAttachmentUpload
- attachmentUploadSuccess
- attachmentUploadFailure
- attachmentRemoved
Contact Support
Events in ASP.NET CORE AI AssistView control
23 Jun 202511 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 control.
created
The AI AssistView control triggers the created event when the control rendering is completed.
@using Syncfusion.EJ2.InteractiveChat;
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" promptRequest="onPromptRequest" created="onCreated"></ejs-aiassistview>
</div>
<script>
var assistObj;
function onCreated() {
// your required action here..
assistObj = this;
}
function onPromptRequest(args) {
setTimeout(() => {
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(defaultResponse);
}, 2000);
}
</script>
promptRequest
The promptRequest event is triggered when the prompt request is made in the AI AssistView control.
@using Syncfusion.EJ2.InteractiveChat;
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" promptRequest="onPromptRequest" created="onCreated"></ejs-aiassistview>
</div>
<script>
var assistObj;
function onCreated() {
assistObj = this;
}
function onPromptRequest(args) {
// your required action here..
setTimeout(() => {
let foundPrompt = prompts.find((promptObj) => promptObj.prompt === args.prompt);
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(foundPrompt ? foundPrompt.response : defaultResponse);
}, 2000);
}
</script>
promptChanged
The promptChanged event is triggered when the prompt text is changed in the AI AssistView control.
@using Syncfusion.EJ2.InteractiveChat;
@using System.Text.Json;
@{
var suggestions = new string[] { "How do I prioritize my tasks?", "How can I improve my time management skills?" };
var prompts = new[]
{
new { prompt = "How do I prioritize my tasks?", response = "Prioritize tasks by urgency and impact: tackle high-impact tasks first, delegate when possible, and break large tasks into smaller steps. For more assistance, feel free to ask—I’m here to help!", suggestionData = new List<string> { } },
new { prompt = "How can I improve my time management skills?", response = "To improve time management skills, try setting clear goals, using a planner or digital tools, prioritizing tasks, breaking tasks into smaller steps, and minimizing distractions. Regularly review and adjust your approach for better efficiency.", suggestionData = new List<string> { } }
};
var promptsJson = JsonSerializer.Serialize(prompts);
}
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" promptChanged="onPromptChanged" promptRequest="onPromptRequest" created="onCreated"></ejs-aiassistview>
</div>
<script>
var assistObj;
var prompts = @Html.Raw(promptsJson);
function onCreated() {
assistObj = this;
}
function onPromptRequest(args) {
// your required action here..
}
function onPromptRequest(args) {
setTimeout(() => {
let foundPrompt = prompts.find((promptObj) => promptObj.prompt === args.prompt);
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(foundPrompt ? foundPrompt.response : defaultResponse);
}, 2000);
}
</script>
beforeAttachmentUpload
The BeforeAttachmentUpload event is triggered before the attached files upload begins in the AI AssistView.
@using Syncfusion.EJ2.InteractiveChat;
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" enableAttachments="true" beforeAttachmentUpload="beforeAttachmentUpload" promptRequest="onPromptRequest" created="onCreated">
<e-aiassistview-attachmentsettings saveUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Save") removeUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Remove")></e-aiassistview-attachmentsettings>
</ejs-aiassistview>
</div>
<script>
var assistObj;
function onCreated() {
assistObj = this;
}
function beforeAttachmentUpload() {
// your required action here..
}
function onPromptRequest() {
setTimeout(() => {
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(defaultResponse);
}, 2000);
}
</script>
attachmentUploadSuccess
The AttachmentUploadSuccess event is triggered when the attached file is successfully uploaded in the AI AssistView.
@using Syncfusion.EJ2.InteractiveChat;
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" enableAttachments="true" attachmentUploadSuccess="attachmentUploadSuccess" promptRequest="onPromptRequest" created="onCreated">
<e-aiassistview-attachmentsettings saveUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Save") removeUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Remove")></e-aiassistview-attachmentsettings>
</ejs-aiassistview>
</div>
<script>
var assistObj;
function onCreated() {
assistObj = this;
}
function attachmentUploadSuccess() {
// your required action here..
}
function onPromptRequest() {
setTimeout(() => {
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(defaultResponse);
}, 2000);
}
</script>
attachmentUploadFailure
The AttachmentUploadFailure event is triggered when the attached file upload fails in the AI AssistView.
@using Syncfusion.EJ2.InteractiveChat;
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" enableAttachments="true" attachmentUploadFailure="attachmentUploadFailure" promptRequest="onPromptRequest" created="onCreated">
<e-aiassistview-attachmentsettings saveUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Save") removeUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Remove")></e-aiassistview-attachmentsettings>
</ejs-aiassistview>
</div>
<script>
var assistObj;
function onCreated() {
assistObj = this;
}
function attachmentUploadFailure() {
// your required action here..
}
function onPromptRequest() {
setTimeout(() => {
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(defaultResponse);
}, 2000);
}
</script>
attachmentRemoved
The AttachmentRemoved event is triggered when an attached file is removed in the AI AssistView.
@using Syncfusion.EJ2.InteractiveChat;
<div class="aiassist-container" style="height: 350px; width: 650px;">
<ejs-aiassistview id="aiAssistView" enableAttachments="true" attachmentRemoved="attachmentRemoved" promptRequest="onPromptRequest" created="onCreated">
<e-aiassistview-attachmentsettings saveUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Save") removeUrl=@Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Remove")></e-aiassistview-attachmentsettings>
</ejs-aiassistview>
</div>
<script>
var assistObj;
function onCreated() {
assistObj = this;
}
function attachmentRemoved() {
// your required action here..
}
function onPromptRequest() {
setTimeout(() => {
let defaultResponse = 'For real-time prompt processing, connect the AI AssistView control 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.';
assistObj.addPromptResponse(defaultResponse);
}, 2000);
}
</script>