@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/catalog.js
CHANGED
|
@@ -261,7 +261,6 @@ var IMAGE_MODELS = [
|
|
|
261
261
|
pricingKind: "image_size",
|
|
262
262
|
display: {
|
|
263
263
|
provider: "openai",
|
|
264
|
-
sortOrder: 20,
|
|
265
264
|
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."
|
|
266
265
|
}
|
|
267
266
|
},
|
|
@@ -296,7 +295,6 @@ var IMAGE_MODELS = [
|
|
|
296
295
|
pricingKind: "image_size",
|
|
297
296
|
display: {
|
|
298
297
|
provider: "openai",
|
|
299
|
-
sortOrder: 10,
|
|
300
298
|
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."
|
|
301
299
|
}
|
|
302
300
|
},
|
|
@@ -2054,13 +2052,14 @@ function toEnvelope(data) {
|
|
|
2054
2052
|
if (data.revision !== void 0) envelope.revision = data.revision;
|
|
2055
2053
|
return envelope;
|
|
2056
2054
|
}
|
|
2055
|
+
function describeError(err) {
|
|
2056
|
+
return err instanceof Error ? err.message : String(err);
|
|
2057
|
+
}
|
|
2057
2058
|
function logPrimed(logger, result) {
|
|
2058
|
-
const
|
|
2059
|
-
logger.info(
|
|
2060
|
-
origin
|
|
2061
|
-
|
|
2062
|
-
revision: loggedRevision
|
|
2063
|
-
});
|
|
2059
|
+
const revision = result.revision === void 0 ? "" : ` revision=${result.revision}`;
|
|
2060
|
+
logger.info(
|
|
2061
|
+
`[modelkit] catalog primed origin=${result.origin} rowCount=${result.rowCount}${revision}`
|
|
2062
|
+
);
|
|
2064
2063
|
}
|
|
2065
2064
|
async function fetchRemote(source, logger) {
|
|
2066
2065
|
const fetchImpl = source.fetch ?? globalThis.fetch;
|
|
@@ -2084,7 +2083,7 @@ async function writeCache(source, logger, rows, rev) {
|
|
|
2084
2083
|
try {
|
|
2085
2084
|
await source.cache.set(JSON.stringify({ rows, revision: rev }));
|
|
2086
2085
|
} catch (err) {
|
|
2087
|
-
logger.warn(
|
|
2086
|
+
logger.warn(`[modelkit] catalog cache write failed: ${describeError(err)}`);
|
|
2088
2087
|
}
|
|
2089
2088
|
}
|
|
2090
2089
|
async function prime(source, logger) {
|
|
@@ -2105,8 +2104,8 @@ async function prime(source, logger) {
|
|
|
2105
2104
|
logPrimed(logger, result);
|
|
2106
2105
|
return result;
|
|
2107
2106
|
} catch (err) {
|
|
2108
|
-
logger.warn(
|
|
2109
|
-
const error =
|
|
2107
|
+
logger.warn(`[modelkit] catalog remote failed, trying cache: ${describeError(err)}`);
|
|
2108
|
+
const error = describeError(err);
|
|
2110
2109
|
try {
|
|
2111
2110
|
const cached = await source.cache?.get();
|
|
2112
2111
|
if (!cached) throw new Error("no cached catalog");
|
|
@@ -2125,7 +2124,9 @@ async function prime(source, logger) {
|
|
|
2125
2124
|
logPrimed(logger, result);
|
|
2126
2125
|
return result;
|
|
2127
2126
|
} catch (cacheErr) {
|
|
2128
|
-
logger.warn(
|
|
2127
|
+
logger.warn(
|
|
2128
|
+
`[modelkit] catalog cache failed, using snapshot: ${describeError(cacheErr)}`
|
|
2129
|
+
);
|
|
2129
2130
|
liveCatalog.replace([...MODELS]);
|
|
2130
2131
|
liveState.origin = "snapshot";
|
|
2131
2132
|
liveState.revision = void 0;
|
|
@@ -2148,7 +2149,9 @@ async function refresh(source, logger) {
|
|
|
2148
2149
|
liveState.revision = fetched.revision;
|
|
2149
2150
|
await writeCache(source, logger, fetched.rows, fetched.revision);
|
|
2150
2151
|
} catch (err) {
|
|
2151
|
-
logger.warn(
|
|
2152
|
+
logger.warn(
|
|
2153
|
+
`[modelkit] catalog refresh failed, keeping current rows: ${describeError(err)}`
|
|
2154
|
+
);
|
|
2152
2155
|
}
|
|
2153
2156
|
}
|
|
2154
2157
|
function primeCatalog(source) {
|