Back to Devexpress

DxAIChatPromptSuggestion.PromptMessage Property

blazor-devexpress-dot-aiintegration-dot-blazor-dot-chat-dot-dxaichatpromptsuggestion-fcba4481.md

latest3.4 KB
Original Source

DxAIChatPromptSuggestion.PromptMessage Property

Specifies the text to be displayed in the input field after a user clicks the corresponding suggestion (hint bubble).

Namespace : DevExpress.AIIntegration.Blazor.Chat

Assembly : DevExpress.AIIntegration.Blazor.Chat.v25.2.dll

NuGet Package : DevExpress.AIIntegration.Blazor.Chat

Declaration

csharp
[Parameter]
public string PromptMessage { get; set; }

Property Value

TypeDescription
String

The prompt message.

|

Remarks

Populate the component’s PromptSuggestions property with DxAIChatPromptSuggestion objects (hint bubbles). You can specify Title, Text, and PromptMessage properties for each suggestion.

Run Demo: AI Chat – Prompt Suggestions

razor
@using DevExpress.AIIntegration.Blazor.Chat

<DxAIChat Initialized="ChatInitialized">
    <PromptSuggestions>
        @foreach (var suggestion in PromptSuggestions) {
            <DxAIChatPromptSuggestion Title="@suggestion.Title"
                                      Text="@suggestion.Text"
                                      PromptMessage="@suggestion.PromptMessage" />
        }
    </PromptSuggestions>
</DxAIChat>

@code {
    List<PromptSuggestion> PromptSuggestions { get; set; }
    void ChatInitialized() {
        PromptSuggestions = GetData();
    }
}
csharp
public List<PromptSuggestion> GetData() {
    return new List<PromptSuggestion>() {
        new PromptSuggestion("Tell me a joke", "Take a break and enjoy a quick laugh", "Tell me a joke."),
        new PromptSuggestion("Summarize text", "Extract a quick summary (main ideas)", "Summarize the following text:"),
        new PromptSuggestion("Write an email", "Make your text look and sound professional", "Format text as a formal email to a client:"),
        new PromptSuggestion("Brainstorm ideas", "Get creative input for your tasks", "Help me brainstorm ideas for:"),
        new PromptSuggestion("Fix my writing", "Avoid spelling, grammar, and style errors", "Proofread the following text:"),
    };
}
public class PromptSuggestion {
    public string Title { get; set; }
    public string Text { get; set; }
    public string PromptMessage { get; set; }
    public PromptSuggestion (string title, string text, string promptMessage) {
        Title = title;
        Text = text;
        PromptMessage = promptMessage;
    }
}

Implements

PromptMessage

See Also

DxAIChatPromptSuggestion Class

DxAIChatPromptSuggestion Members

DevExpress.AIIntegration.Blazor.Chat Namespace