From a653aab13dfd7c19aa4aba101459f6b3689a79cc Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Mon, 25 Jun 2018 07:38:34 -0500 Subject: [PATCH] fix use says is empty. --- BotSharp.Core/Agents/AgentTrainConfig.cs | 21 ++++++++++++++++ .../Dialogflow/AgentImporterInDialogflow.cs | 24 +++++++++++-------- BotSharp.Core/Entities/EntityType.cs | 2 +- 3 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 BotSharp.Core/Agents/AgentTrainConfig.cs diff --git a/BotSharp.Core/Agents/AgentTrainConfig.cs b/BotSharp.Core/Agents/AgentTrainConfig.cs new file mode 100644 index 00000000..4b9660e1 --- /dev/null +++ b/BotSharp.Core/Agents/AgentTrainConfig.cs @@ -0,0 +1,21 @@ +using EntityFrameworkCore.BootKit; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace BotSharp.Core.Agents +{ + [Table("Bot_AgentTrainConfig")] + public class AgentTrainConfig : DbRecord, IDbRecord + { + [Required] + [StringLength(36)] + public String AgentId { get; set; } + + public decimal ClassificationThreshould { get; set; } + + public String Pipeline { get; set; } + } +} diff --git a/BotSharp.Core/Engines/Dialogflow/AgentImporterInDialogflow.cs b/BotSharp.Core/Engines/Dialogflow/AgentImporterInDialogflow.cs index 73375431..f867fb66 100644 --- a/BotSharp.Core/Engines/Dialogflow/AgentImporterInDialogflow.cs +++ b/BotSharp.Core/Engines/Dialogflow/AgentImporterInDialogflow.cs @@ -213,17 +213,21 @@ namespace BotSharp.Core.Engines public void LoadBuildinEntities(Agent agent, string agentDir) { - agent.Intents.ForEach(intent => { + agent.Intents.ForEach(intent => + { - intent.UserSays.ForEach(us => { - - us.Data.Where(data => data.Meta != null) - .ToList() - .ForEach(data => - { - LoadBuildinEntityTypePerUserSay(agent, data); - }); - }); + if (intent.UserSays != null) + { + intent.UserSays.ForEach(us => + { + us.Data.Where(data => data.Meta != null) + .ToList() + .ForEach(data => + { + LoadBuildinEntityTypePerUserSay(agent, data); + }); + }); + } }); } diff --git a/BotSharp.Core/Entities/EntityType.cs b/BotSharp.Core/Entities/EntityType.cs index 68a5d48e..92c00026 100644 --- a/BotSharp.Core/Entities/EntityType.cs +++ b/BotSharp.Core/Entities/EntityType.cs @@ -28,7 +28,7 @@ namespace BotSharp.Core.Entities public bool IsEnum { get; set; } - [StringLength(7)] + [StringLength(6)] public string Color { get; set; } ///