Files
PlantAI-rag-new/agent/methodology/scripts/methodology_server.py
T

33 lines
1006 B
Python
Raw Normal View History

#!/usr/bin/env python3
"""agent/methodology 薄入口 —— Methodology 提取 API(挂 methodology_routes 于 /api/v1 + /health)。
与生产宿主进程(uvicorn api.main:app)等价的最小面:
- GET /health —— 健康(供 SDK upstream 探测)
- /api/v1/methodology/* —— 全量路由族(与 api/methodology_routes.py 契约一致)
"""
from __future__ import annotations
import os
import sys
from pathlib import Path
PROJECT_ROOT = Path(os.environ.get("PLANTAI_RAG_ROOT", Path(__file__).resolve().parents[1]))
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from fastapi import FastAPI # noqa: E402
from api.methodology_routes import router as methodology_router # noqa: E402
app = FastAPI(title="PlantAI Methodology API", version="2.0.0")
app.include_router(methodology_router, prefix="/api/v1")
@app.get("/health")
def health():
return {
"status": "healthy",
"service": "methodology",
"project_root": str(PROJECT_ROOT),
}