[feat] added memory limit line

This commit is contained in:
kwaroran
2023-05-17 02:18:34 +09:00
parent e5c44406fb
commit 59c34956cf
9 changed files with 39 additions and 10 deletions

View File

@@ -238,18 +238,21 @@ export async function sendChat(chatProcessIndex = -1):Promise<boolean> {
chats = sp.chats
currentTokens = sp.currentTokens
currentChat.supaMemoryData = sp.memory ?? currentChat.supaMemoryData
currentChat.lastMemory = sp.lastId ?? currentChat.lastMemory
}
else{
while(currentTokens > maxContextTokens){
if(chats.length <= 1){
alertError(language.errors.toomuchtoken)
return false
}
currentTokens -= (await tokenize(chats[0].content) + 1)
chats.splice(0, 1)
}
}
currentChat.lastMemory = chats[0].memo
console.log(currentChat.lastMemory)
}
let bias:{[key:number]:number} = {}