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.
Updated forge to server the frontend again
SwiftyOSaa1a65c59c4a
diff --git a/QUICKSTART.md b/QUICKSTART.mdindex 5bc210cd4b..e112a20c00 100644--- a/QUICKSTART.md+++ b/QUICKSTART.md@@ -72,11 +72,11 @@Your agent can started using the `./run agent start YOUR_AGENT_NAME`-This will build the frontend, install the dependencies and then start the agent on `http://localhost:8000/`+This start the agent on `http://localhost:8000/`-The frontend can be accessed from `http://localhost:5000/`(follow the README.md in the frontend folder to spin up the UI), you will first need to login using either a google account or your github account.+The frontend can be accessed from `http://localhost:8000/`, you will first need to login using either a google account or your github account.diff --git a/autogpts/forge/forge/sdk/agent.py b/autogpts/forge/forge/sdk/agent.pyindex 739fd4957f..a0b4d33f78 100644--- a/autogpts/forge/forge/sdk/agent.py+++ b/autogpts/forge/forge/sdk/agent.py@@ -1,6 +1,7 @@import asyncioimport osfrom uuid import uuid4+import pathlibfrom fastapi import APIRouter, FastAPI, UploadFilefrom fastapi.responses import RedirectResponse@@ -56,12 +57,19 @@ class Agent:)app.include_router(router, prefix="/ap/v1")- # app.mount("/app", StaticFiles(directory="../../frontend/build/web"), name="app")+ script_dir = os.path.dirname(os.path.realpath(__file__))+ frontend_path = pathlib.Path(os.path.join(script_dir, "../../../../frontend/build/web")).resolve()++ if os.path.exists(frontend_path):+ app.mount("/app", StaticFiles(directory=frontend_path), name="app")+ @app.get("/", include_in_schema=False)+ async def root():+ return RedirectResponse(url='/app/index.html', status_code=307)+ else:+ LOG.warning(f"Frontend not found. {frontend_path} does not exist. The frontend will not be served")app.add_middleware(AgentMiddleware, agent=self)- @app.get("/", include_in_schema=False)- async def root():- return RedirectResponse(url='/app/index.html', status_code=307)+config.loglevel = "ERROR"config.bind = [f"0.0.0.0:{port}"]diff --git a/cli.py b/cli.pyindex 508ac6ec1c..845a7b5c3d 100644--- a/cli.py+++ b/cli.py@@ -264,15 +264,9 @@ def start(agent_name):script_dir = os.path.dirname(os.path.realpath(__file__))agent_dir = os.path.join(script_dir, f"autogpts/{agent_name}")- frontend_dir = os.path.join(script_dir, "frontend")- frontend_build = os.path.join(frontend_dir, "build.sh")run_command = os.path.join(agent_dir, "run")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"))- returnsubprocess.Popen(["./run"], cwd=agent_dir)click.echo(f"Agent '{agent_name}' started")elif not os.path.exists(agent_dir):