若干更新迭代
This commit is contained in:
1 parent
deb9cc5bcf
commit
4ac786aafb
64 files changed
+3251
-291
No files matched your search
+17
-6
@@ -9,13 +9,14 @@ export type MinimaxH3Settings = {
|
||||
ratio?: string;
|
||||
duration?: number;
|
||||
resolution?: string;
|
||||
inputMode?: "frames" | "reference";
|
||||
};
|
||||
|
||||
export type MinimaxH3Usage = {
|
||||
totalSeconds: number;
|
||||
inputSeconds: number;
|
||||
outputSeconds: number;
|
||||
inputImageCount: number;
|
||||
inputImageCount?: number;
|
||||
};
|
||||
|
||||
export function getMinimaxConfig() {
|
||||
@@ -34,9 +35,17 @@ export function buildMinimaxH3Payload(input: {
|
||||
}) {
|
||||
const prompt = input.prompt.trim();
|
||||
if (!prompt) throw new Error("MiniMax H3 视频提示词不能为空。");
|
||||
if (input.materials.length > 1 || input.materials.some((material) => material.type !== "image")) {
|
||||
const mode = input.settings.inputMode || "frames";
|
||||
if (mode !== "frames" && mode !== "reference") throw new Error("MiniMax 请选择首帧或多图参考模式。");
|
||||
if (input.materials.some((material) => material.type !== "image")) {
|
||||
throw new Error("MiniMax H3 第一版支持纯文字生成,或只上传 1 张图片作为首帧。");
|
||||
}
|
||||
if (mode === "reference" && input.materials.length > 9) {
|
||||
throw new Error("MiniMax 多图参考模式最多支持 9 张图片。");
|
||||
}
|
||||
if (mode === "frames" && input.materials.length > 1) {
|
||||
throw new Error("MiniMax 首帧模式最多只能上传 1 张图片;多张图片请切换到多图参考模式。");
|
||||
}
|
||||
const duration = Number(input.settings.duration ?? 5);
|
||||
if (!Number.isInteger(duration) || duration < 4 || duration > 15) {
|
||||
throw new Error("MiniMax H3 视频时长须为 4–15 秒整数。");
|
||||
@@ -45,8 +54,8 @@ export function buildMinimaxH3Payload(input: {
|
||||
if (resolution !== "768P" && resolution !== "2K") {
|
||||
throw new Error("MiniMax H3 分辨率仅支持 768P 或 2K。");
|
||||
}
|
||||
const ratio = input.materials.length === 1 ? "adaptive" : String(input.settings.ratio || "16:9");
|
||||
if (input.materials.length === 0 && !["21:9", "16:9", "4:3", "1:1", "3:4", "9:16"].includes(ratio)) {
|
||||
const ratio = mode === "frames" && input.materials.length === 1 ? "adaptive" : String(input.settings.ratio || "16:9");
|
||||
if ((input.materials.length === 0 && ratio === "adaptive") || !["21:9", "16:9", "4:3", "1:1", "3:4", "9:16", "adaptive"].includes(ratio)) {
|
||||
throw new Error("MiniMax H3 文生视频须选择固定画面比例。");
|
||||
}
|
||||
return {
|
||||
@@ -56,7 +65,7 @@ export function buildMinimaxH3Payload(input: {
|
||||
...input.materials.map((material) => ({
|
||||
type: "image_url",
|
||||
image_url: { url: toAbsoluteUrl(material.url, input.origin) },
|
||||
role: "first_frame"
|
||||
role: mode === "reference" ? "reference_image" : "first_frame"
|
||||
}))
|
||||
],
|
||||
resolution,
|
||||
@@ -100,7 +109,9 @@ export function extractMinimaxH3Usage(value: unknown): MinimaxH3Usage | undefine
|
||||
totalSeconds: nonNegativeInteger(usage.total_seconds),
|
||||
inputSeconds: nonNegativeInteger(usage.input_seconds),
|
||||
outputSeconds,
|
||||
inputImageCount: nonNegativeInteger(usage.input_image_count)
|
||||
...(typeof usage.input_image_count === "number" && Number.isInteger(usage.input_image_count) && usage.input_image_count >= 0
|
||||
? { inputImageCount: usage.input_image_count }
|
||||
: {})
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user