@@ -20,7 +20,6 @@ def __init__(
20
20
self ,
21
21
role : Literal ["system" , "user" , "assistant" ],
22
22
content : str ,
23
- user : str | None = None ,
24
23
pinned : bool = False ,
25
24
hide : bool = False ,
26
25
quiet : bool = False ,
@@ -33,11 +32,6 @@ def __init__(
33
32
self .timestamp = datetime .fromisoformat (timestamp )
34
33
else :
35
34
self .timestamp = timestamp or datetime .now ()
36
- if user :
37
- self .user = user
38
- else :
39
- role_names = {"system" : "System" , "user" : "User" , "assistant" : "Assistant" }
40
- self .user = role_names [role ]
41
35
42
36
# Wether this message should be pinned to the top of the chat, and never context-trimmed.
43
37
self .pinned = pinned
@@ -74,7 +68,7 @@ def format_msgs(
74
68
outputs = []
75
69
for msg in msgs :
76
70
color = ROLE_COLOR [msg .role ]
77
- userprefix = f"[bold { color } ]{ msg .user } [/bold { color } ]"
71
+ userprefix = f"[bold { color } ]{ msg .role . capitalize () } [/bold { color } ]"
78
72
# get terminal width
79
73
max_len = shutil .get_terminal_size ().columns - len (userprefix )
80
74
output = ""
@@ -174,7 +168,6 @@ def toml_to_msg(toml: str) -> Message:
174
168
return Message (
175
169
msg ["role" ],
176
170
msg ["content" ],
177
- user = msg .get ("user" ),
178
171
pinned = msg .get ("pinned" , False ),
179
172
hide = msg .get ("hide" , False ),
180
173
quiet = msg .get ("quiet" , False ),
@@ -196,7 +189,6 @@ def toml_to_msgs(toml: str) -> list[Message]:
196
189
Message (
197
190
msg ["role" ],
198
191
msg ["content" ],
199
- user = msg .get ("user" ),
200
192
pinned = msg .get ("pinned" , False ),
201
193
hide = msg .get ("hide" , False ),
202
194
quiet = msg .get ("quiet" , False ),
0 commit comments