@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.js
CHANGED
|
@@ -264,7 +264,6 @@ var IMAGE_MODELS = [
|
|
|
264
264
|
pricingKind: "image_size",
|
|
265
265
|
display: {
|
|
266
266
|
provider: "openai",
|
|
267
|
-
sortOrder: 20,
|
|
268
267
|
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."
|
|
269
268
|
}
|
|
270
269
|
},
|
|
@@ -299,7 +298,6 @@ var IMAGE_MODELS = [
|
|
|
299
298
|
pricingKind: "image_size",
|
|
300
299
|
display: {
|
|
301
300
|
provider: "openai",
|
|
302
|
-
sortOrder: 10,
|
|
303
301
|
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."
|
|
304
302
|
}
|
|
305
303
|
},
|
|
@@ -2057,13 +2055,14 @@ function toEnvelope(data) {
|
|
|
2057
2055
|
if (data.revision !== void 0) envelope.revision = data.revision;
|
|
2058
2056
|
return envelope;
|
|
2059
2057
|
}
|
|
2058
|
+
function describeError(err) {
|
|
2059
|
+
return err instanceof Error ? err.message : String(err);
|
|
2060
|
+
}
|
|
2060
2061
|
function logPrimed(logger, result) {
|
|
2061
|
-
const
|
|
2062
|
-
logger.info(
|
|
2063
|
-
origin
|
|
2064
|
-
|
|
2065
|
-
revision: loggedRevision
|
|
2066
|
-
});
|
|
2062
|
+
const revision = result.revision === void 0 ? "" : ` revision=${result.revision}`;
|
|
2063
|
+
logger.info(
|
|
2064
|
+
`[modelkit] catalog primed origin=${result.origin} rowCount=${result.rowCount}${revision}`
|
|
2065
|
+
);
|
|
2067
2066
|
}
|
|
2068
2067
|
async function fetchRemote(source, logger) {
|
|
2069
2068
|
const fetchImpl = source.fetch ?? globalThis.fetch;
|
|
@@ -2087,7 +2086,7 @@ async function writeCache(source, logger, rows, rev) {
|
|
|
2087
2086
|
try {
|
|
2088
2087
|
await source.cache.set(JSON.stringify({ rows, revision: rev }));
|
|
2089
2088
|
} catch (err) {
|
|
2090
|
-
logger.warn(
|
|
2089
|
+
logger.warn(`[modelkit] catalog cache write failed: ${describeError(err)}`);
|
|
2091
2090
|
}
|
|
2092
2091
|
}
|
|
2093
2092
|
async function prime(source, logger) {
|
|
@@ -2108,8 +2107,8 @@ async function prime(source, logger) {
|
|
|
2108
2107
|
logPrimed(logger, result);
|
|
2109
2108
|
return result;
|
|
2110
2109
|
} catch (err) {
|
|
2111
|
-
logger.warn(
|
|
2112
|
-
const error =
|
|
2110
|
+
logger.warn(`[modelkit] catalog remote failed, trying cache: ${describeError(err)}`);
|
|
2111
|
+
const error = describeError(err);
|
|
2113
2112
|
try {
|
|
2114
2113
|
const cached = await source.cache?.get();
|
|
2115
2114
|
if (!cached) throw new Error("no cached catalog");
|
|
@@ -2128,7 +2127,9 @@ async function prime(source, logger) {
|
|
|
2128
2127
|
logPrimed(logger, result);
|
|
2129
2128
|
return result;
|
|
2130
2129
|
} catch (cacheErr) {
|
|
2131
|
-
logger.warn(
|
|
2130
|
+
logger.warn(
|
|
2131
|
+
`[modelkit] catalog cache failed, using snapshot: ${describeError(cacheErr)}`
|
|
2132
|
+
);
|
|
2132
2133
|
liveCatalog.replace([...MODELS]);
|
|
2133
2134
|
liveState.origin = "snapshot";
|
|
2134
2135
|
liveState.revision = void 0;
|
|
@@ -2151,7 +2152,9 @@ async function refresh(source, logger) {
|
|
|
2151
2152
|
liveState.revision = fetched.revision;
|
|
2152
2153
|
await writeCache(source, logger, fetched.rows, fetched.revision);
|
|
2153
2154
|
} catch (err) {
|
|
2154
|
-
logger.warn(
|
|
2155
|
+
logger.warn(
|
|
2156
|
+
`[modelkit] catalog refresh failed, keeping current rows: ${describeError(err)}`
|
|
2157
|
+
);
|
|
2155
2158
|
}
|
|
2156
2159
|
}
|
|
2157
2160
|
function primeCatalog(source) {
|