diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 01dbb5ca..83ed2620 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -1414,6 +1414,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATCOMPONENT::T636393754"] = "Move the c -- Show your workspaces UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATCOMPONENT::T733672375"] = "Show your workspaces" +-- Create template from current chat +UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATTEMPLATESELECTION::T1112722156"] = "Create template from current chat" + -- Start a new chat with a chat template UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATTEMPLATESELECTION::T1333844707"] = "Start a new chat with a chat template" @@ -2197,18 +2200,30 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T1847791252"] = "Update" -- The chat template name must not exceed 40 characters. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T204496403"] = "The chat template name must not exceed 40 characters." +-- Profile Usage +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2147062613"] = "Profile Usage" + -- Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2292424657"] = "Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs." -- Role UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2418769465"] = "Role" +-- What predefined user input do you want to use? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2501284417"] = "What predefined user input do you want to use?" + -- Tell the AI your system prompt. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2552381261"] = "Tell the AI your system prompt." -- No, prohibit profile use for this template UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2579080722"] = "No, prohibit profile use for this template" +-- You might want to predefine a first message that will be copied into the user prompt, when you use this chat template. This message could for example be a blueprint for a structured message that this chat template is defined to work with. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2579208700"] = "You might want to predefine a first message that will be copied into the user prompt, when you use this chat template. This message could for example be a blueprint for a structured message that this chat template is defined to work with." + +-- Predefined User Input +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2607897066"] = "Predefined User Input" + -- Entry UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2629823795"] = "Entry" @@ -2263,6 +2278,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T3893704289"] = "Message -- Use the default system prompt UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4051106111"] = "Use the default system prompt" +-- Tell the AI your predefined user input. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4052406705"] = "Tell the AI your predefined user input." + -- Create your custom chat template to tailor the LLM's behavior for specific tasks or domains. Define a custom system prompt and provide an example conversation to design an AI experience perfectly suited to your requirements. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4199560726"] = "Create your custom chat template to tailor the LLM's behavior for specific tasks or domains. Define a custom system prompt and provide an example conversation to design an AI experience perfectly suited to your requirements." diff --git a/app/MindWork AI Studio/Chat/ChatThread.cs b/app/MindWork AI Studio/Chat/ChatThread.cs index c57e5160..d38ddad2 100644 --- a/app/MindWork AI Studio/Chat/ChatThread.cs +++ b/app/MindWork AI Studio/Chat/ChatThread.cs @@ -100,11 +100,11 @@ public sealed record ChatThread systemPromptTextWithChatTemplate = chatThread.SystemPrompt; else { - if(!Guid.TryParse(chatThread.SelectedChatTemplate, out var chatTeamplateId)) + if(!Guid.TryParse(chatThread.SelectedChatTemplate, out var chatTemplateId)) systemPromptTextWithChatTemplate = chatThread.SystemPrompt; else { - if(chatThread.SelectedChatTemplate == ChatTemplate.NO_CHAT_TEMPLATE.Id || chatTeamplateId == Guid.Empty) + if(chatThread.SelectedChatTemplate == ChatTemplate.NO_CHAT_TEMPLATE.Id || chatTemplateId == Guid.Empty) systemPromptTextWithChatTemplate = chatThread.SystemPrompt; else { @@ -121,6 +121,11 @@ public sealed record ChatThread } } + // We need a way to save the changed system prompt in our chat thread. + // Otherwise, the chat thread will always tell us that it is using the + // default system prompt: + chatThread = chatThread with { SystemPrompt = systemPromptTextWithChatTemplate }; + logger.LogInformation(logMessage); // diff --git a/app/MindWork AI Studio/Chat/ContentBlock.cs b/app/MindWork AI Studio/Chat/ContentBlock.cs index a069c3d8..4f281df4 100644 --- a/app/MindWork AI Studio/Chat/ContentBlock.cs +++ b/app/MindWork AI Studio/Chat/ContentBlock.cs @@ -30,12 +30,12 @@ public class ContentBlock /// public bool HideFromUser { get; init; } - public ContentBlock DeepClone() => new() + public ContentBlock DeepClone(bool changeHideState = false, bool hideFromUser = true) => new() { Time = this.Time, ContentType = this.ContentType, Content = this.Content?.DeepClone(), Role = this.Role, - HideFromUser = this.HideFromUser, + HideFromUser = changeHideState ? hideFromUser : this.HideFromUser, }; } \ No newline at end of file diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor b/app/MindWork AI Studio/Components/ChatComponent.razor index 66538eda..48420522 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor +++ b/app/MindWork AI Studio/Components/ChatComponent.razor @@ -81,7 +81,8 @@ } - + + @if (this.SettingsManager.ConfigurationData.Workspace.StorageBehavior is WorkspaceStorageBehavior.STORE_CHATS_AUTOMATICALLY) { diff --git a/app/MindWork AI Studio/Components/ChatComponent.razor.cs b/app/MindWork AI Studio/Components/ChatComponent.razor.cs index c1d36f32..43f79a10 100644 --- a/app/MindWork AI Studio/Components/ChatComponent.razor.cs +++ b/app/MindWork AI Studio/Components/ChatComponent.razor.cs @@ -80,6 +80,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable // Get the preselected chat template: this.currentChatTemplate = this.SettingsManager.GetPreselectedChatTemplate(Tools.Components.CHAT); + this.userInput = this.currentChatTemplate.PredefinedUserPrompt; // // Check for deferred messages of the kind 'SEND_TO_CHAT', @@ -272,7 +273,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable } } - private bool CanThreadBeSaved => this.ChatThread is not null && this.ChatThread.Blocks.Count > 0; + private bool CanThreadBeSaved => this.ChatThread is not null && this.ChatThread.Blocks.Any(b => !b.HideFromUser); private string TooltipAddChatToWorkspace => string.Format(T("Start new chat in workspace '{0}'"), this.currentWorkspaceName); @@ -326,6 +327,7 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable private async Task ChatTemplateWasChanged(ChatTemplate chatTemplate) { this.currentChatTemplate = chatTemplate; + this.userInput = this.currentChatTemplate.PredefinedUserPrompt; if(this.ChatThread is null) return; @@ -675,6 +677,8 @@ public partial class ChatComponent : MSGComponentBase, IAsyncDisposable }; } + this.userInput = this.currentChatTemplate.PredefinedUserPrompt; + // Now, we have to reset the data source options as well: this.ApplyStandardDataSourceOptions(); diff --git a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor index 7f9f09cf..624520de 100644 --- a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor +++ b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor @@ -18,6 +18,8 @@ + + @foreach (var chatTemplate in this.SettingsManager.ConfigurationData.ChatTemplates.GetAllChatTemplates()) { diff --git a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor.cs b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor.cs index e624884c..25b72e11 100644 --- a/app/MindWork AI Studio/Components/ChatTemplateSelection.razor.cs +++ b/app/MindWork AI Studio/Components/ChatTemplateSelection.razor.cs @@ -1,3 +1,4 @@ +using AIStudio.Chat; using AIStudio.Dialogs.Settings; using AIStudio.Settings; @@ -11,6 +12,12 @@ public partial class ChatTemplateSelection : MSGComponentBase [Parameter] public ChatTemplate CurrentChatTemplate { get; set; } = ChatTemplate.NO_CHAT_TEMPLATE; + [Parameter] + public bool CanChatThreadBeUsedForTemplate { get; set; } + + [Parameter] + public ChatThread? CurrentChatThread { get; set; } + [Parameter] public EventCallback CurrentChatTemplateChanged { get; set; } @@ -36,4 +43,14 @@ public partial class ChatTemplateSelection : MSGComponentBase var dialogParameters = new DialogParameters(); await this.DialogService.ShowAsync(T("Open Chat Template Options"), dialogParameters, DialogOptions.FULLSCREEN); } + + private async Task CreateNewChatTemplateFromChat() + { + var dialogParameters = new DialogParameters + { + { x => x.CreateTemplateFromExistingChatThread, true }, + { x => x.ExistingChatThread, this.CurrentChatThread } + }; + await this.DialogService.ShowAsync(T("Open Chat Template Options"), dialogParameters, DialogOptions.FULLSCREEN); + } } \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor b/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor index 61070a48..0de3cd9d 100644 --- a/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor +++ b/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor @@ -56,7 +56,32 @@ @T("Use the default system prompt") - + + @T("Predefined User Input") + + + @T("You might want to predefine a first message that will be copied into the user prompt, when you use this chat template. This message could for example be a blueprint for a structured message that this chat template is defined to work with.") + + + + + @T("Profile Usage") + + @T("Using some chat templates in tandem with profiles might cause issues. Therefore, you might prohibit the usage of profiles here.") @@ -64,11 +89,9 @@ @T("Example Conversation") - @T("Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs.") - diff --git a/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor.cs b/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor.cs index af0f7560..e95b0d76 100644 --- a/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/ChatTemplateDialog.razor.cs @@ -35,6 +35,12 @@ public partial class ChatTemplateDialog : MSGComponentBase [Parameter] public string DataSystemPrompt { get; set; } = string.Empty; + /// + /// What is the predefined user prompt? + /// + [Parameter] + public string PredefinedUserPrompt { get; set; } = string.Empty; + /// /// Should the dialog be in editing mode? /// @@ -47,6 +53,12 @@ public partial class ChatTemplateDialog : MSGComponentBase [Parameter] public bool AllowProfileUsage { get; set; } = true; + [Parameter] + public bool CreateFromExistingChatThread { get; set; } + + [Parameter] + public ChatThread? ExistingChatThread { get; set; } + [Inject] private ILogger Logger { get; init; } = null!; @@ -84,6 +96,13 @@ public partial class ChatTemplateDialog : MSGComponentBase this.dataEditingPreviousName = this.DataName.ToLowerInvariant(); this.dataExampleConversation = this.ExampleConversation.Select(n => n.DeepClone()).ToList(); } + + if (this.CreateFromExistingChatThread && this.ExistingChatThread is not null) + { + this.DataSystemPrompt = this.ExistingChatThread.SystemPrompt; + this.dataExampleConversation = this.ExistingChatThread.Blocks.Select(n => n.DeepClone(true)).ToList(); + this.DataName = this.ExistingChatThread.Name; + } await base.OnInitializedAsync(); } @@ -107,6 +126,7 @@ public partial class ChatTemplateDialog : MSGComponentBase Name = this.DataName, SystemPrompt = this.DataSystemPrompt, + PredefinedUserPrompt = this.PredefinedUserPrompt, ExampleConversation = this.dataExampleConversation, AllowProfileUsage = this.AllowProfileUsage, }; diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs index df45daae..364eb49a 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogChatTemplate.razor.cs @@ -1,16 +1,42 @@ +using AIStudio.Chat; using AIStudio.Settings; +using Microsoft.AspNetCore.Components; namespace AIStudio.Dialogs.Settings; public partial class SettingsDialogChatTemplate : SettingsDialogBase { + [Parameter] + public bool CreateTemplateFromExistingChatThread { get; set; } + + [Parameter] + public ChatThread? ExistingChatThread { get; set; } + + #region Overrides of ComponentBase + + /// + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + if (this.CreateTemplateFromExistingChatThread) + await this.AddChatTemplate(); + } + + #endregion + private async Task AddChatTemplate() { var dialogParameters = new DialogParameters { { x => x.IsEditing, false }, }; - + + if (this.CreateTemplateFromExistingChatThread) + { + dialogParameters.Add(x => x.CreateFromExistingChatThread, this.CreateTemplateFromExistingChatThread); + dialogParameters.Add(x => x.ExistingChatThread, this.ExistingChatThread); + } + var dialogReference = await this.DialogService.ShowAsync(T("Add Chat Template"), dialogParameters, DialogOptions.FULLSCREEN); var dialogResult = await dialogReference.Result; if (dialogResult is null || dialogResult.Canceled) @@ -33,6 +59,7 @@ public partial class SettingsDialogChatTemplate : SettingsDialogBase { x => x.DataId, chatTemplate.Id }, { x => x.DataName, chatTemplate.Name }, { x => x.DataSystemPrompt, chatTemplate.SystemPrompt }, + { x => x.PredefinedUserPrompt, chatTemplate.PredefinedUserPrompt }, { x => x.IsEditing, true }, { x => x.ExampleConversation, chatTemplate.ExampleConversation }, { x => x.AllowProfileUsage, chatTemplate.AllowProfileUsage }, diff --git a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua index e5599727..13dc2f12 100644 --- a/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/de-de-43065dbc-78d0-45b7-92be-f14c2926e2dc/plugin.lua @@ -1416,6 +1416,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATCOMPONENT::T636393754"] = "Verschiebe -- Show your workspaces UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATCOMPONENT::T733672375"] = "Ihre Arbeitsbereiche anzeigen" +-- Create template from current chat +UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATTEMPLATESELECTION::T1112722156"] = "Vorlage aus aktuellem Chat erstellen" + -- Start a new chat with a chat template UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATTEMPLATESELECTION::T1333844707"] = "Neuen Chat mit einer Chat-Vorlage starten" @@ -1719,7 +1722,7 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANE -- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Anwendungsfall: Dieser Agent wird verwendet, um Textinhalte zu bereinigen. Er extrahiert den Hauptinhalt, entfernt Werbung und andere irrelevante Elemente und versucht, relative Links in absolute Links umzuwandeln, damit diese verwendet werden können." --- Agent: Text Content Cleaner Options +-- Agent: Text Content Cleaner UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T3517268866"] = "Agent: Inhaltsbereinigung" -- No options are preselected @@ -2199,18 +2202,30 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T1847791252"] = "Aktuali -- The chat template name must not exceed 40 characters. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T204496403"] = "Der Name der Chat-Vorlage darf maximal 40 Zeichen lang sein." +-- Profile Usage +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2147062613"] = "Profilnutzung" + -- Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2292424657"] = "Fügen Sie Nachrichten einer Beispiel-Konversation hinzu (Nutzereingabe, gefolgt von einer Antwort des Assistenten), um das gewünschte Interaktionsmuster zu demonstrieren. Diese Beispiele helfen der KI, ihre Erwartungen zu verstehen, indem Sie das korrekte Format, den Stil und den Inhalt von Antworten zeigen, bevor tatsächliche Nutzereingaben erfolgen." -- Role UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2418769465"] = "Rolle" +-- What predefined user input do you want to use? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2501284417"] = "Welche vordefinierte Benutzereingabe möchten Sie verwenden?" + -- Tell the AI your system prompt. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2552381261"] = "Teilen Sie der KI einen System-Prompt mit." -- No, prohibit profile use for this template UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2579080722"] = "Nein, die Profilnutzung für diese Vorlage verbieten" +-- You might want to predefine a first message that will be copied into the user prompt, when you use this chat template. This message could for example be a blueprint for a structured message that this chat template is defined to work with. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2579208700"] = "Sie können eine Nachricht vordefinieren, die als Benutzereingabe verwendet wird, wenn Sie diese Chat-Vorlage verwenden. Diese Nachricht könnte beispielsweise eine Vorlage für eine strukturierte Nachricht sein, für die diese Chat-Vorlage entwickelt wurde." + +-- Predefined User Input +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2607897066"] = "Vordefinierte Benutzereingabe" + -- Entry UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2629823795"] = "Eintrag" @@ -2265,6 +2280,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T3893704289"] = "Nachric -- Use the default system prompt UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4051106111"] = "Verwenden Sie den Standard-System-Prompt" +-- Tell the AI your predefined user input. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4052406705"] = "Teilen Sie der KI ihre vordefinierte Benutzereingabe mit." + -- Create your custom chat template to tailor the LLM's behavior for specific tasks or domains. Define a custom system prompt and provide an example conversation to design an AI experience perfectly suited to your requirements. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4199560726"] = "Erstellen Sie ihre eigene Chat-Vorlage, um das Verhalten des LLMs für bestimmte Aufgaben oder Bereiche anzupassen. Definieren Sie einen individuellen System-Prompt und geben Sie eine Beispiel-Konversation vor, um eine KI-Erfahrung zu gestalten, die genau auf ihre Anforderungen zugeschnitten ist." diff --git a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua index 3cbe2009..99371d03 100644 --- a/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua +++ b/app/MindWork AI Studio/Plugins/languages/en-us-97dfb1ba-50c4-4440-8dfa-6575daf543c8/plugin.lua @@ -1416,6 +1416,9 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATCOMPONENT::T636393754"] = "Move the c -- Show your workspaces UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATCOMPONENT::T733672375"] = "Show your workspaces" +-- Create template from current chat +UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATTEMPLATESELECTION::T1112722156"] = "Create template from current chat" + -- Start a new chat with a chat template UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::CHATTEMPLATESELECTION::T1333844707"] = "Start a new chat with a chat template" @@ -1719,7 +1722,7 @@ UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANE -- Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used. UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T1299550589"] = "Use Case: this agent is used to clean up text content. It extracts the main content, removes advertisements and other irrelevant things, and attempts to convert relative links into absolute links so that they can be used." --- Agent: Text Content Cleaner Options +-- Agent: Text Content Cleaner UI_TEXT_CONTENT["AISTUDIO::COMPONENTS::SETTINGS::SETTINGSPANELAGENTCONTENTCLEANER::T3517268866"] = "Agent: Text Content Cleaner" -- No options are preselected @@ -2199,18 +2202,30 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T1847791252"] = "Update" -- The chat template name must not exceed 40 characters. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T204496403"] = "The chat template name must not exceed 40 characters." +-- Profile Usage +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2147062613"] = "Profile Usage" + -- Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2292424657"] = "Add messages of an example conversation (user prompt followed by assistant prompt) to demonstrate the desired interaction pattern. These examples help the AI understand your expectations by showing it the correct format, style, and content of responses before it receives actual user inputs." -- Role UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2418769465"] = "Role" +-- What predefined user input do you want to use? +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2501284417"] = "What predefined user input do you want to use?" + -- Tell the AI your system prompt. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2552381261"] = "Tell the AI your system prompt." -- No, prohibit profile use for this template UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2579080722"] = "No, prohibit profile use for this template" +-- You might want to predefine a first message that will be copied into the user prompt, when you use this chat template. This message could for example be a blueprint for a structured message that this chat template is defined to work with. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2579208700"] = "You might want to predefine a first message that will be copied into the user prompt, when you use this chat template. This message could for example be a blueprint for a structured message that this chat template is defined to work with." + +-- Predefined User Input +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2607897066"] = "Predefined User Input" + -- Entry UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T2629823795"] = "Entry" @@ -2265,6 +2280,9 @@ UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T3893704289"] = "Message -- Use the default system prompt UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4051106111"] = "Use the default system prompt" +-- Tell the AI your predefined user input. +UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4052406705"] = "Tell the AI your predefined user input." + -- Create your custom chat template to tailor the LLM's behavior for specific tasks or domains. Define a custom system prompt and provide an example conversation to design an AI experience perfectly suited to your requirements. UI_TEXT_CONTENT["AISTUDIO::DIALOGS::CHATTEMPLATEDIALOG::T4199560726"] = "Create your custom chat template to tailor the LLM's behavior for specific tasks or domains. Define a custom system prompt and provide an example conversation to design an AI experience perfectly suited to your requirements." diff --git a/app/MindWork AI Studio/Settings/ChatTemplate.cs b/app/MindWork AI Studio/Settings/ChatTemplate.cs index 0c52568a..02e0061c 100644 --- a/app/MindWork AI Studio/Settings/ChatTemplate.cs +++ b/app/MindWork AI Studio/Settings/ChatTemplate.cs @@ -3,7 +3,7 @@ using AIStudio.Tools.PluginSystem; namespace AIStudio.Settings; -public readonly record struct ChatTemplate(uint Num, string Id, string Name, string SystemPrompt, List ExampleConversation, bool AllowProfileUsage) +public readonly record struct ChatTemplate(uint Num, string Id, string Name, string SystemPrompt, string PredefinedUserPrompt, List ExampleConversation, bool AllowProfileUsage) { private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(ChatTemplate).Namespace, nameof(ChatTemplate)); @@ -11,6 +11,7 @@ public readonly record struct ChatTemplate(uint Num, string Id, string Name, str { Name = TB("Use no chat template"), SystemPrompt = string.Empty, + PredefinedUserPrompt = string.Empty, Id = Guid.Empty.ToString(), Num = uint.MaxValue, ExampleConversation = [], diff --git a/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md b/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md index 22704650..cf1aee39 100644 --- a/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md +++ b/app/MindWork AI Studio/wwwroot/changelog/v0.9.50.md @@ -1 +1,3 @@ # v0.9.50, build 225 (2025-07-xx xx:xx UTC) +- Added an option for chat templates to predefine a user input. +- Added the ability to create chat templates from existing chats. \ No newline at end of file