From 66b62fcd1646f39cc3abbf1510dc47ce876c3d66 Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Wed, 29 Aug 2018 17:24:12 -0500 Subject: [PATCH] Fix database startup issue. --- BotSharp.Core/Engines/BotPredictor.cs | 8 ++++---- BotSharp.RestApi/Rasa/ParseController.cs | 11 +++++++++-- BotSharp.WebHost/Startup.cs | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/BotSharp.Core/Engines/BotPredictor.cs b/BotSharp.Core/Engines/BotPredictor.cs index 81d37948..ebc410b7 100644 --- a/BotSharp.Core/Engines/BotPredictor.cs +++ b/BotSharp.Core/Engines/BotPredictor.cs @@ -61,13 +61,13 @@ namespace BotSharp.Core.Engines .Select(x => x.Trim()) .ToList(); - pipelines.ForEach(async pipeName => + for(int pipeIdx = 0; pipeIdx < pipelines.Count; pipeIdx++) { - var pipe = TypeHelper.GetInstance(pipeName, assemblies) as INlpPredict; + var pipe = TypeHelper.GetInstance(pipelines[pipeIdx], assemblies) as INlpPredict; pipe.Configuration = provider.Configuration; pipe.Settings = settings; - await pipe.Predict(agent, data, meta.Pipeline.FirstOrDefault(x => x.Name == pipeName)); - }); + await pipe.Predict(agent, data, meta.Pipeline.FirstOrDefault(x => x.Name == pipelines[pipeIdx])); + } Console.WriteLine(JsonConvert.SerializeObject(data, new JsonSerializerSettings { diff --git a/BotSharp.RestApi/Rasa/ParseController.cs b/BotSharp.RestApi/Rasa/ParseController.cs index 0d4d76be..b55a92ac 100644 --- a/BotSharp.RestApi/Rasa/ParseController.cs +++ b/BotSharp.RestApi/Rasa/ParseController.cs @@ -57,7 +57,7 @@ namespace BotSharp.RestApi.Rasa if (String.IsNullOrEmpty(request.Model)) { - request.Model = Directory.GetDirectories(projectPath).Where(x => x.Contains("model_")).Last(); + request.Model = Directory.GetDirectories(projectPath).Where(x => x.Contains("model_")).Last().Split(Path.DirectorySeparatorChar).Last(); } var modelPath = Path.Combine(projectPath, request.Model); @@ -88,7 +88,14 @@ namespace BotSharp.RestApi.Rasa Text = request.Text, Model = request.Model, Project = agent.Name, - IntentRanking = new List { } + IntentRanking = new List + { + new RasaResponseIntent + { + Name = aIResponse.Result.Metadata.IntentName, + Confidence = aIResponse.Result.Score + } + } }; return rasaResponse; diff --git a/BotSharp.WebHost/Startup.cs b/BotSharp.WebHost/Startup.cs index 5b9241fd..ee319a0b 100644 --- a/BotSharp.WebHost/Startup.cs +++ b/BotSharp.WebHost/Startup.cs @@ -123,10 +123,10 @@ namespace BotSharp.WebHost AppDomain.CurrentDomain.SetData("ContentRootPath", env.ContentRootPath); AppDomain.CurrentDomain.SetData("Assemblies", Configuration.GetValue("Assemblies").Split(',')); - InitializationLoader loader = new InitializationLoader(); + /*InitializationLoader loader = new InitializationLoader(); loader.Env = env; loader.Config = Configuration; - loader.Load(); + loader.Load();*/ } } } \ No newline at end of file