-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathMessage.cs
37 lines (27 loc) · 862 Bytes
/
Message.cs
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
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson;
namespace SharedLib.Models;
public record Message
{
[BsonId]
[BsonRepresentation(BsonType.String)]
public string Id { get; set; }
public string Type { get; set; }
public string SessionId { get; set; }
public DateTime TimeStamp { get; set; }
public string Sender { get; set; }
public int Tokens { get; set; }
public int PromptTokens { get; set; }
public string Text { get; set; }
public Message(string sessionId, string sender, int? tokens, int? promptTokens, string text)
{
Id = Guid.NewGuid().ToString();
Type = nameof(Message);
SessionId = sessionId;
Sender = sender;
Tokens = tokens ?? 0;
PromptTokens = promptTokens ?? 0;
TimeStamp = DateTime.UtcNow;
Text = text;
}
}