-
Notifications
You must be signed in to change notification settings - Fork 3
/
Message.cs
63 lines (52 loc) · 1.6 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.ComponentModel;
using System.Runtime.CompilerServices;
using PAMChatGPT.Extensions;
namespace PAMChatGPT
{
public class Message : INotifyPropertyChanged
{
public MessageFrom MessageFrom { get; set; }
string text = null;
public string Text {
get { return text; }
set
{
text = value;
OnPropertyChanged();
}
}
public string Result {
get
{
string c = "red";
if (MessageFrom == MessageFrom.Bot)
{
c = "blue";
}
else if ((MessageFrom == MessageFrom.User) || (MessageFrom == MessageFrom.UserCode) || (MessageFrom == MessageFrom.AssistantCode))
{
c = "green";
}
return $"%{{color:{c}}}***{MessageFrom.GetDescription<MessageFrom>()}***%:\r\n{Text}";
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
public enum MessageFrom
{
[Description("User")]
User,
[Description("Bot")]
Bot,
[Description("System")]
System,
[Description("User (code)")]
UserCode,
[Description("Assistant (code)")]
AssistantCode
}
}