fix: 修复对原生bing造成的影响

This commit is contained in:
ikechan8370 2023-04-02 13:10:00 +08:00
parent 95a4d7a69c
commit 10bbbf4f64

View file

@ -1049,6 +1049,11 @@ export class chatgpt extends plugin {
let errorMessage = ''
do {
try {
let opt = _.cloneDeep(conversation) || {}
opt.toneStyle = Config.toneStyle
opt.context = Config.sydneyContext
if (Config.toneStyle === 'Sydney' || Config.toneStyle === 'Custom') {
let abtrs = await getAvailableBingToken(conversation, throttledTokens)
bingToken = abtrs.bingToken
allThrottled = abtrs.allThrottled
@ -1057,10 +1062,6 @@ export class chatgpt extends plugin {
}
bingAIClient.opts.userToken = bingToken
bingAIClient.opts.cookies = cookies
try {
let opt = _.cloneDeep(conversation) || {}
opt.toneStyle = Config.toneStyle
opt.context = Config.sydneyContext
opt.messageType = allThrottled ? 'Chat' : 'SearchQuery'
if (Config.enableGroupContext && e.isGroup) {
try {
@ -1095,6 +1096,7 @@ export class chatgpt extends plugin {
logger.warn('获取群聊聊天记录失败,本次对话不携带聊天记录', err)
}
}
}
response = await bingAIClient.sendMessage(prompt, opt, (token) => {
reply += token
})