Fix some error
FIX:
llm_provider.py 102: _model -> model
MOD:
utility.py 25: add windows termial color print
text_to_speech.py 29: add windows version
ADD:
add termcolor in requirements.txt
This commit is contained in:
+30
-13
@@ -1,20 +1,37 @@
|
||||
|
||||
from colorama import Fore
|
||||
from termcolor import colored
|
||||
import platform
|
||||
|
||||
|
||||
def pretty_print(text, color = "info"):
|
||||
"""
|
||||
print text with color
|
||||
"""
|
||||
color_map = {
|
||||
"success": Fore.GREEN,
|
||||
"failure": Fore.RED,
|
||||
"status": Fore.LIGHTGREEN_EX,
|
||||
"code": Fore.LIGHTBLUE_EX,
|
||||
"warning": Fore.YELLOW,
|
||||
"output": Fore.LIGHTCYAN_EX,
|
||||
}
|
||||
if color not in color_map:
|
||||
print(text)
|
||||
pretty_print("Invalid color in pretty_print", "warning")
|
||||
return
|
||||
print(color_map[color], text, Fore.RESET)
|
||||
if platform.system().lower() != "windows":
|
||||
color_map = {
|
||||
"success": Fore.GREEN,
|
||||
"failure": Fore.RED,
|
||||
"status": Fore.LIGHTGREEN_EX,
|
||||
"code": Fore.LIGHTBLUE_EX,
|
||||
"warning": Fore.YELLOW,
|
||||
"output": Fore.LIGHTCYAN_EX,
|
||||
}
|
||||
if color not in color_map:
|
||||
print(text)
|
||||
pretty_print("Invalid color in pretty_print", "warning")
|
||||
return
|
||||
print(color_map[color], text, Fore.RESET)
|
||||
else:
|
||||
color_map = {
|
||||
"success": "green",
|
||||
"failure": "red",
|
||||
"status": "light_green",
|
||||
"code": "light_blue",
|
||||
"warning": "yello",
|
||||
"output": "cyan",
|
||||
"default": "black"
|
||||
}
|
||||
if color not in color_map:
|
||||
color = "default"
|
||||
print(colored(text, color_map[color]))
|
||||
|
||||
Reference in New Issue
Block a user