aboutsummaryrefslogtreecommitdiff
path: root/cli.py
diff options
context:
space:
mode:
authorGravatar SwiftyOS <craigswift13@gmail.com> 2023-10-30 15:36:14 +0100
committerGravatar SwiftyOS <craigswift13@gmail.com> 2023-10-30 15:36:14 +0100
commitd9fbd26b8563e5f59d705623bae0d5cf9c9499c7 (patch)
tree0f9bc26f55eab03b8a3553e329961a161efd1be2 /cli.py
parentMerge branch 'master' of https://github.com/Significant-Gravitas/Auto-GPT (diff)
downloadAuto-GPT-d9fbd26b8563e5f59d705623bae0d5cf9c9499c7.tar.gz
Auto-GPT-d9fbd26b8563e5f59d705623bae0d5cf9c9499c7.tar.bz2
Auto-GPT-d9fbd26b8563e5f59d705623bae0d5cf9c9499c7.zip
fix: Update agent creation logic and error message
- Update the logic for checking if an agent name already exists to be case-insensitive. - Update the error message when an agent with the same name already exists to specify that the name should be unique regardless of case.
Diffstat (limited to 'cli.py')
-rw-r--r--cli.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/cli.py b/cli.py
index 7b85a8ef7..486bdfe64 100644
--- a/cli.py
+++ b/cli.py
@@ -229,9 +229,11 @@ def create(agent_name):
return
try:
new_agent_dir = f"./autogpts/{agent_name}"
- agent_json_file = f"./arena/{agent_name}.json"
+ new_agent_name = f"{agent_name.lower()}.json"
- if not os.path.exists(new_agent_dir) and not os.path.exists(agent_json_file):
+ existing_arena_files = [name.lower() for name in os.listdir("./arena/")]
+
+ if not os.path.exists(new_agent_dir) and not new_agent_name in existing_arena_files:
shutil.copytree("./autogpts/forge", new_agent_dir)
click.echo(
click.style(
@@ -248,7 +250,7 @@ def create(agent_name):
else:
click.echo(
click.style(
- f"😞 Agent '{agent_name}' already exists. Enter a different name for your agent",
+ f"😞 Agent '{agent_name}' already exists. Enter a different name for your agent, the name needs to be unique regardless of case",
fg="red",
)
)
@@ -886,6 +888,5 @@ def update(agent_name, hash, branch):
)
)
-
if __name__ == "__main__":
cli()