feat: limit thoughts extraction based on maxThoughtTagDepth setting

This commit is contained in:
Kwaroran
2024-12-27 15:56:48 +09:00
parent 191be6d5c1
commit cc223dfefa

View File

@@ -753,8 +753,11 @@ export async function sendChat(chatProcessIndex = -1,arg:{
}
}
let thoughts:string[] = []
const maxThoughtDepth = DBState.db.promptSettings?.maxThoughtTagDepth ?? -1
formatedChat = formatedChat.replace(/<Thoughts>(.+)<\/Thoughts>/gms, (match, p1) => {
thoughts.push(p1)
if(maxThoughtDepth === -1 || (maxThoughtDepth - ms.length) <= index){
thoughts.push(p1)
}
return ''
})