namespace AIStudio.Chat;
///
/// Possible roles in the chat.
///
public enum ChatRole
{
NONE,
UNKNOWN,
SYSTEM,
USER,
AI,
}
///
/// Extensions for the ChatRole enum.
///
public static class ExtensionsChatRole
{
///
/// Returns the name of the role.
///
/// The role.
/// The name of the role.
public static string ToName(this ChatRole role) => role switch
{
ChatRole.SYSTEM => "System",
ChatRole.USER => "You",
ChatRole.AI => "AI",
_ => "Unknown",
};
///
/// Returns the color of the role.
///
/// The role.
/// The color of the role.
public static Color ToColor(this ChatRole role) => role switch
{
ChatRole.SYSTEM => Color.Info,
ChatRole.USER => Color.Primary,
ChatRole.AI => Color.Tertiary,
_ => Color.Error,
};
///
/// Returns the icon of the role.
///
/// The role.
/// The icon of the role.
public static string ToIcon(this ChatRole role) => role switch
{
ChatRole.SYSTEM => Icons.Material.Filled.Settings,
ChatRole.USER => Icons.Material.Filled.Person,
ChatRole.AI => Icons.Material.Filled.AutoAwesome,
_ => Icons.Material.Filled.Help,
};
}