feat: 视频创作流程全链路优化
- 后端: Vidu Provider、System API、Upload API、素材服务更新 - 前端: 字幕压制、视频生成、配音、本地存储、类型定义优化 - Rust: FFmpeg 命令、视频合成、语音命令、库注册更新 - Store: 项目状态、语音状态管理优化 - 新增: 对口型替换文档、健康检查器、字幕 API 模块、音频对齐工具 - 删除: 废弃的 polish 提示词模板
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
============
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi import APIRouter, status
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from app.core.health_checker import check_database, check_redis
|
||||
from app.schemas.common import ApiResponse, success_response
|
||||
|
||||
router = APIRouter()
|
||||
@@ -13,16 +15,34 @@ router = APIRouter()
|
||||
@router.get("/health", response_model=ApiResponse[dict])
|
||||
async def system_health():
|
||||
"""系统健康检查(详细版)"""
|
||||
return success_response(
|
||||
data={
|
||||
"status": "healthy",
|
||||
"services": {
|
||||
"api": "up",
|
||||
"database": "unknown", # TODO: 检查数据库连接
|
||||
"redis": "unknown", # TODO: 检查 Redis 连接
|
||||
db_ok, db_msg = await check_database()
|
||||
redis_ok, redis_msg = await check_redis()
|
||||
|
||||
services = {
|
||||
"api": "up",
|
||||
"database": "connected" if db_ok else db_msg,
|
||||
"redis": "connected" if redis_ok else redis_msg,
|
||||
}
|
||||
|
||||
if not db_ok:
|
||||
return JSONResponse(
|
||||
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||
content={
|
||||
"code": status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||
"message": "数据库连接异常",
|
||||
"data": {"status": "unhealthy", "services": services},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
if not redis_ok:
|
||||
return success_response(
|
||||
message="Redis 连接异常,服务降级",
|
||||
data={"status": "degraded", "services": services},
|
||||
)
|
||||
|
||||
return success_response(
|
||||
message="系统运行正常",
|
||||
data={"status": "healthy", "services": services},
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user