kuefr commited on
Commit
c73ceaa
·
verified ·
1 Parent(s): 80a9533

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +10 -2
index.js CHANGED
@@ -1610,7 +1610,11 @@ class ApiProxyService {
1610
  console.log(`API Key失效,尝试下一个 (${keyAttempt + 1}/${maxRetries})`);
1611
  continue;
1612
  }
1613
-
 
 
 
 
1614
  if (response.status === 429) {
1615
  this.config.moveToUsed(apiKey);
1616
  console.log(`请求频率限制,切换API Key (${keyAttempt + 1}/${maxRetries})`);
@@ -1790,7 +1794,11 @@ class ApiProxyService {
1790
  console.log(`API Key失效,尝试下一个 (${keyAttempt + 1}/${maxRetries})`);
1791
  continue;
1792
  }
1793
-
 
 
 
 
1794
  if (response.status === 429) {
1795
  this.config.moveToUsed(apiKey);
1796
  console.log(`请求频率限制,切换API Key (${keyAttempt + 1}/${maxRetries})`);
 
1610
  console.log(`API Key失效,尝试下一个 (${keyAttempt + 1}/${maxRetries})`);
1611
  continue;
1612
  }
1613
+ if (response.status === 400) {
1614
+ this.config.markKeyAsInvalid(apiKey);
1615
+ console.log(`API Key过期,尝试下一个 (${keyAttempt + 1}/${maxRetries})`);
1616
+ continue;
1617
+ }
1618
  if (response.status === 429) {
1619
  this.config.moveToUsed(apiKey);
1620
  console.log(`请求频率限制,切换API Key (${keyAttempt + 1}/${maxRetries})`);
 
1794
  console.log(`API Key失效,尝试下一个 (${keyAttempt + 1}/${maxRetries})`);
1795
  continue;
1796
  }
1797
+ if (response.status === 400) {
1798
+ this.config.markKeyAsInvalid(apiKey);
1799
+ console.log(`API Key过期,尝试下一个 (${keyAttempt + 1}/${maxRetries})`);
1800
+ continue;
1801
+ }
1802
  if (response.status === 429) {
1803
  this.config.moveToUsed(apiKey);
1804
  console.log(`请求频率限制,切换API Key (${keyAttempt + 1}/${maxRetries})`);