mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 13:57:10 +00:00
优化 chat.js
This commit is contained in:
parent
05732f87f2
commit
ab050cf73e
1 changed files with 12 additions and 25 deletions
37
apps/chat.js
37
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}`)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue