Files
meijiaka-zy/python-api/app/api/v1/materials.py
T
小鱼开发 e15bdaf996 fix: 素材匹配、Step流程、UI优化
- 修复 duration 解析 bug (parseInt→parseFloat),解决素材'换一个'候选池过小
- 素材匹配策略:候选池=满足时长+最近5个,严格模式排除已用素材
- Step2 下一步按钮绑定 dubbingAudioUrl 生成状态
- 修复 VoiceDubbing 生成后未同步 projectStore
- 修复 _meta.json JSON 格式错误导致分类列表空白
- Step3/Step4 视频预览区添加标题
- 压制字幕按钮固定在底部
- 选项卡按钮高度微调
2026-04-24 15:46:06 +08:00

33 lines
930 B
Python

"""
空镜素材 API
============
提供空镜素材匹配接口。
"""
from fastapi import APIRouter
from app.schemas.common import ApiResponse, success_response
from app.schemas.materials import MatchMaterialRequest, MaterialInfo
from app.services.material_service import match_material
router = APIRouter()
@router.post("/match", response_model=ApiResponse[MaterialInfo | None])
async def match_material_endpoint(request: MatchMaterialRequest):
"""
根据场景描述和所需时长匹配空镜素材
返回匹配到的素材信息,无匹配返回 data: null
"""
result = match_material(request.scene, request.duration, request.exclude_urls, request.strict)
if result is None:
return success_response(data=None, message="未匹配到素材")
return success_response(
data=MaterialInfo(url=result["url"], duration=result["duration"]),
message="匹配成功",
)