Skip to content

Commit 964b528

Browse files
committed
fix: improved status emojis in formatted messages
1 parent 69c5f01 commit 964b528

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

gptme/message.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,7 @@ def format_msgs(
211211
if highlight:
212212
color = ROLE_COLOR[msg.role]
213213
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+
223215
# get terminal width
224216
max_len = shutil.get_terminal_size().columns - len(userprefix)
225217
output = ""
@@ -247,7 +239,20 @@ def format_msgs(
247239
)
248240
)
249241
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()}")
251256
return outputs
252257

253258

0 commit comments

Comments
 (0)