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

Commit 559c70f

Browse files
rootroot
authored andcommitted
fix: widen video duration validation to support 4-15s range
Replace discrete duration whitelist [4,5,8,10,12,15] with range validation (4 <= duration <= 15, integer) to support Seedance 2.0 continuous duration. Non-seedance models still clamp to their supported values in the controller layer.
1 parent 75ccca3 commit 559c70f

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/api/routes/videos.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ export default {
2323
.validate('body.resolution', v => _.isUndefined(v) || _.isString(v))
2424
.validate('body.duration', v => {
2525
if (_.isUndefined(v)) return true;
26-
// 支持的时长: 4/8/12 (sora2)、5/10 (其他模型)、15 (4.0模型)
27-
const validDurations = [4, 5, 8, 10, 12, 15];
28-
// 对于 multipart/form-data,允许字符串类型的数字
26+
// 支持的时长范围: 4~15 (seedance 2.0 支持任意整数秒)
27+
let num: number;
2928
if (isMultiPart && typeof v === 'string') {
30-
const num = parseInt(v);
31-
return validDurations.includes(num);
29+
num = parseInt(v);
30+
} else if (_.isFinite(v)) {
31+
num = v as number;
32+
} else {
33+
return false;
3234
}
33-
// 对于 JSON,要求数字类型
34-
return _.isFinite(v) && validDurations.includes(v);
35+
return Number.isInteger(num) && num >= 4 && num <= 15;
3536
})
3637
// 限制图片URL数量最多2个
3738
.validate('body.file_paths', v => _.isUndefined(v) || (_.isArray(v) && v.length <= 2))

0 commit comments

Comments
 (0)