mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
Chore: Optimize some code logic and add support for chat context in '锅巴面板' and 'chatgpt帮助' (#310)
* Optimized code logic and added support for chat context in '锅巴面板' and 'chatgpt帮助' In this commit, I have optimized certain code logic to improve the performance of the application. Additionally, I have added support for chat context in croutons and help, which will enhance the user experience and make the chatbot more user-friendly. This feature will allow users to maintain a better understanding of the conversation flow and context, and will ultimately lead to more successful interactions with the chatbot. * Update chat.js --------- Co-authored-by: ikechan8370 <geyinchibuaa@gmail.com>
This commit is contained in:
parent
84eabee14d
commit
68bb1f221e
5 changed files with 79 additions and 47 deletions
|
|
@ -130,10 +130,33 @@ export class ChatgptManagement extends plugin {
|
|||
reg: '^#chatgpt查看(Bing|必应|Sydney|悉尼|sydney|bing)设定$',
|
||||
fnc: 'queryBingPromptPrefix',
|
||||
permission: 'master'
|
||||
},
|
||||
{
|
||||
/** 命令正则匹配 */
|
||||
reg: '^#(关闭|打开)群聊上下文',
|
||||
/** 执行方法 */
|
||||
fnc: 'enableGroupContext',
|
||||
permission: 'master'
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
async enableGroupContext (e) {
|
||||
const re = /#(关闭|打开)/
|
||||
const match = e.msg.match(re)
|
||||
//logger.info(match)
|
||||
if (match) {
|
||||
const action = match[1]
|
||||
if (action === '关闭') {
|
||||
Config.enableGroupContext = false // 关闭
|
||||
await this.reply('已关闭群聊上下文功能', true)
|
||||
} else {
|
||||
Config.enableGroupContext = true // 打开
|
||||
await this.reply('已打开群聊上下文功能', true)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
async turnOnConfirm (e) {
|
||||
await redis.set('CHATGPT:CONFIRM', 'on')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue