From d7d4acf382a7310e48123c843ce17f62738faa3d Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Tue, 4 Feb 2025 23:25:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BF=87=E7=A0=81=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E9=81=8D=E6=89=8D=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/CopilotAIClient.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/CopilotAIClient.js b/client/CopilotAIClient.js index 550e149..40e6c88 100644 --- a/client/CopilotAIClient.js +++ b/client/CopilotAIClient.js @@ -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 {