@shop-os/modelkit 0.2.25 → 0.2.26
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 +8 -0
- package/README.md +5 -2
- package/dist/catalog.cjs +18 -2
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +18 -2
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +26 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -40,6 +40,7 @@ __export(index_exports, {
|
|
|
40
40
|
CatalogSchema: () => CatalogSchema,
|
|
41
41
|
DEFAULT_ADAPTERS: () => DEFAULT_ADAPTERS,
|
|
42
42
|
ExposureSchema: () => ExposureSchema,
|
|
43
|
+
IMAGE_INPUT_SPEC_KEYS: () => IMAGE_INPUT_SPEC_KEYS,
|
|
43
44
|
INPUT_SPEC_SUPPORTS_KEYS: () => INPUT_SPEC_SUPPORTS_KEYS,
|
|
44
45
|
InputSpecSchema: () => InputSpecSchema,
|
|
45
46
|
JsonObjectSchema: () => JsonObjectSchema,
|
|
@@ -2204,6 +2205,14 @@ var VIDEO_INPUT_SPEC_KEYS = [
|
|
|
2204
2205
|
"promptExpansion",
|
|
2205
2206
|
"referenceImages"
|
|
2206
2207
|
];
|
|
2208
|
+
var IMAGE_INPUT_SPEC_KEYS = [
|
|
2209
|
+
"prompt",
|
|
2210
|
+
"references",
|
|
2211
|
+
"aspectRatio",
|
|
2212
|
+
"size",
|
|
2213
|
+
"outputFormat",
|
|
2214
|
+
"seed"
|
|
2215
|
+
];
|
|
2207
2216
|
var AUDIO_INPUT_SPEC_KEYS = [
|
|
2208
2217
|
"prompt",
|
|
2209
2218
|
"durationSeconds",
|
|
@@ -2220,14 +2229,22 @@ var INPUT_SPEC_SUPPORTS_KEYS = [
|
|
|
2220
2229
|
"generateAudio",
|
|
2221
2230
|
"cfgScale",
|
|
2222
2231
|
"promptExpansion",
|
|
2232
|
+
"outputFormat",
|
|
2223
2233
|
"instrumental"
|
|
2224
2234
|
];
|
|
2225
2235
|
var VIDEO_KEY_SET = new Set(VIDEO_INPUT_SPEC_KEYS);
|
|
2236
|
+
var IMAGE_KEY_SET = new Set(IMAGE_INPUT_SPEC_KEYS);
|
|
2226
2237
|
var AUDIO_KEY_SET = new Set(AUDIO_INPUT_SPEC_KEYS);
|
|
2227
2238
|
var ALL_KEY_SET = /* @__PURE__ */ new Set([
|
|
2228
2239
|
...VIDEO_INPUT_SPEC_KEYS,
|
|
2240
|
+
...IMAGE_INPUT_SPEC_KEYS,
|
|
2229
2241
|
...AUDIO_INPUT_SPEC_KEYS
|
|
2230
2242
|
]);
|
|
2243
|
+
var ALLOWED_KEYS_BY_TYPE = /* @__PURE__ */ new Map([
|
|
2244
|
+
["video", VIDEO_KEY_SET],
|
|
2245
|
+
["image", IMAGE_KEY_SET],
|
|
2246
|
+
["audio", AUDIO_KEY_SET]
|
|
2247
|
+
]);
|
|
2231
2248
|
var ProviderScalarSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.boolean()]);
|
|
2232
2249
|
var FieldsSchema = import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string().min(1)).superRefine((fields, ctx) => {
|
|
2233
2250
|
const keys = Object.keys(fields);
|
|
@@ -2296,13 +2313,13 @@ function validateInputSpec(raw, row) {
|
|
|
2296
2313
|
};
|
|
2297
2314
|
}
|
|
2298
2315
|
const issues = [];
|
|
2299
|
-
|
|
2316
|
+
const allowed = ALLOWED_KEYS_BY_TYPE.get(row.type);
|
|
2317
|
+
if (allowed === void 0) {
|
|
2300
2318
|
issues.push({
|
|
2301
2319
|
path: [],
|
|
2302
2320
|
message: `inputSpec is not supported for "${row.type}" rows`
|
|
2303
2321
|
});
|
|
2304
2322
|
} else {
|
|
2305
|
-
const allowed = row.type === "video" ? VIDEO_KEY_SET : AUDIO_KEY_SET;
|
|
2306
2323
|
for (const key of Object.keys(spec.fields)) {
|
|
2307
2324
|
if (!allowed.has(key)) {
|
|
2308
2325
|
issues.push({
|
|
@@ -6844,6 +6861,12 @@ async function generateReplicateImage(req, ctx, deps) {
|
|
|
6844
6861
|
break;
|
|
6845
6862
|
}
|
|
6846
6863
|
default: {
|
|
6864
|
+
const specResult = replicateInputSpec(req, ctx);
|
|
6865
|
+
if (specResult.kind === "invalid") throw replicateInvalidSpec(ctx, specResult.issues);
|
|
6866
|
+
if (specResult.kind === "ok") {
|
|
6867
|
+
input = specResult.input;
|
|
6868
|
+
break;
|
|
6869
|
+
}
|
|
6847
6870
|
const first = (req.references ?? [])[0];
|
|
6848
6871
|
const imageInput = { prompt: req.prompt };
|
|
6849
6872
|
if (first) imageInput.image = refToUrl(first);
|
|
@@ -8918,6 +8941,7 @@ var describe = (modelId) => createDefaultModelKit().describe(modelId);
|
|
|
8918
8941
|
CatalogSchema,
|
|
8919
8942
|
DEFAULT_ADAPTERS,
|
|
8920
8943
|
ExposureSchema,
|
|
8944
|
+
IMAGE_INPUT_SPEC_KEYS,
|
|
8921
8945
|
INPUT_SPEC_SUPPORTS_KEYS,
|
|
8922
8946
|
InputSpecSchema,
|
|
8923
8947
|
JsonObjectSchema,
|