mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 16:39:47 +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.
|
/// The message that should be displayed when the plugin is deprecated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DeprecationMessage { get; }
|
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>
|
/// </summary>
|
||||||
public abstract class PluginBase : IPluginMetadata
|
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;
|
private readonly IReadOnlyCollection<string> baseIssues;
|
||||||
protected readonly LuaState state;
|
protected readonly LuaState state;
|
||||||
|
|
||||||
@ -52,6 +58,9 @@ public abstract class PluginBase : IPluginMetadata
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string DeprecationMessage { get; } = string.Empty;
|
public string DeprecationMessage { get; } = string.Empty;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool IsInternal { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The issues that occurred during the initialization of this plugin.
|
/// The issues that occurred during the initialization of this plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -80,7 +89,10 @@ public abstract class PluginBase : IPluginMetadata
|
|||||||
this.IconSVG = iconSVG;
|
this.IconSVG = iconSVG;
|
||||||
|
|
||||||
if(this.TryInitId(out var issue, out var id))
|
if(this.TryInitId(out var issue, out var id))
|
||||||
|
{
|
||||||
this.Id = id;
|
this.Id = id;
|
||||||
|
this.IsInternal = MANDATORY_INTERNAL_PLUGINS.Contains(id);
|
||||||
|
}
|
||||||
else if(this is not NoPlugin)
|
else if(this is not NoPlugin)
|
||||||
issues.Add(issue);
|
issues.Add(issue);
|
||||||
|
|
||||||
|
@ -17,13 +17,6 @@ public static partial class PluginFactory
|
|||||||
|
|
||||||
private static readonly Dictionary<IPluginMetadata, string> AVAILABLE_PLUGINS = new();
|
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>
|
/// <summary>
|
||||||
/// A list of all available plugins.
|
/// A list of all available plugins.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -43,5 +43,8 @@ public sealed class PluginMetadata(PluginBase plugin) : IPluginMetadata
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string DeprecationMessage { get; } = plugin.DeprecationMessage;
|
public string DeprecationMessage { get; } = plugin.DeprecationMessage;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool IsInternal { get; } = plugin.IsInternal;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user