diff --git a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua index c1f40eb5..c1bcded7 100644 --- a/app/MindWork AI Studio/Assistants/I18N/allTexts.lua +++ b/app/MindWork AI Studio/Assistants/I18N/allTexts.lua @@ -5353,6 +5353,21 @@ UI_TEXT_CONTENT["AISTUDIO::TOOLS::PANDOC::T567205144"] = "It seems that Pandoc i -- The latest Pandoc version was not found, installing version {0} instead. UI_TEXT_CONTENT["AISTUDIO::TOOLS::PANDOC::T726914939"] = "The latest Pandoc version was not found, installing version {0} instead." +-- 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." + +-- 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 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." + +-- The ASSISTANT table does not contain a valid title. +UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::ASSISTANTS::PLUGINASSISTANTS::T998753547"] = "The ASSISTANT table does not contain a valid title." + -- The table AUTHORS does not exist or is using an invalid syntax. UI_TEXT_CONTENT["AISTUDIO::TOOLS::PLUGINSYSTEM::PLUGINBASE::T1068328139"] = "The table AUTHORS does not exist or is using an invalid syntax." diff --git a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs index 25a43491..67dd3b67 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/Assistants/PluginAssistants.cs @@ -4,19 +4,20 @@ using Lua; namespace AIStudio.Tools.PluginSystem.Assistants; -public sealed class PluginAssistants : PluginBase +public sealed class PluginAssistants(bool isInternal, LuaState state, PluginType type) : PluginBase(isInternal, state, type) { - private static string TB(string fallbackEN) => - I18N.I.T(fallbackEN, typeof(PluginAssistants).Namespace, nameof(PluginAssistants)); + private static string TB(string fallbackEN) => I18N.I.T(fallbackEN, typeof(PluginAssistants).Namespace, nameof(PluginAssistants)); private static readonly ILogger LOGGER = Program.LOGGER_FACTORY.CreateLogger(); - public AssistantForm RootComponent { get; set; } + public AssistantForm? RootComponent { get; set; } public string AssistantTitle { get; set; } = string.Empty; private string AssistantDescription { get; set; } = string.Empty; - public PluginAssistants(bool isInternal, LuaState state, PluginType type) : base(isInternal, state, type) + public void TryLoad() { + if(!this.TryProcessAssistant(out var issue)) + this.pluginIssues.Add(issue); } /// @@ -120,10 +121,7 @@ public sealed class PluginAssistants : PluginBase children.Add(comp); } - root = AssistantComponentFactory.CreateComponent( - AssistantUiCompontentType.FORM, - new Dictionary(), - children); + root = AssistantComponentFactory.CreateComponent(AssistantUiCompontentType.FORM, new Dictionary(), children); return true; } diff --git a/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.Loading.cs b/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.Loading.cs index 92f77344..d937df07 100644 --- a/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.Loading.cs +++ b/app/MindWork AI Studio/Tools/PluginSystem/PluginFactory.Loading.cs @@ -1,8 +1,9 @@ +using System.Runtime.CompilerServices; using System.Text; using AIStudio.Settings; using AIStudio.Settings.DataModel; - +using AIStudio.Tools.PluginSystem.Assistants; using Lua; using Lua.Standard; @@ -210,6 +211,11 @@ public static partial class PluginFactory await configPlug.InitializeAsync(true); return configPlug; + case PluginType.ASSISTANT: + var assistantPlugin = new PluginAssistants(isInternal, state, type); + assistantPlugin.TryLoad(); + return assistantPlugin; + default: return new NoPlugin("This plugin type is not supported yet. Please try again with a future version of AI Studio."); }