@shop-os/modelkit 0.6.0 → 0.6.1
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/CHANGELOG.md +5 -0
- package/dist/catalog.cjs +36 -0
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +36 -0
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +38 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.js
CHANGED
|
@@ -8194,6 +8194,30 @@ function applyFalImageRules(model, req, callerSize, warnings) {
|
|
|
8194
8194
|
req.size = exact.tier;
|
|
8195
8195
|
}
|
|
8196
8196
|
|
|
8197
|
+
// src/replicate-video-kinds.ts
|
|
8198
|
+
function replicateBaseModelId(providerModelId) {
|
|
8199
|
+
const colon = providerModelId.indexOf(":");
|
|
8200
|
+
return colon === -1 ? providerModelId : providerModelId.slice(0, colon);
|
|
8201
|
+
}
|
|
8202
|
+
var REPLICATE_VIDEO_KINDS = /* @__PURE__ */ new Map([
|
|
8203
|
+
["kling-video/v2.5-turbo/pro/image-to-video", "kling"],
|
|
8204
|
+
["kling-video/v3.0/pro/image-to-video", "kling"],
|
|
8205
|
+
["kwaivgi/kling-v3-video", "kling"],
|
|
8206
|
+
["kwaivgi/kling-v3-omni-video", "kling-omni"],
|
|
8207
|
+
["minimax/hailuo-02", "hailuo"]
|
|
8208
|
+
]);
|
|
8209
|
+
function videoKind(providerModelId) {
|
|
8210
|
+
return REPLICATE_VIDEO_KINDS.get(replicateBaseModelId(providerModelId));
|
|
8211
|
+
}
|
|
8212
|
+
var KLING_TIERS = [
|
|
8213
|
+
{ mode: "standard", resolution: "720p" },
|
|
8214
|
+
{ mode: "pro", resolution: "1080p" },
|
|
8215
|
+
{ mode: "4k", resolution: "4k" }
|
|
8216
|
+
];
|
|
8217
|
+
function klingTier(req) {
|
|
8218
|
+
return KLING_TIERS.find((tier) => tier.resolution === req.resolution) ?? KLING_TIERS.find((tier) => tier.mode === req.mode) ?? KLING_TIERS[0];
|
|
8219
|
+
}
|
|
8220
|
+
|
|
8197
8221
|
// src/resolve-video-rules.ts
|
|
8198
8222
|
var MOTION_PRO = "fal-ai/kling-video/v3/pro/motion-control";
|
|
8199
8223
|
var MOTION_STANDARD = "fal-ai/kling-video/v3/standard/motion-control";
|
|
@@ -8367,6 +8391,16 @@ function h3EndFrameRatioWarning(model, ratio) {
|
|
|
8367
8391
|
message: `${model.id} follows the end frame's aspect ratio`
|
|
8368
8392
|
};
|
|
8369
8393
|
}
|
|
8394
|
+
function isReplicateKling(model) {
|
|
8395
|
+
if (model.adapter !== "replicate") return false;
|
|
8396
|
+
const kind = videoKind(model.providerModelId);
|
|
8397
|
+
return kind === "kling" || kind === "kling-omni";
|
|
8398
|
+
}
|
|
8399
|
+
function fillReplicateKlingResolution(model, req) {
|
|
8400
|
+
if (isReplicateKling(model) && req.resolution === void 0) {
|
|
8401
|
+
req.resolution = klingTier(req).resolution;
|
|
8402
|
+
}
|
|
8403
|
+
}
|
|
8370
8404
|
function applyFalVideoRules(model, req, callerRatio, warnings) {
|
|
8371
8405
|
if (model.adapter !== "fal") return;
|
|
8372
8406
|
const problem = falVideoProblem(model.providerModelId, withPromptForResolve(req));
|
|
@@ -8756,8 +8790,10 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
8756
8790
|
warnings
|
|
8757
8791
|
);
|
|
8758
8792
|
if (aspectRatio !== void 0) merged.aspectRatio = aspectRatio;
|
|
8793
|
+
fillReplicateKlingResolution(model, merged);
|
|
8759
8794
|
const resolution = resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
|
|
8760
8795
|
if (resolution !== void 0) merged.resolution = resolution;
|
|
8796
|
+
if (isReplicateKling(model)) delete merged.mode;
|
|
8761
8797
|
const duration = resolveDuration(
|
|
8762
8798
|
merged.durationSeconds,
|
|
8763
8799
|
c.durations,
|