|
| Author's Note | Built-in extension that allows you to append notes that will be added to the context and steer the story and character in a specific direction. Because it's sent after the character description, it has a lot of weight. Thanks Aliážµ#2222 for pitching the idea! | None |  |
| Character Backgrounds | Built-in extension to assign unique backgrounds to specific chats or groups. | None |
|
+| Stable Diffusion | Use local of cloud-based Stable Diffusion webUI API to generate images. 5 presets included ('you', 'your face', 'me', 'the story', and 'the last message'. Free mode also supported via `/sd (anything_here_)` command in the chat input bar. Most common StableDiffusion generation settings are customizable within the SillyTavern UI. | None |
|
| Author's Note | Built-in extension that allows you to append notes that will be added to the context and steer the story and character in a specific direction. Because it's sent after the character description, it has a lot of weight. Thanks Aliážµ#2222 for pitching the idea! | None |  |
| Character Backgrounds | Built-in extension to assign unique backgrounds to specific chats or groups. | None |
|
-| Stable Diffusion | Use local of cloud-based Stable Diffusion webUI API to generate images. 5 presets included ('you', 'your face', 'me', 'the story', and 'the last message'. Free mode also supported via `/sd (anything_here_)` command in the chat input bar. Most common StableDiffusion generation settings are customizable within the SillyTavern UI. | None |
|
+| Text-to-Speech | AI-generated voice will read back character messages on demand, or automatically read new messages they arrive. Supports ElevenLabs, Silero, and your device's TTS service. | None |
|
## UI/CSS/Quality of Life tweaks by RossAscends
From a656783b156c9799d34af61f1bdfcfc9b6a60231 Mon Sep 17 00:00:00 2001
From: SillyLossy "' + p1.replace(/\"/g, "") + '"'; } else if (p2) { @@ -1016,7 +1027,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { } if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) { - mes = mes.replaceAll(`${ch_name}:`, ""); + mes = mes.replaceAll(`${ch_name}: `, ""); } return mes; @@ -1061,8 +1072,8 @@ function addCopyToCodeBlocks(messageElement) { const copiedMsg = document.createElement("div"); copiedMsg.classList.add('code-copied'); copiedMsg.innerText = "Copied!"; - copiedMsg.style.top = `${event.clientY - 55}px`; - copiedMsg.style.left = `${event.clientX - 55}px`; + copiedMsg.style.top = `${event.clientY - 55} px`; + copiedMsg.style.left = `${event.clientX - 55} px`; document.body.append(copiedMsg); setTimeout(() => { document.body.removeChild(copiedMsg); @@ -1137,14 +1148,14 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true $("#chat").append(HTMLForEachMes); } else { - const target = $("#chat").find(`.mes[mesid="${insertAfter}"]`); + const target = $("#chat").find(`.mes[mesid = "${insertAfter}"]`); $(HTMLForEachMes).insertAfter(target); $(HTMLForEachMes).find('.swipe_left').css('display', 'none'); $(HTMLForEachMes).find('.swipe_right').css('display', 'none'); } } - const newMessage = $(`#chat [mesid="${count_view_mes}"]`); + const newMessage = $(`#chat[mesid = "${count_view_mes}"]`); newMessage.data("isSystem", isSystem); if (isSystem) { @@ -1155,17 +1166,17 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true // don't need prompt button for user if (params.isUser === true) { newMessage.find(".mes_prompt").hide(); - console.log(`hiding prompt for user mesID ${params.mesId}`); + console.log(`hiding prompt for user mesID ${params.mesId} `); } //shows or hides the Prompt display button let mesIdToFind = Number(newMessage.attr('mesId')); if (itemizedPrompts.length !== 0) { - //console.log(`itemizedPrompt.length = ${itemizedPrompts.length}`) + //console.log(`itemizedPrompt.length = ${ itemizedPrompts.length } `) for (var i = 0; i < itemizedPrompts.length; i++) { if (itemizedPrompts[i].mesId === mesIdToFind) { newMessage.find(".mes_prompt").show(); - console.log(`showing prompt for mesID ${params.mesId} from ${params.characterName}`); + console.log(`showing prompt for mesID ${params.mesId} from ${params.characterName} `); } else { console.log(`no cache obj for mesID ${mesIdToFind}, hiding prompt button and continuing search`); newMessage.find(".mes_prompt").hide(); @@ -1180,23 +1191,23 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true newMessage.find('.avatar img').on('error', function () { $(this).hide(); - $(this).parent().html(``); + $(this).parent().html(`< div class="missing-avatar fa-solid fa-user-slash" > `); }); if (type === 'swipe') { - $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').html(''); - $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').append(messageText); - appendImageToMessage(mes, $("#chat").find(`[mesid="${count_view_mes - 1}"]`)); - $("#chat").find(`[mesid="${count_view_mes - 1}"]`).attr('title', title); + $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_text').html(''); + $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_text').append(messageText); + appendImageToMessage(mes, $("#chat").find(`[mesid = "${count_view_mes - 1}"]`)); + $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).attr('title', title); if (mes.swipe_id == mes.swipes.length - 1) { - $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_timer').text(params.timerValue); - $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_timer').attr('title', params.timerTitle); + $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_timer').text(params.timerValue); + $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_timer').attr('title', params.timerTitle); } else { - $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_timer').html(''); + $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_timer').html(''); } } else { - $("#chat").find(`[mesid="${count_view_mes}"]`).find('.mes_text').append(messageText); + $("#chat").find(`[mesid = "${count_view_mes}"]`).find('.mes_text').append(messageText); appendImageToMessage(mes, newMessage); hideSwipeButtons(); count_view_mes++; @@ -1224,10 +1235,10 @@ function formatGenerationTimer(gen_started, gen_finished) { const start = moment(gen_started); const finish = moment(gen_finished); const seconds = finish.diff(start, 'seconds', true); - const timerValue = `${seconds.toFixed(1)}s`; + const timerValue = `${seconds.toFixed(1)} s`; const timerTitle = [ - `Generation queued: ${start.format(dateFormat)}`, - `Reply received: ${finish.format(dateFormat)}`, + `Generation queued: ${start.format(dateFormat)} `, + `Reply received: ${finish.format(dateFormat)} `, `Time to generate: ${seconds} seconds`, ].join('\n'); @@ -1256,9 +1267,9 @@ function substituteParams(content, _name1, _name2) { } function getStoppingStrings(isImpersonate, addSpace) { - const charString = `\n${name2}:`; - const youString = `\nYou:`; - const userString = `\n${name1}:`; + const charString = `\n${name2}: `; + const youString = `\nYou: `; + const userString = `\n${name1}: `; const result = isImpersonate ? [charString] : [youString]; result.push(userString); @@ -1271,7 +1282,7 @@ function getStoppingStrings(isImpersonate, addSpace) { const names = group.members .map(x => characters.find(y => y.avatar == x)) .filter(x => x && x.name !== name2) - .map(x => `\n${x.name}:`); + .map(x => `\n${x.name}: `); result.push(...names); } } @@ -1371,7 +1382,7 @@ function cleanGroupMessage(getMessage) { continue; } - const indexOfMember = getMessage.indexOf(`${name}:`); + const indexOfMember = getMessage.indexOf(`${name}: `); if (indexOfMember != -1) { getMessage = getMessage.substr(0, indexOfMember); } @@ -1445,8 +1456,8 @@ class StreamingProcessor { return; } - $(`#chat .mes[mesid="${messageId}"] .mes_stop`).css({ 'display': 'block' }); - $(`#chat .mes[mesid="${messageId}"] .mes_buttons`).css({ 'display': 'none' }); + $(`#chat.mes[mesid = "${messageId}"].mes_stop`).css({ 'display': 'block' }); + $(`#chat.mes[mesid = "${messageId}"].mes_buttons`).css({ 'display': 'none' }); } hideStopButton(messageId) { @@ -1454,8 +1465,8 @@ class StreamingProcessor { return; } - $(`#chat .mes[mesid="${messageId}"] .mes_stop`).css({ 'display': 'none' }); - $(`#chat .mes[mesid="${messageId}"] .mes_buttons`).css({ 'display': 'block' }); + $(`#chat.mes[mesid = "${messageId}"].mes_stop`).css({ 'display': 'none' }); + $(`#chat.mes[mesid = "${messageId}"].mes_buttons`).css({ 'display': 'block' }); } onStartStreaming(text) { @@ -1519,9 +1530,9 @@ class StreamingProcessor { chat[messageId].is_system, chat[messageId].is_user, ); - const mesText = $(`#chat .mes[mesid="${messageId}"] .mes_text`); + const mesText = $(`#chat.mes[mesid = "${messageId}"].mes_text`); mesText.html(formattedText); - $(`#chat .mes[mesid="${messageId}"] .mes_timer`).text(timePassed.timerValue).attr('title', timePassed.timerTitle); + $(`#chat.mes[mesid = "${messageId}"].mes_timer`).text(timePassed.timerValue).attr('title', timePassed.timerTitle); this.setFirstSwipe(messageId); } @@ -1531,7 +1542,7 @@ class StreamingProcessor { onFinishStreaming(messageId, text) { this.hideStopButton(this.messageId); this.onProgressStreaming(messageId, text, true); - addCopyToCodeBlocks($(`#chat .mes[mesid="${messageId}"]`)); + addCopyToCodeBlocks($(`#chat.mes[mesid = "${messageId}"]`)); saveChatConditional(); activateSendButtons(); showSwipeButtons(); @@ -1543,7 +1554,7 @@ class StreamingProcessor { if (power_user.auto_swipe) { function containsBlacklistedWords(str, blacklist, threshold) { - const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi'); + const regex = new RegExp(`\\b(${blacklist.join('|')}) \\b`, 'gi'); const matches = str.match(regex) || []; return matches.length >= threshold; } @@ -1753,7 +1764,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, power_user.custom_chat_separator ? power_user.custom_chat_separator : power_user.disable_examples_formatting ? '' : is_pygmalion ? '
"' + p1.replace(/\"/g, "") + '"'; } else if (p2) { @@ -1027,7 +1027,7 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { } if (!power_user.allow_name2_display && ch_name && !isUser && !isSystem) { - mes = mes.replaceAll(`${ch_name}: `, ""); + mes = mes.replaceAll(`${ch_name}:`, ""); } return mes; @@ -1072,8 +1072,8 @@ function addCopyToCodeBlocks(messageElement) { const copiedMsg = document.createElement("div"); copiedMsg.classList.add('code-copied'); copiedMsg.innerText = "Copied!"; - copiedMsg.style.top = `${event.clientY - 55} px`; - copiedMsg.style.left = `${event.clientX - 55} px`; + copiedMsg.style.top = `${event.clientY - 55}px`; + copiedMsg.style.left = `${event.clientX - 55}px`; document.body.append(copiedMsg); setTimeout(() => { document.body.removeChild(copiedMsg); @@ -1148,14 +1148,14 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true $("#chat").append(HTMLForEachMes); } else { - const target = $("#chat").find(`.mes[mesid = "${insertAfter}"]`); + const target = $("#chat").find(`.mes[mesid="${insertAfter}"]`); $(HTMLForEachMes).insertAfter(target); $(HTMLForEachMes).find('.swipe_left').css('display', 'none'); $(HTMLForEachMes).find('.swipe_right').css('display', 'none'); } } - const newMessage = $(`#chat[mesid = "${count_view_mes}"]`); + const newMessage = $(`#chat [mesid="${count_view_mes}"]`); newMessage.data("isSystem", isSystem); if (isSystem) { @@ -1166,17 +1166,17 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true // don't need prompt button for user if (params.isUser === true) { newMessage.find(".mes_prompt").hide(); - console.log(`hiding prompt for user mesID ${params.mesId} `); + console.log(`hiding prompt for user mesID ${params.mesId}`); } //shows or hides the Prompt display button let mesIdToFind = Number(newMessage.attr('mesId')); if (itemizedPrompts.length !== 0) { - //console.log(`itemizedPrompt.length = ${ itemizedPrompts.length } `) + //console.log(`itemizedPrompt.length = ${itemizedPrompts.length}`) for (var i = 0; i < itemizedPrompts.length; i++) { if (itemizedPrompts[i].mesId === mesIdToFind) { newMessage.find(".mes_prompt").show(); - console.log(`showing prompt for mesID ${params.mesId} from ${params.characterName} `); + console.log(`showing prompt for mesID ${params.mesId} from ${params.characterName}`); } else { console.log(`no cache obj for mesID ${mesIdToFind}, hiding prompt button and continuing search`); newMessage.find(".mes_prompt").hide(); @@ -1191,23 +1191,23 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true newMessage.find('.avatar img').on('error', function () { $(this).hide(); - $(this).parent().html(`< div class="missing-avatar fa-solid fa-user-slash" > `); + $(this).parent().html(``); }); if (type === 'swipe') { - $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_text').html(''); - $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_text').append(messageText); - appendImageToMessage(mes, $("#chat").find(`[mesid = "${count_view_mes - 1}"]`)); - $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).attr('title', title); + $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').html(''); + $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_text').append(messageText); + appendImageToMessage(mes, $("#chat").find(`[mesid="${count_view_mes - 1}"]`)); + $("#chat").find(`[mesid="${count_view_mes - 1}"]`).attr('title', title); if (mes.swipe_id == mes.swipes.length - 1) { - $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_timer').text(params.timerValue); - $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_timer').attr('title', params.timerTitle); + $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_timer').text(params.timerValue); + $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_timer').attr('title', params.timerTitle); } else { - $("#chat").find(`[mesid = "${count_view_mes - 1}"]`).find('.mes_timer').html(''); + $("#chat").find(`[mesid="${count_view_mes - 1}"]`).find('.mes_timer').html(''); } } else { - $("#chat").find(`[mesid = "${count_view_mes}"]`).find('.mes_text').append(messageText); + $("#chat").find(`[mesid="${count_view_mes}"]`).find('.mes_text').append(messageText); appendImageToMessage(mes, newMessage); hideSwipeButtons(); count_view_mes++; @@ -1235,10 +1235,10 @@ function formatGenerationTimer(gen_started, gen_finished) { const start = moment(gen_started); const finish = moment(gen_finished); const seconds = finish.diff(start, 'seconds', true); - const timerValue = `${seconds.toFixed(1)} s`; + const timerValue = `${seconds.toFixed(1)}s`; const timerTitle = [ - `Generation queued: ${start.format(dateFormat)} `, - `Reply received: ${finish.format(dateFormat)} `, + `Generation queued: ${start.format(dateFormat)}`, + `Reply received: ${finish.format(dateFormat)}`, `Time to generate: ${seconds} seconds`, ].join('\n'); @@ -1267,9 +1267,9 @@ function substituteParams(content, _name1, _name2) { } function getStoppingStrings(isImpersonate, addSpace) { - const charString = `\n${name2}: `; - const youString = `\nYou: `; - const userString = `\n${name1}: `; + const charString = `\n${name2}:`; + const youString = `\nYou:`; + const userString = `\n${name1}:`; const result = isImpersonate ? [charString] : [youString]; result.push(userString); @@ -1282,7 +1282,7 @@ function getStoppingStrings(isImpersonate, addSpace) { const names = group.members .map(x => characters.find(y => y.avatar == x)) .filter(x => x && x.name !== name2) - .map(x => `\n${x.name}: `); + .map(x => `\n${x.name}:`); result.push(...names); } } @@ -1382,7 +1382,7 @@ function cleanGroupMessage(getMessage) { continue; } - const indexOfMember = getMessage.indexOf(`${name}: `); + const indexOfMember = getMessage.indexOf(`${name}:`); if (indexOfMember != -1) { getMessage = getMessage.substr(0, indexOfMember); } @@ -1456,8 +1456,8 @@ class StreamingProcessor { return; } - $(`#chat.mes[mesid = "${messageId}"].mes_stop`).css({ 'display': 'block' }); - $(`#chat.mes[mesid = "${messageId}"].mes_buttons`).css({ 'display': 'none' }); + $(`#chat .mes[mesid="${messageId}"] .mes_stop`).css({ 'display': 'block' }); + $(`#chat .mes[mesid="${messageId}"] .mes_buttons`).css({ 'display': 'none' }); } hideStopButton(messageId) { @@ -1465,8 +1465,8 @@ class StreamingProcessor { return; } - $(`#chat.mes[mesid = "${messageId}"].mes_stop`).css({ 'display': 'none' }); - $(`#chat.mes[mesid = "${messageId}"].mes_buttons`).css({ 'display': 'block' }); + $(`#chat .mes[mesid="${messageId}"] .mes_stop`).css({ 'display': 'none' }); + $(`#chat .mes[mesid="${messageId}"] .mes_buttons`).css({ 'display': 'block' }); } onStartStreaming(text) { @@ -1530,9 +1530,9 @@ class StreamingProcessor { chat[messageId].is_system, chat[messageId].is_user, ); - const mesText = $(`#chat.mes[mesid = "${messageId}"].mes_text`); + const mesText = $(`#chat .mes[mesid="${messageId}"] .mes_text`); mesText.html(formattedText); - $(`#chat.mes[mesid = "${messageId}"].mes_timer`).text(timePassed.timerValue).attr('title', timePassed.timerTitle); + $(`#chat .mes[mesid="${messageId}"] .mes_timer`).text(timePassed.timerValue).attr('title', timePassed.timerTitle); this.setFirstSwipe(messageId); } @@ -1542,7 +1542,7 @@ class StreamingProcessor { onFinishStreaming(messageId, text) { this.hideStopButton(this.messageId); this.onProgressStreaming(messageId, text, true); - addCopyToCodeBlocks($(`#chat.mes[mesid = "${messageId}"]`)); + addCopyToCodeBlocks($(`#chat .mes[mesid="${messageId}"]`)); saveChatConditional(); activateSendButtons(); showSwipeButtons(); @@ -1554,7 +1554,7 @@ class StreamingProcessor { if (power_user.auto_swipe) { function containsBlacklistedWords(str, blacklist, threshold) { - const regex = new RegExp(`\\b(${blacklist.join('|')}) \\b`, 'gi'); + const regex = new RegExp(`\\b(${blacklist.join('|')})\\b`, 'gi'); const matches = str.match(regex) || []; return matches.length >= threshold; } @@ -1764,7 +1764,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, power_user.custom_chat_separator ? power_user.custom_chat_separator : power_user.disable_examples_formatting ? '' : is_pygmalion ? '