Skip to content

feat(backend): 增加 /api/health 健康检查接口 (GFI-05) - #15

Open
qiaobochi040726-source wants to merge 1 commit into
5758703:mainfrom
qiaobochi040726-source:20260807-api-health
Open

feat(backend): 增加 /api/health 健康检查接口 (GFI-05)#15
qiaobochi040726-source wants to merge 1 commit into
5758703:mainfrom
qiaobochi040726-source:20260807-api-health

Conversation

@qiaobochi040726-source

Copy link
Copy Markdown

Fixes #6

改动

  • backend/app.py/api/health 返回体增加 status: "ok" 字段(保留原 code/message 兼容),HTTP 200,纯 JSON,不加载任何重模型/推理库
  • backend/README.md:健康检查段落更新——路径、返回 JSON 示例、curl 示例命令
  • backend/unittests/test_health.py(新增):3 个用例(200 + status=ok、保留兼容字段、content-type JSON);通过空壳模块占位 + sqlite 内存库规避重依赖与 MySQL

验证

uv run --no-project --with flask --with flask-cors --with flask-sqlalchemy --with flask-jwt-extended --with pytest python -m pytest backend/unittests/test_health.py -q
3 passed, 422 warnings in 4.34s

(422 warnings 为 SQLAlchemy 2.0 LegacyAPIWarning 等既有告警,非本次引入)

验收对照

  • 本地请求 200 + 明确 JSON
  • 无重模型加载
  • README 有路径与 curl 示例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[gfi] 增加后端健康检查接口 GET /api/health

1 participant