Example of AI Assistant in ASP.NET Core Rich Text Editor Control
The AI Assistant feature provides a user interface such as an AssistView inside a popup, nested dropdown with predefined prompts, and a toolbar button for interacting with an AI model.
DEMO
SOURCE
The AI Assistant feature provides a predefined user interface for integrating AI capabilities into the Rich Text Editor, enabling users to create, edit, and enhance content more efficiently.
-
The AI Assistant can be accessed via the keyboard shortcut(
Alt + Enter or ⌥ + Enter) or toolbar. - The AI Commands menu provides a predefined list of prompts useful for performing common content-related actions such as improving, shortening, elaborating, simplifying, summarizing, and checking grammar.
- The AI Query button helps to open the AI Assistant with the flexibility to provide a user defined prompt when processing the content.
Processing of the Prompt:
-
When a prompt is executed the
aiAssistantPromptRequestevent is triggered, followed by afetchrequest to the backend service to process the query. -
The response from the LLM is streamed back into the editor’s Assistant view using the
addAIPromptResponsepublic method. -
When the Stop Responding button is clicked the streaming process is cancelled by setting the
stopStreamingboolean to false.