@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/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,11 @@ header in the release PR.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [0.6.1] - Unreleased
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Every Replicate Kling row (kind `kling` or `kling-omni`, today `kling-v3-omni-video`): the resolved request keeps only the `resolution` that renders and drops `mode`. A 720p request no longer carries the row default `mode: "pro"` next to it. A request without a resolution takes its `mode`'s (`standard` 720p, `pro` 1080p; neither: 720p) before the resolution check, so a row that does not list that resolution refuses it (`error`) or coerces it with a `resolution_coerced` warning (`coerce`). What the provider receives for an accepted request is unchanged.
|
|
16
|
+
|
|
12
17
|
## [0.6.0] - Unreleased
|
|
13
18
|
|
|
14
19
|
### Added
|
package/dist/catalog.cjs
CHANGED
|
@@ -8275,6 +8275,30 @@ function applyFalImageRules(model, req, callerSize, warnings) {
|
|
|
8275
8275
|
req.size = exact.tier;
|
|
8276
8276
|
}
|
|
8277
8277
|
|
|
8278
|
+
// src/replicate-video-kinds.ts
|
|
8279
|
+
function replicateBaseModelId(providerModelId) {
|
|
8280
|
+
const colon = providerModelId.indexOf(":");
|
|
8281
|
+
return colon === -1 ? providerModelId : providerModelId.slice(0, colon);
|
|
8282
|
+
}
|
|
8283
|
+
var REPLICATE_VIDEO_KINDS = /* @__PURE__ */ new Map([
|
|
8284
|
+
["kling-video/v2.5-turbo/pro/image-to-video", "kling"],
|
|
8285
|
+
["kling-video/v3.0/pro/image-to-video", "kling"],
|
|
8286
|
+
["kwaivgi/kling-v3-video", "kling"],
|
|
8287
|
+
["kwaivgi/kling-v3-omni-video", "kling-omni"],
|
|
8288
|
+
["minimax/hailuo-02", "hailuo"]
|
|
8289
|
+
]);
|
|
8290
|
+
function videoKind(providerModelId) {
|
|
8291
|
+
return REPLICATE_VIDEO_KINDS.get(replicateBaseModelId(providerModelId));
|
|
8292
|
+
}
|
|
8293
|
+
var KLING_TIERS = [
|
|
8294
|
+
{ mode: "standard", resolution: "720p" },
|
|
8295
|
+
{ mode: "pro", resolution: "1080p" },
|
|
8296
|
+
{ mode: "4k", resolution: "4k" }
|
|
8297
|
+
];
|
|
8298
|
+
function klingTier(req) {
|
|
8299
|
+
return KLING_TIERS.find((tier) => tier.resolution === req.resolution) ?? KLING_TIERS.find((tier) => tier.mode === req.mode) ?? KLING_TIERS[0];
|
|
8300
|
+
}
|
|
8301
|
+
|
|
8278
8302
|
// src/resolve-video-rules.ts
|
|
8279
8303
|
var MOTION_PRO = "fal-ai/kling-video/v3/pro/motion-control";
|
|
8280
8304
|
var MOTION_STANDARD = "fal-ai/kling-video/v3/standard/motion-control";
|
|
@@ -8448,6 +8472,16 @@ function h3EndFrameRatioWarning(model, ratio) {
|
|
|
8448
8472
|
message: `${model.id} follows the end frame's aspect ratio`
|
|
8449
8473
|
};
|
|
8450
8474
|
}
|
|
8475
|
+
function isReplicateKling(model) {
|
|
8476
|
+
if (model.adapter !== "replicate") return false;
|
|
8477
|
+
const kind = videoKind(model.providerModelId);
|
|
8478
|
+
return kind === "kling" || kind === "kling-omni";
|
|
8479
|
+
}
|
|
8480
|
+
function fillReplicateKlingResolution(model, req) {
|
|
8481
|
+
if (isReplicateKling(model) && req.resolution === void 0) {
|
|
8482
|
+
req.resolution = klingTier(req).resolution;
|
|
8483
|
+
}
|
|
8484
|
+
}
|
|
8451
8485
|
function applyFalVideoRules(model, req, callerRatio, warnings) {
|
|
8452
8486
|
if (model.adapter !== "fal") return;
|
|
8453
8487
|
const problem = falVideoProblem(model.providerModelId, withPromptForResolve(req));
|
|
@@ -8837,8 +8871,10 @@ function resolveVideoOptions(model, request, onUnsupported = "error") {
|
|
|
8837
8871
|
warnings
|
|
8838
8872
|
);
|
|
8839
8873
|
if (aspectRatio !== void 0) merged.aspectRatio = aspectRatio;
|
|
8874
|
+
fillReplicateKlingResolution(model, merged);
|
|
8840
8875
|
const resolution = resolveVideoResolution(merged.resolution, model, onUnsupported, warnings);
|
|
8841
8876
|
if (resolution !== void 0) merged.resolution = resolution;
|
|
8877
|
+
if (isReplicateKling(model)) delete merged.mode;
|
|
8842
8878
|
const duration = resolveDuration(
|
|
8843
8879
|
merged.durationSeconds,
|
|
8844
8880
|
c.durations,
|