copilot-api-plus 1.2.49 → 1.2.50
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/main.js +13 -1
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2259,6 +2259,10 @@ async function handleMultiAccountHttpError(error, account, retryContext) {
|
|
|
2259
2259
|
case 429:
|
|
2260
2260
|
accountManager.markAccountStatus(account.id, "rate_limited", "429 Rate limited");
|
|
2261
2261
|
return null;
|
|
2262
|
+
case 408:
|
|
2263
|
+
consola.warn(`Account ${account.label}: 408 request timeout (network issue, not rotating)`);
|
|
2264
|
+
error.__nonAccountError = true;
|
|
2265
|
+
return null;
|
|
2262
2266
|
default:
|
|
2263
2267
|
if (error.response.status >= 500) {
|
|
2264
2268
|
accountManager.markAccountStatus(account.id, "error", `HTTP ${error.response.status}`);
|
|
@@ -2279,6 +2283,7 @@ async function handleMultiAccountHttpError(error, account, retryContext) {
|
|
|
2279
2283
|
async function createWithMultiAccount(payload) {
|
|
2280
2284
|
const triedAccountIds = /* @__PURE__ */ new Set();
|
|
2281
2285
|
let lastError;
|
|
2286
|
+
let networkRetried = false;
|
|
2282
2287
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
2283
2288
|
const account = accountManager.getActiveAccount();
|
|
2284
2289
|
if (!account || triedAccountIds.has(account.id)) break;
|
|
@@ -2333,7 +2338,14 @@ async function createWithMultiAccount(payload) {
|
|
|
2333
2338
|
if (error.__nonAccountError) throw error;
|
|
2334
2339
|
} else {
|
|
2335
2340
|
const errMsg = error.message || String(error);
|
|
2336
|
-
|
|
2341
|
+
if (!networkRetried) {
|
|
2342
|
+
networkRetried = true;
|
|
2343
|
+
consola.warn(`Account ${account.label}: network error, resetting pool and retrying once: ${errMsg}`);
|
|
2344
|
+
resetAccountConnections(account.id);
|
|
2345
|
+
triedAccountIds.delete(account.id);
|
|
2346
|
+
continue;
|
|
2347
|
+
}
|
|
2348
|
+
consola.warn(`Account ${account.label}: network error after retry (giving up): ${errMsg}`);
|
|
2337
2349
|
throw error;
|
|
2338
2350
|
}
|
|
2339
2351
|
consola.warn(`Account ${account.label} failed (attempt ${attempt + 1}), trying next...`);
|