Spaces:
Sleeping
Sleeping
Update backend/main.py
Browse files21 unmodified lines22232425262728293031323334353637383940414221 unmodified lines)# ββ Static files + SPA βββββββββββββββββββββββββββββββββββββββββββββββββββββββfrom fastapi.staticfiles import StaticFilesfrom fastapi.responses import FileResponseimport pathlib_static_dir = pathlib.Path(__file__).parent.parent / "backend" / "static"if _static_dir.exists():app.mount("/assets", StaticFiles(directory=str(_static_dir / "assets")), name="assets")@app.get("/")async def serve_index():return FileResponse(str(_static_dir / "index.html"))else:@app.get("/")async def serve_fallback():return {"status": "running", "message": "static dir not found at: " + str(_static_dir)}# ββ Config ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββGROQ_MODEL = "llama-3.3-70b-versatile"GROQ_API_KEY = os.environ.get("GROQ_API_KEY", "")21 unmodified lines222324252627282930313233343536373839404142434445464748495021 unmodified lines)# ββ Static files + SPA βββββββββββββββββββββββββββββββββββββββββββββββββββββββfrom fastapi.staticfiles import StaticFilesfrom fastapi.responses import FileResponse, PlainTextResponseimport pathlibimport os@app.get("/")async def serve_index():# Try multiple possible pathscandidates = [pathlib.Path(__file__).parent / "static" / "index.html",pathlib.Path("/app/backend/static/index.html"),pathlib.Path("/app/static/index.html"),]for path in candidates:if path.exists():return FileResponse(str(path))# None found - show debug infodebug = f"Tried:\n"for p in candidates:debug += f" {p} -> exists={p.exists()}\n"debug += f"\n/app contents: {os.listdir('/app')}\n"debug += f"/app/backend contents: {os.listdir('/app/backend')}\n"return PlainTextResponse(debug, status_code=200)# ββ Config ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββGROQ_MODEL = "llama-3.3-70b-versatile"GROQ_API_KEY = os.environ.get("GROQ_API_KEY", "")
backend/main.py+21-13