included the assistant plugin to load during plugin initialization

This commit is contained in:
krut_ni 2025-09-29 21:04:16 +02:00
parent c12fa64d9b
commit b42ee50b1d
3 changed files with 29 additions and 10 deletions

View File

@ -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."

View File

@ -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<PluginAssistants> LOGGER = Program.LOGGER_FACTORY.CreateLogger<PluginAssistants>();
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);
}
/// <summary>
@ -120,10 +121,7 @@ public sealed class PluginAssistants : PluginBase
children.Add(comp);
}
root = AssistantComponentFactory.CreateComponent(
AssistantUiCompontentType.FORM,
new Dictionary<string, object>(),
children);
root = AssistantComponentFactory.CreateComponent(AssistantUiCompontentType.FORM, new Dictionary<string, object>(), children);
return true;
}

View File

@ -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.");
}