Feat : planning agent task parsing and agents assignation

This commit is contained in:
martin legrand
2025-03-10 13:42:07 +01:00
parent 6ea24974c1
commit aece8de10b
11 changed files with 146 additions and 52 deletions
+40
View File
@@ -28,6 +28,7 @@ def pretty_print(text, color = "info"):
"code": Fore.LIGHTBLUE_EX,
"warning": Fore.YELLOW,
"output": Fore.LIGHTCYAN_EX,
"info": Fore.CYAN
}
if color not in color_map:
print(text)
@@ -48,6 +49,45 @@ def pretty_print(text, color = "info"):
color = "default"
print(colored(text, color_map[color]))
def animate_thinking(text="thinking...", color="status", duration=2):
"""
Display an animated "thinking..." indicator.
Args:
text (str): Text to display (default: "thinking...")
color (str): Color for the text (matches pretty_print colors)
duration (float): How long to animate in seconds
"""
import time
import itertools
color_map = {
"success": (Fore.GREEN, "green"),
"failure": (Fore.RED, "red"),
"status": (Fore.LIGHTGREEN_EX, "light_green"),
"code": (Fore.LIGHTBLUE_EX, "light_blue"),
"warning": (Fore.YELLOW, "yellow"),
"output": (Fore.LIGHTCYAN_EX, "cyan"),
"default": (Fore.RESET, "black"),
"info": (Fore.CYAN, "cyan")
}
if color not in color_map:
color = "info"
fore_color, term_color = color_map[color]
spinner = itertools.cycle(['', '', '', '', '', '', '', '', '', ''])
end_time = time.time() + duration
while time.time() < end_time:
symbol = next(spinner)
if platform.system().lower() != "windows":
print(f"\r{fore_color}{symbol} {text}{Fore.RESET}", end="", flush=True)
else:
print(colored(f"\r{symbol} {text}", term_color), end="", flush=True)
time.sleep(0.1)
print()
def timer_decorator(func):
"""
Decorator to measure the execution time of a function.