feat(admin): add admin backend endpoints and service layer
Why: - Dashboard needs system health, Qdrant management, chunk preview, questions, and cost estimation endpoints Changes: - Add admin router with 11 endpoints (health, Qdrant CRUD, chunk preview, questions management, cost estimation) - Add delete_experiment to SQLite storage - Mount admin router and dashboard static files at /app Impact: - New /admin/* API routes available - Dashboard served at /app/ via StaticFiles
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""FastAPI app factory. Composes all domain routers and middleware."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
from starlette.middleware.base import BaseHTTPMiddleware
|
||||
from starlette.requests import Request
|
||||
@@ -8,6 +9,7 @@ from starlette.responses import Response
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from src.core.exceptions import (
|
||||
ChunkingError,
|
||||
@@ -18,6 +20,7 @@ from src.core.exceptions import (
|
||||
)
|
||||
from src.documents.routes import router as documents_router
|
||||
from src.benchmarking.routes import router as benchmarking_router
|
||||
from src.admin.routes import router as admin_router
|
||||
from src.storage.sqlite import init_db
|
||||
|
||||
# Configure logging
|
||||
@@ -91,6 +94,11 @@ def create_app() -> FastAPI:
|
||||
# Mount domain routers
|
||||
app.include_router(documents_router)
|
||||
app.include_router(benchmarking_router)
|
||||
app.include_router(admin_router)
|
||||
|
||||
# Mount dashboard at /app
|
||||
static_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "static")
|
||||
app.mount("/app", StaticFiles(directory=static_dir, html=True), name="dashboard")
|
||||
|
||||
return app
|
||||
|
||||
|
||||
Reference in New Issue
Block a user