diff --git a/src/ts/process/index.ts b/src/ts/process/index.ts index 891e2c56..02d02a3f 100644 --- a/src/ts/process/index.ts +++ b/src/ts/process/index.ts @@ -526,7 +526,6 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n let chats:OpenAIChat[] = examples - console.log(db.aiModel) if(!db.aiModel.startsWith('novelai')){ chats.push({ role: 'system', @@ -1041,7 +1040,6 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n } } - console.log(lastResponseChunk) addRerolls(generationId, Object.values(lastResponseChunk)) db.characters[selectedChar].chats[selectedChat] = runCurrentChatFunction(db.characters[selectedChar].chats[selectedChat]) @@ -1211,8 +1209,6 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n return v[0] }) - console.log(searched) - for(const emo of currentEmotion){ if(emo[0] === emoresult[0]){ const emos:[string, string,number] = [emo[0], emo[1], Date.now()] diff --git a/src/ts/process/memory/supaMemory.ts b/src/ts/process/memory/supaMemory.ts index 4e3df17f..b3761fa8 100644 --- a/src/ts/process/memory/supaMemory.ts +++ b/src/ts/process/memory/supaMemory.ts @@ -151,30 +151,30 @@ export async function supaMemory( value = value.replace(/[\.,\/#!$%\^&\*;:{}=\-_`~()]/g,"") } return value + }).filter((v) => { + return !supaMemory.replace(/[\.,\/#!$%\^&\*;:{}=\-_`~()]/g,"").includes(v.replace(/[\.,\/#!$%\^&\*;:{}=\-_`~()]/g,"")) })) const filteredChat = chats.filter((r) => r.role !== 'system' && r.role !== 'function') const s = await hypa.similaritySearch(stringlizeChat(filteredChat.slice(0, 4), char?.name ?? '', false)) - hypaResult = "past events: " + s.slice(0,3).join("\n") - currentTokens += await tokenizer.tokenizeChat({ - role: "assistant", - content: hypaResult, - memo: "hypaMemory" - }) - currentTokens += 10 + hypaResult = '' + if(s.length > 0){ + hypaResult = "past events: " + s.slice(0,3) + currentTokens += await tokenizer.tokenizeChat({ + role: "assistant", + content: hypaResult, + memo: "hypaMemory" + }) + currentTokens += 10 + } } } if(currentTokens < maxContextTokens){ chats.unshift({ role: "system", - content: supaMemory, + content: supaMemory + '\n\n' + hypaResult, memo: "supaMemory" }) - chats.unshift({ - role: "system", - content: hypaResult, - memo: "hypaMemory" - }) return { currentTokens: currentTokens, chats: chats @@ -313,10 +313,8 @@ export async function supaMemory( return result } - console.log(currentTokens) currentTokens -= await tokenize(supaMemory) currentTokens += await tokenize(result + '\n\n') - console.log(currentTokens) supaMemory = result + '\n\n' summarized = true