BotSharp/BotSharp.Platform.Dialogflow/ModuleInjector.cs
haiping008 3c7c3c183b add ContextStorageFactory
persist context to file
2018-12-07 16:57:26 -06:00

34 lines
1.2 KiB
C#

using BotSharp.Core;
using BotSharp.Core.AgentStorage;
using BotSharp.Core.ContextStorage;
using BotSharp.Core.Modules;
using BotSharp.Platform.Abstraction;
using BotSharp.Platform.Dialogflow.Models;
using BotSharp.Platform.Models;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
namespace BotSharp.Platform.Dialogflow
{
public class ModuleInjector : IModule
{
public void ConfigureServices(IServiceCollection services, IConfiguration config)
{
services.AddSingleton<IPlatformBuilder<AgentModel>, DialogflowAi<AgentModel>>();
services.AddSingleton<DialogflowAi<AgentModel>>();
AgentStorageServiceRegister.Register<AgentModel>(services);
PlatformConfigServiceRegister.Register<PlatformSettings>("dialogflowAi", services, config);
ContextStorageServiceRegister.Register<AIContext>(services);
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
}
}
}