diff --git a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor index 6f7e91b2..b2eaa88c 100644 --- a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor +++ b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor @@ -1,4 +1,6 @@ @attribute [Route(Routes.ASSISTANT_DYNAMIC)] +@using AIStudio.Components +@using AIStudio.Settings @using AIStudio.Tools.PluginSystem.Assistants.DataModel @inherits AssistantBaseCore @@ -30,6 +32,13 @@ } break; + case AssistantUiCompontentType.PROFILE_SELECTION: + if (component is AssistantProfileSelection profileSelection) + { + var selection = profileSelection; + + } + break; case AssistantUiCompontentType.SWITCH: if (component is AssistantSwitch assistantSwitch) { @@ -84,4 +93,4 @@ } break; } -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs index 433afeb4..d4ceea00 100644 --- a/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs +++ b/app/MindWork AI Studio/Assistants/Dynamic/AssistantDynamic.razor.cs @@ -1,5 +1,6 @@ using AIStudio.Dialogs.Settings; using AIStudio.Tools.PluginSystem; +using AIStudio.Settings; using AIStudio.Tools.PluginSystem.Assistants; using AIStudio.Tools.PluginSystem.Assistants.DataModel; using Microsoft.AspNetCore.Components; @@ -15,6 +16,7 @@ public partial class AssistantDynamic : AssistantBaseCore protected override string Description => this.description; protected override string SystemPrompt => this.systemPrompt; protected override bool AllowProfiles => this.allowProfiles; + protected override bool ShowProfileSelection => this.showFooterProfileSelection; protected override string SubmitText => this.submitText; protected override Func SubmitAction => this.Submit; public override Tools.Components Component { get; } @@ -27,6 +29,7 @@ public partial class AssistantDynamic : AssistantBaseCore private string submitText = string.Empty; private string selectedTargetLanguage = string.Empty; private string customTargetLanguage = string.Empty; + private bool showFooterProfileSelection = true; private Dictionary inputFields = new(); private Dictionary dropdownFields = new(); @@ -44,6 +47,7 @@ public partial class AssistantDynamic : AssistantBaseCore this.systemPrompt = assistantPlugin.SystemPrompt; this.submitText = assistantPlugin.SubmitText; this.allowProfiles = assistantPlugin.AllowProfiles; + this.showFooterProfileSelection = !assistantPlugin.HasEmbeddedProfileSelection; } foreach (var component in this.RootComponent!.Children) @@ -138,10 +142,23 @@ public partial class AssistantDynamic : AssistantBaseCore return prompt; } + private string? ValidateProfileSelection(AssistantProfileSelection profileSelection, Profile profile) + { + if (profile == default || profile == Profile.NO_PROFILE) + { + if (!string.IsNullOrWhiteSpace(profileSelection.ValidationMessage)) + return profileSelection.ValidationMessage; + + return this.T("Please select one of your profiles."); + } + + return null; + } + private async Task Submit() { this.CreateChatThread(); var time = this.AddUserRequest(this.CollectUserPrompt()); await this.AddAIResponseAsync(time); } -} \ No newline at end of file +} diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index 544e20ca..359ab834 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -382,6 +382,9 @@ UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::CODING::COMMONCODINGLANGUAGEEXTENSIONS::T -- None UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::CODING::COMMONCODINGLANGUAGEEXTENSIONS::T810547195"] = "None" +-- Please select one of your profiles. +UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::DYNAMIC::ASSISTANTDYNAMIC::T465395981"] = "Please select one of your profiles." + -- Provide a list of bullet points and some basic information for an e-mail. The assistant will generate an e-mail based on that input. UI_TEXT_CONTENT["AISTUDIO::ASSISTANTS::EMAIL::ASSISTANTEMAIL::T1143222914"] = "Provide a list of bullet points and some basic information for an e-mail. The assistant will generate an e-mail based on that input." diff --git a/app/MindWork AI Studio/Plugins/assistants/plugin.lua b/app/MindWork AI Studio/Plugins/assistants/plugin.lua index 38c46b4a..6aa14462 100644 --- a/app/MindWork AI Studio/Plugins/assistants/plugin.lua +++ b/app/MindWork AI Studio/Plugins/assistants/plugin.lua @@ -56,8 +56,8 @@ ASSISTANT = { -- usage example with the full feature set: ASSISTANT = { ["Title"] = "
", -- required - ["Description"] = "", -- required - ["SystemPrompt"] = "", -- required + ["Description"] = "", -- required + ["SystemPrompt"] = "", -- required ["SubmitText"] = "