// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Extensions.AI;
namespace Microsoft.AspNetCore.Components.AI;
///
/// Represents a suggestion that can be displayed and sent to the agent.
///
public readonly struct Suggestion : IEquatable
{
///
/// Initializes a new instance of the struct.
///
/// The display text for the suggestion.
/// The message to send when the suggestion is selected.
public Suggestion(string text, ChatMessage message)
{
this.Text = text;
this.Message = message;
}
///
/// Initializes a new instance of the struct with a simple text message.
///
/// The display text for the suggestion, also used as the message content.
public Suggestion(string text)
{
this.Text = text;
this.Message = new ChatMessage(ChatRole.User, text);
}
///
/// Gets the display text for the suggestion.
///
public string Text { get; }
///
/// Gets the message to send when the suggestion is selected.
///
public ChatMessage Message { get; }
///
public override bool Equals(object? obj) => obj is Suggestion other && this.Equals(other);
///
public bool Equals(Suggestion other) => this.Text == other.Text;
///
public override int GetHashCode() => this.Text?.GetHashCode() ?? 0;
///
/// Determines whether two instances are equal.
///
public static bool operator ==(Suggestion left, Suggestion right) => left.Equals(right);
///
/// Determines whether two instances are not equal.
///
public static bool operator !=(Suggestion left, Suggestion right) => !left.Equals(right);
}
public partial class AgentSuggestions : IComponent
{
private RenderHandle _renderHandle;
private AgentBoundaryContext