refactor: 清理未使用IPC命令、修正point_service注释与扣费逻辑、修复camelToSnake正则、优化vidu import
- 删除8个未使用IPC命令,保留validate_media_path - file.rs返回类型优化为ApiResponse<()> - point_service.consume()注释与签名一致 - VideoGeneration改为拼接成功后扣费 - 添加漏扣费风险注释 - 删除过时测试文件 - 修复camelToSnake连续大写字母问题 - vidu.py import移至模块顶层 Refs: P1-1~P1-6 技术债务清理
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
脚本生成 API
|
||||
============
|
||||
|
||||
提供脚本生成、润色、模型健康检查等功能。
|
||||
提供脚本分类查询、润色、标题生成等功能。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -22,10 +22,7 @@ from app.schemas.script import (
|
||||
CategoryItem,
|
||||
GenerateTitleRequest,
|
||||
GenerateTitleResponse,
|
||||
ModelHealthResponse,
|
||||
PolishRequest,
|
||||
TestModelRequest,
|
||||
TestModelResponse,
|
||||
)
|
||||
from app.services.script_service import get_script_service
|
||||
from app.services import point_service as ps
|
||||
@@ -111,36 +108,7 @@ async def polish_content(
|
||||
raise HTTPException(status_code=500, detail=f"{type_name}润色失败,请稍后重试")
|
||||
|
||||
|
||||
@router.get("/model-health", response_model=ApiResponse[ModelHealthResponse])
|
||||
async def check_model_health():
|
||||
"""
|
||||
检查 AI 模型健康状态
|
||||
|
||||
返回所有配置的模型及其可用性状态。
|
||||
"""
|
||||
service = get_script_service()
|
||||
health_data = await service.check_model_health()
|
||||
|
||||
return success_response(
|
||||
data=ModelHealthResponse(**health_data),
|
||||
message="模型健康检查完成",
|
||||
)
|
||||
|
||||
|
||||
@router.post("/test-model", response_model=ApiResponse[TestModelResponse])
|
||||
async def test_model(request: TestModelRequest):
|
||||
"""
|
||||
测试指定模型连接
|
||||
|
||||
发送一个简单的测试请求,验证模型是否可用。
|
||||
"""
|
||||
service = get_script_service()
|
||||
result = await service.test_model(request.model_id)
|
||||
|
||||
return success_response(
|
||||
data=TestModelResponse(**result),
|
||||
message="模型测试完成" if result["success"] else f"模型测试失败: {result.get('error')}",
|
||||
)
|
||||
|
||||
|
||||
@router.post("/generate-title", response_model=ApiResponse[GenerateTitleResponse])
|
||||
|
||||
Reference in New Issue
Block a user