feat: 更新 API 主页路由及 FastAPI 配置

- 将主页路由从 "/home" 更新为根路径 "/",以简化访问。
- 在 FastAPI 实例中禁用文档和 OpenAPI 相关的 URL,提升 API 安全性。
This commit is contained in:
penghanyuan
2026-02-14 21:25:37 +01:00
parent 6f19429aa4
commit d9e010ef70
2 changed files with 2 additions and 7 deletions

View File

@@ -89,7 +89,7 @@ else:
logger.warning("未检测到 LLM API Key 配置")
logger.info("===================")
app = FastAPI(title="Life Echo API", version="1.0.0")
app = FastAPI(title="Life Echo API", version="1.0.0", docs_url=None, redoc_url=None, openapi_url=None)
@app.on_event("startup")
@@ -177,11 +177,6 @@ app.include_router(home.router) # 应用官网主页
app.mount("/static", StaticFiles(directory=Path(__file__).parent / "static"), name="static")
@app.get("/")
async def root():
return {"message": "Life Echo API", "version": "1.0.0"}
@app.get("/health")
async def health():
return {"status": "ok"}