From ffcbb5105d7773c8e00547e7d4f867b776a80e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=B1=BC=E5=BC=80=E5=8F=91?= Date: Fri, 15 May 2026 17:08:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E6=81=A2=E5=A4=8D=20/health=20?= =?UTF-8?q?=E6=A0=B9=E8=B7=AF=E5=BE=84=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=AB=AF=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docker/Nginx 健康检查请求 /health 返回 404, 在 main.py 中重新添加轻量级 /health 端点供负载均衡使用。 --- python-api/app/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python-api/app/main.py b/python-api/app/main.py index fb8e02a..d015812 100644 --- a/python-api/app/main.py +++ b/python-api/app/main.py @@ -286,6 +286,16 @@ def create_app() -> FastAPI: }, ) + # 健康检查(根路径,供 Docker/Nginx 负载均衡使用) + @app.get("/health", tags=["System"]) + async def health_check(): + """服务健康检查""" + return ApiResponse( + code=200, + data={"status": "healthy"}, + message="服务运行正常", + ) + # 根路由 @app.get("/", tags=["System"]) async def root():