Skip to content

Commit 0bb5b81

Browse files
Fixed small issues (#610)
1 parent e9485ca commit 0bb5b81

File tree

6 files changed

+34
-18
lines changed

6 files changed

+34
-18
lines changed

app/MindWork AI Studio/Assistants/I18N/allTexts.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5194,9 +5194,6 @@ UI_TEXT_CONTENT["AISTUDIO::PROVIDER::LLMPROVIDERSEXTENSIONS::T3424652889"] = "Un
51945194
-- no model selected
51955195
UI_TEXT_CONTENT["AISTUDIO::PROVIDER::MODEL::T2234274832"] = "no model selected"
51965196

5197-
-- Use no chat template
5198-
UI_TEXT_CONTENT["AISTUDIO::SETTINGS::CHATTEMPLATE::T4258819635"] = "Use no chat template"
5199-
52005197
-- Navigation never expands, but there are tooltips
52015198
UI_TEXT_CONTENT["AISTUDIO::SETTINGS::CONFIGURATIONSELECTDATAFACTORY::T1095779033"] = "Navigation never expands, but there are tooltips"
52025199

app/MindWork AI Studio/Components/ChatComponent.razor

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,42 @@
5959
&& this.SettingsManager.ConfigurationData.Workspace.DisplayBehavior is WorkspaceDisplayBehavior.TOGGLE_OVERLAY)
6060
{
6161
<MudTooltip Text="@T("Show your workspaces")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
62-
<MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" OnClick="() => this.ToggleWorkspaceOverlay()"/>
62+
<MudIconButton Icon="@Icons.Material.Filled.SnippetFolder" OnClick="@(() => this.ToggleWorkspaceOverlay())"/>
6363
</MudTooltip>
6464
}
6565

6666
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_MANUALLY)
6767
{
6868
<MudTooltip Text="@T("Save chat")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
69-
<MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="() => this.SaveThread()" Disabled="@(!this.CanThreadBeSaved)"/>
69+
<MudIconButton Icon="@Icons.Material.Filled.Save" OnClick="@(() => this.SaveThread())" Disabled="@(!this.CanThreadBeSaved)"/>
7070
</MudTooltip>
7171
}
7272

7373
<MudTooltip Text="@T("Start temporary chat")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
74-
<MudIconButton Icon="@Icons.Material.Filled.AddComment" OnClick="() => this.StartNewChat(useSameWorkspace: false)"/>
74+
<MudIconButton Icon="@Icons.Material.Filled.AddComment" OnClick="@(() => this.StartNewChat(useSameWorkspace: false))"/>
7575
</MudTooltip>
7676

7777
@if (!string.IsNullOrWhiteSpace(this.currentWorkspaceName))
7878
{
7979
<MudTooltip Text="@this.TooltipAddChatToWorkspace" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
80-
<MudIconButton Icon="@Icons.Material.Filled.CommentBank" OnClick="() => this.StartNewChat(useSameWorkspace: true)"/>
80+
<MudIconButton Icon="@Icons.Material.Filled.CommentBank" OnClick="@(() => this.StartNewChat(useSameWorkspace: true))"/>
8181
</MudTooltip>
8282
}
8383

8484
<ChatTemplateSelection CanChatThreadBeUsedForTemplate="@this.CanThreadBeSaved" CurrentChatThread="@this.ChatThread" CurrentChatTemplate="@this.currentChatTemplate" CurrentChatTemplateChanged="@this.ChatTemplateWasChanged"/>
85-
8685
<AttachDocuments Name="File Attachments" @bind-DocumentPaths="@this.chatDocumentPaths" CatchAllDocuments="true" UseSmallForm="true" Provider="@this.Provider"/>
8786

8887
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY)
8988
{
9089
<MudTooltip Text="@T("Delete this chat & start a new one.")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
91-
<MudIconButton Icon="@Icons.Material.Filled.Refresh" OnClick="() => this.StartNewChat(useSameWorkspace: true, deletePreviousChat: true)" Disabled="@(!this.CanThreadBeSaved)"/>
90+
<MudIconButton Icon="@Icons.Material.Filled.Refresh" OnClick="@(() => this.StartNewChat(useSameWorkspace: true, deletePreviousChat: true))" Disabled="@(!this.CanThreadBeSaved)"/>
9291
</MudTooltip>
9392
}
9493

9594
@if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is not WorkspaceStorageBehavior.DISABLE_WORKSPACES)
9695
{
9796
<MudTooltip Text="@T("Move the chat to a workspace, or to another if it is already in one.")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
98-
<MudIconButton Icon="@Icons.Material.Filled.MoveToInbox" Disabled="@(!this.CanThreadBeSaved)" OnClick="() => this.MoveChatToWorkspace()"/>
97+
<MudIconButton Icon="@Icons.Material.Filled.MoveToInbox" Disabled="@(!this.CanThreadBeSaved)" OnClick="@(() => this.MoveChatToWorkspace())"/>
9998
</MudTooltip>
10099
}
101100

@@ -107,7 +106,7 @@
107106
@if (this.isStreaming && this.cancellationTokenSource is not null)
108107
{
109108
<MudTooltip Text="@T("Stop generation")" Placement="@TOOLBAR_TOOLTIP_PLACEMENT">
110-
<MudIconButton Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="() => this.CancelStreaming()"/>
109+
<MudIconButton Icon="@Icons.Material.Filled.Stop" Color="Color.Error" OnClick="@(() => this.CancelStreaming())"/>
111110
</MudTooltip>
112111
}
113112

app/MindWork AI Studio/Components/ChatTemplateSelection.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
}
1717
</ActivatorContent>
1818
<ChildContent>
19-
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Label="@T("Manage your templates")" OnClick="async () => await this.OpenSettingsDialog()" />
19+
<MudMenuItem Icon="@Icons.Material.Filled.Settings" Label="@T("Manage your templates")" OnClick="@(async () => await this.OpenSettingsDialog())" />
2020
<MudDivider/>
21-
<MudMenuItem Icon="@Icons.Material.Filled.AddComment" Label="@T("Create template from current chat")" OnClick="async () => await this.CreateNewChatTemplateFromChat()" Disabled="@(!this.CanChatThreadBeUsedForTemplate)"/>
21+
<MudMenuItem Icon="@Icons.Material.Filled.AddComment" Label="@T("Create template from current chat")" OnClick="@(async () => await this.CreateNewChatTemplateFromChat())" Disabled="@(!this.CanChatThreadBeUsedForTemplate)"/>
2222
<MudDivider/>
2323
@foreach (var chatTemplate in this.SettingsManager.ConfigurationData.ChatTemplates.GetAllChatTemplates())
2424
{
25-
<MudMenuItem Icon="@Icons.Material.Filled.RateReview" OnClick="async () => await this.SelectionChanged(chatTemplate)">
26-
@chatTemplate.Name
25+
<MudMenuItem Icon="@Icons.Material.Filled.RateReview" OnClick="@(async () => await this.SelectionChanged(chatTemplate))">
26+
@chatTemplate.GetSafeName()
2727
</MudMenuItem>
2828
}
2929
</ChildContent>

app/MindWork AI Studio/Settings/ChatTemplate.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public record ChatTemplate(
1616
bool IsEnterpriseConfiguration = false,
1717
Guid EnterpriseConfigurationPluginId = default) : ConfigurationBaseObject
1818
{
19+
private const string USE_NO_CHAT_TEMPLATE_TEXT = "Use no chat template";
20+
1921
public ChatTemplate() : this(0, Guid.Empty.ToString(), string.Empty, string.Empty, string.Empty, [], false)
2022
{
2123
}
@@ -26,7 +28,7 @@ public ChatTemplate() : this(0, Guid.Empty.ToString(), string.Empty, string.Empt
2628

2729
public static readonly ChatTemplate NO_CHAT_TEMPLATE = new()
2830
{
29-
Name = TB("Use no chat template"),
31+
Name = TB(USE_NO_CHAT_TEMPLATE_TEXT), // Cannot be localized due to being a static readonly field
3032
SystemPrompt = string.Empty,
3133
PredefinedUserPrompt = string.Empty,
3234
Id = Guid.Empty.ToString(),
@@ -43,9 +45,26 @@ public ChatTemplate() : this(0, Guid.Empty.ToString(), string.Empty, string.Empt
4345
/// Returns a string that represents the profile in a human-readable format.
4446
/// </summary>
4547
/// <returns>A string that represents the profile in a human-readable format.</returns>
46-
public override string ToString() => this.Name;
48+
public override string ToString() => this.GetSafeName();
4749

4850
#endregion
51+
52+
/// <summary>
53+
/// Gets the name of this chat template. If it is the NO_CHAT_TEMPLATE, it returns a localized string.
54+
/// </summary>
55+
/// <remarks>
56+
/// Why not using the Name property directly? Because the Name property of NO_CHAT_TEMPLATE cannot be
57+
/// localized because it is a static readonly field. So we need this method to return a localized
58+
/// string instead.
59+
/// </remarks>
60+
/// <returns>The name of this chat template.</returns>
61+
public string GetSafeName()
62+
{
63+
if(this == NO_CHAT_TEMPLATE)
64+
return TB(USE_NO_CHAT_TEMPLATE_TEXT);
65+
66+
return this.Name;
67+
}
4968

5069
public string ToSystemPrompt()
5170
{

app/MindWork AI Studio/Settings/ConfigurationSelectDataFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public static IEnumerable<ConfigurationSelectData<string>> GetProfilesData(IEnum
207207
public static IEnumerable<ConfigurationSelectData<string>> GetChatTemplatesData(IEnumerable<ChatTemplate> chatTemplates)
208208
{
209209
foreach (var chatTemplate in chatTemplates.GetAllChatTemplates())
210-
yield return new(chatTemplate.Name, chatTemplate.Id);
210+
yield return new(chatTemplate.GetSafeName(), chatTemplate.Id);
211211
}
212212

213213
public static IEnumerable<ConfigurationSelectData<ConfidenceSchemes>> GetConfidenceSchemesData()

app/MindWork AI Studio/wwwroot/changelog/v0.9.55.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
- 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.
2121
- Fixed a rare bug in the Microsoft Word export for huge documents.
2222
- 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.
23+
- 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.
2324
- Upgraded dependencies such as Rust, MudBlazor, and others.

0 commit comments

Comments
 (0)