mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-14 15:21:37 +00:00
Fixed localization of profiles
This commit is contained in:
parent
324ea9eb73
commit
7bf609b7f0
@ -7,7 +7,7 @@
|
|||||||
@if (this.CurrentChatTemplate != ChatTemplate.NO_CHAT_TEMPLATE)
|
@if (this.CurrentChatTemplate != ChatTemplate.NO_CHAT_TEMPLATE)
|
||||||
{
|
{
|
||||||
<MudButton IconSize="Size.Large" StartIcon="@Icons.Material.Filled.RateReview" IconColor="Color.Default">
|
<MudButton IconSize="Size.Large" StartIcon="@Icons.Material.Filled.RateReview" IconColor="Color.Default">
|
||||||
@this.CurrentChatTemplate.Name
|
@this.CurrentChatTemplate.GetSafeName()
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
@if (this.CurrentProfile != Profile.NO_PROFILE)
|
@if (this.CurrentProfile != Profile.NO_PROFILE)
|
||||||
{
|
{
|
||||||
<MudButton IconSize="Size.Large" StartIcon="@Icons.Material.Filled.Person4" IconColor="Color.Default">
|
<MudButton IconSize="Size.Large" StartIcon="@Icons.Material.Filled.Person4" IconColor="Color.Default">
|
||||||
@this.CurrentProfile.Name
|
@this.CurrentProfile.GetSafeName()
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -20,7 +20,7 @@
|
|||||||
@foreach (var profile in this.SettingsManager.ConfigurationData.Profiles.GetAllProfiles())
|
@foreach (var profile in this.SettingsManager.ConfigurationData.Profiles.GetAllProfiles())
|
||||||
{
|
{
|
||||||
<MudMenuItem Icon="@this.ProfileIcon(profile)" OnClick="() => this.SelectionChanged(profile)">
|
<MudMenuItem Icon="@this.ProfileIcon(profile)" OnClick="() => this.SelectionChanged(profile)">
|
||||||
@profile.Name
|
@profile.GetSafeName()
|
||||||
</MudMenuItem>
|
</MudMenuItem>
|
||||||
}
|
}
|
||||||
</ChildContent>
|
</ChildContent>
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public record Profile(
|
|||||||
|
|
||||||
public static readonly Profile NO_PROFILE = new()
|
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,
|
NeedToKnow = string.Empty,
|
||||||
Actions = string.Empty,
|
Actions = string.Empty,
|
||||||
Id = Guid.Empty.ToString(),
|
Id = Guid.Empty.ToString(),
|
||||||
@ -39,6 +39,23 @@ public record Profile(
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of this profile. If it is the NO_PROFILE, it returns a localized string.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>The name of this profile.</returns>
|
||||||
|
public string GetSafeName()
|
||||||
|
{
|
||||||
|
if(this == NO_PROFILE)
|
||||||
|
return TB("Use no profile");
|
||||||
|
|
||||||
|
return this.Name;
|
||||||
|
}
|
||||||
|
|
||||||
public string ToSystemPrompt()
|
public string ToSystemPrompt()
|
||||||
{
|
{
|
||||||
if(this.Num == uint.MaxValue)
|
if(this.Num == uint.MaxValue)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user