climage 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +25 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -446,6 +446,11 @@ function isKlingV3Model(model) {
|
|
|
446
446
|
function isViduModel(model) {
|
|
447
447
|
return model.includes("/vidu/");
|
|
448
448
|
}
|
|
449
|
+
function usesImageUrlsArray(model) {
|
|
450
|
+
if (model.includes("/hunyuan-image/") && model.includes("/edit")) return true;
|
|
451
|
+
if (model.includes("/kling-image/")) return true;
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
449
454
|
function selectVideoModel(req) {
|
|
450
455
|
if (req.model) return req.model;
|
|
451
456
|
if (req.startFrame && req.endFrame) {
|
|
@@ -533,8 +538,13 @@ function buildImageInput(req) {
|
|
|
533
538
|
if (imageSize) input.image_size = imageSize;
|
|
534
539
|
if (req.n) input.num_images = req.n;
|
|
535
540
|
if (req.inputImages?.[0]) {
|
|
536
|
-
|
|
537
|
-
|
|
541
|
+
const model = req.model ?? "";
|
|
542
|
+
if (usesImageUrlsArray(model)) {
|
|
543
|
+
input.image_urls = req.inputImages.slice(0, 3);
|
|
544
|
+
} else {
|
|
545
|
+
input.image_url = req.inputImages[0];
|
|
546
|
+
input.strength = 0.75;
|
|
547
|
+
}
|
|
538
548
|
}
|
|
539
549
|
return input;
|
|
540
550
|
}
|
|
@@ -1313,11 +1323,22 @@ async function generateVercelImage(req, apiKey) {
|
|
|
1313
1323
|
const gw = makeGateway(apiKey);
|
|
1314
1324
|
const model = req.model ?? DEFAULT_IMAGE_MODEL2;
|
|
1315
1325
|
log5("Starting image generation, model:", model);
|
|
1326
|
+
const hasInputImages = req.inputImages && req.inputImages.length > 0;
|
|
1327
|
+
let prompt;
|
|
1328
|
+
if (hasInputImages) {
|
|
1329
|
+
const images2 = req.inputImages.map(
|
|
1330
|
+
(img) => img.startsWith("data:") ? dataUriToUint8Array(img) : Uint8Array.from(Buffer.from(img))
|
|
1331
|
+
);
|
|
1332
|
+
prompt = { images: images2, text: req.prompt };
|
|
1333
|
+
log5("Using image editing mode with", images2.length, "input image(s)");
|
|
1334
|
+
} else {
|
|
1335
|
+
prompt = req.prompt;
|
|
1336
|
+
}
|
|
1316
1337
|
log5("Calling generateImage...");
|
|
1317
1338
|
const startTime = Date.now();
|
|
1318
1339
|
const result = await sdkGenerateImage({
|
|
1319
1340
|
model: gw.image(model),
|
|
1320
|
-
prompt
|
|
1341
|
+
prompt,
|
|
1321
1342
|
...req.aspectRatio ? { aspectRatio: req.aspectRatio } : {},
|
|
1322
1343
|
n: req.n
|
|
1323
1344
|
});
|
|
@@ -1341,7 +1362,7 @@ var vercelCapabilities = {
|
|
|
1341
1362
|
supportsCustomAspectRatio: true,
|
|
1342
1363
|
supportsVideoInterpolation: false,
|
|
1343
1364
|
videoDurationRange: [1, 15],
|
|
1344
|
-
supportsImageEditing:
|
|
1365
|
+
supportsImageEditing: true
|
|
1345
1366
|
};
|
|
1346
1367
|
var vercelProvider = {
|
|
1347
1368
|
id: "vercel",
|