From b17cf1e532dd91e5720b545e9caa5847043f586e Mon Sep 17 00:00:00 2001 From: LightningHyperBlaze45654 <73149145+LightningHyperBlaze45654@users.noreply.github.com> Date: Mon, 17 Jun 2024 23:45:03 -0700 Subject: [PATCH] minimal changes on last two chats hypav2.ts update. last commit. --- src/ts/process/memory/hypav2.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ts/process/memory/hypav2.ts b/src/ts/process/memory/hypav2.ts index b4cbe35a..d4a8f978 100644 --- a/src/ts/process/memory/hypav2.ts +++ b/src/ts/process/memory/hypav2.ts @@ -276,14 +276,17 @@ export async function hypaMemoryV2( } } - // Add last two chats if they exist - // Yeah, It's fine to remove this, but for the sake of stability, currently commented it out. Will add stabilizer for this - /* + // Add last two chats if they exist and are not duplicates if (lastTwoChats.length === 2) { - chats.push(lastTwoChats[0]); - chats.push(lastTwoChats[1]); + const [lastChat1, lastChat2] = lastTwoChats; + if (!chats.some(chat => chat.memo === lastChat1.memo)) { + chats.push(lastChat1); + } + if (!chats.some(chat => chat.memo === lastChat2.memo)) { + chats.push(lastChat2); + } } - */ + console.log("model being used: ", db.hypaModel, db.supaModelType, "\nCurrent session tokens: ", currentTokens, "\nAll chats, including memory system prompt: ", chats, "\nMemory data, with all the chunks: ", data); return { currentTokens: currentTokens,