若干更新迭代
This commit is contained in:
1 parent
deb9cc5bcf
commit
4ac786aafb
64 files changed
+3251
-291
No files matched your search
+15
-3
@@ -17,6 +17,7 @@ export type SeedanceSettings = {
|
||||
ratio?: string;
|
||||
duration?: number;
|
||||
resolution?: string;
|
||||
inputMode?: "frames" | "reference";
|
||||
};
|
||||
|
||||
export type SeedanceCreateInput = {
|
||||
@@ -59,9 +60,7 @@ export async function createSeedanceTask(input: SeedanceCreateInput) {
|
||||
}
|
||||
const model = normalizeSeedanceModel(input.model, config.model);
|
||||
const materialContent = materialContentForProvider(input.materials, input.origin);
|
||||
if (!isSeedance25Model(model) && materialContent.length > 4) {
|
||||
throw new Error("Seedance 2.0 最多支持 4 个素材(加上文本后 content 最多 5 项)。");
|
||||
}
|
||||
if (!isSeedance25Model(model)) validateSeedance20Materials(input.materials);
|
||||
if (isSeedance25Model(model)) validateSeedance25Materials(input.materials);
|
||||
const payload = {
|
||||
model,
|
||||
@@ -105,6 +104,19 @@ function validateSeedance25Materials(materials: PromptMaterial[]) {
|
||||
}
|
||||
}
|
||||
|
||||
function validateSeedance20Materials(materials: PromptMaterial[]) {
|
||||
const counts = materials.reduce((result, material) => {
|
||||
result[material.type] += 1;
|
||||
return result;
|
||||
}, { image: 0, video: 0, audio: 0 });
|
||||
if (counts.image > 9 || counts.video > 3 || counts.audio > 3) {
|
||||
throw new Error("Seedance 2.0 最多支持 9 张图片、3 个视频、3 个音频。");
|
||||
}
|
||||
if (counts.audio > 0 && counts.image + counts.video === 0) {
|
||||
throw new Error("Seedance 2.0 音频不能单独使用,请添加图片或视频素材。");
|
||||
}
|
||||
}
|
||||
|
||||
export async function querySeedanceTask(providerTaskId: string): Promise<SeedanceQueryResult> {
|
||||
const config = getSeedanceConfig();
|
||||
if (!config.apiKey) throw new Error("缺少 SEEDANCE_API_KEY,无法查询真实生成任务。");
|
||||
|
||||
Reference in new issue
Block a user