Skip to content

Commit

Permalink
Fixed CORS and proxy timeout issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiftyos committed Sep 28, 2023
1 parent ca65dfc commit 5360313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion autogpts/forge/forge/sdk/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ def start(self, port: int = 8000, router: APIRouter = base_router):
"http://127.0.0.1:5000",
"http://localhost:8000",
"http://127.0.0.1:8000",
"http://localhost:8080",
"http://127.0.0.1:8080",
# Add any other origins you want to whitelist
]

app.add_middleware(
CORSMiddleware,
allow_origins=origins,
Expand Down
4 changes: 3 additions & 1 deletion benchmark/agbenchmark/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class Config:
import json

origins = [
"http://localhost:8000",
"http://localhost:8080",
"http://127.0.0.1:5000",
"http://localhost:5000",
Expand Down Expand Up @@ -312,7 +313,8 @@ async def create_agent_task(task_eval_request: TaskEvalRequestBody) -> Task:

@router.post("/agent/tasks/{task_id}/steps")
async def proxy(request: Request, task_id: str):
async with httpx.AsyncClient() as client:
timeout = httpx.Timeout(300.0, read=300.0) # 5 minutes
async with httpx.AsyncClient(timeout=timeout) as client:
# Construct the new URL
new_url = f"http://localhost:8000/ap/v1/agent/tasks/{task_id}/steps"

Expand Down

0 comments on commit 5360313

Please sign in to comment.