using AIStudio.Components; using Microsoft.AspNetCore.Components; namespace AIStudio.Assistants.ModelComparison; /// /// Why the judge chose so, in justified paragraphs with hyphenation. /// /// /// The judge writes its line breaks itself, and they belong to it. MudJustifiedText sets the style of its own, so /// that it cannot keep line breaks with white-space: pre-wrap; every line of the reasoning becomes a paragraph instead. /// public partial class ModelComparisonJudgeReasoning : MSGComponentBase { /// /// Gets or sets the reasoning of the judge. /// [Parameter, EditorRequired] public string Reasoning { get; set; } = string.Empty; /// /// The paragraphs of the reasoning shown, without empty lines. /// private string[] paragraphs = []; /// /// The reasoning which paragraphs was built from. /// private string? shownReasoning; #region Overrides of ComponentBase protected override void OnParametersSet() { if (!string.Equals(this.shownReasoning, this.Reasoning, StringComparison.Ordinal)) { this.shownReasoning = this.Reasoning; this.paragraphs = this.Reasoning.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); } base.OnParametersSet(); } #endregion }