mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: unknown
This commit is contained in:
parent
5ded004538
commit
cd228128ba
2 changed files with 5 additions and 3 deletions
|
|
@ -1316,7 +1316,7 @@ export class chatgpt extends plugin {
|
|||
} catch (error) {
|
||||
logger.error(error)
|
||||
const message = error?.message || error?.data?.message || error || '出错了'
|
||||
if (message && message.indexOf('限流') > -1) {
|
||||
if (message && typeof message === 'string' && message.indexOf('限流') > -1) {
|
||||
throttledTokens.push(bingToken)
|
||||
let bingTokens = JSON.parse(await redis.get('CHATGPT:BING_TOKENS'))
|
||||
const badBingToken = bingTokens.findIndex(element => element.Token === bingToken)
|
||||
|
|
@ -1327,7 +1327,7 @@ export class chatgpt extends plugin {
|
|||
bingTokens[badBingToken].DisactivationTime = now
|
||||
await redis.set('CHATGPT:BING_TOKENS', JSON.stringify(bingTokens))
|
||||
// 不减次数
|
||||
} else if (message && message.indexOf('UnauthorizedRequest') > -1) {
|
||||
} else if (message && typeof message === 'string' && message.indexOf('UnauthorizedRequest') > -1) {
|
||||
// token过期了
|
||||
let bingTokens = JSON.parse(await redis.get('CHATGPT:BING_TOKENS'))
|
||||
const badBingToken = bingTokens.findIndex(element => element.Token === bingToken)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ export default class SydneyAIClient {
|
|||
'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/Win32',
|
||||
cookie: this.opts.cookies || `_U=${this.opts.userToken}`,
|
||||
Referer: 'https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx',
|
||||
'Referrer-Policy': 'origin-when-cross-origin'
|
||||
'Referrer-Policy': 'origin-when-cross-origin',
|
||||
// Workaround for request being blocked due to geolocation
|
||||
'x-forwarded-for': '1.1.1.1'
|
||||
}
|
||||
}
|
||||
if (this.opts.proxy) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue