Add Name/ Desc to IBotSharpPlugin
This commit is contained in:
parent
4e2d00611b
commit
34e22ce35f
|
|
@ -5,5 +5,7 @@ namespace BotSharp.Abstraction.Plugins;
|
|||
|
||||
public interface IBotSharpPlugin
|
||||
{
|
||||
string Name => "";
|
||||
string Description => "";
|
||||
void RegisterDI(IServiceCollection services, IConfiguration config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using BotSharp.Abstraction.Plugins.Models;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
|
@ -45,20 +46,21 @@ public class PluginLoader
|
|||
foreach (var module in modules)
|
||||
{
|
||||
module.RegisterDI(_services, _config);
|
||||
string classSummary = GetSummaryComment(module.GetType());
|
||||
// string classSummary = GetSummaryComment(module.GetType());
|
||||
var name = string.IsNullOrEmpty(module.Name) ? module.GetType().Name : module.Name;
|
||||
_modules.Add(module);
|
||||
_plugins.Add(new PluginDef
|
||||
{
|
||||
Name = module.GetType().Name,
|
||||
Description = classSummary,
|
||||
Name = name,
|
||||
Description = module.Description,
|
||||
Assembly = assemblyName
|
||||
});
|
||||
Console.Write($"Loaded plugin ");
|
||||
Console.Write(module.GetType().Name, Color.Green);
|
||||
Console.Write(name, Color.Green);
|
||||
Console.WriteLine($" from {assemblyName}.");
|
||||
if (!string.IsNullOrEmpty(classSummary))
|
||||
if (!string.IsNullOrEmpty(module.Description))
|
||||
{
|
||||
Console.WriteLine(classSummary);
|
||||
Console.WriteLine(module.Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ namespace BotSharp.Platform.AzureAi;
|
|||
/// </summary>
|
||||
public class AzureOpenAiPlugin : IBotSharpPlugin
|
||||
{
|
||||
public string Name => "Azure OpenAI";
|
||||
public string Description => "Azure OpenAI Service";
|
||||
|
||||
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
var settings = new AzureOpenAiSettings();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ namespace BotSharp.Plugin.MongoStorage;
|
|||
/// </summary>
|
||||
public class MongoStoragePlugin : IBotSharpPlugin
|
||||
{
|
||||
public string Name => "MongoDB Storage";
|
||||
public string Description => "MongoDB as the repository";
|
||||
|
||||
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
||||
{
|
||||
var dbSettings = new BotSharpDatabaseSettings();
|
||||
|
|
|
|||
Loading…
Reference in a new issue