mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 22:07:10 +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'
|
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 = [
|
// const hello = [
|
||||||
// {
|
// {
|
||||||
// text: '你好,你是谁?',
|
// text: '你好,你是谁?',
|
||||||
|
|
@ -286,7 +293,7 @@ export default class SydneyAIClient {
|
||||||
author: 'bot'
|
author: 'bot'
|
||||||
},
|
},
|
||||||
// ...(Config.sydneyBrainWash ? Array.from({ length: Math.max(1, Config.sydneyBrainWashStrength - Math.floor(previousCachedMessages.length / 2)) }, () => [...hello]).flat() : []),
|
// ...(Config.sydneyBrainWash ? Array.from({ length: Math.max(1, Config.sydneyBrainWashStrength - Math.floor(previousCachedMessages.length / 2)) }, () => [...hello]).flat() : []),
|
||||||
...previousCachedMessages,
|
...pm,
|
||||||
{
|
{
|
||||||
text: message,
|
text: message,
|
||||||
author: 'user'
|
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() : []),
|
// ...(Config.sydneyBrainWash ? Array.from({ length: Math.max(1, Config.sydneyBrainWashStrength - Math.floor(previousCachedMessages.length / 2)) }, () => [...hello]).flat() : []),
|
||||||
// ...groupId ? groupRecord : [],
|
// ...groupId ? groupRecord : [],
|
||||||
...previousCachedMessages
|
...pm
|
||||||
]
|
]
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
|
@ -511,6 +518,9 @@ export default class SydneyAIClient {
|
||||||
}
|
}
|
||||||
const messages = event?.arguments?.[0]?.messages
|
const messages = event?.arguments?.[0]?.messages
|
||||||
if (!messages?.length || messages[0].author !== 'bot') {
|
if (!messages?.length || messages[0].author !== 'bot') {
|
||||||
|
if (event?.arguments?.[0]?.throttling?.maxNumUserMessagesInConversation) {
|
||||||
|
Config.maxNumUserMessagesInConversation = event?.arguments?.[0]?.throttling?.maxNumUserMessagesInConversation
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const message = messages.length
|
const message = messages.length
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ const defaultConfig = {
|
||||||
enableGroupContext: false,
|
enableGroupContext: false,
|
||||||
groupContextLength: 50,
|
groupContextLength: 50,
|
||||||
enableRobotAt: true,
|
enableRobotAt: true,
|
||||||
version: 'v2.4.6'
|
maxNumUserMessagesInConversation: 18,
|
||||||
|
version: 'v2.4.7'
|
||||||
}
|
}
|
||||||
const _path = process.cwd()
|
const _path = process.cwd()
|
||||||
let config = {}
|
let config = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue