mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
fix: 过码第二遍才生效的问题
This commit is contained in:
parent
243331aa2e
commit
d7d4acf382
1 changed files with 5 additions and 1 deletions
|
|
@ -110,6 +110,7 @@ export class BingAIClient {
|
||||||
if (this.debug) {
|
if (this.debug) {
|
||||||
logger.info('send msg: ', JSON.stringify(messagePayload))
|
logger.info('send msg: ', JSON.stringify(messagePayload))
|
||||||
}
|
}
|
||||||
|
let _this = this
|
||||||
// 设置超时机制,防止长时间未收到消息
|
// 设置超时机制,防止长时间未收到消息
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
reject(new Error('No response from server within timeout period.'))
|
reject(new Error('No response from server within timeout period.'))
|
||||||
|
|
@ -124,7 +125,10 @@ export class BingAIClient {
|
||||||
// 如果收到 challenge,处理挑战
|
// 如果收到 challenge,处理挑战
|
||||||
this.handleChallenge(message)
|
this.handleChallenge(message)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
resolve()
|
setTimeout(() => {
|
||||||
|
_this.ws.send(JSON.stringify(messagePayload))
|
||||||
|
resolve()
|
||||||
|
}, 500)
|
||||||
})
|
})
|
||||||
.catch(reject)
|
.catch(reject)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue