[feat] added memory limit line
This commit is contained in:
@@ -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} = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user