fix: 确认生成兜底增强 — project_id 为空时通过 user_id 查找素材 #1338
Reference in New Issue
Block a user
Delete Branch "fix/generate-fallback-user-assets"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
模板编辑器直接创建的草稿 plan 没有
project_id和config.asset_ids,导致:_auto_fallback_auto_material_mode因 project_id 为空直接 returncan_generate发现 clips 都无 asset_id,报错"没有可渲染的就绪片段"修复
asset_repository新增find_ready_videos_by_user(user_id)方法_auto_fallback_auto_material_mode增加策略2:project_id 为空时通过uploaded_by_user_id查找用户上传的就绪视频generation.py传递current_user.user.id给兜底函数影响文件
packages/adapters/sqlalchemy_impl/asset_repository.pyapps/api/app/api/routes/templates_editor/_fallback.pyapps/api/app/api/routes/templates_editor/generation.py🚀 预览环境已部署
CI全绿,自动审批通过。
CI全绿,自动审批通过。
【阻塞级判定】
📊 审查概览
🔴 阻塞级问题(必须修复)
无
💡 改进建议(不阻塞合并)
current_user.user.id。请确认current_user依赖注入返回的对象结构。在标准的 FastAPIget_current_user依赖中通常直接返回 User 对象,即current_user.id。如果current_user是一个包含user属性的包装类(如TokenData或自定义AuthContext),则当前代码是正确的。建议确认该属性路径是否与项目其他路由保持一致。✅ 良好实践
asset_repo.find_ready_videos_by_user前使用了hasattr检查,增强了代码对不同 Repository 实现的兼容性。user_id时使用了切片[:8] + "...",有效避免了敏感信息(完整用户ID)在日志中泄露。✅ 格式检查通过 | ✅ 逻辑审查通过 | ✅ 性能良好
🤖 由 AI 代码审查机器人自动生成 | 2026-08-10 13:29:04 | 模型:
🗑️ 预览环境已清理
PR #1338 已关闭或合并,对应的预览环境已被清理。