-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathMessage.cs
More file actions
44 lines (38 loc) · 1.17 KB
/
Message.cs
File metadata and controls
44 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using MaIN.Domain.Models;
namespace MaIN.Domain.Entities;
public class Message
{
public const string UnprocessedMessageProperty = "UnprocessedMessage";
public Message()
{
if (Type == MessageType.LocalLLM)
{
Properties.Add(UnprocessedMessageProperty, string.Empty);
}
}
public required string Role { get; set; }
public required string Content { get; set; }
public required MessageType Type { get; set; }
public List<LLMTokenValue> Tokens { get; set; } = [];
public bool Tool { get; init; }
public DateTime Time { get; set; }
public List<byte[]>? Images { get; set; }
// Backward-compat wrapper – single image access
public byte[]? Image
{
get => Images?.Count > 0 ? Images[0] : null;
set
{
if (value == null) Images = null;
else Images = [value];
}
}
public byte[]? Speech { get; set; }
public List<FileInfo>? Files { get; set; }
public Dictionary<string, string> Properties { get; set; } = [];
public Message MarkProcessed()
{
Properties.Remove(UnprocessedMessageProperty);
return this;
}
}