fix(baoyu-imagine): align Replicate output extensions with model formats
This commit is contained in:
parent
a60d842053
commit
4c3238ba1c
|
|
@ -6,6 +6,7 @@ import {
|
|||
buildInput,
|
||||
extractOutputUrl,
|
||||
generateImage,
|
||||
getDefaultOutputExtension,
|
||||
parseModelId,
|
||||
validateArgs,
|
||||
} from "./replicate.ts";
|
||||
|
|
@ -241,6 +242,12 @@ test("Replicate output extraction supports string, array, and object URLs", () =
|
|||
);
|
||||
});
|
||||
|
||||
test("Replicate default output extension matches model family behavior", () => {
|
||||
assert.equal(getDefaultOutputExtension("bytedance/seedream-4.5"), ".jpg");
|
||||
assert.equal(getDefaultOutputExtension("bytedance/seedream-5-lite"), ".png");
|
||||
assert.equal(getDefaultOutputExtension("google/nano-banana-2"), ".png");
|
||||
});
|
||||
|
||||
test("Replicate generateImage validates arguments before making API requests", async () => {
|
||||
const previousToken = process.env.REPLICATE_API_TOKEN;
|
||||
process.env.REPLICATE_API_TOKEN = "test-token";
|
||||
|
|
|
|||
|
|
@ -200,6 +200,12 @@ function buildWanInput(prompt: string, model: string, args: CliArgs, referenceIm
|
|||
return input;
|
||||
}
|
||||
|
||||
export function getDefaultOutputExtension(model: string): ".png" | ".jpg" {
|
||||
if (isSeedream45Model(model)) return ".jpg";
|
||||
if (isSeedream5LiteModel(model)) return ".png";
|
||||
return ".png";
|
||||
}
|
||||
|
||||
export function validateArgs(model: string, args: CliArgs): void {
|
||||
if (isNanoBananaModel(model) && args.n > 1) {
|
||||
throw new Error("Nano Banana models on Replicate do not support --n yet because their current schema does not expose a multi-image count field.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue