From 0bb5b81bd03c65b4bc6d575a24c51272a358270d Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Tue, 30 Dec 2025 20:29:19 +0100 Subject: [PATCH] Fixed small issues (#610) --- .../Assistants/I18N/allTexts.lua | 3 --- .../Components/ChatComponent.razor | 15 ++++++------ .../Components/ChatTemplateSelection.razor | 8 +++---- .../Settings/ChatTemplate.cs | 23 +++++++++++++++++-- .../ConfigurationSelectDataFactory.cs | 2 +- .../wwwroot/changelog/v0.9.55.md | 1 + 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 497e4bd4..a535e468 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -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" diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor b/app/MindWork AI Studio/Components/ChatComponent.razor index 1eb28244..6396ba9a 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor +++ b/app/MindWork AI Studio/Components/ChatComponent.razor @@ -59,43 +59,42 @@ && this.SettingsManager.ConfigurationData.Workspace.DisplayBehavior is WorkspaceDisplayBehavior.TOGGLE_OVERLAY) { - + } @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY) { - + } - + @if (!string.IsNullOrWhiteSpace(this.currentWorkspaceName)) { - + } - @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) { - + } @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES) { - + } @@ -107,7 +106,7 @@ @if (this.isStreaming && this.cancellationTokenSource is not null) { - + } diff --git a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor index 624520de..1f12f235 100644 --- a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor +++ b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor @@ -16,14 +16,14 @@ } - + - + @foreach (var chatTemplate in this.SettingsManager.ConfigurationData.ChatTemplates.GetAllChatTemplates()) { - - @chatTemplate.Name + + @chatTemplate.GetSafeName() } diff --git a/app/MindWork AI Studio/Settings/ChatTemplate.cs b/app/MindWork AI Studio/Settings/ChatTemplate.cs index 38f3623d..54d37ce3 100644 --- a/app/MindWork AI Studio/Settings/ChatTemplate.cs +++ b/app/MindWork AI Studio/Settings/ChatTemplate.cs @@ -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. /// /// A string that represents the profile in a human-readable format. - public override string ToString() => this.Name; + public override string ToString() => this.GetSafeName(); #endregion + + /// + /// Gets the name of this chat template. If it is the NO_CHAT_TEMPLATE, it returns a localized string. + /// + /// + /// 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. + /// + /// The name of this chat template. + public string GetSafeName() + { + if(this == NO_CHAT_TEMPLATE) + return TB(USE_NO_CHAT_TEMPLATE_TEXT); + + return this.Name; + } public string ToSystemPrompt() { diff --git a/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs b/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs index 5004dc43..5d868307 100644 --- a/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs +++ b/app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs @@ -207,7 +207,7 @@ public static class ConfigurationSelectDataFactory public static IEnumerable> GetChatTemplatesData(IEnumerable chatTemplates) { foreach (var chatTemplate in chatTemplates.GetAllChatTemplates()) - yield return new(chatTemplate.Name, chatTemplate.Id); + yield return new(chatTemplate.GetSafeName(), chatTemplate.Id); } public static IEnumerable> GetConfidenceSchemesData() diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md index 9dfc2fe8..9a04b6f7 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md @@ -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. \ No newline at end of file