From 711dbdcc1521275709aede01258bb478a79d3ec3 Mon Sep 17 00:00:00 2001 From: SillyLossy Date: Thu, 1 Jun 2023 01:30:12 +0300 Subject: [PATCH] [Feature Request] Chromadb, ability to pause collection. SillyTavern/SillyTavern#420 --- .../extensions/infinity-context/index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/infinity-context/index.js b/public/scripts/extensions/infinity-context/index.js index 6985cb51d..2bd03367b 100644 --- a/public/scripts/extensions/infinity-context/index.js +++ b/public/scripts/extensions/infinity-context/index.js @@ -76,6 +76,7 @@ async function loadSettings() { $('#chromadb_n_results').val(extension_settings.chromadb.n_results).trigger('input'); $('#chromadb_split_length').val(extension_settings.chromadb.split_length).trigger('input'); $('#chromadb_file_split_length').val(extension_settings.chromadb.file_split_length).trigger('input'); + $('#chromadb_freeze').prop('checked', extension_settings.chromadb.freeze); } function onStrategyChange() { @@ -119,6 +120,10 @@ function checkChatId(chat_id) { } async function addMessages(chat_id, messages) { + if (extension_settings.chromadb.freeze) { + return { count: 0 }; + } + const url = new URL(getApiUrl()); url.pathname = '/api/chromadb'; @@ -380,7 +385,7 @@ window.chromadb_interceptGeneration = async (chat) => { if (currentChatId) { const messagesToStore = chat.slice(0, -extension_settings.chromadb.keep_context); - if (messagesToStore.length > 0) { + if (messagesToStore.length > 0 || extension_settings.chromadb.freeze) { await addMessages(currentChatId, messagesToStore); const lastMessage = chat[chat.length - 1]; @@ -431,6 +436,11 @@ window.chromadb_interceptGeneration = async (chat) => { } } +function onFreezeInput() { + extension_settings.chromadb.freeze = $('#chromadb_freeze').is(':checked'); + saveSettingsDebounced(); +} + jQuery(async () => { const settingsHtml = `
@@ -454,6 +464,10 @@ jQuery(async () => { +