style: improve string formatting

This commit is contained in:
Martín Bravo 2025-03-18 10:14:52 +01:00
parent 0079bca717
commit b7627cb642

View file

@ -42,21 +42,24 @@ def get_all_nodes(agent: Agent, parent: Agent = None) -> str:
parts = [] parts = []
# Ensure parent agent node is colored # Ensure parent agent node is colored
if not parent: if not parent:
parts.append(f""" parts.append(
"{agent.name}" [label="{agent.name}", shape=box, style=filled, f'"{agent.name}" [label="{agent.name}", shape=box, style=filled, '
fillcolor=lightyellow, width=1.5, height=0.8];""") 'fillcolor=lightyellow, width=1.5, height=0.8];'
)
# Smaller tools (ellipse, green) # Smaller tools (ellipse, green)
for tool in agent.tools: for tool in agent.tools:
parts.append(f""" parts.append(
"{tool.name}" [label="{tool.name}", shape=ellipse, style=filled, f'"{tool.name}" [label="{tool.name}", shape=ellipse, style=filled, '
fillcolor=lightgreen, width=0.5, height=0.3];""") f'fillcolor=lightgreen, width=0.5, height=0.3];'
)
# Bigger handoffs (rounded box, yellow) # Bigger handoffs (rounded box, yellow)
for handoff in agent.handoffs: for handoff in agent.handoffs:
parts.append(f""" parts.append(
"{handoff.name}" [label="{handoff.name}", shape=box, style=filled, f'"{handoff.name}" [label="{handoff.name}", shape=box, style=filled, style=rounded, '
style=rounded, fillcolor=lightyellow, width=1.5, height=0.8];""") f'fillcolor=lightyellow, width=1.5, height=0.8];'
)
parts.append(get_all_nodes(handoff)) parts.append(get_all_nodes(handoff))
return "".join(parts) return "".join(parts)