Fixed small issues (#610)
Build and Release / Read metadata (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis updater) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage deb updater) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2025-12-30 20:29:19 +01:00
1 parent e9485ca8ea
commit 0bb5b81bd0
6 files changed
+34 -18

No files matched your search

@@ -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()