feat: add versioned backend scoring workflow

This commit is contained in:
2026-09-25 11:11:18 +08:00
parent 146d5566cf
commit eece55d08d
20 changed files with 2063 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import logging
from contextlib import asynccontextmanager
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from .api import router
from .db import SessionLocal
from .seed import seed_initial
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(name)s %(message)s")
@asynccontextmanager
async def lifespan(_app: FastAPI):
with SessionLocal() as db:
seed_initial(db)
yield
app = FastAPI(title="WiseGrade 智评", version="0.1.0", lifespan=lifespan)
app.include_router(router)
@app.exception_handler(ValueError)
async def value_error_handler(_request: Request, exc: ValueError):
return JSONResponse(status_code=400, content={"detail": str(exc)})
@app.get("/api/health")
def health():
return {"status": "ok"}