mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Convert to python module named autogpt.
Also fixed the Dockerfile. Converting to module makes development easier. Fixes coverage script in CI and test imports.
This commit is contained in:
committed by
Merwane Hamadi
parent
a17a850b25
commit
d64f866bfa
23
autogpt/utils.py
Normal file
23
autogpt/utils.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import yaml
|
||||
from colorama import Fore
|
||||
|
||||
|
||||
def clean_input(prompt: str=''):
|
||||
try:
|
||||
return input(prompt)
|
||||
except KeyboardInterrupt:
|
||||
print("You interrupted Auto-GPT")
|
||||
print("Quitting...")
|
||||
exit(0)
|
||||
|
||||
|
||||
def validate_yaml_file(file: str):
|
||||
try:
|
||||
with open(file) as file:
|
||||
yaml.load(file, Loader=yaml.FullLoader)
|
||||
except FileNotFoundError:
|
||||
return (False, f"The file {Fore.CYAN}`{file}`{Fore.RESET} wasn't found")
|
||||
except yaml.YAMLError as e:
|
||||
return (False, f"There was an issue while trying to read with your AI Settings file: {e}")
|
||||
|
||||
return (True, f"Successfully validated {Fore.CYAN}`{file}`{Fore.RESET}!")
|
||||
Reference in New Issue
Block a user