Getting Started with ASP.NET Core AI AssistView Control

23 Jul 20267 minutes to read

This section briefly explains about how to include the ASP.NET Core AI AssistView control in your ASP.NET Core application using Visual Studio.

Prerequisites

.NET and Visual Studio compatibility

.NET version Minimum Visual Studio version
.NET 10.0 Visual Studio 2026 18.0.0 or later
.NET 9.0 Visual Studio 2022 17.12.0 or later
.NET 8.0 Visual Studio 2022 17.8.0 or later
.NET Core SDK 3.1 Visual Studio 2019 16.4 or later
.NET Core SDK 2.0 Visual Studio 2017 15.7 or later

Browser support

Browser Versions
Google Chrome, including Android & iOS Latest Version
Mozilla Firefox Latest Version
Microsoft Edge Latest Version
Apple Safari, including iOS Latest Version
Opera Latest Version
Microsoft Internet Explorer 11

Create an ASP.NET Core Web App with Razor pages

Create an ASP.NET Core Web App using Visual Studio via Microsoft Templates or the Syncfusion® ASP.NET Core Extension. For detailed instructions, refer to the ASP.NET Core Web App Getting Started documentation.

Install the required ASP.NET Core packages

To add ASP.NET Core AI AssistView control in the app, open the NuGet package manager in Visual Studio (Tools → NuGet Package Manager → Manage NuGet Packages for Solution), search for and install the Syncfusion.AspNetCore.InteractiveChat and Syncfusion.AspNetCore.Themes packages. All Syncfusion ASP.NET Core packages are available in nuget.org. See the NuGet packages topic for details.

Alternatively, you can install the same package using the Package Manager Console with the following commands.

Install-Package Syncfusion.AspNetCore.InteractiveChat -Version 34.1.29
Install-Package Syncfusion.AspNetCore.Themes -Version 34.1.29

Add the ASP.NET Core Tag Helpers

After the packages are installed, open the ~/Pages/_ViewImports.cshtml file and import the Syncfusion.AspNetCore.Base and Syncfusion.AspNetCore.InteractiveChat Tag Helpers.

@addTagHelper *, Syncfusion.AspNetCore.Base
@addTagHelper *, Syncfusion.AspNetCore.InteractiveChat

Add stylesheet and script resources

The theme stylesheet and script are referenced from CDN. Include the stylesheet and script references inside the <head> of the ~/Pages/Shared/_Layout.cshtml

<head>
    ...
    <!-- ASP.NET Core controls styles -->
    <link rel="stylesheet" href="_content/Syncfusion.AspNetCore.Themes/styles/fluent2.css" />
    <!-- ASP.NET Core controls scripts -->
    <script src="_content/Syncfusion.AspNetCore.InteractiveChat/scripts/sf-ai-assistview.min.js"></script>
</head>

Register the Script Manager

Open the ~/Pages/Shared/_Layout.cshtml file and register the script manager <ejs-scripts> at the end of the <body> element as follows.

<body>
    ...
    <!-- ASP.NET Core Script Manager -->
    <ejs-scripts></ejs-scripts>
</body>

Add the ASP.NET Core AI AssistView control

Add the ASP.NET Core AI AssistView control in the ~/Pages/Index.cshtml file.

<div class="aiassist-container" style="height: 350px; width: 650px;">
    <ejs-aiassistview id="aiAssistView"></ejs-aiassistview>
</div>

Run the application

Press Ctrl+F5 (Windows) or +F5 (macOS) to launch the application. The ASP.NET Core AI AssistView control will render in your default web browser.

ASP.NET Core AI AssistView Control

Note: Starting from version 33.1x, when a user submits a prompt to the AI AssistView, the component automatically scrolls and focuses on the latest prompt and response. This behavior eliminates the need for users to manually scroll down to see the new response, ensuring they always view the most recent AI response without interruption. Prior to version 33.1x, the previous responses remained visible when new responses were added.

Configure suggestions and responses

You can use the promptSuggestions property to add prompt suggestions and the promptRequest event to add responses when the prompt matches the specified prompts data otherwise, the default response will be displayed.

@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" promptSuggestions="@suggestions" promptRequest="onPromptRequest" created="onCreated"></ejs-aiassistview>
</div>

<script>
    var assistObj;
    var prompts = @Html.Raw(promptsJson);
    function onCreated() {
        assistObj = this;
    }
    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>

ASP.NET Core AI AssistView default prompt