Files
AgentScript/agent/backend/app/api/health_api.py
T
HenryandClaude Code 26e13ff032 feat: Agent 工作区初始提交(源码+文档+Skills)
包含 CodeAgent 前后端源码、SKILLS、MCP、demo 代码与工作区文档。
排除依赖缓存、运行数据、备份与二进制附件,规则见 .gitignore。

Co-Authored-By: Claude Code <[email protected]>
2026-11-13 13:48:41 +08:00

32 lines
843 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
健康检查 API
============
【功能说明】全链路健康探活接口。
"""
from __future__ import annotations
import logging
from fastapi import APIRouter
from app.schemas.project import ApiResponse
from app.services.health_service import check_all
logger = logging.getLogger("agent.health.api")
router = APIRouter(prefix="/api/health", tags=["健康检查"])
@router.get("", response_model=ApiResponse[dict], summary="全链路健康检查")
def health_check() -> ApiResponse[dict]:
"""服务/数据库/向量库/模型/Git/磁盘 全链路探活。"""
result = check_all()
code = 0 if result["status"] == "healthy" else 1
return ApiResponse(
code=code,
message=f"整体状态:{result['status']}({result['healthy_count']}/{result['total_count']} 正常)",
data=result,
)