diff --git a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor index 1f12f235..edfb9b41 100644 --- a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor +++ b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor @@ -7,7 +7,7 @@ @if (this.CurrentChatTemplate != ChatTemplate.NO_CHAT_TEMPLATE) { - @this.CurrentChatTemplate.Name + @this.CurrentChatTemplate.GetSafeName() } else diff --git a/app/MindWork AI Studio/Components/ProfileSelection.razor b/app/MindWork AI Studio/Components/ProfileSelection.razor index cab52e9b..2f9a65bd 100644 --- a/app/MindWork AI Studio/Components/ProfileSelection.razor +++ b/app/MindWork AI Studio/Components/ProfileSelection.razor @@ -6,7 +6,7 @@ @if (this.CurrentProfile != Profile.NO_PROFILE) { - @this.CurrentProfile.Name + @this.CurrentProfile.GetSafeName() } else @@ -20,7 +20,7 @@ @foreach (var profile in this.SettingsManager.ConfigurationData.Profiles.GetAllProfiles()) { - @profile.Name + @profile.GetSafeName() } diff --git a/app/MindWork AI Studio/Settings/Profile.cs b/app/MindWork AI Studio/Settings/Profile.cs index 0436beb5..9d0eddfd 100644 --- a/app/MindWork AI Studio/Settings/Profile.cs +++ b/app/MindWork AI Studio/Settings/Profile.cs @@ -22,7 +22,7 @@ public record Profile( public static readonly Profile NO_PROFILE = new() { - Name = TB("Use no profile"), + Name = TB("Use no profile"), // Cannot be localized due to being a static readonly field NeedToKnow = string.Empty, Actions = string.Empty, Id = Guid.Empty.ToString(), @@ -39,6 +39,23 @@ public record Profile( #endregion + /// + /// Gets the name of this profile. If it is the NO_PROFILE, it returns a localized string. + /// + /// + /// Why not using the Name property directly? Because the Name property of NO_PROFILE cannot be + /// localized because it is a static readonly field. So we need this method to return a localized + /// string instead. + /// + /// The name of this profile. + public string GetSafeName() + { + if(this == NO_PROFILE) + return TB("Use no profile"); + + return this.Name; + } + public string ToSystemPrompt() { if(this.Num == uint.MaxValue)