Skip to content

Commit affec1f

Browse files
committed
fix: cors origin policy
1 parent 046b128 commit affec1f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import os
22

33
import uvicorn
4+
import fastapi.middleware.cors import CORMiddleware
45
from google.adk.cli.fast_api import get_fast_api_app
56

67
# Get the directory where main.py is located
78
AGENT_DIR = os.path.dirname(os.path.abspath(__file__))
89
# Example session DB URL (e.g., SQLite)
910
# SESSION_DB_URL = "sqlite:///./sessions.db"
1011
# Example allowed origins for CORS
11-
ALLOWED_ORIGINS = ["*"]
12+
ALLOWED_ORIGINS = ["https://chaos-pilot.vercel.app", "http://localhost:4200"]
1213
# Set web=True if you intend to serve a web interface, False otherwise
1314
SERVE_WEB_INTERFACE = True
1415

1516

1617
# Call the function to get the FastAPI app instance
1718
# Ensure the agent directory name ('capital_agent') matches your agent folder
1819
app = get_fast_api_app(
20+
CORMiddleware,
1921
agents_dir=AGENT_DIR,
20-
# session_service_uri=SESSION_DB_URL,
2122
allow_origins=ALLOWED_ORIGINS,
2223
web=SERVE_WEB_INTERFACE,
2324
)

0 commit comments

Comments
 (0)