From 488747b7623b281c2ee7d980444fb4821717f83e Mon Sep 17 00:00:00 2001 From: krut_ni Date: Tue, 30 Sep 2025 21:54:24 +0200 Subject: [PATCH] included allowProfiles and system prompt properties to the lua parser --- .../Assistants/I18N/allTexts.lua | 6 ++++++ .../Assistants/PluginAssistants.cs | 20 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index c1bcded7..544e20ca 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -5356,12 +5356,18 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::PANDOC::T726914939"] = "The latest Pandoc vers -- The ASSISTANT table does not contain a valid description. UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T2080819991"] = "The ASSISTANT table does not contain a valid description." +-- The ASSISTANT table does not contain a the boolean flag to control the allowance of profiles. +UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T221472268"] = "The ASSISTANT table does not contain a the boolean flag to control the allowance of profiles." + -- Failed to parse the UI render tree. UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T2583341941"] = "Failed to parse the UI render tree." -- The ASSISTANT table does not contain a valid UI section. UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T3126717084"] = "The ASSISTANT table does not contain a valid UI section." +-- The ASSISTANT table does not contain a valid system prompt. +UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T3723171842"] = "The ASSISTANT table does not contain a valid system prompt." + -- The ASSISTANT table does not exist or is not a valid table. UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T6004146"] = "The ASSISTANT table does not exist or is not a valid table." diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs index 67dd3b67..cf92f55a 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs @@ -12,7 +12,9 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType public AssistantForm? RootComponent { get; set; } public string AssistantTitle { get; set; } = string.Empty; - private string AssistantDescription { get; set; } = string.Empty; + public string AssistantDescription { get; set; } = string.Empty; + public string SystemPrompt { get; set; } = string.Empty; + public bool AllowProfiles { get; set; } = true; public void TryLoad() { @@ -54,9 +56,25 @@ public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType message = TB("The ASSISTANT table does not contain a valid description."); return false; } + + if (!assistantTable.TryGetValue("SystemPrompt", out var assistantSystemPromptValue) || + !assistantSystemPromptValue.TryRead(out var assistantSystemPrompt)) + { + message = TB("The ASSISTANT table does not contain a valid system prompt."); + return false; + } + + if (!assistantTable.TryGetValue("AllowProfiles", out var assistantAllowProfilesValue) || + !assistantAllowProfilesValue.TryRead(out var assistantAllowProfiles)) + { + message = TB("The ASSISTANT table does not contain a the boolean flag to control the allowance of profiles."); + return false; + } this.AssistantTitle = assistantTitle; this.AssistantDescription = assistantDescription; + this.SystemPrompt = assistantSystemPrompt; + this.AllowProfiles = assistantAllowProfiles; // Ensure that the UI table exists nested in the ASSISTANT table and is a valid Lua table: if (!assistantTable.TryGetValue("UI", out var uiVal) || !uiVal.TryRead(out var uiTable))