using BotSharp.Abstraction.Conversations.Enums; namespace BotSharp.Abstraction.Conversations.Models; public class Conversation { public string Id { get; set; } = string.Empty; public string AgentId { get; set; } = string.Empty; public string UserId { get; set; } = string.Empty; /// /// Agent task id /// public string? TaskId { get; set; } public string Title { get; set; } = string.Empty; public string TitleAlias { get; set; } = string.Empty; [JsonIgnore] public List Dialogs { get; set; } = []; [JsonIgnore] public Dictionary States { get; set; } = []; public string Status { get; set; } = ConversationStatus.Open; public string Channel { get; set; } = ConversationChannel.OpenAPI; /// /// Channel id, like phone number, email address, etc. /// public string ChannelId { get; set; } = default!; public int DialogCount { get; set; } public List Tags { get; set; } = []; public DateTime UpdatedTime { get; set; } = DateTime.UtcNow; public DateTime CreatedTime { get; set; } = DateTime.UtcNow; } public class DialogElement { [JsonPropertyName("meta_data")] public DialogMetaData MetaData { get; set; } = new(); [JsonPropertyName("content")] public string Content { get; set; } = default!; [JsonPropertyName("secondary_content")] public string? SecondaryContent { get; set; } [JsonPropertyName("rich_content")] public string? RichContent { get; set; } [JsonPropertyName("secondary_rich_content")] public string? SecondaryRichContent { get; set; } [JsonPropertyName("payload")] public string? Payload { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("data")] public object? Data { get; set; } public DialogElement() { } public DialogElement(DialogMetaData meta, string content, string? richContent = null, string? secondaryContent = null, string? secondaryRichContent = null, string? payload = null, object? data = null) { MetaData = meta; Content = content; RichContent = richContent; SecondaryContent = secondaryContent; SecondaryRichContent = secondaryRichContent; Payload = payload; Data = data; } public override string ToString() { return $"{MetaData.Role}: {Content} [{MetaData?.CreatedTime}]"; } } public class DialogMetaData { [JsonPropertyName("role")] public string Role { get; set; } = default!; [JsonPropertyName("agent_id")] public string AgentId { get; set; } = default!; [JsonPropertyName("message_id")] public string MessageId { get; set; } = default!; [JsonPropertyName("message_type")] public string MessageType { get; set; } = default!; [JsonPropertyName("function_name")] public string? FunctionName { get; set; } [JsonPropertyName("sender_id")] public string? SenderId { get; set; } [JsonPropertyName("create_at")] public DateTime CreatedTime { get; set; } }