mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 21:37:11 +00:00
feat: 尝试把20条后溢出的对话自动塞到扩展后面
This commit is contained in:
parent
019dc5e0c3
commit
9c3d1bc5e4
1 changed files with 10 additions and 0 deletions
|
|
@ -259,9 +259,12 @@ export default class SydneyAIClient {
|
|||
})
|
||||
let pm = []
|
||||
// 无限续杯
|
||||
let exceedConversations = []
|
||||
previousCachedMessages.reverse().forEach(m => {
|
||||
if (pm.filter(m => m.author === 'user').length < Config.maxNumUserMessagesInConversation - 1) {
|
||||
pm.push(m)
|
||||
} else {
|
||||
exceedConversations.push(e)
|
||||
}
|
||||
})
|
||||
pm = pm.reverse()
|
||||
|
|
@ -435,6 +438,13 @@ export default class SydneyAIClient {
|
|||
if (Config.debug) {
|
||||
logger.info(context)
|
||||
}
|
||||
if (exceedConversations.length > 0) {
|
||||
context += '\nThese are some conversations records between you and I: \n'
|
||||
context += exceedConversations.map(m => {
|
||||
return `${m.author}: ${m.text}`
|
||||
}).join('\n')
|
||||
context += '\n'
|
||||
}
|
||||
if (context) {
|
||||
obj.arguments[0].previousMessages.push({
|
||||
author: 'user',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue