mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Reduce console logs clutter
This commit is contained in:
@ -226,7 +226,7 @@ let converter;
|
||||
reloadMarkdownProcessor();
|
||||
|
||||
// array for prompt token calculations
|
||||
console.log('initializing Prompt Itemization Array on Startup');
|
||||
console.debug('initializing Prompt Itemization Array on Startup');
|
||||
let itemizedPrompts = [];
|
||||
|
||||
/* let bg_menu_toggle = false; */
|
||||
@ -448,7 +448,7 @@ async function getClientVersion() {
|
||||
$('#version_display').text(displayVersion);
|
||||
$('#version_display_welcome').text(displayVersion);
|
||||
} catch (err) {
|
||||
console.log("Couldn't get client version", err);
|
||||
console.error("Couldn't get client version", err);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1931,7 +1931,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
for (let i = coreChat.length - 1, j = 0; i >= 0; i--, j++) {
|
||||
// For OpenAI it's only used in WI
|
||||
if (main_api == 'openai' && !world_info) {
|
||||
console.log('No WI, skipping chat2 for OAI');
|
||||
console.debug('No WI, skipping chat2 for OAI');
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2031,7 +2031,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
}
|
||||
|
||||
let mesSend = [];
|
||||
console.log('calling runGenerate');
|
||||
console.debug('calling runGenerate');
|
||||
streamingProcessor = isStreamingEnabled() ? new StreamingProcessor(type, force_name2) : false;
|
||||
await runGenerate();
|
||||
|
||||
@ -2044,7 +2044,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
generateOpenAIPromptCache();
|
||||
}
|
||||
|
||||
console.log('generating prompt');
|
||||
console.debug('generating prompt');
|
||||
chatString = "";
|
||||
arrMes = arrMes.reverse();
|
||||
arrMes.forEach(function (item, i, arr) {//For added anchors and others
|
||||
@ -2099,7 +2099,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('--setting Prompt string');
|
||||
console.debug('--setting Prompt string');
|
||||
mesExmString = pinExmString ?? mesExamplesArray.slice(0, count_exm_add).join('');
|
||||
mesSendString = '';
|
||||
for (let j = 0; j < mesSend.length; j++) {
|
||||
@ -2147,7 +2147,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
}
|
||||
|
||||
function checkPromtSize() {
|
||||
console.log('---checking Prompt size');
|
||||
console.debug('---checking Prompt size');
|
||||
setPromtString();
|
||||
const prompt = [
|
||||
worldInfoString,
|
||||
@ -2169,16 +2169,16 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
checkPromtSize(); // and check size again..
|
||||
} else {
|
||||
//end
|
||||
console.log(`---mesSend.length = ${mesSend.length}`);
|
||||
console.debug(`---mesSend.length = ${mesSend.length}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (generatedPromtCache.length > 0 && main_api !== 'openai') {
|
||||
console.log('---Generated Prompt Cache length: ' + generatedPromtCache.length);
|
||||
console.debug('---Generated Prompt Cache length: ' + generatedPromtCache.length);
|
||||
checkPromtSize();
|
||||
} else {
|
||||
console.log('---calling setPromtString ' + generatedPromtCache.length)
|
||||
console.debug('---calling setPromtString ' + generatedPromtCache.length)
|
||||
setPromtString();
|
||||
}
|
||||
|
||||
@ -2263,7 +2263,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
}
|
||||
|
||||
let generate_url = getGenerateUrl();
|
||||
console.log('rungenerate calling API');
|
||||
console.debug('rungenerate calling API');
|
||||
|
||||
showStopButton();
|
||||
|
||||
@ -2374,11 +2374,11 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
|
||||
if (!isImpersonate) {
|
||||
if (tokens_already_generated == 0) {
|
||||
console.log("New message");
|
||||
console.debug("New message");
|
||||
({ type, getMessage } = saveReply(type, getMessage, this_mes_is_name, title));
|
||||
}
|
||||
else {
|
||||
console.log("Should append message");
|
||||
console.debug("Should append message");
|
||||
({ type, getMessage } = saveReply('append', getMessage, this_mes_is_name, title));
|
||||
}
|
||||
} else {
|
||||
@ -2395,7 +2395,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
// if any tokens left to generate
|
||||
if (getMultigenAmount() > 0) {
|
||||
runGenerate(getMessage);
|
||||
console.log('returning to make generate again');
|
||||
console.debug('returning to make generate again');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2450,9 +2450,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
}
|
||||
|
||||
if (power_user.auto_swipe) {
|
||||
console.log('checking for autoswipeblacklist on non-streaming message');
|
||||
console.debug('checking for autoswipeblacklist on non-streaming message');
|
||||
function containsBlacklistedWords(getMessage, blacklist, threshold) {
|
||||
console.log('checking blacklisted words');
|
||||
console.debug('checking blacklisted words');
|
||||
const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi');
|
||||
const matches = getMessage.match(regex) || [];
|
||||
return matches.length >= threshold;
|
||||
@ -2461,7 +2461,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
const generatedTextFiltered = (getMessage) => {
|
||||
if (power_user.auto_swipe_blacklist_threshold) {
|
||||
if (containsBlacklistedWords(getMessage, power_user.auto_swipe_blacklist, power_user.auto_swipe_blacklist_threshold)) {
|
||||
console.log("Generated text has blacklisted words")
|
||||
console.debug("Generated text has blacklisted words")
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -2469,7 +2469,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
return false
|
||||
}
|
||||
if (generatedTextFiltered(getMessage)) {
|
||||
console.log('swiping right automatically');
|
||||
console.debug('swiping right automatically');
|
||||
swipe_right();
|
||||
return
|
||||
}
|
||||
@ -2480,7 +2480,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
||||
//console.log('runGenerate calling showSwipeBtns');
|
||||
showSwipeButtons();
|
||||
}
|
||||
console.log('/savechat called by /Generate');
|
||||
console.debug('/savechat called by /Generate');
|
||||
|
||||
saveChatConditional();
|
||||
activateSendButtons();
|
||||
@ -2563,14 +2563,14 @@ export async function sendMessageAsUser(textareaText, messageBias) {
|
||||
chat[chat.length - 1]['extra'] = {};
|
||||
|
||||
if (messageBias) {
|
||||
console.log('checking bias');
|
||||
console.debug('checking bias');
|
||||
chat[chat.length - 1]['extra']['bias'] = messageBias;
|
||||
}
|
||||
|
||||
addOneMessage(chat[chat.length - 1]);
|
||||
// Wait for all handlers to finish before continuing with the prompt
|
||||
await eventSource.emit(event_types.MESSAGE_SENT, (chat.length - 1));
|
||||
console.log('message sent as user');
|
||||
console.debug('message sent as user');
|
||||
}
|
||||
|
||||
function getMaxContextSize() {
|
||||
@ -2690,7 +2690,7 @@ function getMultigenAmount() {
|
||||
|
||||
function promptItemize(itemizedPrompts, requestedMesId) {
|
||||
var incomingMesId = Number(requestedMesId);
|
||||
console.log(`looking for MesId ${incomingMesId}`);
|
||||
console.debug(`looking for MesId ${incomingMesId}`);
|
||||
var thisPromptSet = undefined;
|
||||
|
||||
for (var i = 0; i < itemizedPrompts.length; i++) {
|
||||
@ -3217,14 +3217,14 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
|
||||
chat[chat.length - 1]['mes'] = getMessage;
|
||||
}
|
||||
} else if (type === 'append') {
|
||||
console.log("Trying to append.")
|
||||
console.debug("Trying to append.")
|
||||
chat[chat.length - 1]['title'] = title;
|
||||
chat[chat.length - 1]['mes'] += getMessage;
|
||||
chat[chat.length - 1]['gen_started'] = generation_started;
|
||||
chat[chat.length - 1]['gen_finished'] = generationFinished;
|
||||
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
|
||||
} else if (type === 'appendFinal') {
|
||||
console.log("Trying to appendFinal.")
|
||||
console.debug("Trying to appendFinal.")
|
||||
chat[chat.length - 1]['title'] = title;
|
||||
chat[chat.length - 1]['mes'] = getMessage;
|
||||
chat[chat.length - 1]['gen_started'] = generation_started;
|
||||
@ -3232,7 +3232,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
|
||||
addOneMessage(chat[chat.length - 1], { type: 'swipe' });
|
||||
|
||||
} else {
|
||||
console.log('entering chat update routine for non-swipe post');
|
||||
console.debug('entering chat update routine for non-swipe post');
|
||||
chat[chat.length] = {};
|
||||
chat[chat.length - 1]['extra'] = {};
|
||||
chat[chat.length - 1]['name'] = name2;
|
||||
@ -3246,7 +3246,7 @@ function saveReply(type, getMessage, this_mes_is_name, title) {
|
||||
chat[chat.length - 1]['gen_finished'] = generationFinished;
|
||||
|
||||
if (selected_group) {
|
||||
console.log('entering chat update for groups');
|
||||
console.debug('entering chat update for groups');
|
||||
let avatarImg = 'img/ai4.png';
|
||||
if (characters[this_chid].avatar != 'none') {
|
||||
avatarImg = getThumbnailUrl('avatar', characters[this_chid].avatar);
|
||||
@ -3698,9 +3698,9 @@ function changeMainAPI() {
|
||||
}
|
||||
|
||||
// Hide common settings for OpenAI
|
||||
console.log('value?', selectedVal);
|
||||
console.debug('value?', selectedVal);
|
||||
if (selectedVal == "openai") {
|
||||
console.log('hiding settings?');
|
||||
console.debug('hiding settings?');
|
||||
$("#common-gen-settings-block").css("display", "none");
|
||||
} else {
|
||||
$("#common-gen-settings-block").css("display", "block");
|
||||
@ -4993,7 +4993,7 @@ const swipe_right = () => {
|
||||
complete: function () {
|
||||
eventSource.emit(event_types.MESSAGE_SWIPED, (chat.length - 1));
|
||||
if (run_generate && !is_send_press && parseInt(chat[chat.length - 1]['swipe_id']) === chat[chat.length - 1]['swipes'].length) {
|
||||
console.log('caught here 2');
|
||||
console.debug('caught here 2');
|
||||
is_send_press = true;
|
||||
$('.mes_buttons:last').hide();
|
||||
Generate('swipe');
|
||||
@ -6086,7 +6086,7 @@ $(document).ready(function () {
|
||||
$(this).prop("checked", false);
|
||||
});
|
||||
this_del_mes = 0;
|
||||
console.log('canceled del msgs, calling showswipesbtns');
|
||||
console.debug('canceled del msgs, calling showswipesbtns');
|
||||
showSwipeButtons();
|
||||
is_delete_mode = false;
|
||||
});
|
||||
@ -6116,7 +6116,7 @@ $(document).ready(function () {
|
||||
this_del_mes = 0;
|
||||
$('#chat .mes').last().addClass('last_mes');
|
||||
$('#chat .mes').eq(-2).removeClass('last_mes');
|
||||
console.log('confirmed del msgs, calling showswipesbtns');
|
||||
console.debug('confirmed del msgs, calling showswipesbtns');
|
||||
showSwipeButtons();
|
||||
is_delete_mode = false;
|
||||
});
|
||||
@ -6881,7 +6881,7 @@ $(document).ready(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Label value OK, setting to the master input control', myText);
|
||||
console.debug('Label value OK, setting to the master input control', myText);
|
||||
$(masterElement).val(myValue).trigger('input');
|
||||
restoreCaretPosition($(this).get(0), caretPosition);
|
||||
});
|
||||
|
@ -259,7 +259,7 @@ export function RA_CountCharTokens() {
|
||||
(power_user.pin_examples ? characters[this_chid].mes_example : ''),
|
||||
].join('\n').replace(/\r/gm, '').trim();
|
||||
perm_tokens = getTokenCount(perm_string);
|
||||
} else { console.log("RA_TC -- no valid char found, closing."); } // if neither, probably safety char or some error in loading
|
||||
} else { console.debug("RA_TC -- no valid char found, closing."); } // if neither, probably safety char or some error in loading
|
||||
}
|
||||
// display the counted tokens
|
||||
if (count_tokens < 1024 && perm_tokens < 1024) {
|
||||
@ -428,13 +428,13 @@ function OpenNavPanels() {
|
||||
|
||||
//auto-open L nav if locked and previously open
|
||||
if (LoadLocalBool("LNavLockOn") == true && LoadLocalBool("LNavOpened") == true) {
|
||||
console.log("RA -- clicking left nav to open");
|
||||
console.debug("RA -- clicking left nav to open");
|
||||
$("#leftNavDrawerIcon").click();
|
||||
}
|
||||
|
||||
//auto-open WI if locked and previously open
|
||||
if (LoadLocalBool("WINavLockOn") == true && LoadLocalBool("WINavOpened") == true) {
|
||||
console.log("RA -- clicking WI to open");
|
||||
console.debug("RA -- clicking WI to open");
|
||||
$("#WIDrawerIcon").click();
|
||||
}
|
||||
}
|
||||
@ -651,14 +651,14 @@ $("document").ready(function () {
|
||||
$(WIPanelPin).on("click", function () {
|
||||
SaveLocal("WINavLockOn", $(WIPanelPin).prop("checked"));
|
||||
if ($(WIPanelPin).prop("checked") == true) {
|
||||
console.log('adding pin class to WI');
|
||||
console.debug('adding pin class to WI');
|
||||
$(WorldInfo).addClass('pinnedOpen');
|
||||
} else {
|
||||
console.log('removing pin class from WI');
|
||||
console.debug('removing pin class from WI');
|
||||
$(WorldInfo).removeClass('pinnedOpen');
|
||||
|
||||
if ($(WorldInfo).hasClass('openDrawer') && $('.openDrawer').length > 1) {
|
||||
console.log('closing WI after lock removal');
|
||||
console.debug('closing WI after lock removal');
|
||||
$(WorldInfo).slideToggle(200, "swing");
|
||||
//$(WorldInfoDrawerIcon).toggleClass('openIcon closedIcon');
|
||||
$(WorldInfo).toggleClass('openDrawer closedDrawer');
|
||||
@ -673,7 +673,7 @@ $("document").ready(function () {
|
||||
$(RightNavPanel).addClass('pinnedOpen');
|
||||
}
|
||||
if ($(RPanelPin).prop('checked' == true)) {
|
||||
console.log('setting pin class via checkbox state');
|
||||
console.debug('setting pin class via checkbox state');
|
||||
$(RightNavPanel).addClass('pinnedOpen');
|
||||
}
|
||||
// read the state of left Nav Lock and apply to leftnav classlist
|
||||
@ -683,7 +683,7 @@ $("document").ready(function () {
|
||||
$(LeftNavPanel).addClass('pinnedOpen');
|
||||
}
|
||||
if ($(LPanelPin).prop('checked' == true)) {
|
||||
console.log('setting pin class via checkbox state');
|
||||
console.debug('setting pin class via checkbox state');
|
||||
$(LeftNavPanel).addClass('pinnedOpen');
|
||||
}
|
||||
|
||||
@ -695,7 +695,7 @@ $("document").ready(function () {
|
||||
}
|
||||
|
||||
if ($(WIPanelPin).prop('checked' == true)) {
|
||||
console.log('setting pin class via checkbox state');
|
||||
console.debug('setting pin class via checkbox state');
|
||||
$(WorldInfo).addClass('pinnedOpen');
|
||||
}
|
||||
|
||||
@ -842,7 +842,7 @@ $("document").ready(function () {
|
||||
}
|
||||
|
||||
if (event.ctrlKey && event.key == "ArrowUp") { //edits last USER message if chatbar is empty and focused
|
||||
console.log('got ctrl+uparrow input');
|
||||
console.debug('got ctrl+uparrow input');
|
||||
if (
|
||||
$("#send_textarea").val() === '' &&
|
||||
chatbarInFocus === true &&
|
||||
|
@ -188,7 +188,7 @@ async function validateImages(character, forceRedrawCached) {
|
||||
|
||||
if (spriteCache[character]) {
|
||||
if (forceRedrawCached && $('#image_list').data('name') !== character) {
|
||||
console.log('force redrawing character sprites list')
|
||||
console.debug('force redrawing character sprites list')
|
||||
drawSpritesList(character, labels, spriteCache[character]);
|
||||
}
|
||||
|
||||
@ -237,7 +237,7 @@ function getListItem(item, imageSrc, textClass) {
|
||||
}
|
||||
|
||||
async function getSpritesList(name) {
|
||||
console.log('getting sprites list');
|
||||
console.debug('getting sprites list');
|
||||
|
||||
try {
|
||||
const result = await fetch(`/get_sprites?name=${encodeURIComponent(name)}`);
|
||||
@ -284,14 +284,14 @@ async function getExpressionsList() {
|
||||
}
|
||||
|
||||
async function setExpression(character, expression, force) {
|
||||
console.log('entered setExpressions');
|
||||
console.debug('entered setExpressions');
|
||||
await validateImages(character);
|
||||
const img = $('img.expression');
|
||||
|
||||
const sprite = (spriteCache[character] && spriteCache[character].find(x => x.label === expression));
|
||||
console.log('checking for expression images to show..');
|
||||
console.debug('checking for expression images to show..');
|
||||
if (sprite) {
|
||||
console.log('setting expression from character images folder');
|
||||
console.debug('setting expression from character images folder');
|
||||
img.attr('src', sprite.path);
|
||||
img.removeClass('default');
|
||||
img.off('error');
|
||||
@ -308,7 +308,7 @@ async function setExpression(character, expression, force) {
|
||||
}
|
||||
|
||||
function setDefault() {
|
||||
console.log('setting default');
|
||||
console.debug('setting default');
|
||||
const defImgUrl = `/img/default-expressions/${expression}.png`;
|
||||
//console.log(defImgUrl);
|
||||
img.attr('src', defImgUrl);
|
||||
|
@ -83,7 +83,7 @@ async function loadSettings() {
|
||||
Object.assign(extension_settings.chromadb, defaultSettings);
|
||||
}
|
||||
|
||||
console.log(`loading chromadb strat:${extension_settings.chromadb.strategy}`);
|
||||
console.debug(`loading chromadb strat:${extension_settings.chromadb.strategy}`);
|
||||
$("#chromadb_strategy option[value=" + extension_settings.chromadb.strategy + "]").attr(
|
||||
"selected",
|
||||
"true"
|
||||
@ -95,7 +95,7 @@ async function loadSettings() {
|
||||
}
|
||||
|
||||
function onStrategyChange() {
|
||||
console.log('changing chromadb strat');
|
||||
console.debug('changing chromadb strat');
|
||||
extension_settings.chromadb.strategy = $('#chromadb_strategy').val();
|
||||
|
||||
//$('#chromadb_strategy').select(extension_settings.chromadb.strategy);
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
export function SaveLocal(target, val) {
|
||||
localStorage.setItem(target, val);
|
||||
console.log('SaveLocal -- ' + target + ' : ' + val);
|
||||
console.debug('SaveLocal -- ' + target + ' : ' + val);
|
||||
}
|
||||
export function LoadLocal(target) {
|
||||
console.log('LoadLocal -- ' + target);
|
||||
console.debug('LoadLocal -- ' + target);
|
||||
return localStorage.getItem(target);
|
||||
|
||||
}
|
||||
|
@ -426,14 +426,14 @@ function onTagRenameInput() {
|
||||
}
|
||||
|
||||
function onTagColorize(evt) {
|
||||
console.log(evt);
|
||||
console.debug(evt);
|
||||
const id = $(evt.target).closest('.tag_view_item').attr('id');
|
||||
const newColor = evt.detail.rgba;
|
||||
$(evt.target).parent().parent().find('.tag_view_name').css('background-color', newColor);
|
||||
$(`.tag[id="${id}"]`).css('background-color', newColor);
|
||||
const tag = tags.find(x => x.id === id);
|
||||
tag.color = newColor;
|
||||
console.log(tag);
|
||||
console.debug(tag);
|
||||
saveSettingsDebounced();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user