Add support for configuration plugins in PluginFactory

This commit is contained in:
Thorsten Sommer 2025-06-01 20:56:25 +02:00
parent e573b4d744
commit 00778752c6
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -1,5 +1,7 @@
using System.Text; using System.Text;
using AIStudio.Settings.DataModel;
using Lua; using Lua;
using Lua.Standard; using Lua.Standard;
@ -216,11 +218,18 @@ public static partial class PluginFactory
return new NoPlugin($"TYPE is not a valid plugin type. Valid types are: {CommonTools.GetAllEnumValues<PluginType>()}"); return new NoPlugin($"TYPE is not a valid plugin type. Valid types are: {CommonTools.GetAllEnumValues<PluginType>()}");
var isInternal = !string.IsNullOrWhiteSpace(pluginPath) && pluginPath.StartsWith(INTERNAL_PLUGINS_ROOT, StringComparison.OrdinalIgnoreCase); var isInternal = !string.IsNullOrWhiteSpace(pluginPath) && pluginPath.StartsWith(INTERNAL_PLUGINS_ROOT, StringComparison.OrdinalIgnoreCase);
return type switch switch (type)
{ {
PluginType.LANGUAGE => new PluginLanguage(isInternal, state, type), case PluginType.LANGUAGE:
return new PluginLanguage(isInternal, state, type);
_ => new NoPlugin("This plugin type is not supported yet. Please try again with a future version of AI Studio.") case PluginType.CONFIGURATION:
}; var configPlug = new PluginConfiguration(isInternal, state, type);
await configPlug.InitializeAsync();
return configPlug;
default:
return new NoPlugin("This plugin type is not supported yet. Please try again with a future version of AI Studio.");
}
} }
} }