mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-06 11:05:26 +00:00
Fix : major displaying issues and libraries warning
This commit is contained in:
parent
60e740f605
commit
ed02a4dad0
@ -27,13 +27,13 @@ class CasualAgent(Agent):
|
||||
|
||||
self.wait_message(speech_module)
|
||||
while not complete:
|
||||
if exec_success:
|
||||
complete = True
|
||||
animate_thinking("Thinking...", color="status")
|
||||
answer, reasoning = self.llm_request()
|
||||
exec_success, _ = self.execute_modules(answer)
|
||||
answer = self.remove_blocks(answer)
|
||||
self.last_answer = answer
|
||||
if exec_success:
|
||||
complete = True
|
||||
return answer, reasoning
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -32,6 +32,7 @@ class CoderAgent(Agent):
|
||||
animate_thinking("Thinking...", color="status")
|
||||
self.wait_message(speech_module)
|
||||
answer, reasoning = self.llm_request()
|
||||
animate_thinking("Executing code...", color="status")
|
||||
exec_success, _ = self.execute_modules(answer)
|
||||
answer = self.remove_blocks(answer)
|
||||
self.last_answer = answer
|
||||
|
@ -80,7 +80,7 @@ if __name__ == "__main__":
|
||||
Hey could you search the web for the latest news on the stock market ?
|
||||
""",
|
||||
"""
|
||||
hey can you give dating advice ?
|
||||
hey can you give give a list of the files in the current directory ?
|
||||
""",
|
||||
"""
|
||||
Make a cool game to illustrate the current relation between USA and europe
|
||||
|
@ -40,8 +40,7 @@ class Speech():
|
||||
)
|
||||
for i, (gs, ps, audio) in enumerate(generator):
|
||||
audio_file = 'sample.wav'
|
||||
print(audio_file)
|
||||
display(Audio(data=audio, rate=24000, autoplay=i==0))
|
||||
display(Audio(data=audio, rate=24000, autoplay=i==0), display_id=False)
|
||||
sf.write(audio_file, audio, 24000) # save each audio file
|
||||
if platform.system().lower() != "windows":
|
||||
subprocess.call(["afplay", audio_file])
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
from io import StringIO
|
||||
|
||||
@ -25,10 +26,15 @@ class PyInterpreter(Tools):
|
||||
return "Code rejected by user."
|
||||
stdout_buffer = StringIO()
|
||||
sys.stdout = stdout_buffer
|
||||
global_vars = {
|
||||
'__builtins__': __builtins__,
|
||||
'os': os,
|
||||
'sys': sys,
|
||||
}
|
||||
code = '\n\n'.join(codes)
|
||||
try:
|
||||
try:
|
||||
buffer = exec(code)
|
||||
buffer = exec(code, global_vars)
|
||||
if buffer is not None:
|
||||
output = buffer + '\n'
|
||||
except Exception as e:
|
||||
|
@ -2,6 +2,9 @@
|
||||
from colorama import Fore
|
||||
from termcolor import colored
|
||||
import platform
|
||||
import threading
|
||||
import itertools
|
||||
import time
|
||||
|
||||
|
||||
def pretty_print(text, color = "info"):
|
||||
@ -49,44 +52,41 @@ def pretty_print(text, color = "info"):
|
||||
color = "default"
|
||||
print(colored(text, color_map[color]))
|
||||
|
||||
def animate_thinking(text="thinking...", color="status", duration=2):
|
||||
def animate_thinking(text, color="status", duration=2):
|
||||
"""
|
||||
Display an animated "thinking..." indicator.
|
||||
|
||||
Display an animated "thinking..." indicator in a separate thread.
|
||||
Args:
|
||||
text (str): Text to display (default: "thinking...")
|
||||
color (str): Color for the text (matches pretty_print colors)
|
||||
text (str): Text to display
|
||||
color (str): Color for the text
|
||||
duration (float): How long to animate in seconds
|
||||
"""
|
||||
import time
|
||||
import itertools
|
||||
def _animate():
|
||||
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")
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
fore_color, term_color = color_map[color]
|
||||
spinner = itertools.cycle(['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'])
|
||||
end_time = time.time() + duration
|
||||
|
||||
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()
|
||||
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()
|
||||
animation_thread = threading.Thread(target=_animate)
|
||||
animation_thread.daemon = True
|
||||
animation_thread.start()
|
||||
|
||||
def timer_decorator(func):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user