mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 04:33:49 +00:00
Added chat templates (#474)
This commit is contained in:
1 parent
35eebc08a5
commit
df062ae6e6
27 files changed
+799
-21
No files matched your search
@@ -1,3 +1,5 @@
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
|
||||
namespace AIStudio.Chat;
|
||||
|
||||
/// <summary>
|
||||
@@ -19,6 +21,8 @@ public enum ChatRole
|
||||
/// </summary>
|
||||
public static class ExtensionsChatRole
|
||||
{
|
||||
private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ChatRole).Namespace, nameof(ChatRole));
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the role.
|
||||
/// </summary>
|
||||
@@ -26,11 +30,11 @@ public static class ExtensionsChatRole
|
||||
/// <returns>The name of the role.</returns>
|
||||
public static string ToName(this ChatRole role) => role switch
|
||||
{
|
||||
ChatRole.SYSTEM => "System",
|
||||
ChatRole.USER => "You",
|
||||
ChatRole.AI => "AI",
|
||||
ChatRole.SYSTEM => TB("System"),
|
||||
ChatRole.USER => TB("You"),
|
||||
ChatRole.AI => TB("AI"),
|
||||
|
||||
_ => "Unknown",
|
||||
_ => TB("Unknown"),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -60,4 +64,18 @@ public static class ExtensionsChatRole
|
||||
|
||||
_ => Icons.Material.Filled.Help,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Returns the specific name of the role for the chat template.
|
||||
/// </summary>
|
||||
/// <param name="role">The role.</param>
|
||||
/// <returns>The name of the role.</returns>
|
||||
public static string ToChatTemplateName(this ChatRole role) => role switch
|
||||
{
|
||||
ChatRole.SYSTEM => TB("System"),
|
||||
ChatRole.USER => TB("User"),
|
||||
ChatRole.AI => TB("Assistant"),
|
||||
|
||||
_ => TB("Unknown"),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user