2018-06-18 14:15:54 +00:00
|
|
|
|
using DotNetToolkit;
|
|
|
|
|
|
using EntityFrameworkCore.BootKit;
|
2017-12-18 05:30:20 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2017-12-18 13:31:15 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2017-12-18 05:30:20 +00:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2018-06-18 14:15:54 +00:00
|
|
|
|
using System.Linq;
|
2017-12-18 05:30:20 +00:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
2018-03-28 22:08:49 +00:00
|
|
|
|
namespace BotSharp.Core.Intents
|
2017-12-18 05:30:20 +00:00
|
|
|
|
{
|
2018-01-02 18:05:35 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Intent Table
|
|
|
|
|
|
/// </summary>
|
2017-12-30 20:26:35 +00:00
|
|
|
|
[Table("Bot_Intent")]
|
|
|
|
|
|
public class Intent : DbRecord, IDbRecord
|
2017-12-18 05:30:20 +00:00
|
|
|
|
{
|
2017-12-18 13:31:15 +00:00
|
|
|
|
[Required]
|
|
|
|
|
|
[StringLength(36)]
|
|
|
|
|
|
public String AgentId { get; set; }
|
|
|
|
|
|
|
2018-04-30 03:09:32 +00:00
|
|
|
|
[MaxLength(64)]
|
2017-12-18 05:30:20 +00:00
|
|
|
|
public String Name { get; set; }
|
2017-12-18 13:31:15 +00:00
|
|
|
|
|
|
|
|
|
|
[MaxLength(256)]
|
|
|
|
|
|
public String Description { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[ForeignKey("IntentId")]
|
2018-03-21 21:07:43 +00:00
|
|
|
|
public List<IntentInputContext> Contexts { get; set; }
|
|
|
|
|
|
|
2018-06-18 14:15:54 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Get input contexts hash
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[NotMapped]
|
|
|
|
|
|
public String ContextHash
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2018-06-18 22:15:32 +00:00
|
|
|
|
return Contexts == null || Contexts.Count == 0
|
|
|
|
|
|
? Guid.Empty.ToString("N")
|
|
|
|
|
|
: $"{String.Join(',', Contexts.OrderBy(x => x.Name).Select(x => x.Name))}".GetMd5Hash();
|
2018-06-18 14:15:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-03-21 21:07:43 +00:00
|
|
|
|
[ForeignKey("IntentId")]
|
|
|
|
|
|
public List<IntentExpression> UserSays { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[ForeignKey("IntentId")]
|
|
|
|
|
|
public List<IntentResponse> Responses { get; set; }
|
2017-12-18 05:30:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|