From c55ad419dd641a464bf47189d01109eb332d7664 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sat, 6 Jul 2024 15:29:47 +0300 Subject: [PATCH] Clean-up console logs --- public/script.js | 2 +- public/scripts/extensions/memory/index.js | 6 +++++- public/scripts/extensions/quick-reply/index.js | 11 ++++++----- public/scripts/power-user.js | 10 +++++----- public/scripts/samplerSelect.js | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/public/script.js b/public/script.js index 79eae6303..be58c5922 100644 --- a/public/script.js +++ b/public/script.js @@ -6110,7 +6110,7 @@ export function changeMainAPI() { } if (selectedVal === 'textgenerationwebui' || selectedVal === 'novel') { - console.log('enabling amount_gen for ooba/novel'); + console.debug('enabling amount_gen for ooba/novel'); activeItem.amountGenElem.find('input').prop('disabled', false); activeItem.amountGenElem.css('opacity', 1.0); } diff --git a/public/scripts/extensions/memory/index.js b/public/scripts/extensions/memory/index.js index efd6f5fdd..2bb5c1269 100644 --- a/public/scripts/extensions/memory/index.js +++ b/public/scripts/extensions/memory/index.js @@ -804,7 +804,11 @@ function setMemoryContext(value, saveToMessage, index = null) { const context = getContext(); context.setExtensionPrompt(MODULE_NAME, formatMemoryValue(value), extension_settings.memory.position, extension_settings.memory.depth, false, extension_settings.memory.role); $('#memory_contents').val(value); - console.log('Summary set to: ' + value, 'Position: ' + extension_settings.memory.position, 'Depth: ' + extension_settings.memory.depth, 'Role: ' + extension_settings.memory.role); + + const summaryLog = value + ? `Summary set to: ${value}. Position: ${extension_settings.memory.position}. Depth: ${extension_settings.memory.depth}. Role: ${extension_settings.memory.role}` + : 'Summary has no content'; + console.debug(summaryLog); if (saveToMessage && context.chat.length) { const idx = index ?? context.chat.length - 2; diff --git a/public/scripts/extensions/quick-reply/index.js b/public/scripts/extensions/quick-reply/index.js index df2a1454c..b0f496126 100644 --- a/public/scripts/extensions/quick-reply/index.js +++ b/public/scripts/extensions/quick-reply/index.js @@ -14,6 +14,7 @@ import { SettingsUi } from './src/ui/SettingsUi.js'; const _VERBOSE = true; +export const debug = (...msg) => _VERBOSE ? console.debug('[QR2]', ...msg) : null; export const log = (...msg) => _VERBOSE ? console.log('[QR2]', ...msg) : null; export const warn = (...msg) => _VERBOSE ? console.warn('[QR2]', ...msg) : null; /** @@ -206,18 +207,18 @@ const init = async () => { window['quickReplyApi'] = quickReplyApi; }; const finalizeInit = async () => { - log('executing startup'); + debug('executing startup'); await autoExec.handleStartup(); - log('/executing startup'); + debug('/executing startup'); - log(`executing queue (${executeQueue.length} items)`); + debug(`executing queue (${executeQueue.length} items)`); while (executeQueue.length > 0) { const func = executeQueue.shift(); await func(); } - log('/executing queue'); + debug('/executing queue'); isReady = true; - log('READY'); + debug('READY'); }; await init(); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index e484d2d99..f57de63ff 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -1064,19 +1064,19 @@ function applyChatDisplay() { switch (power_user.chat_display) { case 0: { - console.log('applying default chat'); + console.debug('applying default chat'); $('body').removeClass('bubblechat'); $('body').removeClass('documentstyle'); break; } case 1: { - console.log('applying bubblechat'); + console.debug('applying bubblechat'); $('body').addClass('bubblechat'); $('body').removeClass('documentstyle'); break; } case 2: { - console.log('applying document style'); + console.debug('applying document style'); $('body').removeClass('bubblechat'); $('body').addClass('documentstyle'); break; @@ -3130,6 +3130,7 @@ $(document).ready(() => { const winHeight = window.innerHeight; const originalWidth = winWidth * zoomLevel; const originalHeight = winHeight * zoomLevel; + console.log(`Window resize: ${coreTruthWinWidth}x${coreTruthWinHeight} -> ${window.innerWidth}x${window.innerHeight}`); console.debug(`Zoom: ${zoomLevel}, X:${winWidth}, Y:${winHeight}, original: ${originalWidth}x${originalHeight} `); return zoomLevel; }); @@ -3138,7 +3139,6 @@ $(document).ready(() => { var coreTruthWinHeight = window.innerHeight; $(window).on('resize', async () => { - console.log(`Window resize: ${coreTruthWinWidth}x${coreTruthWinHeight} -> ${window.innerWidth}x${window.innerHeight}`); adjustAutocompleteDebounced(); setHotswapsDebounced(); @@ -3191,7 +3191,7 @@ $(document).ready(() => { } } } else { - console.log('aborting MUI reset', Object.keys(power_user.movingUIState).length); + console.debug('aborting MUI reset', Object.keys(power_user.movingUIState).length); } saveSettingsDebounced(); coreTruthWinWidth = window.innerWidth; diff --git a/public/scripts/samplerSelect.js b/public/scripts/samplerSelect.js index 4aa0caff6..887bc4488 100644 --- a/public/scripts/samplerSelect.js +++ b/public/scripts/samplerSelect.js @@ -307,7 +307,7 @@ async function listSamplers(main_api, arrayOnly = false) { } if (arrayOnly) { - console.log('returning full samplers array'); + console.debug('returning full samplers array'); return availableSamplers; }