18 lines
493 B
Python
18 lines
493 B
Python
from fastapi import APIRouter
|
|
import toml
|
|
from pathlib import Path
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/")
|
|
async def root():
|
|
version = "dev"
|
|
pyproject_path = Path(__file__).parent.parent.parent / "pyproject.toml"
|
|
if pyproject_path.exists():
|
|
try:
|
|
data = toml.load(pyproject_path)
|
|
version = data.get("project", {}).get("version", "dev")
|
|
except Exception:
|
|
pass
|
|
return {"status": "ok", "msg": "LLM-infa API", "version": version}
|