若干更新迭代

This commit is contained in:
andy committed 2026-10-02 19:56:32 +08:00
1 parent deb9cc5bcf
commit 4ac786aafb
64 files changed
+3251 -291

No files matched your search

+12
View File
@@ -27,6 +27,16 @@ describe("MiniMax H3 V2 client", () => {
expect(() => buildMinimaxH3Payload({ prompt: "bad", materials: [{ type: "video", url: "/a.mp4" }], settings: {}, origin: "https://app.test" })).toThrow("只上传 1 张图片");
});
it("sends every selected reference image and rejects overflow", () => {
const materials = Array.from({ length: 9 }, (_, index) => ({ type: "image" as const, url: `/image-${index}.png` }));
const payload = buildMinimaxH3Payload({ prompt: "combine", materials, settings: { inputMode: "reference", ratio: "adaptive" }, origin: "https://app.test" });
expect(payload.content).toHaveLength(10);
expect(payload.content.slice(1).every((item) => "role" in item && item.role === "reference_image")).toBe(true);
expect(buildMinimaxH3Payload({ prompt: "text only", materials: [], settings: { inputMode: "reference", ratio: "16:9" }, origin: "https://app.test" }).content).toHaveLength(1);
expect(() => buildMinimaxH3Payload({ prompt: "text only", materials: [], settings: { inputMode: "reference", ratio: "adaptive" }, origin: "https://app.test" })).toThrow("固定画面比例");
expect(() => buildMinimaxH3Payload({ prompt: "x", materials: [...materials, materials[0]], settings: { inputMode: "reference" }, origin: "https://app.test" })).toThrow("最多支持 9 张图片");
});
it("submits and queries the official asynchronous endpoints", async () => {
process.env.MINIMAX_API_KEY = "test-key";
process.env.MINIMAX_BASE_URL = "https://minimax.test";
@@ -45,6 +55,8 @@ describe("MiniMax H3 V2 client", () => {
it("extracts billable usage", () => {
expect(extractMinimaxH3Usage({ total_seconds: 8, input_seconds: 0, output_seconds: 8, input_image_count: 1 })).toEqual({ totalSeconds: 8, inputSeconds: 0, outputSeconds: 8, inputImageCount: 1 });
expect(extractMinimaxH3Usage({ output_seconds: 8 })).not.toHaveProperty("inputImageCount");
expect(extractMinimaxH3Usage({ output_seconds: 8, input_image_count: 0 })).toHaveProperty("inputImageCount", 0);
expect(extractMinimaxH3Usage({ output_seconds: 0 })).toBeUndefined();
});
});