mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: 修复上下文聊天大于20时记录顺序错误的问题
This commit is contained in:
parent
2ad77d8112
commit
88360ecc42
3 changed files with 9 additions and 8 deletions
|
|
@ -16,13 +16,13 @@ export async function getChatHistoryGroup (e, num) {
|
|||
if (!chatHistory || chatHistory.length === 0) {
|
||||
break
|
||||
}
|
||||
chats.push(...chatHistory)
|
||||
if (seq === chatHistory[0].seq || seq === chatHistory[0].message_id) {
|
||||
chats.push(...chatHistory.reverse())
|
||||
if (seq === chatHistory[chatHistory.length - 1].seq || seq === chatHistory[chatHistory.length - 1].message_id) {
|
||||
break
|
||||
}
|
||||
seq = chatHistory[0].seq || chatHistory[0].message_id
|
||||
seq = chatHistory[chatHistory.length - 1].seq || chatHistory[chatHistory.length - 1].message_id
|
||||
}
|
||||
chats = chats.slice(0, num)
|
||||
chats = chats.slice(0, num).reverse()
|
||||
try {
|
||||
let mm = await e.bot.gml
|
||||
for (const chat of chats) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue