fix problem from claude
This commit is contained in:
20
ai-moderation/app/routers/health_router.py
Normal file
20
ai-moderation/app/routers/health_router.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from app.ml.model_manager import model_manager
|
||||
|
||||
router = APIRouter(tags=["Health"])
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
def health():
|
||||
"""Liveness: процесс жив и отвечает."""
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@router.get("/ready")
|
||||
def ready():
|
||||
"""Readiness: модели загружены, можно слать запросы."""
|
||||
if not model_manager.ready:
|
||||
return JSONResponse(status_code=503, content={"status": "loading"})
|
||||
return {"status": "ready"}
|
||||
Reference in New Issue
Block a user