From 33d6aa1f2ac0516123134c4560fbc74fcf66792f Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Sat, 2 Jun 2018 22:53:54 -0500 Subject: [PATCH] intent detail fix --- BotSharp.Core/BotSharp.Core.csproj | 1 + BotSharp.Core/Intents/IntentDriver.cs | 5 +++++ README.md | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/BotSharp.Core/BotSharp.Core.csproj b/BotSharp.Core/BotSharp.Core.csproj index 32d3e63f..f3220064 100644 --- a/BotSharp.Core/BotSharp.Core.csproj +++ b/BotSharp.Core/BotSharp.Core.csproj @@ -20,6 +20,7 @@ 1.1.0 Support Rasa NLU 0.12.x Since 2018 Haiping Chen + https://github.com/Oceania2018/BotSharp diff --git a/BotSharp.Core/Intents/IntentDriver.cs b/BotSharp.Core/Intents/IntentDriver.cs index 68e3c12b..3065a49b 100644 --- a/BotSharp.Core/Intents/IntentDriver.cs +++ b/BotSharp.Core/Intents/IntentDriver.cs @@ -24,6 +24,11 @@ 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/README.md b/README.md index 94d0cdca..93e08c26 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,12 @@ * Import agent from Dialogflow directly ### How to use +````shell +PM> Install-Package BotSharp.Core -Version 1.1.0 +```` + + + ````cs [TestMethod] public void RestoreAgentTest()