Skip to content

Commit 8a5d825

Browse files
998699: attachment click event added
1 parent 5d97425 commit 8a5d825

File tree

11 files changed

+143
-4
lines changed

11 files changed

+143
-4
lines changed

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/events.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,16 @@ The [AttachmentRemoved](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.
101101
{% highlight c# tabtitle="Attachment-remove.cs" %}
102102
{% include code-snippet/ai-assistview/events/attachment-remove/attachment-remove.cs %}
103103
{% endhighlight %}
104-
{% endtabs %}
104+
{% endtabs %}
105+
106+
## attachmentClick
107+
The `AttachmentClick` event is triggered when an attached file is clicked in the AI AssistView.
108+
109+
{% tabs %}
110+
{% highlight razor tabtitle="CSHTML" %}
111+
{% include code-snippet/ai-assistview/events/attachmentClick/razor %}
112+
{% endhighlight %}
113+
{% highlight c# tabtitle="AttachmentClick.cs" %}
114+
{% include code-snippet/ai-assistview/events/attachmentClick/attachmentClick.cs %}
115+
{% endhighlight %}
116+
{% endtabs %}

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.MVC/file-attachments.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,18 @@ You can use the  `MaxFileSize` property to allowed a maximum file size of the u
7474
{% endhighlight %}
7575
{% endtabs %}
7676

77-
![FileSize](images/file-size.png)
77+
![FileSize](images/file-size.png)
78+
79+
### Setting maximum count
80+
Restrict how many files can be attached at once using `MaximumCount` property. The default value is `10`. If users select more than the allowed count, the maximum count reached error will be displayed.
81+
82+
{% tabs %}
83+
{% highlight razor tabtitle="CSHTML" %}
84+
{% include code-snippet/ai-assistview/file-attachments/maximumCount/razor %}
85+
{% endhighlight %}
86+
{% highlight c# tabtitle="MaximumCount.cs" %}
87+
{% include code-snippet/ai-assistview/file-attachments/maximumCount/maximumCount.cs %}
88+
{% endhighlight %}
89+
{% endtabs %}
90+
91+
![MaximumCount](images/maximumCount.png)

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/events.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,13 @@ The [AttachmentRemoved](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.
8080
{% highlight razor tabtitle="CSHTML" %}
8181
{% include code-snippet/ai-assistview/events/attachment-remove/tagHelper %}
8282
{% endhighlight %}
83-
{% endtabs %}
83+
{% endtabs %}
84+
85+
## attachmentClick
86+
The `attachmentClick` event is triggered when an attached file is clicked in the AI AssistView.
87+
88+
{% tabs %}
89+
{% highlight razor tabtitle="CSHTML" %}
90+
{% include code-snippet/ai-assistview/events/attachmentClick/tagHelper %}
91+
{% endhighlight %}
92+
{% endtabs %}

ej2-asp-core-mvc/ai-assistview/EJ2_ASP.NETCORE/file-attachments.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,18 @@ You can use the  `maxFileSize` property to allowed a maximum file size of the u
7474
{% endhighlight %}
7575
{% endtabs %}
7676

77-
![FileSize](images/file-size.png)
77+
![FileSize](images/file-size.png)
78+
79+
### Setting maximum count
80+
Restrict how many files can be attached at once using `maximumCount` property. The default value is `10`. If users select more than the allowed count, the maximum count reached error will be displayed.
81+
82+
{% tabs %}
83+
{% highlight razor tabtitle="CSHTML" %}
84+
{% include code-snippet/ai-assistview/file-attachments/maximumCount/razor %}
85+
{% endhighlight %}
86+
{% highlight c# tabtitle="MaximumCount.cs" %}
87+
{% include code-snippet/ai-assistview/file-attachments/maximumCount/maximumCount.cs %}
88+
{% endhighlight %}
89+
{% endtabs %}
90+
91+
![MaximumCount](images/maximumCount.png)
19.7 KB
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public ActionResult AttachmentClick()
2+
{
3+
return View();
4+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@using Syncfusion.EJ2.InteractiveChat
2+
3+
<div class="aiassist-container" style="height: 350px; width: 650px;">
4+
@Html.EJS().AIAssistView("aiAssistView").EnableAttachments(true).PromptRequest("onPromptRequest").Created("onCreated").AttachmentSettings(new AIAssistViewAttachmentSettings() { SaveUrl = @Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Save"), RemoveUrl = @Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Remove"), AttachmentClick = "attachmentClick" }).Render()
5+
</div>
6+
7+
<script>
8+
var assistObj;
9+
function onCreated() {
10+
assistObj = this;
11+
}
12+
function attachmentClick() {
13+
// your required action here..
14+
}
15+
function onPromptRequest() {
16+
setTimeout(function () {
17+
var 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.';
18+
assistObj.addPromptResponse(defaultResponse);
19+
}, 2000);
20+
}
21+
</script>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@using Syncfusion.EJ2.InteractiveChat;
2+
3+
<div class="aiassist-container" style="height: 350px; width: 650px;">
4+
<ejs-aiassistview id="aiAssistView" enableAttachments="true" promptRequest="onPromptRequest" created="onCreated">
5+
<e-aiassistview-attachmentsettings attachmentClick="attachmentClick" 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>
6+
</ejs-aiassistview>
7+
</div>
8+
9+
<script>
10+
var assistObj;
11+
function onCreated() {
12+
assistObj = this;
13+
}
14+
function attachmentClick() {
15+
// your required action here..
16+
}
17+
function onPromptRequest() {
18+
setTimeout(() => {
19+
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.';
20+
assistObj.addPromptResponse(defaultResponse);
21+
}, 2000);
22+
}
23+
</script>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public ActionResult MaximumCount()
2+
{
3+
return View();
4+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@using Syncfusion.EJ2.InteractiveChat
2+
3+
<div class="aiassist-container" style="height: 350px; width: 650px;">
4+
@Html.EJS().AIAssistView("aiAssistView").EnableAttachments(true).PromptRequest("onPromptRequest").Created("onCreated").AttachmentSettings(new AIAssistViewAttachmentSettings() { SaveUrl = @Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Save"), RemoveUrl = @Url.Content("https://services.syncfusion.com/aspnet/production/api/FileUploader/Remove"), MaximumCount = 5 }).Render()
5+
</div>
6+
7+
<script>
8+
var assistObj;
9+
function onCreated() {
10+
assistObj = this;
11+
}
12+
function onPromptRequest() {
13+
setTimeout(function () {
14+
var 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.';
15+
assistObj.addPromptResponse(defaultResponse);
16+
}, 2000);
17+
}
18+
</script>

0 commit comments

Comments
 (0)