Spaces:
Running
Running
File size: 627 Bytes
8366946 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
"""Base class for Agents, providing colorful logging with Rich."""
from src.config.logging_queue import log_queue
from src.utils.logger import console
class Agent:
"""Abstract superclass for Agents, with colorful Rich logging."""
name: str = ""
color: str = "white"
def log(self, message: str) -> None:
"""Print log with colored message using Rich."""
# Terminal (Rich)
console.print(f"[{self.color} on black][{self.name}] {message}[/]")
# Gradio UI (HTML)
log_queue.put(
f"<span style='color:{self.color}'>[{self.name}] {message}</span><br>"
)
|