mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 20:01:37 +00:00
Fixed localization issue in "No chat template" entry.
This commit is contained in:
parent
ccb0c1d8bd
commit
838c375d42
@ -5194,9 +5194,6 @@ UI_TEXT_CONTENT["AISTUDIO::PROVIDER::LLMPROVIDERSEXTENSIONS::T3424652889"] = "Un
|
||||
-- no model selected
|
||||
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::MODEL::T2234274832"] = "no model selected"
|
||||
|
||||
-- Use no chat template
|
||||
UI_TEXT_CONTENT["AISTUDIO::SETTINGS::CHATTEMPLATE::T4258819635"] = "Use no chat template"
|
||||
|
||||
-- Navigation never expands, but there are tooltips
|
||||
UI_TEXT_CONTENT["AISTUDIO::SETTINGS::CONFIGURATIONSELECTDATAFACTORY::T1095779033"] = "Navigation never expands, but there are tooltips"
|
||||
|
||||
|
||||
@ -16,14 +16,14 @@
|
||||
}
|
||||
</ActivatorContent>
|
||||
<ChildContent>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Label="@T("Manage your templates")" OnClick="async () => await this.OpenSettingsDialog()" />
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Label="@T("Manage your templates")" OnClick="@(async () => await this.OpenSettingsDialog())" />
|
||||
<MudDivider/>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.AddComment" Label="@T("Create template from current chat")" OnClick="async () => await this.CreateNewChatTemplateFromChat()" Disabled="@(!this.CanChatThreadBeUsedForTemplate)"/>
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.AddComment" Label="@T("Create template from current chat")" OnClick="@(async () => await this.CreateNewChatTemplateFromChat())" Disabled="@(!this.CanChatThreadBeUsedForTemplate)"/>
|
||||
<MudDivider/>
|
||||
@foreach (var chatTemplate in this.SettingsManager.ConfigurationData.ChatTemplates.GetAllChatTemplates())
|
||||
{
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.RateReview" OnClick="async () => await this.SelectionChanged(chatTemplate)">
|
||||
@chatTemplate.Name
|
||||
<MudMenuItem Icon="@Icons.Material.Filled.RateReview" OnClick="@(async () => await this.SelectionChanged(chatTemplate))">
|
||||
@chatTemplate.GetSafeName()
|
||||
</MudMenuItem>
|
||||
}
|
||||
</ChildContent>
|
||||
|
||||
@ -16,6 +16,8 @@ public record ChatTemplate(
|
||||
bool IsEnterpriseConfiguration = false,
|
||||
Guid EnterpriseConfigurationPluginId = default) : ConfigurationBaseObject
|
||||
{
|
||||
private const string USE_NO_CHAT_TEMPLATE_TEXT = "Use no chat template";
|
||||
|
||||
public ChatTemplate() : this(0, Guid.Empty.ToString(), string.Empty, string.Empty, string.Empty, [], false)
|
||||
{
|
||||
}
|
||||
@ -26,7 +28,7 @@ public record ChatTemplate(
|
||||
|
||||
public static readonly ChatTemplate NO_CHAT_TEMPLATE = new()
|
||||
{
|
||||
Name = TB("Use no chat template"),
|
||||
Name = TB(USE_NO_CHAT_TEMPLATE_TEXT), // Cannot be localized due to being a static readonly field
|
||||
SystemPrompt = string.Empty,
|
||||
PredefinedUserPrompt = string.Empty,
|
||||
Id = Guid.Empty.ToString(),
|
||||
@ -43,9 +45,26 @@ public record ChatTemplate(
|
||||
/// Returns a string that represents the profile in a human-readable format.
|
||||
/// </summary>
|
||||
/// <returns>A string that represents the profile in a human-readable format.</returns>
|
||||
public override string ToString() => this.Name;
|
||||
public override string ToString() => this.GetSafeName();
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of this chat template. If it is the NO_CHAT_TEMPLATE, it returns a localized string.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Why not using the Name property directly? Because the Name property of NO_CHAT_TEMPLATE 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 chat template.</returns>
|
||||
public string GetSafeName()
|
||||
{
|
||||
if(this == NO_CHAT_TEMPLATE)
|
||||
return TB(USE_NO_CHAT_TEMPLATE_TEXT);
|
||||
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
public string ToSystemPrompt()
|
||||
{
|
||||
|
||||
@ -207,7 +207,7 @@ public static class ConfigurationSelectDataFactory
|
||||
public static IEnumerable<ConfigurationSelectData<string>> GetChatTemplatesData(IEnumerable<ChatTemplate> chatTemplates)
|
||||
{
|
||||
foreach (var chatTemplate in chatTemplates.GetAllChatTemplates())
|
||||
yield return new(chatTemplate.Name, chatTemplate.Id);
|
||||
yield return new(chatTemplate.GetSafeName(), chatTemplate.Id);
|
||||
}
|
||||
|
||||
public static IEnumerable<ConfigurationSelectData<ConfidenceSchemes>> GetConfidenceSchemesData()
|
||||
|
||||
@ -20,4 +20,5 @@
|
||||
- Fixed a visual bug where a function's preview status was misaligned. You might have seen it in document analysis or the ERI server assistant.
|
||||
- Fixed a rare bug in the Microsoft Word export for huge documents.
|
||||
- Fixed a bug in the chat options that occurred when selecting default data sources. Under certain conditions, selecting data sources caused an error that required restarting the app. This preview-only feature (RAG preview) had not been released yet.
|
||||
- Fixed a bug in the chat template selection where the "No chat template" entry could not be localized, causing English text to appear in languages such as German. This behavior has now been fixed.
|
||||
- Upgraded dependencies such as Rust, MudBlazor, and others.
|
||||
Loading…
Reference in New Issue
Block a user