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" }