@mcowger/oh-my-pi-plexus 1.3.10 → 1.4.0
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/dist/extension.js +5 -2
- package/package.json +1 -1
package/dist/extension.js
CHANGED
|
@@ -109536,9 +109536,10 @@ function detectOpenAICompletionsCompat(providerName, baseUrl) {
|
|
|
109536
109536
|
return compat;
|
|
109537
109537
|
}
|
|
109538
109538
|
var DEFAULT_MODELS_FETCH_TIMEOUT_MS = 1e4;
|
|
109539
|
-
async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_FETCH_TIMEOUT_MS, etag) {
|
|
109539
|
+
async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_FETCH_TIMEOUT_MS, etag, signal) {
|
|
109540
109540
|
const controller = new AbortController;
|
|
109541
109541
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
109542
|
+
const requestSignal = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;
|
|
109542
109543
|
try {
|
|
109543
109544
|
const headers = { Accept: "application/json" };
|
|
109544
109545
|
if (apiKey)
|
|
@@ -109547,7 +109548,7 @@ async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_F
|
|
|
109547
109548
|
headers["If-None-Match"] = etag;
|
|
109548
109549
|
const res = await fetch(modelsUrl, {
|
|
109549
109550
|
headers,
|
|
109550
|
-
signal:
|
|
109551
|
+
signal: requestSignal
|
|
109551
109552
|
});
|
|
109552
109553
|
if (res.status === 304) {
|
|
109553
109554
|
return { models: [], notModified: true };
|
|
@@ -109559,6 +109560,8 @@ async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_F
|
|
|
109559
109560
|
const responseEtag = res.headers.get("etag") ?? undefined;
|
|
109560
109561
|
return { models: raw.data ?? [], raw, etag: responseEtag };
|
|
109561
109562
|
} catch (err) {
|
|
109563
|
+
if (signal?.aborted)
|
|
109564
|
+
throw err;
|
|
109562
109565
|
if (err instanceof Error && err.name === "AbortError") {
|
|
109563
109566
|
throw new Error(`Plexus models fetch timed out after ${timeoutMs}ms`);
|
|
109564
109567
|
}
|