mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
fix: sydney和自定义的无限续杯
This commit is contained in:
parent
4b93b5edaf
commit
192beb2722
2 changed files with 14 additions and 3 deletions
|
|
@ -257,6 +257,13 @@ export default class SydneyAIClient {
|
|||
author: message.role === 'User' ? 'user' : 'bot'
|
||||
}
|
||||
})
|
||||
let pm = []
|
||||
previousCachedMessages.reverse().forEach(m => {
|
||||
if (pm.filter(m => m.author === 'user').length < Config.maxNumUserMessagesInConversation - 1) {
|
||||
pm.push(m)
|
||||
}
|
||||
})
|
||||
pm = pm.reverse()
|
||||
// const hello = [
|
||||
// {
|
||||
// text: '你好,你是谁?',
|
||||
|
|
@ -286,7 +293,7 @@ export default class SydneyAIClient {
|
|||
author: 'bot'
|
||||
},
|
||||
// ...(Config.sydneyBrainWash ? Array.from({ length: Math.max(1, Config.sydneyBrainWashStrength - Math.floor(previousCachedMessages.length / 2)) }, () => [...hello]).flat() : []),
|
||||
...previousCachedMessages,
|
||||
...pm,
|
||||
{
|
||||
text: message,
|
||||
author: 'user'
|
||||
|
|
@ -306,7 +313,7 @@ export default class SydneyAIClient {
|
|||
},
|
||||
// ...(Config.sydneyBrainWash ? Array.from({ length: Math.max(1, Config.sydneyBrainWashStrength - Math.floor(previousCachedMessages.length / 2)) }, () => [...hello]).flat() : []),
|
||||
// ...groupId ? groupRecord : [],
|
||||
...previousCachedMessages
|
||||
...pm
|
||||
]
|
||||
: undefined
|
||||
}
|
||||
|
|
@ -511,6 +518,9 @@ export default class SydneyAIClient {
|
|||
}
|
||||
const messages = event?.arguments?.[0]?.messages
|
||||
if (!messages?.length || messages[0].author !== 'bot') {
|
||||
if (event?.arguments?.[0]?.throttling?.maxNumUserMessagesInConversation) {
|
||||
Config.maxNumUserMessagesInConversation = event?.arguments?.[0]?.throttling?.maxNumUserMessagesInConversation
|
||||
}
|
||||
return
|
||||
}
|
||||
const message = messages.length
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ const defaultConfig = {
|
|||
enableGroupContext: false,
|
||||
groupContextLength: 50,
|
||||
enableRobotAt: true,
|
||||
version: 'v2.4.6'
|
||||
maxNumUserMessagesInConversation: 18,
|
||||
version: 'v2.4.7'
|
||||
}
|
||||
const _path = process.cwd()
|
||||
let config = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue