若干更新迭代
This commit is contained in:
1 parent
deb9cc5bcf
commit
4ac786aafb
64 files changed
+3251
-291
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
bailianResultUrls,
|
||||
bailianOutputVideoSeconds,
|
||||
bailianStatus,
|
||||
buildBailianImagePayload,
|
||||
buildBailianVideoPayload,
|
||||
@@ -58,6 +59,19 @@ describe("Bailian client", () => {
|
||||
expect(payload.parameters).not.toHaveProperty("size");
|
||||
});
|
||||
|
||||
it("maps Wan 3.0 references while retaining optional first and last frames", () => {
|
||||
const materials = Array.from({ length: 10 }, (_, index) => ({ type: "image" as const, url: `/image-${index}.png` }));
|
||||
const reference = buildBailianVideoPayload({ model: "wan3.0-video", prompt: "combine", materials, origin: "https://app.test", settings: { duration: 30, resolution: "480P", ratio: "9:16", inputMode: "reference" } });
|
||||
expect(reference.input.media).toHaveLength(10);
|
||||
expect(reference.input.media?.every((item) => item.type === "reference_image")).toBe(true);
|
||||
expect(reference.parameters.ratio).toBe("9:16");
|
||||
const frames = buildBailianVideoPayload({ model: "wan3.0-video", prompt: "animate", materials: materials.slice(0, 2), origin: "https://app.test", settings: { inputMode: "frames" } });
|
||||
expect(frames.input.media?.map((item) => item.type)).toEqual(["first_frame", "last_frame"]);
|
||||
expect(buildBailianVideoPayload({ model: "wan3.0-video", prompt: "landscape", materials: [], origin: "https://app.test", settings: { inputMode: "reference" } }).input).toEqual({ prompt: "landscape" });
|
||||
expect(() => buildBailianVideoPayload({ model: "wan2.7-i2v-2026-04-25", prompt: "x", materials, origin: "https://app.test", settings: { inputMode: "reference" } })).toThrow("请选择 Wan 3.0");
|
||||
expect(bailianOutputVideoSeconds({ usage: { output_video_duration: 5.25, duration: 8 } })).toBe(5.25);
|
||||
});
|
||||
|
||||
it("normalizes task state and result URLs", () => {
|
||||
const response = { output: { task_status: "SUCCEEDED", results: [{ url: "https://example.com/result.png" }] } };
|
||||
expect(bailianStatus(response)).toBe("succeeded");
|
||||
|
||||
Reference in new issue
Block a user