mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: 修复和优化群聊文件读取逻辑
This commit is contained in:
parent
d254163fa7
commit
e61d4ff3fa
3 changed files with 17 additions and 6 deletions
|
|
@ -1,4 +1,3 @@
|
|||
import common from '../../../lib/common/common.js'
|
||||
|
||||
export async function getChatHistoryGroup (e, num) {
|
||||
// if (e.adapter === 'shamrock') {
|
||||
|
|
@ -46,9 +45,15 @@ export async function getChatHistoryGroup (e, num) {
|
|||
return []
|
||||
}
|
||||
|
||||
function pickMemberAsync (e, userId) {
|
||||
async function pickMemberAsync (e, userId) {
|
||||
let key = `CHATGPT:GroupMemberInfo:${e.group_id}:${userId}`
|
||||
let cache = await redis.get(key)
|
||||
if (cache) {
|
||||
return JSON.parse(cache)
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
e.group.pickMember(userId, true, (sender) => {
|
||||
redis.set(key, JSON.stringify(sender), { EX: 86400 })
|
||||
resolve(sender)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue