feat: add Seedance segmented video workflow
This commit is contained in:
@@ -23,7 +23,7 @@ export function activeVideoProvider(): VideoProvider {
|
||||
}
|
||||
|
||||
function durationOrDefault(duration?: number): number {
|
||||
return Math.min(Math.max(duration ?? 6, 3), 15);
|
||||
return Math.min(Math.max(duration ?? 15, 3), 15);
|
||||
}
|
||||
|
||||
function openAITargetDuration(duration?: number): number {
|
||||
@@ -113,8 +113,10 @@ function withProductVideoConstraints(prompt: string, targetDuration: number): st
|
||||
return [
|
||||
prompt.trim(),
|
||||
'',
|
||||
'硬性约束:主角必须是“有你家族 · 糯糯猪”智能陪伴毛绒娃娃,整体成品高度约 45cm,必须明显是 40cm 以上的大尺寸抱抱玩偶。',
|
||||
'保持浅粉毛绒、圆胖坐姿、黑亮眼睛、粉色猪鼻、下垂耳朵、金色挂绳和爱心吊牌;不要改成普通小挂件、钥匙扣或低于 40cm 的小公仔。',
|
||||
'硬性尺寸约束:主角必须是“有你家族 · 糯糯猪”智能陪伴毛绒娃娃,整体成品高度约 45cm,正面宽约 32cm,侧深约 28cm,背面宽约 33cm。',
|
||||
'必须明显是 40cm 以上的大尺寸抱抱玩偶:优先用成人双手、前臂、胸前怀抱、包装盒、椅子或床品证明比例;不能像掌心小玩偶、桌面摆件、挂件或钥匙扣。',
|
||||
'如果参考图有中文或数字,只把它们当作尺寸比例依据;成片中不要生成任何数字、厘米文字、箭头尺寸标注或文字海报,避免出现错误读数。',
|
||||
'保持浅粉长绒、圆胖坐姿、黑亮眼睛、粉色猪鼻、下垂耳朵、金色挂绳和爱心吊牌;不要改成普通小挂件、钥匙扣或低于 40cm 的小公仔。',
|
||||
`目标视频总时长不少于 ${targetDuration} 秒;如果 API 需要分段或延展,保持同一角色、同一尺寸比例和连续镜头语言。`,
|
||||
].join('\n');
|
||||
}
|
||||
@@ -154,7 +156,10 @@ export async function generateSeedanceVideo(opts: VideoGenerationRequest): Promi
|
||||
if (!key) throw new Error('SEEDANCE_API_KEY missing');
|
||||
if (!opts.prompt?.trim()) throw new Error('prompt required');
|
||||
|
||||
const content = buildContent(opts);
|
||||
const content = buildContent({
|
||||
...opts,
|
||||
prompt: withProductVideoConstraints(opts.prompt, Math.max(opts.duration ?? 60, 60)),
|
||||
});
|
||||
const body: Record<string, unknown> = {
|
||||
model: SEEDANCE_MODEL,
|
||||
content,
|
||||
|
||||
Reference in New Issue
Block a user