Skip to content

Commit

Permalink
fix: 跟进shamrock和lain的更新
Browse files Browse the repository at this point in the history
  • Loading branch information
ikechan8370 authored Nov 12, 2023
1 parent 56a8937 commit c99019c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils/chat.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
export async function getChatHistoryGroup (e, num) {
if (e.adapter === 'shamrock') {
return await e.group.getChatHistory(0, num, false)
} else {
//if (e.adapter === 'shamrock') {
// return await e.group.getChatHistory(0, num, false)
//} else {
let latestChats = await e.group.getChatHistory(0, 1)
if (latestChats.length > 0) {
let latestChat = latestChats[0]
if (latestChat) {
let seq = latestChat.seq
let seq = latestChat.seq || latestChat.message_id
let chats = []
while (chats.length < num) {
let chatHistory = await e.group.getChatHistory(seq, 20)
chats.push(...chatHistory)
seq = chatHistory[0].seq || chatHistory[0].message_id
}
chats = chats.slice(0, num)
try {
Expand All @@ -28,6 +29,6 @@ export async function getChatHistoryGroup (e, num) {
return chats
}
}
}
// }
return []
}

0 comments on commit c99019c

Please sign in to comment.