diff --git a/haiku_rag_slim/haiku/rag/ingester/api/routes/dashboard.py b/haiku_rag_slim/haiku/rag/ingester/api/routes/dashboard.py index 892c2fc2..1cf87ddb 100644 --- a/haiku_rag_slim/haiku/rag/ingester/api/routes/dashboard.py +++ b/haiku_rag_slim/haiku/rag/ingester/api/routes/dashboard.py @@ -1,18 +1,17 @@ from pathlib import Path from fastapi import APIRouter -from fastapi.responses import HTMLResponse +from fastapi.responses import FileResponse router = APIRouter(tags=["dashboard"]) -_STATIC_DIR = Path(__file__).resolve().parent.parent / "static" -_INDEX_HTML = (_STATIC_DIR / "index.html").read_text(encoding="utf-8") +_INDEX_HTML_PATH = Path(__file__).resolve().parent.parent / "static" / "index.html" -@router.get("/", response_class=HTMLResponse, include_in_schema=False) -async def dashboard() -> HTMLResponse: +@router.get("/", include_in_schema=False) +async def dashboard() -> FileResponse: """Serve the operator dashboard. Static page that polls /health, /sources, /stats and /jobs from the browser. Auth happens via the bearer header the JS attaches to its fetches — the dashboard route itself is unauthenticated so an operator can open it in a browser and paste the token on demand.""" - return HTMLResponse(content=_INDEX_HTML) + return FileResponse(_INDEX_HTML_PATH, media_type="text/html")