fix: 过码第二遍才生效的问题

This commit is contained in:
ikechan8370 2025-02-04 23:25:54 +08:00
parent 243331aa2e
commit d7d4acf382

View file

@ -110,6 +110,7 @@ export class BingAIClient {
if (this.debug) {
logger.info('send msg: ', JSON.stringify(messagePayload))
}
let _this = this
// 设置超时机制,防止长时间未收到消息
const timeout = setTimeout(() => {
reject(new Error('No response from server within timeout period.'))
@ -124,7 +125,10 @@ export class BingAIClient {
// 如果收到 challenge处理挑战
this.handleChallenge(message)
.then(() => {
resolve()
setTimeout(() => {
_this.ws.send(JSON.stringify(messagePayload))
resolve()
}, 500)
})
.catch(reject)
} else {