From c6ea723976ed444bc175ca5b2d950287106e5f0a Mon Sep 17 00:00:00 2001 From: Bolo <36342729+PppBr@users.noreply.github.com> Date: Mon, 6 Aug 2018 10:29:14 -0500 Subject: [PATCH] come accross the loading corpus problem in GetIntentExpressions --- BotSharp.Core/Engines/BotTrainer.cs | 7 ++++--- BotSharp.RestApi/AgentController.cs | 15 +++++++++++++++ BotSharp.WebHost/Settings/app.json | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/BotSharp.Core/Engines/BotTrainer.cs b/BotSharp.Core/Engines/BotTrainer.cs index c5b6984f0..a7812a443 100644 --- a/BotSharp.Core/Engines/BotTrainer.cs +++ b/BotSharp.Core/Engines/BotTrainer.cs @@ -46,15 +46,16 @@ public string Train(Agent agent) // Get NLP Provider var config = (IConfiguration)AppDomain.CurrentDomain.GetData("Configuration"); var assemblies = (string[])AppDomain.CurrentDomain.GetData("Assemblies"); - string providerName = config.GetSection($"{config}:Provider").Value; + var platform = config.GetSection($"BotPlatform").Value; + string providerName = config.GetSection($"{platform}:Provider").Value; var provider = TypeHelper.GetInstance(providerName, assemblies) as INlpPipeline; - provider.Configuration = config.GetSection("BotSharpAi"); + provider.Configuration = config.GetSection(platform); provider.Process(agent, data); //var corpus = agent.GrabCorpus(dc); // pipe process - var pipelines = config.GetSection($"{config}:Pipe").Value + var pipelines = provider.Configuration.GetSection($"Pipe").Value .Split(',') .Select(x => x.Trim()) .ToList(); diff --git a/BotSharp.RestApi/AgentController.cs b/BotSharp.RestApi/AgentController.cs index 8e8fa3237..153b8bb83 100644 --- a/BotSharp.RestApi/AgentController.cs +++ b/BotSharp.RestApi/AgentController.cs @@ -37,6 +37,21 @@ public ActionResult Restore([FromRoute] String agentId) return Ok(); } + /// + /// Restore a agent from a uploaded zip file + /// + /// + /// + [HttpGet("{agentId}")] + public string Train([FromRoute] String agentId) + { + var ai = new BotSharpAi(); + ai.LoadAgent("bff7605c-3db5-44dc-9ba7-1c9be2832318"); + ai.Train(); + + return ""; + } + /// /// Dump agent /// diff --git a/BotSharp.WebHost/Settings/app.json b/BotSharp.WebHost/Settings/app.json index b86eafa89..e60729fd3 100644 --- a/BotSharp.WebHost/Settings/app.json +++ b/BotSharp.WebHost/Settings/app.json @@ -1,4 +1,4 @@ { "Assemblies": "BotSharp.Core", - "BotPlatform": "ApiAi" + "BotPlatform": "BotSharpAi" }