New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Kendo UI AIPrompt TagHelper AIPromptTagHelper class.

Definition

Namespace:Kendo.Mvc.TagHelpers

Assembly:Kendo.Mvc.dll

Syntax:

C#
[HtmlTargetElement("kendo-aiprompt")]
[HtmlTargetElement("ai-assistant", ParentTag = "ai", TagStructure = TagStructure.NormalOrSelfClosing)]
[RestrictChildren("prompt-outputs", new string[] { "toolbar-items", "aiprompt-views", "messages", "service", "output-actions", "prompt-text-area", "speech-to-text", "output-template", "prompt-suggestion-item-template" })]
public class AIPromptTagHelper : TagHelperBase, ITagHelper, ITagHelperComponent, ITemplateComponent

Inheritance: objectTagHelperTagHelperBaseAIPromptTagHelper

Implements: ITagHelperITagHelperComponentITemplateComponent

Inherited Members TagHelperBase.MinimumValidatorTagHelperBase.MaximumValidatorTagHelperBase.Init(TagHelperContext)TagHelperBase.Process(TagHelperContext, TagHelperOutput)TagHelperBase.GetInitializator()TagHelperBase.VerifySettings()TagHelperBase.SerializeTemplates()TagHelperBase.GenerateId(TagHelperOutput)TagHelperBase.CreateHandler(string)TagHelperBase.GetRangeValidationParameter<TValue>(ModelExplorer, string)TagHelperBase.ExtractEditFormat(string)TagHelperBase.ToDictionaryHandler(IDictionary<string, string>)TagHelperBase.AddSelfToTemplate(TagHelperContext)TagHelperBase.ViewContextTagHelperBase.GeneratorTagHelperBase.InitializerTagHelperBase.WriterTagHelperBase.ScriptAttributesTagHelperBase.NameTagHelperBase.IdTagHelperBase.SelectorTagHelperBase.IdPrefixTagHelperBase.IsInClientTemplateTagHelperBase.DeferredTagHelperBase.AsModuleTagHelper.Orderobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Example:

csharp
@addTagHelper *, Kendo.Mvc

<kendo-aiprompt name="aiprompt" active-view="0"></kendo-aiprompt>

Constructors

Initializes a new instance of the AIPromptTagHelper class.

C#
public AIPromptTagHelper(IKendoHtmlGenerator generator)
Parameters:generatorIKendoHtmlGenerator

Properties

Specifies the index of the active view or the name of the view.

C#
public object ActiveView { get; set; }

Specifies whether the prompt outputs are HTML-encoded before being displayed in the output view. When set to true (default), the output is encoded and displayed as plain text, preventing any HTML formatting or scripts from being rendered.

C#
public bool? EncodedPromptOutputs { get; set; }

The name of the JavaScript function that will handle the commandExecute event. Triggered when a command item from the Commands view is clicked. The panel bar dataItem of the selected item is available through the event argument.

C#
public string OnCommandExecute { get; set; }

The name of the JavaScript function that will handle the kendoKeydown event. Triggered when the user presses a keyboard key while the AIPrompt is focused.The event handler function context (available via the this keyword) will be set to the widget instance.

C#
public string OnKendoKeydown { get; set; }

The name of the JavaScript function that will handle the outputAction event. Triggered when an action button on an output card is clicked. This event is fired for both built-in and custom actions.

C#
public string OnOutputAction { get; set; }

The name of the JavaScript function that will handle the outputCopy event. This event is deprecated. Use the outputAction event instead.Triggered when the copy output button of an output is clicked. The prompt and the output object are available through the event argument.

C#
public string OnOutputCopy { get; set; }

The name of the JavaScript function that will handle the outputRatingChange event. This event is deprecated. Use the outputAction event instead.Triggered when the rating of an output is changed through the rate buttons of an output. The output id and the new rating are available through the event argument.

C#
public string OnOutputRatingChange { get; set; }

The name of the JavaScript function that will handle the promptRequest event. Triggered when the prompt view Generate output button is clicked. The prompt text is available through the event argument. Suitable to make a request to the AI service to receive an output. Use the addPromptOutput method to add the generated output to the promptOutputs collection.The prompt, output, history and isRetry properties are available in the event argument. When the output is generated after clicking the retry button of an output, the isRetry property is true and the output property is the output content of the output card. The history property is an array of prompt outputs generated before the current output.You can prevent the default behavior of the promptRequest event by calling e.preventDefault() in the event handler.

C#
public string OnPromptRequest { get; set; }

The name of the JavaScript function that will handle the promptRequestCancel event. Triggered when a prompt request is cancelled, typically by clicking the stop generation button during streaming operations.

C#
public string OnPromptRequestCancel { get; set; }

The name of the JavaScript function that will handle the promptResponse event. Triggered when the AI service response is received. The response data is available through the event argument. Triggered only when the serviceUrl option is set.You can prevent the default behavior of the promptResponse event by calling e.preventDefault() in the event handler.

C#
public string OnPromptResponse { get; set; }

A template function for customizing the display of output content. This function is called when an output has finished streaming and final content needs to be rendered.The function receives an object with output (the output data) and content (the output text) properties and should return HTML string.

C#
public string OutputTemplate { get; set; }

A template function for customizing the display of output content. This function is called when an output has finished streaming and final content needs to be rendered.The function receives an object with output (the output data) and content (the output text) properties and should return HTML string. This option expects the name of a JavaScript function that will be called to return the template.

C#
public string OutputTemplateHandler { get; set; }

A template function for customizing the display of output content. This function is called when an output has finished streaming and final content needs to be rendered.The function receives an object with output (the output data) and content (the output text) properties and should return HTML string. This option expects the ID of the script element that contains the template.

C#
public string OutputTemplateId { get; set; }

A template function for customizing the display of output content. This function is called when an output has finished streaming and final content needs to be rendered.The function receives an object with output (the output data) and content (the output text) properties and should return HTML string. This option expects the IHtmlContent instance containing the created HTML.

C#
public IHtmlContent OutputTemplateView { get; set; }

The template of the prompt suggestion item. It can be a string, a function or a Kendo Template.

C#
public string PromptSuggestionItemTemplate { get; set; }

The template of the prompt suggestion item. It can be a string, a function or a Kendo Template. This option expects the name of a JavaScript function that will be called to return the template.

C#
public string PromptSuggestionItemTemplateHandler { get; set; }

The template of the prompt suggestion item. It can be a string, a function or a Kendo Template. This option expects the ID of the script element that contains the template.

C#
public string PromptSuggestionItemTemplateId { get; set; }

The template of the prompt suggestion item. It can be a string, a function or a Kendo Template. This option expects the IHtmlContent instance containing the created HTML.

C#
public IHtmlContent PromptSuggestionItemTemplateView { get; set; }

An array of prompt suggestions as strings to display in the prompt view. The suggestions can be clicked to populate the prompt input.

C#
public ICollection<string> PromptSuggestions { get; set; }

The URL of the AI service to use for generating outputs.

C#
[HtmlAttributeName("service")]
public string ServiceValue { get; set; }

Specifies if the output rating should be displayed on the output card. > Note: This property is deprecated. Use the outputActions configuration instead.

C#
[Obsolete]
public bool? ShowOutputRating { get; set; }

Controls whether the subtitle of the card in the output view displays a tooltip containing the full content of the subtitle, which is the prompt used to generate the output.

C#
public bool? ShowOutputSubtitleTooltip { get; set; }

Configures the templates for the AIPrompt.

C#
[HtmlAttributeNotBound]
public IDictionary<string, string> Templates { get; }

Implements: ITemplateComponent.Templates

Methods

Gets the initialization script.

C#
protected override string GetInitializationScript()
Returns:

string

The initialization script.

Overrides: TagHelperBase.GetInitializationScript()

C#
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Parameters:contextTagHelperContextoutputTagHelperOutputReturns:

Task

Overrides: TagHelper.ProcessAsync(TagHelperContext, TagHelperOutput)

Serializes the defined settings.

C#
public override IDictionary<string, object> Serialize()
Returns:

IDictionary<string, object>

Overrides: TagHelperBase.Serialize()

SerializeEvents method.

C#
protected override Dictionary<string, object> SerializeEvents()
Returns:

Dictionary<string, object>

Overrides: TagHelperBase.SerializeEvents()

SerializeSettings method.

C#
protected override Dictionary<string, object> SerializeSettings()
Returns:

Dictionary<string, object>

Overrides: TagHelperBase.SerializeSettings()

Writes the HTML output.

C#
protected override void WriteHtml(TagHelperOutput output)
Parameters:outputTagHelperOutput

The TagHelper output.

Overrides: TagHelperBase.WriteHtml(TagHelperOutput)