Fix hanuraiMemory function to use shift instead of pop for chats array
This commit is contained in:
@@ -57,7 +57,7 @@ export async function hanuraiMemory(chats:OpenAIChat[],arg:{
|
|||||||
let tokens = arg.currentTokens + db.hanuraiTokens
|
let tokens = arg.currentTokens + db.hanuraiTokens
|
||||||
|
|
||||||
while(tokens > arg.maxContextTokens){
|
while(tokens > arg.maxContextTokens){
|
||||||
const poped = chats.pop()
|
const poped = chats.shift()
|
||||||
if(!poped){
|
if(!poped){
|
||||||
alertError(language.errors.toomuchtoken + "\n\nRequired Tokens: " + tokens)
|
alertError(language.errors.toomuchtoken + "\n\nRequired Tokens: " + tokens)
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user