2025-03-04 23:25:35 +00:00
|
|
|
using BotSharp.Abstraction.Loggers.Models;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Plugin.MongoStorage.Collections;
|
|
|
|
|
|
2025-03-06 23:44:49 +00:00
|
|
|
public class InstructionLogDocument : MongoBase
|
2025-03-04 23:25:35 +00:00
|
|
|
{
|
|
|
|
|
public string? AgentId { get; set; }
|
|
|
|
|
public string Provider { get; set; } = default!;
|
|
|
|
|
public string Model { get; set; } = default!;
|
2025-03-05 23:22:46 +00:00
|
|
|
public string? TemplateName { get; set; }
|
|
|
|
|
public string UserMessage { get; set; } = default!;
|
|
|
|
|
public string? SystemInstruction { get; set; }
|
|
|
|
|
public string CompletionText { get; set; } = default!;
|
2025-03-04 23:25:35 +00:00
|
|
|
public string? UserId { get; set; }
|
|
|
|
|
public Dictionary<string, BsonDocument> States { get; set; } = new();
|
|
|
|
|
public DateTime CreatedTime { get; set; }
|
|
|
|
|
|
2025-03-06 23:44:49 +00:00
|
|
|
public static InstructionLogDocument ToMongoModel(InstructionLogModel log)
|
2025-03-04 23:25:35 +00:00
|
|
|
{
|
2025-03-06 23:44:49 +00:00
|
|
|
return new InstructionLogDocument
|
2025-03-04 23:25:35 +00:00
|
|
|
{
|
2025-10-15 09:10:06 +00:00
|
|
|
Id = log.Id,
|
2025-03-04 23:25:35 +00:00
|
|
|
AgentId = log.AgentId,
|
|
|
|
|
Provider = log.Provider,
|
|
|
|
|
Model = log.Model,
|
2025-03-05 23:22:46 +00:00
|
|
|
TemplateName = log.TemplateName,
|
|
|
|
|
UserMessage = log.UserMessage,
|
|
|
|
|
SystemInstruction = log.SystemInstruction,
|
|
|
|
|
CompletionText = log.CompletionText,
|
2025-03-04 23:25:35 +00:00
|
|
|
UserId = log.UserId,
|
|
|
|
|
CreatedTime = log.CreatedTime
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-06 23:44:49 +00:00
|
|
|
public static InstructionLogModel ToDomainModel(InstructionLogDocument log)
|
2025-03-04 23:25:35 +00:00
|
|
|
{
|
|
|
|
|
return new InstructionLogModel
|
|
|
|
|
{
|
2025-03-05 23:22:46 +00:00
|
|
|
Id = log.Id,
|
2025-03-04 23:25:35 +00:00
|
|
|
AgentId = log.AgentId,
|
|
|
|
|
Provider = log.Provider,
|
|
|
|
|
Model = log.Model,
|
2025-03-05 23:22:46 +00:00
|
|
|
TemplateName = log.TemplateName,
|
|
|
|
|
UserMessage = log.UserMessage,
|
|
|
|
|
SystemInstruction = log.SystemInstruction,
|
|
|
|
|
CompletionText = log.CompletionText,
|
2025-03-04 23:25:35 +00:00
|
|
|
UserId = log.UserId,
|
|
|
|
|
CreatedTime = log.CreatedTime
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|