feat: 必应无需token即可进行对话(max20->5)

This commit is contained in:
ikechan8370 2023-05-25 18:54:55 +08:00
parent 3c437ddfc5
commit 375fad8a20
2 changed files with 7 additions and 3 deletions

View file

@ -1661,7 +1661,7 @@ export class chatgpt extends plugin {
// 如果token曾经有异常则清除异常
let Tokens = JSON.parse(await redis.get('CHATGPT:BING_TOKENS'))
const TokenIndex = Tokens.findIndex(element => element.Token === abtrs.bingToken)
if (Tokens[TokenIndex].exception) {
if (TokenIndex > 0 && Tokens[TokenIndex].exception) {
delete Tokens[TokenIndex].exception
await redis.set('CHATGPT:BING_TOKENS', JSON.stringify(Tokens))
}
@ -2140,7 +2140,11 @@ async function getAvailableBingToken (conversation, throttled = []) {
})
bingToken = minElement.Token
} else {
throw new Error('全部Token均已失效暂时无法使用')
// throw new Error('全部Token均已失效暂时无法使用')
return {
bingToken: null,
allThrottled
}
}
if (Config.toneStyle != 'Sydney' && Config.toneStyle != 'Custom') {
// bing 下需要保证同一对话使用同一账号的token