mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 13:59:48 +00:00
Added internal flag for plugins
This commit is contained in:
parent
64669088ed
commit
3b0a35eaac
@ -66,4 +66,9 @@ public interface IPluginMetadata
|
||||
/// The message that should be displayed when the plugin is deprecated.
|
||||
/// </summary>
|
||||
public string DeprecationMessage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True, when the plugin is AI Studio internal.
|
||||
/// </summary>
|
||||
public bool IsInternal { get; }
|
||||
}
|
@ -8,6 +8,12 @@ namespace AIStudio.Tools.PluginSystem;
|
||||
/// </summary>
|
||||
public abstract class PluginBase : IPluginMetadata
|
||||
{
|
||||
private static readonly Guid[] MANDATORY_INTERNAL_PLUGINS =
|
||||
[
|
||||
new("97dfb1ba-50c4-4440-8dfa-6575daf543c8"), // Language EN-US (base language)
|
||||
new("43065dbc-78d0-45b7-92be-f14c2926e2dc"), // Language DE-DE
|
||||
];
|
||||
|
||||
private readonly IReadOnlyCollection<string> baseIssues;
|
||||
protected readonly LuaState state;
|
||||
|
||||
@ -52,6 +58,9 @@ public abstract class PluginBase : IPluginMetadata
|
||||
/// <inheritdoc />
|
||||
public string DeprecationMessage { get; } = string.Empty;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsInternal { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The issues that occurred during the initialization of this plugin.
|
||||
/// </summary>
|
||||
@ -80,7 +89,10 @@ public abstract class PluginBase : IPluginMetadata
|
||||
this.IconSVG = iconSVG;
|
||||
|
||||
if(this.TryInitId(out var issue, out var id))
|
||||
{
|
||||
this.Id = id;
|
||||
this.IsInternal = MANDATORY_INTERNAL_PLUGINS.Contains(id);
|
||||
}
|
||||
else if(this is not NoPlugin)
|
||||
issues.Add(issue);
|
||||
|
||||
|
@ -17,13 +17,6 @@ public static partial class PluginFactory
|
||||
|
||||
private static readonly Dictionary<IPluginMetadata, string> AVAILABLE_PLUGINS = new();
|
||||
|
||||
private static readonly SettingsManager SETTINGS = Program.SERVICE_PROVIDER.GetRequiredService<SettingsManager>();
|
||||
|
||||
private static readonly Guid[] MANDATORY_INTERNAL_PLUGINS =
|
||||
[
|
||||
new("97dfb1ba-50c4-4440-8dfa-6575daf543c8"), // Language EN-US (base language)
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// A list of all available plugins.
|
||||
/// </summary>
|
||||
|
@ -43,5 +43,8 @@ public sealed class PluginMetadata(PluginBase plugin) : IPluginMetadata
|
||||
/// <inheritdoc />
|
||||
public string DeprecationMessage { get; } = plugin.DeprecationMessage;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsInternal { get; } = plugin.IsInternal;
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Reference in New Issue
Block a user