@picsart/ai-sdk 5.29.0 → 5.30.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 +15 -1
- package/index.js +15 -5
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2521,6 +2521,17 @@ interface GenerateTextResult {
|
|
|
2521
2521
|
/** Credit usage reported by the platform — same structure as the pluggable APIs' GenAITaskResponse. */
|
|
2522
2522
|
usage?: CreditUsage;
|
|
2523
2523
|
}
|
|
2524
|
+
/** Input-transformation settings injected into the workflow payload as
|
|
2525
|
+
* `options.inputs_transformation` (GenAIOptions, alongside `drive`). */
|
|
2526
|
+
interface PayloadInputsTransformationOptions {
|
|
2527
|
+
/**
|
|
2528
|
+
* Downscale input images that exceed the vendor's download size cap
|
|
2529
|
+
* (e.g. ByteDance's 30 MiB) and retry the generation once, instead of
|
|
2530
|
+
* failing with an input-limit error. Defaults to true; workers without
|
|
2531
|
+
* input transformation ignore it.
|
|
2532
|
+
*/
|
|
2533
|
+
downscaleOversizedImages?: boolean;
|
|
2534
|
+
}
|
|
2524
2535
|
/** Options for individual generate() / submit() calls. */
|
|
2525
2536
|
interface GenerateOptions {
|
|
2526
2537
|
signal?: AbortSignal;
|
|
@@ -2539,6 +2550,9 @@ interface GenerateOptions {
|
|
|
2539
2550
|
folder?: DriveFolder;
|
|
2540
2551
|
/** Save result to Picsart Drive via backend. Injected into the workflow payload. */
|
|
2541
2552
|
drive?: PayloadDriveOptions;
|
|
2553
|
+
/** Input-transformation settings. Injected into the workflow payload; when
|
|
2554
|
+
* omitted, oversized-image downscaling defaults to enabled. */
|
|
2555
|
+
inputsTransformation?: PayloadInputsTransformationOptions;
|
|
2542
2556
|
/**
|
|
2543
2557
|
* App identity stamped onto the saved generation (appId/appType).
|
|
2544
2558
|
* TODO(backend-autosave): temporary — remove once the backend stamps these.
|
|
@@ -3043,4 +3057,4 @@ declare const findModel: (ref: string) => ModelDefinition | undefined;
|
|
|
3043
3057
|
*/
|
|
3044
3058
|
declare const KLING_DUAL_IMAGE_EFFECTS: ReadonlySet<string>;
|
|
3045
3059
|
|
|
3046
|
-
export { ALL_MODELS, type AiClient, ApiError, type ApiErrorCode, type ApiErrorInit, type ApiResponse, type ApiRunOptions, type ApiSchemas, type ApisClient, type AppIdentity, type AppType, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type CatalogDescriptor, type CatalogEntry, type CatalogItem, type CatalogKind, type CatalogPage, type CatalogPageOptions, type CatalogPreview, type CatalogQuery, type CatalogResult, type CatalogSource, type CatalogsClient, type CatalogsOptions, type ClientConfig, type CreditRange, type CreditRangeContext, type CreditTier, type CreditUsage, DEFAULT_VISIBLE_RELEASES, type DeepLinkResult, type DriveAttributes, type DriveClient, type DriveConfig, type DriveFile, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type EnumOption, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerateTextResult, type GenerationContext, type GenerationFile, type GenerationMode, KLING_DUAL_IMAGE_EFFECTS, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type ModelFilter$1 as ModelFilter, type ModelInput, type ModelInputById, type ModelMeta, type ModelParams, type ModelParamsAccessor, Models, type ObjectDescriptor, type ObjectEntry, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TypedModelId, type UserReaction, type ValidationResult$1 as ValidationResult, type VoiceOption, type WorkflowJobHandle, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, toAvatarOption, toVoiceOption };
|
|
3060
|
+
export { ALL_MODELS, type AiClient, ApiError, type ApiErrorCode, type ApiErrorInit, type ApiResponse, type ApiRunOptions, type ApiSchemas, type ApisClient, type AppIdentity, type AppType, type AuthenticatedFetch, type AvatarOption, type BooleanDescriptor, type BooleanEntry, type CatalogDescriptor, type CatalogEntry, type CatalogItem, type CatalogKind, type CatalogPage, type CatalogPageOptions, type CatalogPreview, type CatalogQuery, type CatalogResult, type CatalogSource, type CatalogsClient, type CatalogsOptions, type ClientConfig, type CreditRange, type CreditRangeContext, type CreditTier, type CreditUsage, DEFAULT_VISIBLE_RELEASES, type DeepLinkResult, type DriveAttributes, type DriveClient, type DriveConfig, type DriveFile, type DriveFileDetails, type DriveFolder, type DriveMediaItem, type DriveSaveResult, type EntryMeta, type EnumDescriptor, type EnumEntry, type EnumOption, type FileDescriptor, type FileEntry, type FlatParamEntry, type GenerateOptions, type GenerateResult, type GenerateResultItem, type GenerateTextResult, type GenerationContext, type GenerationFile, type GenerationMode, KLING_DUAL_IMAGE_EFFECTS, type ListOptions, type MediaModelId, type MediaTypeFilter, Model, type ModelDefinition, type ModelDescriptor, type ModelFilter$1 as ModelFilter, type ModelInput, type ModelInputById, type ModelMeta, type ModelParams, type ModelParamsAccessor, Models, type ObjectDescriptor, type ObjectEntry, type ParamDescriptor, type ParamEntry, type ParamOption, type PayloadDriveFolderOptions, type PayloadDriveOptions, type PayloadInputsTransformationOptions, type PricingOptions, type ProviderInfo, type RangeDescriptor, type RangeEntry, type ReleaseTag, type SaveParams, type SdkPayload, type SdkTransport, type TextDescriptor, type TextEntry, type TextModelId, type TextModelInputById, type ToolUsage, type TypedModelId, type UserReaction, type ValidationResult$1 as ValidationResult, type VoiceOption, type WorkflowJobHandle, buildFilename, buildGenerationAttributes, catalog, createClient, decodeDeepLinkPayload, encodeDeepLinkPayload, findModel, getModel, getModelsByMode, getVoiceById, inferResourceType, isVisibleForReleases, parseGeneration, releaseOf, toAvatarOption, toVoiceOption };
|
package/index.js
CHANGED
|
@@ -10746,9 +10746,19 @@ function createClient(config) {
|
|
|
10746
10746
|
folder: explicit?.folder ?? (folderPath ? { path: folderPath } : void 0)
|
|
10747
10747
|
};
|
|
10748
10748
|
}
|
|
10749
|
-
function
|
|
10750
|
-
|
|
10751
|
-
|
|
10749
|
+
function injectPayloadOptions(payload, drive, inputsTransformation) {
|
|
10750
|
+
const record = payload;
|
|
10751
|
+
const existing = record.options ?? {};
|
|
10752
|
+
return {
|
|
10753
|
+
...record,
|
|
10754
|
+
options: {
|
|
10755
|
+
...existing,
|
|
10756
|
+
inputs_transformation: {
|
|
10757
|
+
downscale_oversized_images: inputsTransformation?.downscaleOversizedImages ?? true
|
|
10758
|
+
},
|
|
10759
|
+
...drive ? { drive } : {}
|
|
10760
|
+
}
|
|
10761
|
+
};
|
|
10752
10762
|
}
|
|
10753
10763
|
return {
|
|
10754
10764
|
// ── Simple path ──────────────────────────────────────────────────
|
|
@@ -10770,7 +10780,7 @@ function createClient(config) {
|
|
|
10770
10780
|
}
|
|
10771
10781
|
const { workflow, payload, contract } = prepareRequest(resolved, params2);
|
|
10772
10782
|
const drive = buildDrivePayloadOptions(resolved, params2, options);
|
|
10773
|
-
const finalPayload =
|
|
10783
|
+
const finalPayload = injectPayloadOptions(payload, drive, options?.inputsTransformation);
|
|
10774
10784
|
const completed = await executeModel(resolved, workflow, finalPayload, options);
|
|
10775
10785
|
return parseResult(completed, resolved, contract);
|
|
10776
10786
|
},
|
|
@@ -10824,7 +10834,7 @@ function createClient(config) {
|
|
|
10824
10834
|
const resolved = resolveModel(model);
|
|
10825
10835
|
const { workflow, payload } = prepareRequest(resolved, params2);
|
|
10826
10836
|
const drive = buildDrivePayloadOptions(resolved, params2, options);
|
|
10827
|
-
const finalPayload =
|
|
10837
|
+
const finalPayload = injectPayloadOptions(payload, drive, options?.inputsTransformation);
|
|
10828
10838
|
return client.submit({ workflow, payload: finalPayload, signal: options?.signal });
|
|
10829
10839
|
},
|
|
10830
10840
|
/** Check the current status of a submitted job. */
|