Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT

pull/5233/head^2
hunteraraujo 2023-09-16 10:56:49 -07:00
commit 39c0a1c4f8
4 changed files with 54 additions and 15 deletions

View File

@ -1,6 +0,0 @@
{
"github_repo_url": "git@github.com:Swiftyos/Auto-GPT.git",
"timestamp": "2023-09-15T19:03:00.371772",
"commit_hash_to_benchmark": "7bc7cd46712708486f09e422c28620753effaf4e",
"branch_to_benchmark": "master"
}

View File

@ -35,7 +35,11 @@ updates_list = []
import json import json
origins = ["http://localhost:8080"] origins = [
"http://localhost:8080",
"http://127.0.0.1:5000",
"http://localhost:5000",
]
app = FastAPI() app = FastAPI()
app.add_middleware( app.add_middleware(
CORSMiddleware, CORSMiddleware,

55
cli.py
View File

@ -1,3 +1,9 @@
"""
This is a minimal file intended to be run by users to help them manage the autogpt projects.
If you want to contribute, please use only libraries that come as part of Python.
To ensure efficiency, add the imports to the functions so only what is needed is imported.
"""
try: try:
import click import click
import github import github
@ -20,11 +26,28 @@ def setup():
import os import os
import subprocess import subprocess
click.echo(
click.style(
"""
d8888 888 .d8888b. 8888888b. 88888888888
d88888 888 d88P Y88b 888 Y88b 888
d88P888 888 888 888 888 888 888
d88P 888 888 888 888888 .d88b. 888 888 d88P 888
d88P 888 888 888 888 d88""88b 888 88888 8888888P" 888
d88P 888 888 888 888 888 888 888 888 888 888
d8888888888 Y88b 888 Y88b. Y88..88P Y88b d88P 888 888
d88P 888 "Y88888 "Y888 "Y88P" "Y8888P88 888 888
""",
fg="green",
)
)
script_dir = os.path.dirname(os.path.realpath(__file__)) script_dir = os.path.dirname(os.path.realpath(__file__))
setup_script = os.path.join(script_dir, "setup.sh") setup_script = os.path.join(script_dir, "setup.sh")
if os.path.exists(setup_script): if os.path.exists(setup_script):
click.echo(click.style("🚀 Setup initiated...\n", fg="green"))
subprocess.Popen([setup_script], cwd=script_dir) subprocess.Popen([setup_script], cwd=script_dir)
click.echo(click.style("🚀 Setup initiated", fg="green"))
else: else:
click.echo( click.echo(
click.style( click.style(
@ -582,7 +605,19 @@ def enter(agent_name, branch):
return return
else: else:
# Check if the agent has already entered the arena # Check if the agent has already entered the arena
if os.path.exists(f"arena/{agent_name}.json"): try:
subprocess.check_output(
[
"git",
"rev-parse",
"--verify",
"--quiet",
f"arena_submission_{agent_name}",
]
)
except subprocess.CalledProcessError:
pass
else:
click.echo( click.echo(
click.style( click.style(
f"⚠️ The agent '{agent_name}' has already entered the arena. To update your submission, follow these steps:", f"⚠️ The agent '{agent_name}' has already entered the arena. To update your submission, follow these steps:",
@ -644,6 +679,13 @@ def enter(agent_name, branch):
.strip() .strip()
) )
if github_repo_url.startswith("git@"):
github_repo_url = (
github_repo_url.replace("git@", "https://")
.replace(".git", "")
.replace(":", "/")
)
# If --branch is passed, use it instead of master # If --branch is passed, use it instead of master
if branch: if branch:
branch_to_use = branch branch_to_use = branch
@ -659,7 +701,7 @@ def enter(agent_name, branch):
arena_submission_branch = f"arena_submission_{agent_name}" arena_submission_branch = f"arena_submission_{agent_name}"
# Create a new branch called arena_submission_{agent_name} # Create a new branch called arena_submission_{agent_name}
subprocess.check_call(['git', 'checkout', '-b', arena_submission_branch]) subprocess.check_call(["git", "checkout", "-b", arena_submission_branch])
# Create a dictionary with the necessary fields # Create a dictionary with the necessary fields
data = { data = {
"github_repo_url": github_repo_url, "github_repo_url": github_repo_url,
@ -703,7 +745,7 @@ Hey there amazing builders! We're thrilled to have you join this exciting journe
- **Agent Name:** {agent_name} - **Agent Name:** {agent_name}
- **Team Members:** (Who are the amazing minds behind this team? Do list everyone along with their roles!) - **Team Members:** (Who are the amazing minds behind this team? Do list everyone along with their roles!)
- **Repository Link:** (Do share the link where all the magic is happening) - **Repository Link:** [{github_repo_url.replace('https://github.com/', '')}]({github_repo_url})
#### 🌟 Project Vision #### 🌟 Project Vision
@ -730,7 +772,7 @@ Hey there amazing builders! We're thrilled to have you join this exciting journe
- [ ] We confirm that our project will be open-source and adhere to the MIT License. - [ ] We confirm that our project will be open-source and adhere to the MIT License.
- [ ] Our lablab.ai registration email matches our OpenAI account to claim the bonus credits (if applicable). - [ ] Our lablab.ai registration email matches our OpenAI account to claim the bonus credits (if applicable).
""", """,
head=f'{repo.owner.login}:{arena_submission_branch}', head=f"{repo.owner.login}:{arena_submission_branch}",
base=branch_to_use, base=branch_to_use,
) )
click.echo( click.echo(
@ -756,6 +798,7 @@ Hey there amazing builders! We're thrilled to have you join this exciting journe
# Switch back to the master branch # Switch back to the master branch
subprocess.check_call(["git", "checkout", branch_to_use]) subprocess.check_call(["git", "checkout", branch_to_use])
@arena.command() @arena.command()
@click.argument("agent_name") @click.argument("agent_name")
@click.argument("hash") @click.argument("hash")
@ -783,7 +826,7 @@ def update(agent_name, hash, branch):
) )
) )
return return
if not os.path.exists(agent_json_file): if not os.path.exists(agent_json_file):
click.echo( click.echo(
click.style( click.style(

View File

@ -51,5 +51,3 @@ elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" ==
else else
echo "Unsupported OS. Please install Google Chrome manually from https://www.google.com/chrome/" echo "Unsupported OS. Please install Google Chrome manually from https://www.google.com/chrome/"
fi fi
echo "Installation has been completed."