fix user expression parts order

This commit is contained in:
Oceania2018 2018-06-06 11:20:02 -05:00
parent 96e976fbe0
commit 6d9cf5ddbb
3 changed files with 10 additions and 2 deletions

View file

@ -83,7 +83,7 @@ namespace BotSharp.Core.Agents
var intents = dc.Table<Intent>()
.Include(x => x.Contexts)
.Include(x => x.UserSays).ThenInclude(say => say.Data)
.Where(x => x.UserSays.Count > 0)
.Where(x => x.AgentId == agent.Id && x.UserSays.Count > 0)
.ToList();
intents.ForEach(intent =>

View file

@ -13,13 +13,18 @@ namespace BotSharp.Core.Intents
{
public static Intent GetIntent(this IBotEngine bot, Database dc, string intentId)
{
return dc.Table<Intent>()
var intent = dc.Table<Intent>()
.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);
// order parts by time
intent.UserSays.ForEach(x => x.Data = x.Data.OrderBy(d => d.UpdatedTime).ToList());
return intent;
}
public static String CreateIntent(this Agent agent, Database dc, Intent intent)

View file

@ -19,6 +19,9 @@ namespace BotSharp.Core.Intents
[MaxLength(32)]
public string DataType { get; set; }
[MaxLength(128)]
public string DefaultValue { get; set; }
[MaxLength(64)]
public string Name { get; set; }