mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
feat: simple queue management
This commit is contained in:
parent
e6738e5527
commit
b88d450aef
2 changed files with 32 additions and 0 deletions
22
apps/chat.js
22
apps/chat.js
|
|
@ -74,6 +74,14 @@ export class chatgpt extends plugin {
|
||||||
{
|
{
|
||||||
reg: '#chatgpt文本模式',
|
reg: '#chatgpt文本模式',
|
||||||
fnc: 'switch2Text'
|
fnc: 'switch2Text'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
reg: '#清空(chat)?队列',
|
||||||
|
fnc: 'emptyQueue'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
reg: '#移出(chat)?队列首位',
|
||||||
|
fnc: 'removeQueueFirst'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
@ -309,4 +317,18 @@ export class chatgpt extends plugin {
|
||||||
await this.reply(`与OpenAI通信异常,请稍后重试:${e}`, true, { recallMsg: e.isGroup ? 10 : 0 })
|
await this.reply(`与OpenAI通信异常,请稍后重试:${e}`, true, { recallMsg: e.isGroup ? 10 : 0 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async emptyQueue (e) {
|
||||||
|
await redis.lTrim('CHATGPT:CHAT_QUEUE', 1, 0)
|
||||||
|
await this.reply('已清空当前等待队列')
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeQueueFirst (e) {
|
||||||
|
let uid = await redis.lPop('CHATGPT:CHAT_QUEUE', 0)
|
||||||
|
if (!uid) {
|
||||||
|
await this.reply('当前等待队列为空')
|
||||||
|
} else {
|
||||||
|
await this.reply('已移出等待队列首位: ' + uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
apps/help.js
10
apps/help.js
|
|
@ -45,6 +45,16 @@ let helpData = [
|
||||||
title: '#结束对话 @某人',
|
title: '#结束对话 @某人',
|
||||||
desc: '结束该用户当前对话,下次开启对话机器人将遗忘掉本次对话内容。'
|
desc: '结束该用户当前对话,下次开启对话机器人将遗忘掉本次对话内容。'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
icon: 'destroy',
|
||||||
|
title: '#清空chat队列',
|
||||||
|
desc: '清空当前对话等待队列。仅建议前方卡死时使用。'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'destroy-other',
|
||||||
|
title: '#移出chat队列首位',
|
||||||
|
desc: '移出当前对话等待队列中的首位。若前方对话卡死可使用本命令。'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
icon: 'help',
|
icon: 'help',
|
||||||
title: '#chatgpt帮助',
|
title: '#chatgpt帮助',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue