2023-08-31 02:09:38 +00:00
|
|
|
using BotSharp.Abstraction.Conversations;
|
2023-08-31 14:52:09 +00:00
|
|
|
using BotSharp.Abstraction.MLTasks;
|
2023-08-31 02:09:38 +00:00
|
|
|
using BotSharp.Abstraction.Plugins;
|
2023-08-31 14:52:09 +00:00
|
|
|
using BotSharp.Plugin.RoutingSpeeder.Settings;
|
|
|
|
|
using BotSharp.Plugin.RoutingSpeeder.Providers;
|
2023-08-31 02:09:38 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Plugin.RoutingSpeeder;
|
|
|
|
|
|
|
|
|
|
public class RoutingSpeederPlugin : IBotSharpPlugin
|
|
|
|
|
{
|
|
|
|
|
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
|
|
|
|
{
|
2023-08-31 14:52:09 +00:00
|
|
|
var settings = new routerSpeedSettings();
|
|
|
|
|
config.Bind("routerSpeed", settings);
|
|
|
|
|
services.AddSingleton(x => settings);
|
|
|
|
|
services.AddSingleton(x => settings.fastText);
|
2023-08-31 02:09:38 +00:00
|
|
|
services.AddScoped<IConversationHook, RoutingConversationHook>();
|
2023-08-31 14:52:09 +00:00
|
|
|
services.AddSingleton<ITextEmbedding, fastTextEmbeddingProvider>();
|
2023-08-31 02:09:38 +00:00
|
|
|
}
|
|
|
|
|
}
|