@shop-os/modelkit 0.2.3 → 0.2.4
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 +16 -13
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.js +16 -13
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +16 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -355,7 +355,6 @@ var IMAGE_MODELS = [
|
|
|
355
355
|
pricingKind: "image_size",
|
|
356
356
|
display: {
|
|
357
357
|
provider: "openai",
|
|
358
|
-
sortOrder: 20,
|
|
359
358
|
description: "OpenAI's most capable GPT Image 2.5 tier, built for editing precision; takes text and image input and outputs images in low, medium, high, xhigh, or max quality."
|
|
360
359
|
}
|
|
361
360
|
},
|
|
@@ -390,7 +389,6 @@ var IMAGE_MODELS = [
|
|
|
390
389
|
pricingKind: "image_size",
|
|
391
390
|
display: {
|
|
392
391
|
provider: "openai",
|
|
393
|
-
sortOrder: 10,
|
|
394
392
|
description: "OpenAI's fastest GPT Image 2.5 tier for high-quality everyday image generation and editing; takes text and image input and outputs images."
|
|
395
393
|
}
|
|
396
394
|
},
|
|
@@ -2148,13 +2146,14 @@ function toEnvelope(data) {
|
|
|
2148
2146
|
if (data.revision !== void 0) envelope.revision = data.revision;
|
|
2149
2147
|
return envelope;
|
|
2150
2148
|
}
|
|
2149
|
+
function describeError(err) {
|
|
2150
|
+
return err instanceof Error ? err.message : String(err);
|
|
2151
|
+
}
|
|
2151
2152
|
function logPrimed(logger, result) {
|
|
2152
|
-
const
|
|
2153
|
-
logger.info(
|
|
2154
|
-
origin
|
|
2155
|
-
|
|
2156
|
-
revision: loggedRevision
|
|
2157
|
-
});
|
|
2153
|
+
const revision = result.revision === void 0 ? "" : ` revision=${result.revision}`;
|
|
2154
|
+
logger.info(
|
|
2155
|
+
`[modelkit] catalog primed origin=${result.origin} rowCount=${result.rowCount}${revision}`
|
|
2156
|
+
);
|
|
2158
2157
|
}
|
|
2159
2158
|
async function fetchRemote(source, logger) {
|
|
2160
2159
|
const fetchImpl = source.fetch ?? globalThis.fetch;
|
|
@@ -2178,7 +2177,7 @@ async function writeCache(source, logger, rows, rev) {
|
|
|
2178
2177
|
try {
|
|
2179
2178
|
await source.cache.set(JSON.stringify({ rows, revision: rev }));
|
|
2180
2179
|
} catch (err) {
|
|
2181
|
-
logger.warn(
|
|
2180
|
+
logger.warn(`[modelkit] catalog cache write failed: ${describeError(err)}`);
|
|
2182
2181
|
}
|
|
2183
2182
|
}
|
|
2184
2183
|
async function prime(source, logger) {
|
|
@@ -2199,8 +2198,8 @@ async function prime(source, logger) {
|
|
|
2199
2198
|
logPrimed(logger, result);
|
|
2200
2199
|
return result;
|
|
2201
2200
|
} catch (err) {
|
|
2202
|
-
logger.warn(
|
|
2203
|
-
const error =
|
|
2201
|
+
logger.warn(`[modelkit] catalog remote failed, trying cache: ${describeError(err)}`);
|
|
2202
|
+
const error = describeError(err);
|
|
2204
2203
|
try {
|
|
2205
2204
|
const cached = await source.cache?.get();
|
|
2206
2205
|
if (!cached) throw new Error("no cached catalog");
|
|
@@ -2219,7 +2218,9 @@ async function prime(source, logger) {
|
|
|
2219
2218
|
logPrimed(logger, result);
|
|
2220
2219
|
return result;
|
|
2221
2220
|
} catch (cacheErr) {
|
|
2222
|
-
logger.warn(
|
|
2221
|
+
logger.warn(
|
|
2222
|
+
`[modelkit] catalog cache failed, using snapshot: ${describeError(cacheErr)}`
|
|
2223
|
+
);
|
|
2223
2224
|
liveCatalog.replace([...MODELS]);
|
|
2224
2225
|
liveState.origin = "snapshot";
|
|
2225
2226
|
liveState.revision = void 0;
|
|
@@ -2242,7 +2243,9 @@ async function refresh(source, logger) {
|
|
|
2242
2243
|
liveState.revision = fetched.revision;
|
|
2243
2244
|
await writeCache(source, logger, fetched.rows, fetched.revision);
|
|
2244
2245
|
} catch (err) {
|
|
2245
|
-
logger.warn(
|
|
2246
|
+
logger.warn(
|
|
2247
|
+
`[modelkit] catalog refresh failed, keeping current rows: ${describeError(err)}`
|
|
2248
|
+
);
|
|
2246
2249
|
}
|
|
2247
2250
|
}
|
|
2248
2251
|
function primeCatalog(source) {
|