Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
| 3 |
from fastapi.responses import FileResponse
|
|
|
|
| 4 |
import uvicorn
|
| 5 |
import os
|
| 6 |
from pathlib import Path
|
|
@@ -44,6 +45,17 @@ app = FastAPI(
|
|
| 44 |
description="LLM-driven intent & API flow engine (bootstrap)",
|
| 45 |
)
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
run_in_thread()
|
| 48 |
start_cleanup_task() # Activity log cleanup
|
| 49 |
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.staticfiles import StaticFiles
|
| 3 |
from fastapi.responses import FileResponse
|
| 4 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
import uvicorn
|
| 6 |
import os
|
| 7 |
from pathlib import Path
|
|
|
|
| 45 |
description="LLM-driven intent & API flow engine (bootstrap)",
|
| 46 |
)
|
| 47 |
|
| 48 |
+
# CORS for development
|
| 49 |
+
if os.getenv("ENVIRONMENT") == "development":
|
| 50 |
+
app.add_middleware(
|
| 51 |
+
CORSMiddleware,
|
| 52 |
+
allow_origins=["http://localhost:4200"], # Angular dev server
|
| 53 |
+
allow_credentials=True,
|
| 54 |
+
allow_methods=["*"],
|
| 55 |
+
allow_headers=["*"],
|
| 56 |
+
)
|
| 57 |
+
log("🔧 CORS enabled for development")
|
| 58 |
+
|
| 59 |
run_in_thread()
|
| 60 |
start_cleanup_task() # Activity log cleanup
|
| 61 |
|