2023-05-27 01:58:31 +00:00
|
|
|
using BotSharp.Abstraction;
|
2023-06-03 04:01:03 +00:00
|
|
|
using BotSharp.Platform.Community;
|
|
|
|
|
using BotSharp.Platform.Community.Handlers;
|
2023-05-27 01:58:31 +00:00
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Core;
|
|
|
|
|
|
|
|
|
|
public static class LlamaSharplServiceCollectionExtensions
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddLlamaSharp(this IServiceCollection services, IConfiguration config)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|