diff --git a/public/script.js b/public/script.js index 128554531..f901090dd 100644 --- a/public/script.js +++ b/public/script.js @@ -757,7 +757,6 @@ $.get("/csrf-token").then(async (data) => { function checkOnlineStatus() { ///////// REMOVED LINES THAT DUPLICATE RA_CHeckOnlineStatus FEATURES - if (online_status == "no_connection") { $("#online_status_indicator2").css("background-color", "red"); //Kobold $("#online_status_text2").html("No connection..."); diff --git a/public/scripts/extensions/infinity-context/index.js b/public/scripts/extensions/infinity-context/index.js index ecdf56830..bc40bf27d 100644 --- a/public/scripts/extensions/infinity-context/index.js +++ b/public/scripts/extensions/infinity-context/index.js @@ -186,6 +186,16 @@ function onFileSplitLengthInput() { saveSettingsDebounced(); } +function onChunkNLInput() { + let shouldSplit = $('#onChunkNLInput').is(':checked'); + if(shouldSplit){ + extension_settings.chromadb.file_split_type = "newline"; + } else { + extension_settings.chromadb.file_split_type = "length"; + } + saveSettingsDebounced(); +} + function checkChatId(chat_id) { if (!chat_id || chat_id.trim() === '') { toastr.error('Please select a character and try again.'); @@ -438,8 +448,14 @@ async function onSelectInjectFile(e) { try { toastr.info('This may take some time, depending on the file size', 'Processing...'); const text = await getFileText(file); - - const split = splitRecursive(text, extension_settings.chromadb.file_split_length).filter(onlyUnique); + extension_settings.chromadb.file_split_type = "newline"; + //allow splitting on newlines or splitrecursively + let split = []; + if(extension_settings.chromadb.file_split_type == "newline"){ + split = text.split(/\r?\n/).filter(onlyUnique); + } else { + split = splitRecursive(text, extension_settings.chromadb.file_split_length).filter(onlyUnique); + } const baseDate = Date.now(); const messages = split.map((m, i) => ({ @@ -538,10 +554,19 @@ window.chromadb_interceptGeneration = async (chat, maxContext) => { let recallMsg = extension_settings.chromadb.recall_msg || defaultSettings.chroma_default_msg; const chromaDepth = extension_settings.chromadb.chroma_depth; const chromaSortStrategy = extension_settings.chromadb.sort_strategy; + + //log the current settings + console.debug("CHROMADB: Current settings: %o", extension_settings.chromadb); + + if (currentChatId) { const messagesToStore = chat.slice(0, -extension_settings.chromadb.keep_context); + //log the messages to store + console.debug("CHROMADB: Messages to store: %o", messagesToStore); if (messagesToStore.length > 0 || extension_settings.chromadb.freeze) { + //log the messages to store length vs keep context + console.debug("CHROMADB: Messages to store length vs keep context: %o vs %o", messagesToStore.length, extension_settings.chromadb.keep_context); await addMessages(currentChatId, messagesToStore); const lastMessage = chat[chat.length - 1]; @@ -550,7 +575,6 @@ window.chromadb_interceptGeneration = async (chat, maxContext) => { console.debug(recallStrategy) if (lastMessage) { if (recallStrategy === 'multichat'){ - console.log("Utilizing multichat") queriedMessages = await queryMultiMessages(currentChatId, lastMessage.mes); } else{ @@ -639,7 +663,6 @@ window.chromadb_interceptGeneration = async (chat, maxContext) => { chat.splice(0, messagesToStore.length, ...newChat); } - console.log('ChromaDB chat after injection', chat); } } } @@ -725,6 +748,10 @@ jQuery(async () => { Use % strategy +