From a858e1c4f8638ef44a45a2766c5e727e2f8b845f Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Sun, 27 May 2018 10:35:16 -0500 Subject: [PATCH] remove lang in response message. --- .../Dialogflow/DialogflowIntentResponseMessage.cs | 1 - BotSharp.Core/BotSharp.Core.csproj | 3 ++- BotSharp.Core/Engines/AgentImporterInDialogflow.cs | 2 -- BotSharp.Core/Intents/IntentDriver.cs | 13 +++++++++++++ BotSharp.Core/Intents/IntentResponseMessage.cs | 4 ---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/BotSharp.Core/Adapters/Dialogflow/DialogflowIntentResponseMessage.cs b/BotSharp.Core/Adapters/Dialogflow/DialogflowIntentResponseMessage.cs index c5439b65..f5188398 100644 --- a/BotSharp.Core/Adapters/Dialogflow/DialogflowIntentResponseMessage.cs +++ b/BotSharp.Core/Adapters/Dialogflow/DialogflowIntentResponseMessage.cs @@ -7,7 +7,6 @@ namespace BotSharp.Core.Adapters.Dialogflow { public class DialogflowIntentResponseMessage : AIResponseMessageBase { - public string Lang { get; set; } public Object Speech { get; set; } public Object Payload { get; set; } } diff --git a/BotSharp.Core/BotSharp.Core.csproj b/BotSharp.Core/BotSharp.Core.csproj index ab625d88..32d3e63f 100644 --- a/BotSharp.Core/BotSharp.Core.csproj +++ b/BotSharp.Core/BotSharp.Core.csproj @@ -12,13 +12,14 @@ true Haiping Chen - BotSharp + BotSharp.Core .Net implementation of open chatbot platform like google Dialogflow. Modulized design supports different NLU engine as backend. MIT https://github.com/Oceania2018/BotSharp NLU, Chatbot, Bot, AI Bot 1.1.0 Support Rasa NLU 0.12.x + Since 2018 Haiping Chen diff --git a/BotSharp.Core/Engines/AgentImporterInDialogflow.cs b/BotSharp.Core/Engines/AgentImporterInDialogflow.cs index 7ae1ed16..447abf81 100644 --- a/BotSharp.Core/Engines/AgentImporterInDialogflow.cs +++ b/BotSharp.Core/Engines/AgentImporterInDialogflow.cs @@ -107,7 +107,6 @@ namespace BotSharp.Core.Engines { return new IntentResponseMessage { - Lang = x.Lang, Payload = JObject.FromObject(x.Payload), Type = x.Type }; @@ -119,7 +118,6 @@ namespace BotSharp.Core.Engines return new IntentResponseMessage { - Lang = x.Lang, Speech = speech, Type = x.Type }; diff --git a/BotSharp.Core/Intents/IntentDriver.cs b/BotSharp.Core/Intents/IntentDriver.cs index 1191e292..68e3c12b 100644 --- a/BotSharp.Core/Intents/IntentDriver.cs +++ b/BotSharp.Core/Intents/IntentDriver.cs @@ -1,5 +1,7 @@ using BotSharp.Core.Agents; +using BotSharp.Core.Engines; using EntityFrameworkCore.BootKit; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; @@ -9,6 +11,17 @@ namespace BotSharp.Core.Intents { public static class IntentDriver { + public static Intent GetIntent(this IBotEngine bot, Database dc, string intentId) + { + return dc.Table() + .Include(x => x.Contexts) + .Include(x => x.Responses).ThenInclude(x => x.Contexts) + .Include(x => x.Responses).ThenInclude(x => x.Parameters) + .Include(x => x.Responses).ThenInclude(x => x.Messages) + .Include(x => x.UserSays).ThenInclude(x => x.Data) + .FirstOrDefault(x => x.Id == intentId); + } + public static String CreateIntent(this Agent agent, Database dc, Intent intent) { if (dc.Table().Any(x => x.Id == intent.Id)) return intent.Id; diff --git a/BotSharp.Core/Intents/IntentResponseMessage.cs b/BotSharp.Core/Intents/IntentResponseMessage.cs index 6cbaee78..e0d3799d 100644 --- a/BotSharp.Core/Intents/IntentResponseMessage.cs +++ b/BotSharp.Core/Intents/IntentResponseMessage.cs @@ -19,10 +19,6 @@ namespace BotSharp.Core.Intents public AIResponseMessageType Type { get; set; } - [Required] - [MaxLength(5)] - public String Lang { get; set; } - /// /// json list data ///