BaseAIContextMenuItem Class
Implements the base functionality of AI-powered context menu items.
Namespace: DevExpress.AIIntegration.Blazor.RichEdit
Assembly: DevExpress.AIIntegration.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.AIIntegration.Blazor.RichEdit
Declaration
public abstract class BaseAIContextMenuItem :
BasePopupItem
Remarks
Use the BaseAIContextMenuItem
class to implement a custom AI-powered context menu item.
Create the
BaseAIContextMenuItem
class successor. Specify its text and provide a custom prompt.public class ShakespeareAIContextMenuItem : BaseAIContextMenuItem { [Inject] IAIExtensionsContainer? aIExtensionsContainer { get; set; } protected override string DefaultItemText => "Rewrite like Shakespeare"; protected override Task<TextResponse> GetCommandTextResult(string text) { var customExtension = aIExtensionsContainer.CreateCustomPromptExtension(); return customExtension.ExecuteAsync(new CustomPromptRequest("Rewrite the following text in William Shakespeare style.", text)); } }
Add the new item to the AdditionalItems collection.
@using DevExpress.AIIntegration.Blazor.RichEdit @using DevExpress.Blazor.RichEdit <DxRichEdit DocumentContent="DocumentContent" CssClass="my-editor"> <AdditionalItems> <ShakespeareAIContextMenuItem /> ... </AdditionalItems> </DxRichEdit>
Inheritance
Object
ComponentBase
DevExpress.AIIntegration.Blazor.Internal.BasePopupItem
See Also