@picsart/ai-sdk 6.0.0 → 6.1.0
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/index.d.ts +5 -14
- package/index.js +3 -16
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2488,24 +2488,15 @@ interface CatalogsOptions {
|
|
|
2488
2488
|
* best-effort: present when the vendor reports it, absent otherwise.
|
|
2489
2489
|
*/
|
|
2490
2490
|
interface GenerateResultItemMetadata {
|
|
2491
|
-
/** Explore image id (recraft explore models)
|
|
2491
|
+
/** Explore image id (recraft explore models) — pass back as `sourceImageId`
|
|
2492
|
+
* to iterate on this image. */
|
|
2492
2493
|
exploreImageId?: string;
|
|
2493
2494
|
/** Voice preview id (ElevenLabs voice design/remix) — pass to the vendor's
|
|
2494
2495
|
* create-voice-from-preview step to persist the voice. */
|
|
2495
2496
|
generatedVoiceId?: string;
|
|
2496
|
-
/**
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
nsfw?: boolean;
|
|
2500
|
-
width?: number;
|
|
2501
|
-
height?: number;
|
|
2502
|
-
contentType?: string;
|
|
2503
|
-
/** Video duration in seconds. */
|
|
2504
|
-
duration?: number;
|
|
2505
|
-
/** Video frame rate. */
|
|
2506
|
-
fps?: number;
|
|
2507
|
-
/** Video file size in bytes. */
|
|
2508
|
-
fileSize?: number;
|
|
2497
|
+
/** URL of the generated video's last frame, when the model was asked for it
|
|
2498
|
+
* (`returnLastFrame`, seedance) — the seed for frame-chaining flows. */
|
|
2499
|
+
lastFrameUrl?: string;
|
|
2509
2500
|
}
|
|
2510
2501
|
|
|
2511
2502
|
/**
|
package/index.js
CHANGED
|
@@ -9411,27 +9411,14 @@ var extractAllResults = (result) => {
|
|
|
9411
9411
|
}
|
|
9412
9412
|
return items.length > 0 ? items : void 0;
|
|
9413
9413
|
};
|
|
9414
|
-
function buildItemMetadata(parsed, item,
|
|
9414
|
+
function buildItemMetadata(parsed, item, _index, provider) {
|
|
9415
9415
|
const meta = {};
|
|
9416
9416
|
const top = parsed && typeof parsed === "object" ? parsed : void 0;
|
|
9417
9417
|
const it = item && typeof item === "object" && !Array.isArray(item) ? item : void 0;
|
|
9418
9418
|
if (provider === "recraft" && typeof it?.image_id === "string") meta.exploreImageId = it.image_id;
|
|
9419
9419
|
if (provider === "elevenlabs" && typeof it?.generated_voice_id === "string") meta.generatedVoiceId = it.generated_voice_id;
|
|
9420
|
-
|
|
9421
|
-
if (
|
|
9422
|
-
meta.nsfw = top.has_nsfw_concepts[index];
|
|
9423
|
-
}
|
|
9424
|
-
if (typeof it?.width === "number") meta.width = it.width;
|
|
9425
|
-
if (typeof it?.height === "number") meta.height = it.height;
|
|
9426
|
-
if (typeof it?.content_type === "string") meta.contentType = it.content_type;
|
|
9427
|
-
const video = top?.video && typeof top.video === "object" ? top.video : void 0;
|
|
9428
|
-
if (video) {
|
|
9429
|
-
if (typeof video.duration === "number") meta.duration = video.duration;
|
|
9430
|
-
if (typeof video.fps === "number") meta.fps = video.fps;
|
|
9431
|
-
if (typeof video.file_size === "number") meta.fileSize = video.file_size;
|
|
9432
|
-
if (meta.width === void 0 && typeof video.width === "number") meta.width = video.width;
|
|
9433
|
-
if (meta.height === void 0 && typeof video.height === "number") meta.height = video.height;
|
|
9434
|
-
}
|
|
9420
|
+
const lastFrame = it?.last_frame_url ?? top?.last_frame_url;
|
|
9421
|
+
if (typeof lastFrame === "string") meta.lastFrameUrl = lastFrame;
|
|
9435
9422
|
return Object.keys(meta).length > 0 ? meta : void 0;
|
|
9436
9423
|
}
|
|
9437
9424
|
function toCompletedStatus(handle, result, raw, usage) {
|