|
2 | 2 |
|
3 | 3 | namespace BotSharp.Abstraction.Loggers.Models; |
4 | 4 |
|
5 | | -public class InstructionLogModel |
| 5 | +public class InstructionLogModel : InstructionLogBaseModel |
| 6 | +{ |
| 7 | + public Dictionary<string, string> States { get; set; } = []; |
| 8 | + |
| 9 | + public static InstructionLogModel From(InstructionFileLogModel log) |
| 10 | + { |
| 11 | + return new InstructionLogModel |
| 12 | + { |
| 13 | + Id = log.Id, |
| 14 | + AgentId = log.AgentId, |
| 15 | + AgentName = log.AgentName, |
| 16 | + Provider = log.Provider, |
| 17 | + Model = log.Model, |
| 18 | + TemplateName = log.TemplateName, |
| 19 | + UserMessage = log.UserMessage, |
| 20 | + SystemInstruction = log.SystemInstruction, |
| 21 | + CompletionText = log.CompletionText, |
| 22 | + UserId = log.UserId, |
| 23 | + UserName = log.UserName, |
| 24 | + CreatedTime = log.CreatedTime |
| 25 | + }; |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +public class InstructionFileLogModel : InstructionLogBaseModel |
| 30 | +{ |
| 31 | + [JsonPropertyName("states")] |
| 32 | + public Dictionary<string, JsonDocument> States { get; set; } = []; |
| 33 | + |
| 34 | + public static InstructionFileLogModel From(InstructionLogModel log) |
| 35 | + { |
| 36 | + return new InstructionFileLogModel |
| 37 | + { |
| 38 | + Id = log.Id, |
| 39 | + AgentId = log.AgentId, |
| 40 | + AgentName = log.AgentName, |
| 41 | + Provider = log.Provider, |
| 42 | + Model = log.Model, |
| 43 | + TemplateName = log.TemplateName, |
| 44 | + UserMessage = log.UserMessage, |
| 45 | + SystemInstruction = log.SystemInstruction, |
| 46 | + CompletionText = log.CompletionText, |
| 47 | + UserId = log.UserId, |
| 48 | + UserName = log.UserName, |
| 49 | + CreatedTime = log.CreatedTime |
| 50 | + }; |
| 51 | + } |
| 52 | +} |
| 53 | + |
| 54 | +public class InstructionLogBaseModel |
6 | 55 | { |
7 | 56 | [JsonPropertyName("id")] |
8 | 57 | [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] |
@@ -43,12 +92,6 @@ public class InstructionLogModel |
43 | 92 | [JsonIgnore] |
44 | 93 | public string? UserName { get; set; } |
45 | 94 |
|
46 | | - [JsonIgnore] |
47 | | - public Dictionary<string, string> States { get; set; } = []; |
48 | | - |
49 | | - [JsonPropertyName("states")] |
50 | | - public Dictionary<string, JsonDocument> InnerStates { get; set; } = []; |
51 | | - |
52 | 95 | [JsonPropertyName("created_time")] |
53 | 96 | public DateTime CreatedTime { get; set; } = DateTime.UtcNow; |
54 | 97 | } |
0 commit comments