aboutsummaryrefslogtreecommitdiff
path: root/cli.py
diff options
context:
space:
mode:
authorGravatar SwiftyOS <craigswift13@gmail.com> 2023-09-18 17:56:23 +0200
committerGravatar SwiftyOS <craigswift13@gmail.com> 2023-09-18 17:56:23 +0200
commit7022eda1a3dc340acba9b6c35873db5f9f82d985 (patch)
tree6e7be46116f315304ef11725cfedf29f6d14128e /cli.py
parentFix test listing (diff)
downloadAuto-GPT-7022eda1a3dc340acba9b6c35873db5f9f82d985.tar.gz
Auto-GPT-7022eda1a3dc340acba9b6c35873db5f9f82d985.tar.bz2
Auto-GPT-7022eda1a3dc340acba9b6c35873db5f9f82d985.zip
Updated cli
Diffstat (limited to 'cli.py')
-rw-r--r--cli.py60
1 files changed, 32 insertions, 28 deletions
diff --git a/cli.py b/cli.py
index e2a05344a..508ac6ec1 100644
--- a/cli.py
+++ b/cli.py
@@ -270,7 +270,9 @@ def start(agent_name):
if os.path.exists(agent_dir) and os.path.isfile(run_command):
subprocess.Popen([frontend_build], cwd=frontend_dir)
os.chdir(agent_dir)
-
+ if os.name == 'nt':
+ click.echo(click.style("šŸ˜ž The script cannot be run on Windows.", fg="red"))
+ return
subprocess.Popen(["./run"], cwd=agent_dir)
click.echo(f"Agent '{agent_name}' started")
elif not os.path.exists(agent_dir):
@@ -350,7 +352,7 @@ def start(agent_name, subprocess_args):
script_dir = os.path.dirname(os.path.realpath(__file__))
agent_dir = os.path.join(script_dir, f"autogpts/{agent_name}")
- benchmark_script = os.path.join(agent_dir, "run_benchmark.sh")
+ benchmark_script = os.path.join(agent_dir, "run_benchmark")
if os.path.exists(agent_dir) and os.path.isfile(benchmark_script):
os.chdir(agent_dir)
subprocess.Popen([benchmark_script, *subprocess_args], cwd=agent_dir)
@@ -392,16 +394,17 @@ def benchmark_categories_list():
)
# Use it as the base for the glob pattern, excluding 'deprecated' directory
for data_file in glob.glob(glob_path, recursive=True):
- with open(data_file, "r") as f:
- try:
- data = json.load(f)
- categories.update(data.get("category", []))
- except json.JSONDecodeError:
- print(f"Error: {data_file} is not a valid JSON file.")
- continue
- except IOError:
- print(f"IOError: file could not be read: {data_file}")
- continue
+ if 'deprecated' not in data_file:
+ with open(data_file, "r") as f:
+ try:
+ data = json.load(f)
+ categories.update(data.get("category", []))
+ except json.JSONDecodeError:
+ print(f"Error: {data_file} is not a valid JSON file.")
+ continue
+ except IOError:
+ print(f"IOError: file could not be read: {data_file}")
+ continue
if categories:
click.echo(click.style("Available categories: šŸ“š", fg="green"))
@@ -435,21 +438,22 @@ def benchmark_tests_list():
)
# Use it as the base for the glob pattern, excluding 'deprecated' directory
for data_file in glob.glob(glob_path, recursive=True):
- with open(data_file, "r") as f:
- try:
- data = json.load(f)
- category = data.get("category", [])
- test_name = data.get("name", "")
- if category and test_name:
- if category[0] not in tests:
- tests[category[0]] = []
- tests[category[0]].append(test_name)
- except json.JSONDecodeError:
- print(f"Error: {data_file} is not a valid JSON file.")
- continue
- except IOError:
- print(f"IOError: file could not be read: {data_file}")
- continue
+ if 'deprecated' not in data_file:
+ with open(data_file, "r") as f:
+ try:
+ data = json.load(f)
+ category = data.get("category", [])
+ test_name = data.get("name", "")
+ if category and test_name:
+ if category[0] not in tests:
+ tests[category[0]] = []
+ tests[category[0]].append(test_name)
+ except json.JSONDecodeError:
+ print(f"Error: {data_file} is not a valid JSON file.")
+ continue
+ except IOError:
+ print(f"IOError: file could not be read: {data_file}")
+ continue
if tests:
click.echo(click.style("Available tests: šŸ“š", fg="green"))
@@ -463,7 +467,7 @@ def benchmark_tests_list():
.replace(" ", " ")
)
test_name_padded = f"{test_name:<40}"
- click.echo(click.style(f"\t\tšŸ”¬ {test_name_padded} - Test{test}", fg="cyan"))
+ click.echo(click.style(f"\t\tšŸ”¬ {test_name_padded} - {test}", fg="cyan"))
else:
click.echo(click.style("No tests found šŸ˜ž", fg="red"))