< Summary

Information
Class: UIBlazor.Models.VisualChatMessage
Assembly: UIBlazor
File(s): /home/runner/work/InvAit/InvAit/UIBlazor/Models/VisualChatMessage.cs
Tag: 14_22728831704
Line coverage
47%
Covered lines: 10
Uncovered lines: 11
Coverable lines: 21
Total lines: 114
Line coverage: 47.6%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Id()100%11100%
get_Content()100%11100%
get_Segments()100%11100%
get_DisplayContent()100%210%
get_ReasoningContent()100%11100%
get_Timestamp()100%11100%
get_IsStreaming()100%210%
get_IsEditing()100%210%
get_TempContent()100%11100%
get_ToolDisplayName()100%11100%
get_Model()100%210%
get_Role()100%11100%
get_ToolMessages()100%11100%
get_IsExpanded()100%210%
get_PlanContent()100%210%
get_HasPlan()100%210%
get_ToolApprovalStates()100%11100%
get_RetryCountdown()100%210%
get_RetryAttempt()100%210%
get_MaxRetryAttempts()100%210%
get_IsRetrying()100%210%

File(s)

/home/runner/work/InvAit/InvAit/UIBlazor/Models/VisualChatMessage.cs

#LineLine coverage
 1using System.Text.Json.Serialization;
 2using UIBlazor.Constants;
 3
 4namespace UIBlazor.Models;
 5
 6/// <summary>
 7/// Represents a chat message.
 8/// Saved in session history
 9/// </summary>
 10public class VisualChatMessage
 11{
 12    /// <summary>
 13    /// Gets or sets the unique identifier for the message.
 14    /// </summary>
 15    [JsonIgnore]
 616    public string Id { get; set; } = DateTime.Now.ToString("s") + Guid.NewGuid().ToString();
 17
 18    /// <summary>
 19    /// Gets or sets the content of the message. Without thinking block.
 20    /// </summary>
 1021    public string Content { get; set; } = string.Empty;
 22
 23    [JsonIgnore]
 3524    public List<ContentSegment> Segments { get; set; } = [];
 25
 26    /// <summary>
 27    /// Gets or sets the content of the message for display in the UI.
 28    /// If null, Content is used.
 29    /// </summary>
 30    [JsonIgnore]
 031    public string? DisplayContent { get; set; }
 32
 33    /// <summary>
 34    /// Gets or sets the content of the Reasoning message. Aka Think block.
 35    /// </summary>
 36    [JsonIgnore]
 637    public string ReasoningContent { get; set; } = string.Empty;
 38
 39    /// <summary>
 40    /// Gets or sets the timestamp when the message was created.
 41    /// </summary>
 742    public DateTime Timestamp { get; set; } = DateTime.Now;
 43
 44    /// <summary>
 45    /// Gets or sets whether this message is currently streaming.
 46    /// </summary>
 47    [JsonIgnore]
 048    public bool IsStreaming { get; set; }
 49
 50    /// <summary>
 51    /// Gets or sets whether this message is currently being edited.
 52    /// </summary>
 53    [JsonIgnore]
 054    public bool IsEditing { get; set; }
 55
 56    /// <summary>
 57    /// Temporary storage for content during editing.
 58    /// </summary>
 59    [JsonIgnore]
 660    public string TempContent { get; set; } = string.Empty;
 61
 62    [JsonIgnore]
 663    public string ToolDisplayName { get; set; } = string.Empty;
 64
 065    public string? Model { get; set; }
 66
 67    /// <summary>
 68    /// Gets or sets the role associated with the message (e.g., "user", "assistant").
 69    /// </summary>
 1370    public string Role { get; set; } = ChatMessageRole.User;
 71
 72    /// <summary>
 73    /// Nested tool messages for assistant messages.
 74    /// </summary>
 75    [JsonIgnore]
 676    public List<VisualChatMessage> ToolMessages { get; set; } = [];
 77
 78    /// <summary>
 79    /// Whether the message block is expanded or collapsed.
 80    /// </summary>
 81    [JsonIgnore]
 082    public bool IsExpanded { get; set; }
 83
 84    /// <summary>
 85    /// Extracted plan content if any.
 86    /// </summary>
 87    [JsonIgnore]
 088    public string? PlanContent { get; set; }
 89
 90    /// <summary>
 91    /// Whether this message contains a plan.
 92    /// </summary>
 93    [JsonIgnore]
 094    public bool HasPlan => !string.IsNullOrEmpty(PlanContent);
 95
 96    /// <summary>
 97    /// Approval states for each tool call in this message.
 98    /// Key is index from 0.
 99    /// </summary>
 100    [JsonIgnore]
 6101    public Dictionary<int, ToolApprovalStatus> ToolApprovalStates { get; set; } = [];
 102
 103    [JsonIgnore]
 0104    public int RetryCountdown { get; set; }
 105
 106    [JsonIgnore]
 0107    public int RetryAttempt { get; set; }
 108
 109    [JsonIgnore]
 0110    public int MaxRetryAttempts { get; set; }
 111
 112    [JsonIgnore]
 0113    public bool IsRetrying => RetryCountdown > 0;
 114}