mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-06 15:49:40 +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
@@ -0,0 +1,13 @@
|
||||
using AIStudio.Settings;
|
||||
|
||||
namespace AIStudio.Tools;
|
||||
|
||||
public static class ChatTemplateExtensions
|
||||
{
|
||||
public static IEnumerable<ChatTemplate> GetAllChatTemplates(this IEnumerable<ChatTemplate> chatTemplates)
|
||||
{
|
||||
yield return ChatTemplate.NO_CHATTEMPLATE;
|
||||
foreach (var chatTemplate in chatTemplates)
|
||||
yield return chatTemplate;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
@@ -131,4 +130,11 @@ public static class ComponentsExtensions
|
||||
|
||||
_ => default,
|
||||
};
|
||||
|
||||
public static ChatTemplate PreselectedChatTemplate(this Components component, SettingsManager settingsManager) => component switch
|
||||
{
|
||||
Components.CHAT => settingsManager.ConfigurationData.Chat.PreselectOptions ? settingsManager.ConfigurationData.ChatTemplates.FirstOrDefault(x => x.Id == settingsManager.ConfigurationData.Chat.PreselectedChatTemplate) : default,
|
||||
|
||||
_ => default,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user