36 lines
1018 B
Python
36 lines
1018 B
Python
import sys
|
|
import platform
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from app.api.deps import get_db
|
|
from app.services.gpu_backend import gpu_manager
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/")
|
|
async def health_check():
|
|
gpu_info = gpu_manager.get_status()
|
|
return {
|
|
"status": "ok",
|
|
"service": "rfcp-backend",
|
|
"version": "3.6.0",
|
|
"build": "gpu" if gpu_info.get("gpu_available") else "cpu",
|
|
"gpu": {
|
|
"available": gpu_info.get("gpu_available", False),
|
|
"backend": gpu_info.get("active_backend", "cpu"),
|
|
"device": gpu_info.get("active_device", {}).get("name") if gpu_info.get("active_device") else "CPU",
|
|
},
|
|
"python": sys.version.split()[0],
|
|
"platform": platform.system(),
|
|
}
|
|
|
|
|
|
@router.get("/db")
|
|
async def db_check(db=Depends(get_db)):
|
|
try:
|
|
await db.command("ping")
|
|
return {"status": "ok", "database": "connected"}
|
|
except Exception as e:
|
|
return {"status": "error", "database": str(e)}
|