chore: init monorepo snapshot

This commit is contained in:
liaibo
2025-11-23 10:55:04 +08:00
commit c70ff52869
941 changed files with 246586 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel, Field
from app.services.rag_service import RagService
router = APIRouter()
rag_service = RagService()
class QueryRequest(BaseModel):
query: str = Field(..., description="用户查询")
top_k: int = Field(8, description="返回条数")
class PathRequest(BaseModel):
source: str
target: str
@router.post("/query")
async def query(payload: QueryRequest):
"""优先调用 LightRAG,失败自动降级 Supabase"""
result = await rag_service.query(payload.query, payload.top_k)
return {"data": result}
@router.post("/graph")
async def graph(payload: QueryRequest):
result = await rag_service.graph(payload.query)
return {"data": result}
@router.post("/path")
async def path(payload: PathRequest):
result = await rag_service.path(payload.source, payload.target)
return {"data": result}
@router.get("/health/full")
async def health() -> dict:
"""最小化健康检查,后续补充依赖自检"""
try:
_ = await rag_service.query("ping", top_k=1)
return {"status": "ok"}
except Exception as exc: # noqa: BLE001
raise HTTPException(status_code=500, detail=str(exc))