File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -211,15 +211,7 @@ def format_msgs(
211
211
if highlight :
212
212
color = ROLE_COLOR [msg .role ]
213
213
userprefix = f"[bold { color } ]{ userprefix } [/bold { color } ]"
214
- if msg .role == "system" :
215
- first_line = msg .content .split ("\n " , 1 )[0 ].lower ()
216
- isSuccess = first_line .startswith (("saved" , "appended" , "patch successfully" , "ran" ))
217
- isError = first_line .startswith (("error" , "failed" ))
218
- if isSuccess :
219
- userprefix = f"{ userprefix } ✅"
220
- elif isError :
221
- userprefix = f"{ userprefix } ❌"
222
-
214
+
223
215
# get terminal width
224
216
max_len = shutil .get_terminal_size ().columns - len (userprefix )
225
217
output = ""
@@ -247,7 +239,20 @@ def format_msgs(
247
239
)
248
240
)
249
241
output += f"```{ block .rstrip ()} \n ```"
250
- outputs .append (f"{ userprefix } : { output .rstrip ()} " )
242
+
243
+ status_emoji = ""
244
+ if msg .role == "system" :
245
+ first_line = msg .content .split ("\n " , 1 )[0 ].lower ()
246
+ isSuccess = first_line .startswith (
247
+ ("saved" , "appended" , "patch successfully" )
248
+ )
249
+ isError = first_line .startswith (("error" , "failed" ))
250
+ if isSuccess :
251
+ status_emoji = "✅ "
252
+ elif isError :
253
+ status_emoji = "❌ "
254
+
255
+ outputs .append (f"{ userprefix } : { status_emoji } { output .rstrip ()} " )
251
256
return outputs
252
257
253
258
You can’t perform that action at this time.
0 commit comments