From 2e91b54d6decb752663a5cca013c20c4b0d36c7e Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Mon, 7 May 2018 23:04:59 -0500 Subject: [PATCH] add entity color --- BotSharp.Core/BotSharp.Core.csproj | 9 +++++++++ BotSharp.Core/Engines/AgentImporterInDialogflow.cs | 8 ++++---- BotSharp.Core/Entities/Entity.cs | 12 ++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/BotSharp.Core/BotSharp.Core.csproj b/BotSharp.Core/BotSharp.Core.csproj index 0b4df65f..41d0b6dd 100644 --- a/BotSharp.Core/BotSharp.Core.csproj +++ b/BotSharp.Core/BotSharp.Core.csproj @@ -9,6 +9,15 @@ netcoreapp2.0 + true + Haiping Chen + + BotSharp + .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.0.0 diff --git a/BotSharp.Core/Engines/AgentImporterInDialogflow.cs b/BotSharp.Core/Engines/AgentImporterInDialogflow.cs index dd0afa52..19f60ae3 100644 --- a/BotSharp.Core/Engines/AgentImporterInDialogflow.cs +++ b/BotSharp.Core/Engines/AgentImporterInDialogflow.cs @@ -19,7 +19,7 @@ namespace BotSharp.Core.Engines public Agent LoadAgent(string agentId, string agentDir) { // load agent profile - string data = File.ReadAllText($"{agentDir}\\Dialogflow\\{agentId}\\agent.json"); + string data = File.ReadAllText($"{agentDir}{Path.DirectorySeparatorChar}Dialogflow{Path.DirectorySeparatorChar}{agentId}{Path.DirectorySeparatorChar}agent.json"); var agent = JsonConvert.DeserializeObject(data); agent.Id = Guid.NewGuid().ToString(); agent.Name = agentId; @@ -31,11 +31,11 @@ namespace BotSharp.Core.Engines { agent.Entities = new List(); - Directory.EnumerateFiles($"{agentDir}\\Dialogflow\\{agent.Name}\\entities") + Directory.EnumerateFiles($"{agentDir}{Path.DirectorySeparatorChar}Dialogflow{Path.DirectorySeparatorChar}{agent.Name}{Path.DirectorySeparatorChar}entities") .ToList() .ForEach(fileName => { - string entityName = fileName.Split('\\').Last(); + string entityName = fileName.Split($"{Path.DirectorySeparatorChar}").Last(); if (!entityName.Contains("_")) { string entityJson = File.ReadAllText($"{fileName}"); @@ -63,7 +63,7 @@ namespace BotSharp.Core.Engines { agent.Intents = new List(); - Directory.EnumerateFiles($"{agentDir}\\Dialogflow\\{agent.Name}\\intents") + Directory.EnumerateFiles($"{agentDir}{Path.DirectorySeparatorChar}Dialogflow{Path.DirectorySeparatorChar}{agent.Name}{Path.DirectorySeparatorChar}intents") .ToList() .ForEach(fileName => { diff --git a/BotSharp.Core/Entities/Entity.cs b/BotSharp.Core/Entities/Entity.cs index 7791bbe4..6d5eaf2e 100644 --- a/BotSharp.Core/Entities/Entity.cs +++ b/BotSharp.Core/Entities/Entity.cs @@ -18,11 +18,23 @@ namespace BotSharp.Core.Entities [MaxLength(64)] public String Name { get; set; } + [MaxLength(256)] + public String Description { get; set; } + [ForeignKey("EntityId")] public List Entries { get; set; } public bool IsOverridable { get; set; } public bool IsEnum { get; set; } + + [StringLength(7)] + public string Color { get; set; } + + /// + /// Entries count + /// + [NotMapped] + public int Count { get; set; } } }