Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix: Update agent creation logic and error message

SwiftyOSd9fbd26b8563
diff --git a/cli.py b/cli.py
index 7b85a8ef7d..486bdfe64d 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()