fix(viral-video): #2165 视频生成详细错误日志+真人拦截友好提示 #2166

Merged
xiaoxia merged 2 commits from fix/2165-video-error-logging-and-user-message into develop 2026-10-04 00:08:33 +08:00
Owner

背景

P0 staging 视频生成失败笼统显示返回为空无法定位根因+真人拦截友好提示+详细错误日志。

变更

  • ai_client/dashscope_client 新增 last_video_error 字段记录结构化错误(error_code/user_message/status_code/detail/model)
  • 新增 _classify_video_error 自动识别:真人拦截/鉴权失败/配额/限流/模型不存在/参数错误/网络超时/任务失败
  • call_video_generation 暴露 get_last_video_error()
  • worker _step_render 不再笼统返回为空,读取错误详情展示具体原因
  • 增强日志:打印完整 payload、轮询 HTTP 错误 body、下载失败原因
  • 修复重试策略:4xx 不重试仅 5xx/网络错误重试
  • DashScope 同步支持

测试

新增5个单测,142个相关单测全绿,Black+Ruff通过。部署后真实失败场景会有详细日志和友好提示。

## 背景 P0 staging 视频生成失败笼统显示返回为空无法定位根因+真人拦截友好提示+详细错误日志。 ## 变更 - ai_client/dashscope_client 新增 last_video_error 字段记录结构化错误(error_code/user_message/status_code/detail/model) - 新增 _classify_video_error 自动识别:真人拦截/鉴权失败/配额/限流/模型不存在/参数错误/网络超时/任务失败 - call_video_generation 暴露 get_last_video_error() - worker _step_render 不再笼统返回为空,读取错误详情展示具体原因 - 增强日志:打印完整 payload、轮询 HTTP 错误 body、下载失败原因 - 修复重试策略:4xx 不重试仅 5xx/网络错误重试 - DashScope 同步支持 ## 测试 新增5个单测,142个相关单测全绿,Black+Ruff通过。部署后真实失败场景会有详细日志和友好提示。

🚀 预览环境已部署

项目 详情
PR号 #2166
预览链接 https://pr-2166.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #2166 | | 预览链接 | [https://pr-2166.preview.xiaoxiajianji.com](https://pr-2166.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia added 2 commits 2026-10-03 23:26:11 +08:00
- ai_client/dashscope_client 新增 last_video_error 字段,记录每次失败的
  error_code/user_message/status_code/detail/model 等结构化信息
- 新增 _classify_video_error 错误分类器,自动识别:
  - 真人肖像拦截 (portrait_intercept) → 提示用户移除真人图片
  - 鉴权失败 (auth_error) / 配额不足 (quota_exceeded) / 限流 (rate_limit)
  - 模型/Endpoint 不存在 (model_not_found) / 参数错误 (invalid_param)
  - 网络超时 (network_error) / 任务失败 (task_failed) / 未知 (unknown)
- call_video_generation 失败时通过 get_last_video_error() 暴露详细错误
- worker _step_render 不再笼统抛"返回为空",改为读取错误详情并展示具体用户提示
- 增强日志:完整 payload 打印(截断 prompt)、轮询 HTTP 错误记录完整 body、
  下载/超时时记录具体失败原因
- 修复重试策略:4xx 错误不再重试(参数/鉴权错误重试无意义),仅 5xx/网络错误重试
- DashScope 客户端同样增加 last_video_error 和错误分类,保持语义一致
- 新增单测覆盖:400真人拦截、401鉴权失败、轮询failed、ai_service错误透传、dashscope 401
fix(viral-video): 肖像/真人审核拦截时自动降级为纯文字t2v重试一次
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 53s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m10s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m58s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m0s
AI Code Review / AI Code Review (pull_request) Successful in 7m2s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 13m26s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 14m50s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 12m45s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 16m31s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 20m19s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 34m53s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 55s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 5m55s
c87810a4a6
- _step_render 捕获portrait_intercept/真人/肖像/隐私/SensitiveContent等关键词错误
- 第一次带参考图/首帧/参考视频被审核拦截时,自动移除所有参考素材走纯t2v重试
- 保留reference_audios(TTS口型)不影响肖像审核
- 仍失败则抛具体错误信息(#2166已增强的错误透传)
- 解决用户上传真人产品图直接失败无法出片的问题
xiaoxia force-pushed fix/2165-video-error-logging-and-user-message from 3066082ceb to c87810a4a6 2026-10-03 23:26:11 +08:00 Compare
xiaoxia merged commit 3bb9c5dd4e into develop 2026-10-04 00:08:33 +08:00

🗑️ 预览环境已清理

PR #2166 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #2166 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.