From ab050cf73ea4447d07108f4a54efc6f65daa8ee3 Mon Sep 17 00:00:00 2001 From: ifeif <36729028+ifeif@users.noreply.github.com> Date: Tue, 16 May 2023 14:43:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20chat.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/chat.js | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/apps/chat.js b/apps/chat.js index 5473396..a814393 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -1018,7 +1018,18 @@ export class chatgpt extends plugin { let mood = 'blandness' if (!response) { await e.reply('没有任何回复', true) - return + return false + } else if (response === 'Thanks for this conversation! I\'ve reached my limit, will you hit “New topic,” please?') { + this.reply('当前对话超过上限,已重置对话', false, { at: true }) + await redis.del(`CHATGPT:CONVERSATIONS_BING:${e.sender.user_id}`) + return false + } else if (response === 'Unexpected message author.') { + this.reply('无法回答当前话题,已重置对话', false, { at: true }) + await redis.del(`CHATGPT:CONVERSATIONS_BING:${e.sender.user_id}`) + return false + } else if (response === 'Throttled: Request is throttled.') { + this.reply('今日对话已达上限') + return false } let emotion, emotionDegree if (Config.ttsMode === 'azure' && (use === 'claude' || use === 'bing') && await AzureTTS.getEmotionPrompt(e)) { @@ -1116,18 +1127,6 @@ export class chatgpt extends plugin { if (useTTS && response.length <= Config.autoUsePictureThreshold) { // 缓存数据 this.cacheContent(e, use, response, prompt, quotemessage, mood, chatMessage.suggestedResponses, imgUrls) - if (response === 'Thanks for this conversation! I\'ve reached my limit, will you hit “New topic,” please?') { - this.reply('当前对话超过上限,已重置对话', false, { at: true }) - await redis.del(`CHATGPT:CONVERSATIONS_BING:${e.sender.user_id}`) - return false - } else if (response === 'Unexpected message author.') { - this.reply('无法回答当前话题,已重置对话', false, { at: true }) - await redis.del(`CHATGPT:CONVERSATIONS_BING:${e.sender.user_id}`) - return false - } else if (response === 'Throttled: Request is throttled.') { - this.reply('今日对话已达上限') - return false - } // 处理tts输入文本 let ttsResponse, ttsRegex const regex = /^\/(.*)\/([gimuy]*)$/ @@ -1237,18 +1236,6 @@ export class chatgpt extends plugin { } } else { this.cacheContent(e, use, response, prompt, quotemessage, mood, chatMessage.suggestedResponses, imgUrls) - if (response === 'Thanks for this conversation! I\'ve reached my limit, will you hit “New topic,” please?') { - this.reply('当前对话超过上限,已重置对话', false, { at: true }) - await redis.del(`CHATGPT:CONVERSATIONS_BING:${e.sender.user_id}`) - return false - } else if (response === 'Unexpected message author.') { - this.reply('无法回答当前话题,已重置对话', false, { at: true }) - await redis.del(`CHATGPT:CONVERSATIONS_BING:${e.sender.user_id}`) - return false - } else if (response === 'Throttled: Request is throttled.') { - this.reply('今日对话已达上限') - return false - } await this.reply(await convertFaces(response, Config.enableRobotAt, e), e.isGroup) if (quotemessage.length > 0) { this.reply(await makeForwardMsg(this.e, quotemessage.map(msg => `${msg.text} - ${msg.url}`)))