BotSharp/src/Plugins/BotSharp.Plugin.MongoStorage/Models/DialogMongoElement.cs

77 lines
2 KiB
C#
Raw Normal View History

2023-11-22 00:16:45 +00:00
using BotSharp.Abstraction.Conversations.Models;
namespace BotSharp.Plugin.MongoStorage.Models;
public class DialogMongoElement
{
2024-02-22 16:02:11 +00:00
public DialogMetaDataMongoElement 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 DialogMongoElement()
{
}
public static DialogMongoElement ToMongoElement(DialogElement dialog)
{
return new DialogMongoElement
{
2024-02-22 16:02:11 +00:00
MetaData = DialogMetaDataMongoElement.ToMongoElement(dialog.MetaData),
Content = dialog.Content,
RichContent = dialog.RichContent
2023-11-22 00:16:45 +00:00
};
}
public static DialogElement ToDomainElement(DialogMongoElement dialog)
{
return new DialogElement
{
2024-02-22 16:02:11 +00:00
MetaData = DialogMetaDataMongoElement.ToDomainElement(dialog.MetaData),
Content = dialog.Content,
RichContent = dialog.RichContent
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 DialogMetaDataMongoElement
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; }
2024-02-22 16:02:11 +00:00
public DialogMetaDataMongoElement()
2023-12-28 18:27:09 +00:00
{
}
2024-02-22 16:02:11 +00:00
public static DialogMetaData ToDomainElement(DialogMetaDataMongoElement meta)
2023-12-28 18:27:09 +00:00
{
2024-02-22 16:02:11 +00:00
return new DialogMetaData
2023-12-28 18:27:09 +00:00
{
Role = meta.Role,
AgentId = meta.AgentId,
MessageId = meta.MessageId,
FunctionName = meta.FunctionName,
SenderId = meta.SenderId,
CreateTime = meta.CreateTime,
};
}
2024-02-22 16:02:11 +00:00
public static DialogMetaDataMongoElement ToMongoElement(DialogMetaData meta)
2023-12-28 18:27:09 +00:00
{
2024-02-22 16:02:11 +00:00
return new DialogMetaDataMongoElement
2023-12-28 18:27:09 +00:00
{
Role = meta.Role,
AgentId = meta.AgentId,
MessageId = meta.MessageId,
FunctionName = meta.FunctionName,
SenderId = meta.SenderId,
CreateTime = meta.CreateTime,
};
}
}