Syncfusion ASP.NET MVC AI AssistView
A full-featured conversational AI interface component for ASP.NET MVC. Renders prompt/response conversations, supports prompt suggestions, custom views, toolbar customization, file attachments, speech-to-text, and integrates with major AI backends.
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- NuGet installation and namespace setup
- CDN stylesheet and script references
- ScriptManager registration
- Minimal
AIAssistView render
- Wiring
PromptRequest and addPromptResponse
- Configuring
PromptSuggestions with matched responses
Assist View Configuration
📄 Read: references/assist-view-config.md
- Setting prompt text (
Prompt property)
- Prompt placeholder text (
PromptPlaceholder)
- Pre-loading prompt/response pairs (
Prompts collection)
- Rendering markdown responses
- Prompt suggestions and suggestion headers
- Prompter avatar icon (
PromptIconCss)
- Responder avatar icon (
ResponseIconCss)
- Show/hide clear button (
ShowClearButton)
- Scroll-to-bottom indicator (
EnableScrollToBottom)
Appearance
📄 Read: references/appearance.md
- Setting control width (
Width property)
- Setting control height (
Height property)
- Custom CSS class (
CssClass property)
Templates
📄 Read: references/templates.md
- Banner template (
BannerTemplate) — welcome notes, branding
- Prompt item template (
PromptItemTemplate) — custom prompt bubbles
- Response item template (
ResponseItemTemplate) — custom response bubbles
- Prompt suggestion item template (
PromptSuggestionItemTemplate)
- Footer template (
FooterTemplate) — fully custom input area
Toolbar Items
📄 Read: references/toolbar-items.md
- Footer toolbar (send, attachment, positioning, custom items, ItemClick)
- Header toolbar items (iconCss, type, text, visible, disabled, tooltip, cssClass, align, tabIndex, template, ItemClicked)
- Built-in prompt toolbar (edit, copy) and response toolbar (copy, like, dislike)
- Custom prompt toolbar items (
PromptToolbarSettings)
- Custom response toolbar items (
ResponseToolbarSettings)
- Regenerate Responses — enable regenerate button, request alternative AI responses, navigate through multiple responses (
RegeneratedResponses property)
Generative UI
📄 Read: references/generative-ui.md
- Register custom tools (
registerToolUI method)
- Define tool templates and handlers for interactive components
- Add tools to AI responses via
blocks property with blockType: 'tool'
- Examples: weather cards, recipe builders, interactive forms
- Configure AI system prompt for structured generative UI block responses
- Dynamic tool rendering within conversation context
Chain of Thoughts (Thinking)
📄 Read: references/chain-of-thoughts.md
- Visualize AI reasoning process with thinking blocks
- Define reasoning stages with
blockType: 'thinking' and stages array
- Stage status options:
completed, inprogress, failed
- Add collapsible thinking headers and timeline visualization
- Configure thinking block templates (
blockTemplate, itemTemplate)
- Support for inline context items with clickable badges
- Ideal for extended reasoning models (Claude 3.5, GPT-o1, etc.)
Custom Views
📄 Read: references/custom-views.md
- Adding views via
Views collection
- View type (
Assist vs Custom)
- View name, icon (
IconCss), and ViewTemplate
- Setting active view (
ActiveView)
File Attachments
📄 Read: references/file-attachments.md
- Enabling attachments (
EnableAttachments)
- Configuring
AttachmentSettings (SaveUrl, RemoveUrl)
- Restricting file types (
AllowedFileType)
- File size limit (
MaxFileSize)
- Maximum attachment count (
MaximumCount)
Events
📄 Read: references/events.md
Created — after control renders
PromptRequest — when user submits a prompt
PromptChanged — when prompt text changes
- Attachment events:
BeforeAttachmentUpload, AttachmentUploadSuccess, AttachmentUploadFailure, AttachmentRemoved, AttachmentClick
Methods
📄 Read: references/methods.md
addPromptResponse(string) — add response to last prompt
addPromptResponse(object) — add new prompt+response pair
executePrompt(string) — programmatically trigger a prompt
AI Integrations & Speech
📄 Read: references/ai-integrations.md
- Azure OpenAI integration (controller + view wiring)
- Gemini AI integration (
Mscc.GenerativeAI NuGet)
- Ollama / local LLM integration (
Microsoft.Extensions.AI)
- LiteLLM proxy integration (OpenAI-compatible API)
- Speech-to-Text (
SpeechToTextSettings: enable, lang, buttonSettings, tooltipSettings, interimResults, events)
- Text-to-Speech (TTS) (
TextToSpeechSettings: language, speechPitch, speechRate, volume, voice; enable via e-assist-audio toolbar icon)
- Streaming response pattern (character-by-character with
marked.js)
Quick Start Example
@using Syncfusion.EJ2.InteractiveChat
@using Newtonsoft.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.",
suggestionData = new List<string>() }
};
var promptsJson = Html.Raw(JsonConvert.SerializeObject(prompts));
}
<div style="height: 350px; width: 650px;">
@Html.EJS().AIAssistView("aiAssistView")
.PromptSuggestions(suggestions)
.PromptRequest("onPromptRequest")
.Created("onCreated")
.Render()
</div>
<script>
var assistObj;
var prompts = @Html.Raw(promptsJson);
function onCreated() { assistObj = this; }
function onPromptRequest(args) {
setTimeout(function () {
var found = prompts.find(p => p.prompt === args.prompt);
var defaultResponse = 'Connect to your AI service for real-time responses.';
assistObj.addPromptResponse(found ? found.response : defaultResponse);
}, 2000);
}
</script>
Common Patterns
Pattern: Streaming Response with Markdown
// Include marked.js: <script src="https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js"></script>
async function streamResponse(responseText) {
let current = '';
let i = 0;
while (i < responseText.length) {
current += responseText[i++];
if (i % 10 === 0 || i === responseText.length) {
assistObj.addPromptResponse(marked.parse(current), i === responseText.length);
assistObj.scrollToBottom();
}
await new Promise(r => setTimeout(r, 15));
}
}
Pattern: Server-side AI Proxy (controller)
[HttpPost]
public async Task<IActionResult> GetAIResponse([FromBody] PromptRequest request)
{
if (string.IsNullOrEmpty(request?.Prompt))
return BadRequest("Prompt cannot be empty.");
// Call AI provider and return Json(responseText)
}
public class PromptRequest { public string Prompt { get; set; } }
Pattern: Reset conversation on toolbar click
function toolbarItemClicked(args) {
if (args.item.iconCss === 'e-icons e-refresh') {
assistObj.prompts = [];
assistObj.promptSuggestions = suggestions;
}
}
Key Properties at a Glance
| Property |
Type |
Description |
Prompt |
string |
Pre-set prompt text |
PromptPlaceholder |
string |
Textarea placeholder (default: "Type prompt for assistance...") |
Prompts |
collection |
Pre-loaded prompt/response data; supports regeneratedResponses for alternative responses |
PromptSuggestions |
string[] |
Suggestion chips shown to user |
PromptSuggestionsHeader |
string |
Header above suggestion chips |
PromptIconCss |
string |
CSS class for prompter avatar |
ResponseIconCss |
string |
CSS class for responder avatar (default: e-assistview-icon) |
ShowClearButton |
bool |
Show clear button in textarea (default: false) |
EnableScrollToBottom |
bool |
Show scroll-to-bottom icon (default: true) |
Width / Height |
string |
Control dimensions (default: 100%) |
CssClass |
string |
Custom CSS class for theming |
ActiveView |
int |
Zero-based index of active view (default: 0) |
EnableAttachments |
bool |
Enable file attachment button (default: false) |
ResponseToolbarSettings.Items |
collection |
Response toolbar buttons; can include e-assist-regenerate (regenerate) and e-assist-audio (text-to-speech) |
TextToSpeechSettings |
object |
Configure TTS behavior: Language, SpeechPitch, SpeechRate, Volume, Voice |
BlockTemplate |
string |
Custom template for thinking/tool blocks (generative UI and Chain of Thoughts) |
ItemTemplate |
string |
Custom template for thinking block stages in timeline |
Key Events
| Event |
Trigger |
Created |
Control fully rendered |
PromptRequest |
User submits a prompt |
PromptChanged |
Prompt textarea text changes |
BeforeAttachmentUpload |
Before file upload begins |
AttachmentUploadSuccess |
File uploaded successfully |
AttachmentUploadFailure |
File upload failed |
AttachmentRemoved |
Attachment removed |
Key Methods
| Method |
Description |
assistObj.addPromptResponse('text') |
Add string response to last prompt |
assistObj.addPromptResponse({prompt, response}) |
Add new prompt+response pair |
assistObj.executePrompt('text') |
Programmatically submit a prompt |
assistObj.scrollToBottom() |
Scroll conversation to bottom |
1---2name: syncfusion-aspnetmvc-ai-assistview3description: Implement the Syncfusion ASP.NET MVC AI AssistView component — a conversational AI chat interface with prompt/response rendering, prompt suggestions, custom views, toolbar customization, file attachments, speech-to-text, AI backend integrations (Azure OpenAI, Gemini, Ollama, LiteLLM), generative UI with interactive tools, Chain of Thoughts reasoning visualization and text-to-speech audio playback. Use this skill when building AI chat UIs, integrating LLM backends, configuring assistant toolbars, customizing templates, rendering dynamic UI components, or handling voice input/output in ASP.NET MVC applications.4---56# Syncfusion ASP.NET MVC AI AssistView78A full-featured conversational AI interface component for ASP.NET MVC. Renders prompt/response conversations, supports prompt suggestions, custom views, toolbar customization, file attachments, speech-to-text, and integrates with major AI backends.910## Documentation and Navigation Guide1112### Getting Started13📄 **Read:** [references/getting-started.md](references/getting-started.md)14- NuGet installation and namespace setup15- CDN stylesheet and script references16- ScriptManager registration17- Minimal `AIAssistView` render18- Wiring `PromptRequest` and `addPromptResponse`19- Configuring `PromptSuggestions` with matched responses2021### Assist View Configuration22📄 **Read:** [references/assist-view-config.md](references/assist-view-config.md)23- Setting prompt text (`Prompt` property)24- Prompt placeholder text (`PromptPlaceholder`)25- Pre-loading prompt/response pairs (`Prompts` collection)26- Rendering markdown responses27- Prompt suggestions and suggestion headers28- Prompter avatar icon (`PromptIconCss`)29- Responder avatar icon (`ResponseIconCss`)30- Show/hide clear button (`ShowClearButton`)31- Scroll-to-bottom indicator (`EnableScrollToBottom`)3233### Appearance34📄 **Read:** [references/appearance.md](references/appearance.md)35- Setting control width (`Width` property)36- Setting control height (`Height` property)37- Custom CSS class (`CssClass` property)3839### Templates40📄 **Read:** [references/templates.md](references/templates.md)41- Banner template (`BannerTemplate`) — welcome notes, branding42- Prompt item template (`PromptItemTemplate`) — custom prompt bubbles43- Response item template (`ResponseItemTemplate`) — custom response bubbles44- Prompt suggestion item template (`PromptSuggestionItemTemplate`)45- Footer template (`FooterTemplate`) — fully custom input area4647### Toolbar Items48📄 **Read:** [references/toolbar-items.md](references/toolbar-items.md)49- Footer toolbar (send, attachment, positioning, custom items, ItemClick)50- Header toolbar items (iconCss, type, text, visible, disabled, tooltip, cssClass, align, tabIndex, template, ItemClicked)51- Built-in prompt toolbar (edit, copy) and response toolbar (copy, like, dislike)52- Custom prompt toolbar items (`PromptToolbarSettings`)53- Custom response toolbar items (`ResponseToolbarSettings`)54- **Regenerate Responses** — enable regenerate button, request alternative AI responses, navigate through multiple responses (`RegeneratedResponses` property)5556### Generative UI57📄 **Read:** [references/generative-ui.md](references/generative-ui.md)58- Register custom tools (`registerToolUI` method)59- Define tool templates and handlers for interactive components60- Add tools to AI responses via `blocks` property with `blockType: 'tool'`61- Examples: weather cards, recipe builders, interactive forms62- Configure AI system prompt for structured generative UI block responses63- Dynamic tool rendering within conversation context6465### Chain of Thoughts (Thinking)66📄 **Read:** [references/chain-of-thoughts.md](references/chain-of-thoughts.md)67- Visualize AI reasoning process with thinking blocks68- Define reasoning stages with `blockType: 'thinking'` and `stages` array69- Stage status options: `completed`, `inprogress`, `failed`70- Add collapsible thinking headers and timeline visualization71- Configure thinking block templates (`blockTemplate`, `itemTemplate`)72- Support for inline context items with clickable badges73- Ideal for extended reasoning models (Claude 3.5, GPT-o1, etc.)7475### Custom Views76📄 **Read:** [references/custom-views.md](references/custom-views.md)77- Adding views via `Views` collection78- View type (`Assist` vs `Custom`)79- View name, icon (`IconCss`), and `ViewTemplate`80- Setting active view (`ActiveView`)8182### File Attachments83📄 **Read:** [references/file-attachments.md](references/file-attachments.md)84- Enabling attachments (`EnableAttachments`)85- Configuring `AttachmentSettings` (SaveUrl, RemoveUrl)86- Restricting file types (`AllowedFileType`)87- File size limit (`MaxFileSize`)88- Maximum attachment count (`MaximumCount`)8990### Events91📄 **Read:** [references/events.md](references/events.md)92- `Created` — after control renders93- `PromptRequest` — when user submits a prompt94- `PromptChanged` — when prompt text changes95- Attachment events: `BeforeAttachmentUpload`, `AttachmentUploadSuccess`, `AttachmentUploadFailure`, `AttachmentRemoved`, `AttachmentClick`9697### Methods98📄 **Read:** [references/methods.md](references/methods.md)99- `addPromptResponse(string)` — add response to last prompt100- `addPromptResponse(object)` — add new prompt+response pair101- `executePrompt(string)` — programmatically trigger a prompt102103### AI Integrations & Speech104📄 **Read:** [references/ai-integrations.md](references/ai-integrations.md)105- Azure OpenAI integration (controller + view wiring)106- Gemini AI integration (`Mscc.GenerativeAI` NuGet)107- Ollama / local LLM integration (`Microsoft.Extensions.AI`)108- LiteLLM proxy integration (OpenAI-compatible API)109- **Speech-to-Text** (`SpeechToTextSettings`: enable, lang, buttonSettings, tooltipSettings, interimResults, events)110- **Text-to-Speech (TTS)** (`TextToSpeechSettings`: language, speechPitch, speechRate, volume, voice; enable via `e-assist-audio` toolbar icon)111- Streaming response pattern (character-by-character with `marked.js`)112113---114115## Quick Start Example116117```razor118@using Syncfusion.EJ2.InteractiveChat119@using Newtonsoft.Json120121@{122 var suggestions = new string[] {123 "How do I prioritize my tasks?",124 "How can I improve my time management skills?"125 };126 var prompts = new[]127 {128 new { prompt = "How do I prioritize my tasks?",129 response = "Prioritize tasks by urgency and impact: tackle high-impact tasks first, delegate when possible, and break large tasks into smaller steps.",130 suggestionData = new List<string>() }131 };132 var promptsJson = Html.Raw(JsonConvert.SerializeObject(prompts));133}134135<div style="height: 350px; width: 650px;">136 @Html.EJS().AIAssistView("aiAssistView")137 .PromptSuggestions(suggestions)138 .PromptRequest("onPromptRequest")139 .Created("onCreated")140 .Render()141</div>142143<script>144 var assistObj;145 var prompts = @Html.Raw(promptsJson);146147 function onCreated() { assistObj = this; }148149 function onPromptRequest(args) {150 setTimeout(function () {151 var found = prompts.find(p => p.prompt === args.prompt);152 var defaultResponse = 'Connect to your AI service for real-time responses.';153 assistObj.addPromptResponse(found ? found.response : defaultResponse);154 }, 2000);155 }156</script>157```158159---160161## Common Patterns162163### Pattern: Streaming Response with Markdown164```javascript165// Include marked.js: <script src="https://cdn.jsdelivr.net/npm/marked@latest/marked.min.js"></script>166async function streamResponse(responseText) {167 let current = '';168 let i = 0;169 while (i < responseText.length) {170 current += responseText[i++];171 if (i % 10 === 0 || i === responseText.length) {172 assistObj.addPromptResponse(marked.parse(current), i === responseText.length);173 assistObj.scrollToBottom();174 }175 await new Promise(r => setTimeout(r, 15));176 }177}178```179180### Pattern: Server-side AI Proxy (controller)181```csharp182[HttpPost]183public async Task<IActionResult> GetAIResponse([FromBody] PromptRequest request)184{185 if (string.IsNullOrEmpty(request?.Prompt))186 return BadRequest("Prompt cannot be empty.");187 // Call AI provider and return Json(responseText)188}189public class PromptRequest { public string Prompt { get; set; } }190```191192### Pattern: Reset conversation on toolbar click193```javascript194function toolbarItemClicked(args) {195 if (args.item.iconCss === 'e-icons e-refresh') {196 assistObj.prompts = [];197 assistObj.promptSuggestions = suggestions;198 }199}200```201202---203204## Key Properties at a Glance205206| Property | Type | Description |207|---|---|---|208| `Prompt` | string | Pre-set prompt text |209| `PromptPlaceholder` | string | Textarea placeholder (default: "Type prompt for assistance...") |210| `Prompts` | collection | Pre-loaded prompt/response data; supports `regeneratedResponses` for alternative responses |211| `PromptSuggestions` | string[] | Suggestion chips shown to user |212| `PromptSuggestionsHeader` | string | Header above suggestion chips |213| `PromptIconCss` | string | CSS class for prompter avatar |214| `ResponseIconCss` | string | CSS class for responder avatar (default: `e-assistview-icon`) |215| `ShowClearButton` | bool | Show clear button in textarea (default: false) |216| `EnableScrollToBottom` | bool | Show scroll-to-bottom icon (default: true) |217| `Width` / `Height` | string | Control dimensions (default: 100%) |218| `CssClass` | string | Custom CSS class for theming |219| `ActiveView` | int | Zero-based index of active view (default: 0) |220| `EnableAttachments` | bool | Enable file attachment button (default: false) |221| `ResponseToolbarSettings.Items` | collection | Response toolbar buttons; can include `e-assist-regenerate` (regenerate) and `e-assist-audio` (text-to-speech) |222| `TextToSpeechSettings` | object | Configure TTS behavior: `Language`, `SpeechPitch`, `SpeechRate`, `Volume`, `Voice` |223| `BlockTemplate` | string | Custom template for thinking/tool blocks (generative UI and Chain of Thoughts) |224| `ItemTemplate` | string | Custom template for thinking block stages in timeline |225226## Key Events227228| Event | Trigger |229|---|---|230| `Created` | Control fully rendered |231| `PromptRequest` | User submits a prompt |232| `PromptChanged` | Prompt textarea text changes |233| `BeforeAttachmentUpload` | Before file upload begins |234| `AttachmentUploadSuccess` | File uploaded successfully |235| `AttachmentUploadFailure` | File upload failed |236| `AttachmentRemoved` | Attachment removed |237238## Key Methods239240| Method | Description |241|---|---|242| `assistObj.addPromptResponse('text')` | Add string response to last prompt |243| `assistObj.addPromptResponse({prompt, response})` | Add new prompt+response pair |244| `assistObj.executePrompt('text')` | Programmatically submit a prompt |245| `assistObj.scrollToBottom()` | Scroll conversation to bottom |