2025-05-24 10:27:00 +00:00
|
|
|
using AIStudio.Chat;
|
|
|
|
using AIStudio.Tools.PluginSystem;
|
|
|
|
|
|
|
|
namespace AIStudio.Settings;
|
|
|
|
|
2025-08-19 07:22:33 +00:00
|
|
|
public record ChatTemplate(
|
|
|
|
uint Num,
|
|
|
|
string Id,
|
|
|
|
string Name,
|
|
|
|
string SystemPrompt,
|
|
|
|
string PredefinedUserPrompt,
|
|
|
|
List<ContentBlock> ExampleConversation,
|
|
|
|
bool AllowProfileUsage,
|
|
|
|
bool IsEnterpriseConfiguration = false,
|
|
|
|
Guid EnterpriseConfigurationPluginId = default) : IConfigurationObject
|
2025-05-24 10:27:00 +00:00
|
|
|
{
|
2025-08-18 18:40:52 +00:00
|
|
|
public ChatTemplate() : this(0, Guid.Empty.ToString(), string.Empty, string.Empty, string.Empty, [], false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-05-24 10:27:00 +00:00
|
|
|
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ChatTemplate).Namespace, nameof(ChatTemplate));
|
|
|
|
|
2025-05-24 17:11:28 +00:00
|
|
|
public static readonly ChatTemplate NO_CHAT_TEMPLATE = new()
|
2025-05-24 10:27:00 +00:00
|
|
|
{
|
|
|
|
Name = TB("Use no chat template"),
|
|
|
|
SystemPrompt = string.Empty,
|
2025-07-11 07:57:46 +00:00
|
|
|
PredefinedUserPrompt = string.Empty,
|
2025-05-24 10:27:00 +00:00
|
|
|
Id = Guid.Empty.ToString(),
|
|
|
|
Num = uint.MaxValue,
|
|
|
|
ExampleConversation = [],
|
|
|
|
AllowProfileUsage = true,
|
2025-08-18 18:40:52 +00:00
|
|
|
EnterpriseConfigurationPluginId = Guid.Empty,
|
|
|
|
IsEnterpriseConfiguration = false,
|
2025-05-24 10:27:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#region Overrides of ValueType
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 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;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
public string ToSystemPrompt()
|
|
|
|
{
|
|
|
|
if(this.Num == uint.MaxValue)
|
|
|
|
return string.Empty;
|
|
|
|
|
|
|
|
return this.SystemPrompt;
|
|
|
|
}
|
|
|
|
}
|