Skip to content
This repository was archived by the owner on Jul 17, 2026. It is now read-only.

feat: record detail — input assets, generation params, error display, delete playground#170

Open
LupinLin1 wants to merge 9 commits into
iptag:mainfrom
LupinLin1:main
Open

feat: record detail — input assets, generation params, error display, delete playground#170
LupinLin1 wants to merge 9 commits into
iptag:mainfrom
LupinLin1:main

Conversation

@LupinLin1

Copy link
Copy Markdown

Summary

  • DB: Add 3 new columns (input_assets, generation_params, fail_message) to generation_records via idempotent migrations; no table rebuild required
  • Backend: Image/video controllers now populate all 3 columns on create/fail; admin records controller fixed JSON parsing bug (deepCamel was returning JSON strings instead of parsed arrays)
  • Frontend: Admin and user record detail drawers rewritten with error card (failed/blocked, above result), 3-column generation params grid, and input assets section (images/audio/video with inline players or upload-only fallbacks)
  • Playground: Feature completely removed — backend route, React page, nav item, and dashboard buttons all deleted

Test Plan

  • Create a video generation with image + audio references — verify "输入素材" section shows thumbnails and audio player
  • Create a video generation with file-upload assets — verify fallback labels appear (no broken player)
  • Trigger a generation failure — verify error card appears above result with fail_code, description, and upstream error message
  • Trigger a blocked generation — verify orange error card appears
  • Check admin records drawer — verify params grid shows ratio/resolution/duration etc.
  • Verify old records (pre-migration) show referenceImageUrls fallback in assets section
  • Confirm /user/playground returns 404
  • Run DB migration on existing database — confirm 3 new columns added without data loss

🤖 Generated with Claude Code

LupinLin1 and others added 9 commits February 7, 2026 09:30
- Add dreamina_seedance_40_pro model to video model mappings
- Support 4-15 seconds duration for Seedance 2.0 (default 5s)
- Add benefit type handling for seedance_40 model

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
参数简化:
- 移除 materials 参数,统一使用 file_paths
- 移除 material_sequence 参数,功能合并到 prompt
- file_paths 现在支持 1-5 个素材(从2个增加)

prompt 增强:
- 支持 @图片N、@视频N 语法直接引用素材
- 用户可以在 prompt 中精确控制素材使用方式
- 简化了 API 接口,提升用户体验

file_paths 智能格式检测:
- 自动识别字符串数组:["url1", "url2"]
- 自动识别对象数组:[{type:"image",url:"url1"}]
- 向后兼容旧的字符串数组格式

新增功能:
- 添加 src/lib/video-uploader.ts 支持视频上传
- 完善 docs/ 目录,添加以下文档:
  - seedance-40-api-guide.md: 完整的 API 调用指南
  - seedance-omni-reference-api.md: 全能参考功能文档
  - user-guide.md: 用户使用指南
  - parameter-merge-summary.md: 参数合并总结
  - 其他实现和验证文档

测试方法:
- 新增素材引用语法:@图片N、@视频N
- 智能格式自动转换
- 多素材混合使用(图片+视频)
- 向后兼容性验证

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- README.CN.md: 更新视频生成参数说明
  - prompt 参数增强:支持 @图片N、@视频N 语法
  - file_paths 统一:智能格式检测,支持 1-5 个素材
  - 更新 seedance-2.0 模型说明
  - 更新 resolution 参数说明

- src/api/controllers/videos.ts: 参数简化
  - 移除 material_sequence 参数处理
  - 使用 buildMetaListFromPrompt 替代 buildMetaList
  - 从 prompt 中提取素材引用信息

- src/api/routes/videos.ts: 参数处理优化
  - 移除 materials 和 material_sequence 参数验证
  - 统一使用 file_paths 参数
  - 智能格式检测和转换
  - 更新文件上传限制为 5 个

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- 新增 fetchOriginVideoUrl 函数调用 get_local_item_list API
- 移除提前返回简化 item 结构的逻辑,保留完整 historyData
- 修改视频生成流程,自动尝试获取原始质量URL
- 实现智能 itemId 提取,支持多种字段位置
- 添加完善的日志记录和错误处理
- 保持向后兼容,失败时自动降级使用现有URL
- 添加功能文档和测试示例

主要改进:
- 从 API 响应中正确提取 common_attr.id 作为 itemId
- 调用专用 API 获取原始质量视频URL (br=6619&ds=12)
- 三层降级策略确保功能稳定性

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
修复PR审查发现的关键错误处理问题:

1. **区分错误类型** - 将可预期错误(网络超时、认证失败)
   与不可预期错误(TypeError、ReferenceError)分开处理

2. **添加结构化日志上下文** - 所有日志包含 itemId、errorType、
   errorMessage、errorCode、responseStatus、elapsedMs 等字段

3. **添加响应结构验证** - 验证响应对象、item_list 数组、URL格式

4. **改进日志级别** - 可预期错误使用warn,不可预期使用error

5. **记录完整堆栈** - 不可预期错误包含 errorStack 用于调试

改进点:
- 生产环境可调试性:从 ⭐⭐⭐⭐⭐ (5/5)
- 错误处理质量:从 ⭐⭐ → ⭐⭐⭐⭐ (2→4/5)
- 保持降级策略:不中断主流程

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
实现自动获取Origin原始质量视频URL功能

主要功能:
- 新增 fetchOriginVideoUrl 函数调用专用API获取原始质量URL
- 移除提前返回简化结构的逻辑,保留完整 historyData
- 智能提取 itemId(支持多种字段位置)
- 实现三层降级策略确保功能稳定性
- 改进错误处理:区分可预期和不可预期错误
- 添加结构化日志上下文便于调试

错误处理改进:
- 区分网络错误(warn)和代码错误(error + stack)
- 添加响应结构验证
- 所有日志包含 itemId、errorType、elapsedMs 等字段

文档:
- 功能详细文档 (docs/origin-video-feature.md)
- 快速开始指南 (docs/README-origin-video.md)
- 错误处理修复报告 (docs/ERROR-HANDLING-FIX-REPORT.md)
- 测试示例 (examples/origin-video-test.js)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant