@aria-framework/ai 0.24.0 → 0.24.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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aria-framework/ai",
|
|
3
3
|
"description": "Aria App Framework \u2014 AI module. A dependency-injected model seam (createAiClient) over several providers (LM Studio / OpenAI-compatible / Anthropic), with a fact-preservation guard, generic Polish and Generate writing engines, and a browser polish widget. Prompts and config stay in the consuming app.",
|
|
4
|
-
"version": "0.24.
|
|
4
|
+
"version": "0.24.1",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
7
7
|
"publishConfig": {
|
|
@@ -404,6 +404,14 @@ async function embed(cfg, texts) {
|
|
|
404
404
|
} finally {
|
|
405
405
|
clearTimeout(timer);
|
|
406
406
|
}
|
|
407
|
+
// THE STATUS FIRST, the body second — the order complete() already had. Parsing first turned a
|
|
408
|
+
// 429 (often an empty body) into "not JSON", and a 429 with a JSON body into "could not embed",
|
|
409
|
+
// both `bad_response`: never `rate_limit`, so client.embed's Retry-After wait (0.24.0) could not
|
|
410
|
+
// fire and an lmx gateway throttle read as a broken engine. httpError is handed the body already
|
|
411
|
+
// read — a real Response cannot be read twice.
|
|
412
|
+
if (res.status === 401 || res.status === 403 || res.status === 429) {
|
|
413
|
+
throw await httpError({ status: res.status, headers: res.headers, text: async () => raw }, label, cfg.apiKey);
|
|
414
|
+
}
|
|
407
415
|
let payload;
|
|
408
416
|
try { payload = JSON.parse(raw); } catch (err) {
|
|
409
417
|
throw new AiError('bad_response', `${label} returned something that is not JSON from ${url}.`);
|