Spaces:
Build error
Build error
File size: 3,740 Bytes
e20bd8e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | import logging
from art import text2art
from colorama import init, Fore, Style
from datetime import datetime
# Initialize colorama
init()
logger = logging.getLogger(__name__)
class AgentVisualManager:
"""Provides visual feedback for agent operations"""
def show_agent_status(self, agent_name: str, status: str):
"""Display agent status with visual feedback"""
colors = {
"initializing": Fore.YELLOW,
"processing": Fore.BLUE,
"completed": Fore.GREEN,
"error": Fore.RED,
"waiting": Fore.CYAN
}
stages = {
"initializing": f"""
{colors["initializing"]}ββββββββββββββββββββββ
β Agent Init β
β {agent_name:<14} β
ββββββββββββββββββββββ{Style.RESET_ALL}
""",
"processing": f"""
{colors["processing"]}ββββββββββββββββββββββ
β Processing β βοΈ
β {agent_name:<14} β
ββββββββββββββββββββββ{Style.RESET_ALL}
""",
"completed": f"""
{colors["completed"]}ββββββββββββββββββββββ
β Completed! β β
β {agent_name:<14} β
ββββββββββββββββββββββ{Style.RESET_ALL}
""",
"error": f"""
{colors["error"]}ββββββββββββββββββββββ
β Error! β β
β {agent_name:<14} β
ββββββββββββββββββββββ{Style.RESET_ALL}
""",
"waiting": f"""
{colors["waiting"]}ββββββββββββββββββββββ
β Waiting β β³
β {agent_name:<14} β
ββββββββββββββββββββββ{Style.RESET_ALL}
"""
}
print(f"\n{datetime.now().strftime('%H:%M:%S')} - ", end="")
print(stages.get(status, ""))
def show_agent_communication(self, from_agent: str, to_agent: str, message_type: str = "request"):
"""Display agent communication flow"""
arrow = "βββ" if message_type == "request" else "βββ"
color = Fore.BLUE if message_type == "request" else Fore.GREEN
print(f"""
{color}βββββββββββββββ {arrow} βββββββββββββββ
β {from_agent:<11}β β {to_agent:<11}β
βββββββββββββββ βββββββββββββββ{Style.RESET_ALL}
""")
def show_team_formation(self, team_leader: str, team_members: list):
"""Display team structure"""
print(Fore.CYAN + text2art("Team Formation") + Style.RESET_ALL)
print(f"""
{Fore.YELLOW}βββββββββββββββ
β LEADER β
β {team_leader:<11}β
βββββββββββββββ{Style.RESET_ALL}
β
""")
for member in team_members:
if member != team_leader:
print(f""" {Fore.BLUE} β
βββββββββββββββ
β {member:<11}β
βββββββββββββββ{Style.RESET_ALL}""") |