Class
Sealed
public sealed class AiMessage
Namespace: Moka.Blazor.AI.Models
A single message in an AI conversation.
Properties
| Name | Description |
|---|---|
Content |
Message content (may be streamed incrementally). |
DurationMs |
Duration of the streaming response in milliseconds. |
EstimatedTokens |
Estimated token count (approximate: chars / 4). |
IsCancelled |
Whether the user cancelled/stopped this response mid-stream. |
IsStreaming |
Whether this message is still being streamed. |
Role |
Role of the message author. |
Timestamp |
When the message was created. |
Content
string AiMessage.Content { get; set; }
Message content (may be streamed incrementally).
DurationMs
long AiMessage.DurationMs { get; set; }
Duration of the streaming response in milliseconds.
EstimatedTokens
int AiMessage.EstimatedTokens { get; set; }
Estimated token count (approximate: chars / 4).
IsCancelled
bool AiMessage.IsCancelled { get; set; }
Whether the user cancelled/stopped this response mid-stream.
IsStreaming
bool AiMessage.IsStreaming { get; set; }
Whether this message is still being streamed.
Role
AiMessageRole AiMessage.Role { get; init; }
Role of the message author.
Timestamp
DateTimeOffset AiMessage.Timestamp { get; init; }
When the message was created.
View Source
/// <summary>
/// A single message in an AI conversation.
/// </summary>
public sealed class AiMessage
{
/// <summary>Role of the message author.</summary>
public required AiMessageRole Role { get; init; }
/// <summary>Message content (may be streamed incrementally).</summary>
public string Content { get; set; } = "";
/// <summary>When the message was created.</summary>
public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow;
/// <summary>Whether this message is still being streamed.</summary>
public bool IsStreaming { get; set; }
/// <summary>Whether the user cancelled/stopped this response mid-stream.</summary>
public bool IsCancelled { get; set; }
/// <summary>Duration of the streaming response in milliseconds.</summary>
public long DurationMs { get; set; }
/// <summary>Estimated token count (approximate: chars / 4).</summary>
public int EstimatedTokens { get; set; }
}