2023-05-27 01:58:31 +00:00
|
|
|
using BotSharp.Abstraction;
|
2023-06-03 14:57:08 +00:00
|
|
|
using BotSharp.Platform.Native.Handlers;
|
|
|
|
|
using BotSharp.Platform.Native.Settings;
|
2023-05-27 01:58:31 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Core;
|
|
|
|
|
|
2023-06-03 14:57:08 +00:00
|
|
|
public static class BotSharplServiceCollectionExtensions
|
2023-05-27 01:58:31 +00:00
|
|
|
{
|
2023-06-03 14:57:08 +00:00
|
|
|
public static IServiceCollection AddBotSharpCommunityPlatform(this IServiceCollection services, IConfiguration config)
|
2023-05-27 01:58:31 +00:00
|
|
|
{
|
|
|
|
|
services.AddSingleton(x =>
|
|
|
|
|
{
|
|
|
|
|
var settings = new LlamaSharpSettings();
|
|
|
|
|
config.Bind("LlamaSharp", settings);
|
|
|
|
|
return settings;
|
|
|
|
|
});
|
2023-05-29 01:06:05 +00:00
|
|
|
services.AddSingleton<IChatCompletionHandler, ChatCompletionHandler>();
|
2023-05-27 01:58:31 +00:00
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|