fix : pretty_print issue

This commit is contained in:
martin legrand
2025-03-29 14:43:50 +01:00
parent f42a31578e
commit e69cff0735
4 changed files with 12 additions and 9 deletions
+2
View File
@@ -79,6 +79,8 @@ class Provider:
except AttributeError as e:
raise NotImplementedError(f"{str(e)}\nIs {self.provider_name} implemented ?")
except Exception as e:
if "RemoteDisconnected" in str(e):
return f"{self.server_ip} seem offline. RemoteDisconnected error."
raise Exception(f"Provider {self.provider_name} failed: {str(e)}") from e
return thought
+4 -3
View File
@@ -6,8 +6,7 @@ import threading
import itertools
import time
def pretty_print(text, color = "info"):
def pretty_print(text, color="info"):
"""
Print text with color formatting.
@@ -37,7 +36,8 @@ def pretty_print(text, color = "info"):
print(text)
pretty_print(f"Invalid color {color} in pretty_print", "warning")
return
print(color_map[color], text, Fore.RESET)
print(f"{color_map[color]}{text}{Fore.RESET}")
print(' ' * 10) # prevent cut-off
else:
color_map = {
"success": "green",
@@ -51,6 +51,7 @@ def pretty_print(text, color = "info"):
if color not in color_map:
color = "default"
print(colored(text, color_map[color]))
print(' ' * 10) # prevent cut-off
def animate_thinking(text, color="status", duration=2):
def _animate():