2018-03-28 22:08:49 +00:00
|
|
|
|
using BotSharp.Core.Agents;
|
|
|
|
|
|
using BotSharp.Core.Entities;
|
|
|
|
|
|
using BotSharp.Core.Models;
|
2018-03-21 21:07:43 +00:00
|
|
|
|
using EntityFrameworkCore.BootKit;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
2018-03-28 22:08:49 +00:00
|
|
|
|
namespace BotSharp.Core.Engines
|
2018-03-21 21:07:43 +00:00
|
|
|
|
{
|
2018-04-30 03:09:32 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Rasa nlu 0.11.x
|
|
|
|
|
|
/// </summary>
|
2018-05-22 00:39:33 +00:00
|
|
|
|
public class RasaAi : IBotEngine
|
2018-03-21 21:07:43 +00:00
|
|
|
|
{
|
2018-03-28 22:08:49 +00:00
|
|
|
|
public Database dc { get; set; }
|
|
|
|
|
|
public AIConfiguration AiConfig { get; set; }
|
2018-03-21 21:07:43 +00:00
|
|
|
|
public static IConfiguration Configuration { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public Agent agent { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public RasaAi(Database dc)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.dc = dc;
|
2018-03-28 22:08:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public RasaAi(Database dc, AIConfiguration aiConfig)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.dc = dc;
|
|
|
|
|
|
|
|
|
|
|
|
AiConfig = aiConfig;
|
2018-05-22 00:39:33 +00:00
|
|
|
|
agent = this.LoadAgent(dc, aiConfig);
|
2018-03-28 22:08:49 +00:00
|
|
|
|
aiConfig.DevMode = agent.DeveloperAccessToken == aiConfig.ClientAccessToken;
|
2018-03-21 21:07:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|