2023-11-15 13:33:46 +00:00
|
|
|
using BotSharp.Abstraction.Conversations.Enums;
|
2023-09-08 18:16:23 +00:00
|
|
|
|
2023-06-12 13:28:49 +00:00
|
|
|
namespace BotSharp.Abstraction.Conversations.Models;
|
|
|
|
|
|
2023-06-27 18:31:13 +00:00
|
|
|
public class Conversation
|
2023-06-12 13:28:49 +00:00
|
|
|
{
|
|
|
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
|
public string AgentId { get; set; } = string.Empty;
|
|
|
|
|
public string UserId { get; set; } = string.Empty;
|
2024-02-12 15:14:33 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Agent task id
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? TaskId { get; set; }
|
2023-06-12 13:28:49 +00:00
|
|
|
public string Title { get; set; } = string.Empty;
|
2023-11-15 13:33:46 +00:00
|
|
|
|
2023-09-08 18:16:23 +00:00
|
|
|
[JsonIgnore]
|
2023-11-22 00:16:45 +00:00
|
|
|
public List<DialogElement> Dialogs { get; set; } = new List<DialogElement>();
|
2023-11-15 13:33:46 +00:00
|
|
|
|
2023-09-08 18:16:23 +00:00
|
|
|
[JsonIgnore]
|
2024-01-02 17:40:08 +00:00
|
|
|
public Dictionary<string, string> States { get; set; } = new Dictionary<string, string>();
|
2023-06-27 18:31:13 +00:00
|
|
|
|
2023-11-15 13:33:46 +00:00
|
|
|
public string Status { get; set; } = ConversationStatus.Open;
|
|
|
|
|
|
2023-11-20 15:51:57 +00:00
|
|
|
public string Channel { get; set; } = ConversationChannel.OpenAPI;
|
|
|
|
|
|
2023-06-12 13:28:49 +00:00
|
|
|
public DateTime UpdatedTime { get; set; } = DateTime.UtcNow;
|
|
|
|
|
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
|
2024-03-24 01:31:15 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The default value will be same as CreatedTime
|
|
|
|
|
/// It used to insert a breakpoint in the conversation to hide the previous dialogs.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime Breakpoint { get; set; } = DateTime.UtcNow.AddMilliseconds(-100);
|
2023-06-12 13:28:49 +00:00
|
|
|
}
|
2023-11-22 00:16:45 +00:00
|
|
|
|
|
|
|
|
public class DialogElement
|
|
|
|
|
{
|
2024-02-22 16:02:11 +00:00
|
|
|
public DialogMetaData MetaData { get; set; }
|
2023-11-22 00:16:45 +00:00
|
|
|
public string Content { get; set; }
|
2024-02-22 16:02:11 +00:00
|
|
|
public string? RichContent { get; set; }
|
2023-11-22 00:16:45 +00:00
|
|
|
|
|
|
|
|
public DialogElement()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-22 16:02:11 +00:00
|
|
|
public DialogElement(DialogMetaData meta, string content, string? richContent = null)
|
2023-11-22 00:16:45 +00:00
|
|
|
{
|
|
|
|
|
MetaData = meta;
|
|
|
|
|
Content = content;
|
2024-02-22 16:02:11 +00:00
|
|
|
RichContent = richContent;
|
2023-11-22 00:16:45 +00:00
|
|
|
}
|
2024-03-24 17:33:41 +00:00
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"{MetaData.Role}: {Content} [{MetaData.CreateTime}]";
|
|
|
|
|
}
|
2023-11-22 00:16:45 +00:00
|
|
|
}
|
2023-12-28 18:27:09 +00:00
|
|
|
|
2024-02-22 16:02:11 +00:00
|
|
|
public class DialogMetaData
|
2023-12-28 18:27:09 +00:00
|
|
|
{
|
|
|
|
|
public string Role { get; set; }
|
|
|
|
|
public string AgentId { get; set; }
|
|
|
|
|
public string MessageId { get; set; }
|
|
|
|
|
public string? FunctionName { get; set; }
|
|
|
|
|
public string? SenderId { get; set; }
|
|
|
|
|
public DateTime CreateTime { get; set; }
|
|
|
|
|
}
|