mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 16:19:48 +00:00
Implement IPluginMetadata interface in PluginBase for enhanced plugin metadata management
This commit is contained in:
parent
cc2f11f4e7
commit
e10cf4171b
64
app/MindWork AI Studio/Tools/PluginSystem/IPluginMetadata.cs
Normal file
64
app/MindWork AI Studio/Tools/PluginSystem/IPluginMetadata.cs
Normal file
@ -0,0 +1,64 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public interface IPluginMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of this plugin.
|
||||
/// </summary>
|
||||
public PluginType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of this plugin.
|
||||
/// </summary>
|
||||
public Guid Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of this plugin.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The description of this plugin.
|
||||
/// </summary>
|
||||
public string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of this plugin.
|
||||
/// </summary>
|
||||
public PluginVersion Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The authors of this plugin.
|
||||
/// </summary>
|
||||
public string[] Authors { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The support contact for this plugin.
|
||||
/// </summary>
|
||||
public string SupportContact { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The source URL of this plugin.
|
||||
/// </summary>
|
||||
public string SourceURL { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The categories of this plugin.
|
||||
/// </summary>
|
||||
public PluginCategory[] Categories { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The target groups of this plugin.
|
||||
/// </summary>
|
||||
public PluginTargetGroup[] TargetGroups { get; }
|
||||
|
||||
/// <summary>
|
||||
/// True, when the plugin is maintained.
|
||||
/// </summary>
|
||||
public bool IsMaintained { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The message that should be displayed when the plugin is deprecated.
|
||||
/// </summary>
|
||||
public string? DeprecationMessage { get; }
|
||||
}
|
@ -7,71 +7,47 @@ namespace AIStudio.Tools.PluginSystem;
|
||||
/// <summary>
|
||||
/// Represents the base of any AI Studio plugin.
|
||||
/// </summary>
|
||||
public abstract class PluginBase
|
||||
public abstract class PluginBase : IPluginMetadata
|
||||
{
|
||||
private readonly IReadOnlyCollection<string> baseIssues;
|
||||
protected readonly LuaState state;
|
||||
|
||||
protected readonly List<string> pluginIssues = [];
|
||||
|
||||
/// <summary>
|
||||
/// The type of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public PluginType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public Guid Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public string Name { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The description of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public string Description { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The version of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public PluginVersion Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The authors of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public string[] Authors { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The support contact for this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public string SupportContact { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The source URL of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public string SourceURL { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The categories of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public PluginCategory[] Categories { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// The target groups of this plugin.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public PluginTargetGroup[] TargetGroups { get; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// True, when the plugin is maintained.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public bool IsMaintained { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The message that should be displayed when the plugin is deprecated.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public string? DeprecationMessage { get; }
|
||||
|
||||
/// <summary>
|
||||
|
44
app/MindWork AI Studio/Tools/PluginSystem/PluginMetadata.cs
Normal file
44
app/MindWork AI Studio/Tools/PluginSystem/PluginMetadata.cs
Normal file
@ -0,0 +1,44 @@
|
||||
namespace AIStudio.Tools.PluginSystem;
|
||||
|
||||
public sealed class PluginMetadata(PluginBase plugin) : IPluginMetadata
|
||||
{
|
||||
#region Implementation of IPluginMetadata
|
||||
|
||||
/// <inheritdoc />
|
||||
public PluginType Type { get; } = plugin.Type;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id { get; } = plugin.Id;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name { get; } = plugin.Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Description { get; } = plugin.Description;
|
||||
|
||||
/// <inheritdoc />
|
||||
public PluginVersion Version { get; } = plugin.Version;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string[] Authors { get; } = plugin.Authors;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string SupportContact { get; } = plugin.SupportContact;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string SourceURL { get; } = plugin.SourceURL;
|
||||
|
||||
/// <inheritdoc />
|
||||
public PluginCategory[] Categories { get; } = plugin.Categories;
|
||||
|
||||
/// <inheritdoc />
|
||||
public PluginTargetGroup[] TargetGroups { get; } = plugin.TargetGroups;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IsMaintained { get; } = plugin.IsMaintained;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? DeprecationMessage { get; } = plugin.DeprecationMessage;
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Reference in New Issue
Block a user