diff --git a/public/scripts/extensions/vectors/index.js b/public/scripts/extensions/vectors/index.js index f60425888..173ed0433 100644 --- a/public/scripts/extensions/vectors/index.js +++ b/public/scripts/extensions/vectors/index.js @@ -81,6 +81,7 @@ const settings = { // For chats enabled_chats: false, + keep_hidden: false, template: 'Past events:\n{{text}}', depth: 2, position: extension_prompt_types.IN_PROMPT, @@ -347,7 +348,7 @@ async function synchronizeChat(batchSize = 5) { return -1; } - const hashedMessages = context.chat.filter(x => !x.is_system).map(x => ({ text: String(substituteParams(x.mes)), hash: getStringHash(substituteParams(x.mes)), index: context.chat.indexOf(x) })); + const hashedMessages = context.chat.filter(x => settings.keep_hidden || !x.is_system).map(x => ({ text: String(substituteParams(x.mes)), hash: getStringHash(substituteParams(x.mes)), index: context.chat.indexOf(x) })); const hashesInCollection = await getSavedHashes(chatId); let newVectorItems = hashedMessages.filter(x => !hashesInCollection.includes(x.hash)); @@ -1496,10 +1497,11 @@ async function onViewStatsClick() { { timeOut: 10000, escapeHtml: false }, ); + $('#chat .mes.vectorized').removeClass('vectorized'); const chat = getContext().chat; for (const message of chat) { if (hashesInCollection.includes(getStringHash(substituteParams(message.mes)))) { - const messageElement = $(`.mes[mesid="${chat.indexOf(message)}"]`); + const messageElement = $(`#chat .mes[mesid="${chat.indexOf(message)}"]`); messageElement.addClass('vectorized'); } } @@ -1726,6 +1728,11 @@ jQuery(async () => { saveSettingsDebounced(); toggleSettings(); }); + $('#vectors_keep_hidden').prop('checked', settings.keep_hidden).on('input', () => { + settings.keep_hidden = !!$('#vectors_keep_hidden').prop('checked'); + Object.assign(extension_settings.vectors, settings); + saveSettingsDebounced(); + }); $('#vectors_enabled_files').prop('checked', settings.enabled_files).on('input', () => { settings.enabled_files = $('#vectors_enabled_files').prop('checked'); Object.assign(extension_settings.vectors, settings); diff --git a/public/scripts/extensions/vectors/settings.html b/public/scripts/extensions/vectors/settings.html index 1d86a3922..0678b9aad 100644 --- a/public/scripts/extensions/vectors/settings.html +++ b/public/scripts/extensions/vectors/settings.html @@ -408,6 +408,10 @@