新增seedance2.0视频接口支持 - #4042
Conversation
WalkthroughThe Doubao video task adaptor undergoes schema and logic updates: request payloads are restructured with new optional fields and Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
relay/channel/task/doubao/adaptor.go (1)
288-295:⚠️ Potential issue | 🟠 MajorHandle
expiredstatus as terminal failure in both locations.The Doubao/Seedance API returns
expiredfor timed-out tasks afterexecution_expires_afteris reached. Currently, this status falls through to the default case (line 288-295) and is treated as in-progress, causing expired tasks to keep polling indefinitely. The OpenAI conversion (line 317-321) also only checks forfailed, missing the error case forexpired. Both locations must treatexpiredas a terminal failure.🛠️ Proposed fix
- case "failed": + case "failed", "expired": taskResult.Status = model.TaskStatusFailure taskResult.Progress = "100%" - taskResult.Reason = resTask.Error.Message + if resTask.Error.Message != "" { + taskResult.Reason = resTask.Error.Message + } else { + taskResult.Reason = resTask.Status + } @@ - if dResp.Status == "failed" { + if dResp.Status == "failed" || dResp.Status == "expired" { openAIVideo.Error = &dto.OpenAIVideoError{ Message: dResp.Error.Message, Code: dResp.Error.Code, } }Also applies to: 317-321
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@relay/channel/task/doubao/adaptor.go` around lines 288 - 295, The "expired" status must be treated as a terminal failure like "failed": in the status switch (where taskResult.Status, taskResult.Progress and taskResult.Reason are set based on resTask.Status) add "expired" to the failure branch so taskResult.Status = model.TaskStatusFailure, taskResult.Progress = "100%" and taskResult.Reason = resTask.Error.Message; likewise, in the OpenAI conversion block (the branch that currently checks only for "failed" around the lines handling conversion) include "expired" alongside "failed" so it is mapped to the same terminal failure handling instead of falling through to TaskStatusInProgress.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@relay/channel/task/doubao/adaptor.go`:
- Around line 288-295: The "expired" status must be treated as a terminal
failure like "failed": in the status switch (where taskResult.Status,
taskResult.Progress and taskResult.Reason are set based on resTask.Status) add
"expired" to the failure branch so taskResult.Status = model.TaskStatusFailure,
taskResult.Progress = "100%" and taskResult.Reason = resTask.Error.Message;
likewise, in the OpenAI conversion block (the branch that currently checks only
for "failed" around the lines handling conversion) include "expired" alongside
"failed" so it is mapped to the same terminal failure handling instead of
falling through to TaskStatusInProgress.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b4b2cb4a-9131-450f-8ba3-5dd37910792c
📒 Files selected for processing (2)
relay/channel/task/doubao/adaptor.gorelay/channel/task/doubao/constants.go
…5e127fbea2fcb1f3011da86ad54 新增seedance2.0视频接口支持
|
我使用以下参数进行调用生成视频返回的视频时长还是5s,不是参数传入的11s,辛苦看下是什么原因导致的,谢谢了。 |
|
支持秒的在这个pr #4068 |
|
您这里更新了,new API的video generation API仿佛还没有更新。请作者尽快更新一下? |
|
v0.12.11 仍然无法正确透传duration。 curl --location 'https:///v1/video/generations' 或者 curl --location 'https:///v1/video/generations' 最终生成的视频都是5秒的。 |
|
走 openai /v1/videos兼容格式 |


官方文档: https://www.volcengine.com/docs/82379/1520757?lang=zh
模型id: doubao-seedance-2-0-260128, doubao-seedance-2-0-fast-260128
请求示例: openai /v1/videos兼容格式
Summary by CodeRabbit
New Features
Bug Fixes