Skip to content

Commit eb2ca5d

Browse files
Bug: fix Visualizer "Message To User" that should be "Message from User" (#1002)
1 parent 6a5dcec commit eb2ca5d

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

openhands-sdk/openhands/sdk/conversation/visualizer.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,24 @@ def _create_event_panel(self, event: Event) -> Panel | None:
199199
}
200200
role_color = role_colors.get(event.llm_message.role, "white")
201201

202-
# Use "to" for user messages (user sending to agent)
203-
# and "from" for assistant messages
204-
direction = "to" if event.llm_message.role == "user" else "from"
205-
title_text = f"[bold {role_color}]Message {direction} "
206-
if self._name_for_visualization:
207-
title_text += f"{self._name_for_visualization} Agent"
202+
# "User Message To [Name] Agent" for user
203+
# "Message from [Name] Agent" for agent
204+
agent_name = (
205+
f"{self._name_for_visualization} "
206+
if self._name_for_visualization
207+
else ""
208+
)
209+
210+
if event.llm_message.role == "user":
211+
title_text = (
212+
f"[bold {role_color}]User Message to "
213+
f"{agent_name}Agent[/bold {role_color}]"
214+
)
208215
else:
209-
title_text += event.source.capitalize()
210-
title_text += f"[/bold {role_color}]"
216+
title_text = (
217+
f"[bold {role_color}]Message from "
218+
f"{agent_name}Agent[/bold {role_color}]"
219+
)
211220
return Panel(
212221
content,
213222
title=title_text,

0 commit comments

Comments
 (0)