add entity color
This commit is contained in:
parent
41fd2a8bc4
commit
2e91b54d6d
|
|
@ -9,6 +9,15 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<Authors>Haiping Chen</Authors>
|
||||
<Company />
|
||||
<Product>BotSharp</Product>
|
||||
<Description>.Net implementation of open chatbot platform like google Dialogflow. Modulized design supports different NLU engine as backend.</Description>
|
||||
<RepositoryType>MIT</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Oceania2018/BotSharp</RepositoryUrl>
|
||||
<PackageTags>NLU, Chatbot, Bot, AI Bot</PackageTags>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -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<DialogflowAgent>(data);
|
||||
agent.Id = Guid.NewGuid().ToString();
|
||||
agent.Name = agentId;
|
||||
|
|
@ -31,11 +31,11 @@ namespace BotSharp.Core.Engines
|
|||
{
|
||||
agent.Entities = new List<Entity>();
|
||||
|
||||
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<Intent>();
|
||||
|
||||
Directory.EnumerateFiles($"{agentDir}\\Dialogflow\\{agent.Name}\\intents")
|
||||
Directory.EnumerateFiles($"{agentDir}{Path.DirectorySeparatorChar}Dialogflow{Path.DirectorySeparatorChar}{agent.Name}{Path.DirectorySeparatorChar}intents")
|
||||
.ToList()
|
||||
.ForEach(fileName =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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<EntityEntry> Entries { get; set; }
|
||||
|
||||
public bool IsOverridable { get; set; }
|
||||
|
||||
public bool IsEnum { get; set; }
|
||||
|
||||
[StringLength(7)]
|
||||
public string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Entries count
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public int Count { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue