From 96e976fbe017e1115d68a8a70773a2817931a6a6 Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Tue, 5 Jun 2018 06:40:45 -0500 Subject: [PATCH] Upgrade .Net Core to 2.1 --- BotSharp.Core/BotSharp.Core.csproj | 10 +++++----- BotSharp.Core/Engines/RequestExtension.cs | 5 +++-- BotSharp.Core/Intents/IntentDriver.cs | 5 ----- BotSharp.UnitTest/BotSharp.UnitTest.csproj | 12 ++++++------ .../Settings/config_jieba_mitie_sklearn.yml | 2 -- BotSharp.UnitTest/Settings/config_spacy.yml | 3 +++ 6 files changed, 17 insertions(+), 20 deletions(-) create mode 100644 BotSharp.UnitTest/Settings/config_spacy.yml diff --git a/BotSharp.Core/BotSharp.Core.csproj b/BotSharp.Core/BotSharp.Core.csproj index f3220064..68ba3180 100644 --- a/BotSharp.Core/BotSharp.Core.csproj +++ b/BotSharp.Core/BotSharp.Core.csproj @@ -8,16 +8,16 @@ - netcoreapp2.0 + netcoreapp2.1 true Haiping Chen BotSharp.Core - .Net implementation of open chatbot platform like google Dialogflow. Modulized design supports different NLU engine as backend. + Upgrade .Net Core to 2.1 MIT https://github.com/Oceania2018/BotSharp NLU, Chatbot, Bot, AI Bot - 1.1.0 + 1.2.0 Support Rasa NLU 0.12.x Since 2018 Haiping Chen https://github.com/Oceania2018/BotSharp @@ -30,9 +30,9 @@ - + - + diff --git a/BotSharp.Core/Engines/RequestExtension.cs b/BotSharp.Core/Engines/RequestExtension.cs index 346ae0d1..c21c657e 100644 --- a/BotSharp.Core/Engines/RequestExtension.cs +++ b/BotSharp.Core/Engines/RequestExtension.cs @@ -473,8 +473,9 @@ namespace BotSharp.Core.Engines #if RASA_NLU_0_11 rest.AddParameter("application/json", json, ParameterType.RequestBody); #else - string body = File.ReadAllText($"{Database.ContentRootPath}{Path.DirectorySeparatorChar}Settings{Path.DirectorySeparatorChar}config_jieba_mitie_sklearn.yml"); - body = body.Replace("@data", json); + string trainingConfig = console.agent.Language == "zh" ? "config_jieba_mitie_sklearn.yml" : "config_spacy.yml"; + string body = File.ReadAllText($"{Database.ContentRootPath}{Path.DirectorySeparatorChar}Settings{Path.DirectorySeparatorChar}{trainingConfig}"); + body = $"{body}\r\ndata: {json}"; rest.AddParameter("application/x-yml", body, ParameterType.RequestBody); #endif diff --git a/BotSharp.Core/Intents/IntentDriver.cs b/BotSharp.Core/Intents/IntentDriver.cs index 3065a49b..68e3c12b 100644 --- a/BotSharp.Core/Intents/IntentDriver.cs +++ b/BotSharp.Core/Intents/IntentDriver.cs @@ -24,11 +24,6 @@ namespace BotSharp.Core.Intents public static String CreateIntent(this Agent agent, Database dc, Intent intent) { - if (String.IsNullOrEmpty(intent.Id)) - { - intent.Id = Guid.NewGuid().ToString(); - } - if (dc.Table().Any(x => x.Id == intent.Id)) return intent.Id; dc.Table().Add(intent); diff --git a/BotSharp.UnitTest/BotSharp.UnitTest.csproj b/BotSharp.UnitTest/BotSharp.UnitTest.csproj index fc2ae61d..4b239e00 100644 --- a/BotSharp.UnitTest/BotSharp.UnitTest.csproj +++ b/BotSharp.UnitTest/BotSharp.UnitTest.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + netcoreapp2.1 false @@ -221,11 +221,11 @@ - - - - - + + + + + diff --git a/BotSharp.UnitTest/Settings/config_jieba_mitie_sklearn.yml b/BotSharp.UnitTest/Settings/config_jieba_mitie_sklearn.yml index b49a4e34..9368c2fa 100644 --- a/BotSharp.UnitTest/Settings/config_jieba_mitie_sklearn.yml +++ b/BotSharp.UnitTest/Settings/config_jieba_mitie_sklearn.yml @@ -9,5 +9,3 @@ pipeline: - name: "intent_entity_featurizer_regex" - name: "intent_featurizer_mitie" - name: "intent_classifier_sklearn" - -data: @data diff --git a/BotSharp.UnitTest/Settings/config_spacy.yml b/BotSharp.UnitTest/Settings/config_spacy.yml new file mode 100644 index 00000000..bc12d3f5 --- /dev/null +++ b/BotSharp.UnitTest/Settings/config_spacy.yml @@ -0,0 +1,3 @@ +language: "en" + +pipeline: "spacy_sklearn" \ No newline at end of file