intent detail fix

This commit is contained in:
Oceania2018 2018-06-02 22:53:54 -05:00
parent a858e1c4f8
commit 33d6aa1f2a
3 changed files with 12 additions and 0 deletions

View file

@ -20,6 +20,7 @@
<Version>1.1.0</Version>
<PackageReleaseNotes>Support Rasa NLU 0.12.x</PackageReleaseNotes>
<Copyright>Since 2018 Haiping Chen</Copyright>
<PackageProjectUrl>https://github.com/Oceania2018/BotSharp</PackageProjectUrl>
</PropertyGroup>
<ItemGroup>

View file

@ -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<Intent>().Any(x => x.Id == intent.Id)) return intent.Id;
dc.Table<Intent>().Add(intent);

View file

@ -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()