mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 19:19:47 +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>
|
/// <summary>
|
||||||
/// Represents the base of any AI Studio plugin.
|
/// Represents the base of any AI Studio plugin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class PluginBase
|
public abstract class PluginBase : IPluginMetadata
|
||||||
{
|
{
|
||||||
private readonly IReadOnlyCollection<string> baseIssues;
|
private readonly IReadOnlyCollection<string> baseIssues;
|
||||||
protected readonly LuaState state;
|
protected readonly LuaState state;
|
||||||
|
|
||||||
protected readonly List<string> pluginIssues = [];
|
protected readonly List<string> pluginIssues = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The type of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public PluginType Type { get; }
|
public PluginType Type { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The ID of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public Guid Id { get; }
|
public Guid Id { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The name of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; } = string.Empty;
|
public string Name { get; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The description of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public string Description { get; } = string.Empty;
|
public string Description { get; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The version of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public PluginVersion Version { get; }
|
public PluginVersion Version { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The authors of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public string[] Authors { get; } = [];
|
public string[] Authors { get; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The support contact for this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public string SupportContact { get; } = string.Empty;
|
public string SupportContact { get; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The source URL of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public string SourceURL { get; } = string.Empty;
|
public string SourceURL { get; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The categories of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public PluginCategory[] Categories { get; } = [];
|
public PluginCategory[] Categories { get; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The target groups of this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public PluginTargetGroup[] TargetGroups { get; } = [];
|
public PluginTargetGroup[] TargetGroups { get; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// True, when the plugin is maintained.
|
|
||||||
/// </summary>
|
|
||||||
public bool IsMaintained { get; }
|
public bool IsMaintained { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <inheritdoc />
|
||||||
/// The message that should be displayed when the plugin is deprecated.
|
|
||||||
/// </summary>
|
|
||||||
public string? DeprecationMessage { get; }
|
public string? DeprecationMessage { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <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