From 905131c764eed6a48a3dd1a71f759aecb6967aad Mon Sep 17 00:00:00 2001 From: SDS <52386626+StefanDanielSchwarz@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:46:53 +0200 Subject: [PATCH 1/9] Update Deterministic.settings Go back down to 2048 tokens instead of 4096 to be in line with the other non-Llama 2-specific presets --- public/KoboldAI Settings/Deterministic.settings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/KoboldAI Settings/Deterministic.settings b/public/KoboldAI Settings/Deterministic.settings index dfd3f3c3d..ecf38562a 100644 --- a/public/KoboldAI Settings/Deterministic.settings +++ b/public/KoboldAI Settings/Deterministic.settings @@ -1,9 +1,9 @@ { "genamt": 300, - "max_length": 4096, + "max_length": 2048, "temp": 0, "rep_pen": 1.1, - "rep_pen_range": 4096, + "rep_pen_range": 2048, "streaming_kobold": true, "top_p": 0, "top_a": 0, From 1f56f0d64a50dd1ac306dc64859f7d29afb5637c Mon Sep 17 00:00:00 2001 From: SDS <52386626+StefanDanielSchwarz@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:47:59 +0200 Subject: [PATCH 2/9] Update simple-proxy-for-tavern.settings Go back down to 2048 tokens instead of 4096 to be in line with the other non-Llama 2-specific presets --- public/KoboldAI Settings/simple-proxy-for-tavern.settings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/KoboldAI Settings/simple-proxy-for-tavern.settings b/public/KoboldAI Settings/simple-proxy-for-tavern.settings index 1392907b5..c4fbee1eb 100644 --- a/public/KoboldAI Settings/simple-proxy-for-tavern.settings +++ b/public/KoboldAI Settings/simple-proxy-for-tavern.settings @@ -1,9 +1,9 @@ { "genamt": 250, - "max_length": 4096, + "max_length": 2048, "temp": 0.65, "rep_pen": 1.18, - "rep_pen_range": 4096, + "rep_pen_range": 2048, "streaming_kobold": true, "top_p": 0.47, "top_a": 0, From ea0fe349cd48916859dc7fea311e1b1c277ae0db Mon Sep 17 00:00:00 2001 From: SDS <52386626+StefanDanielSchwarz@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:55:09 +0200 Subject: [PATCH 3/9] Update readme.md Added myself to the credits list in the Readme doc [as suggested](https://github.com/SillyTavern/SillyTavern/pull/848#issuecomment-1662510842) --- .github/readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/readme.md b/.github/readme.md index d24787189..1bed0e5fd 100644 --- a/.github/readme.md +++ b/.github/readme.md @@ -293,6 +293,7 @@ GNU Affero General Public License for more details.** * RossAscends' additions: AGPL v3 * Portions of CncAnon's TavernAITurbo mod: Unknown license * kingbri's various commits and suggestions () +* StefanDanielSchwarz's various commits and bug reports () * Waifu mode inspired by the work of PepperTaco () * Thanks Pygmalion University for being awesome testers and suggesting cool features! * Thanks oobabooga for compiling presets for TextGen From c760447288ad2f7c46e166156eb94ab97dab53c0 Mon Sep 17 00:00:00 2001 From: SDS <52386626+StefanDanielSchwarz@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:56:01 +0200 Subject: [PATCH 4/9] Update readme-zh_cn.md Added myself to the credits list in the Readme doc [as suggested](https://github.com/SillyTavern/SillyTavern/pull/848#issuecomment-1662510842) --- .github/readme-zh_cn.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/readme-zh_cn.md b/.github/readme-zh_cn.md index ad0079ea4..5a3716e52 100644 --- a/.github/readme-zh_cn.md +++ b/.github/readme-zh_cn.md @@ -291,6 +291,7 @@ SillyTavern 会将 API 密钥保存在目录中的 `secrets.json` 文件内。 * RossAscends' additions: AGPL v3 * Portions of CncAnon's TavernAITurbo mod: Unknown license * kingbri's various commits and suggestions (https://github.com/bdashore3) +* StefanDanielSchwarz's various commits and bug reports (https://github.com/StefanDanielSchwarz) * Waifu mode inspired by the work of PepperTaco (https://github.com/peppertaco/Tavern/) * Thanks Pygmalion University for being awesome testers and suggesting cool features! * Thanks oobabooga for compiling presets for TextGen From 9f44a72d768e12602775188749b284bfb06131c0 Mon Sep 17 00:00:00 2001 From: joe Date: Thu, 3 Aug 2023 19:05:21 +0900 Subject: [PATCH 5/9] Setting Tracking Live2d --- .../scripts/extensions/expressions/index.js | 81 +++++++++---------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index 67cbfd0e8..4213516af 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -45,7 +45,6 @@ let lastCharacter = undefined; let lastMessage = null; let spriteCache = {}; let inApiCall = false; -let live2d_var = false; let previousSrc = null; @@ -448,8 +447,7 @@ async function loadLiveChar() { } } - -function handleImageChange(isChecked) { +function handleImageChange() { const imgElement = document.querySelector('img#expression-image.expression'); if (!imgElement) { @@ -457,31 +455,30 @@ function handleImageChange(isChecked) { return; } - if (isChecked) { + if (extension_settings.expressions.live2d) { + previousSrc = imgElement.src; // Method get IP of endpoint - if (imgElement.src !== getApiUrl() + '/api/live2d/result_feed') { - const expressionListItemElement = document.querySelector('#live2d'); - const expressionImageElement = expressionListItemElement.querySelector('.expression_list_image'); - const newSrc = expressionImageElement.src; + const live2dResultFeedSrc = `${getApiUrl()}/api/live2d/result_feed`; + if (imgElement.src !== live2dResultFeedSrc) { + const expressionImageElement = document.querySelector('.expression_list_image'); - doExtrasFetch(newSrc, { - method: 'HEAD', - }) - .then(response => { - if (response.ok) { - imgElement.src = getApiUrl() + '/api/live2d/result_feed'; - } + if (expressionImageElement) { + doExtrasFetch(expressionImageElement.src, { + method: 'HEAD', }) - .catch(error => { - console.error(error); // Log the error if necessary - }); - } else if (previousSrc) { - imgElement.src = previousSrc; // Revert the src to its previous value + .then(response => { + if (response.ok) { + imgElement.src = live2dResultFeedSrc; + } + }) + .catch(error => { + console.error(error); // Log the error if necessary + }); + } } - } else if (previousSrc !== null) { - imgElement.src = previousSrc; // Revert the src to its previous value + } else { + setExpression(getContext().name2, "neutral", true); } - live2d_var = isChecked; } async function moduleWorker() { @@ -497,22 +494,16 @@ async function moduleWorker() { if (context.groupId !== lastCharacter && context.characterId !== lastCharacter) { removeExpression(); spriteCache = {}; - previousSrc = null; - //uncheck live image - let checkbox = document.getElementById('image_type_toggle'); - if (checkbox.checked) { - checkbox.click(); - } - //clear expression let imgElement = document.getElementById('expression-image'); imgElement.src = ""; - //Load new char - if (live2d_var) { - loadLiveChar(); + //set checkbox to global var + $('#image_type_toggle').prop('checked', extension_settings.expressions.live2d); + if(extension_settings.expressions.live2d == true){ + live2d(extension_settings.expressions.live2d); } } @@ -618,6 +609,14 @@ async function moduleWorker() { } } +function live2d(switch_var){ + extension_settings.expressions.live2d = switch_var; // Store setting + saveSettingsDebounced(); + + if (extension_settings.expressions.live2d) { loadLiveChar(); } // load char as needed + handleImageChange(switch_var); // Change image as needed +} + function getSpriteFolderName(message) { const context = getContext(); let avatarPath = ''; @@ -805,7 +804,7 @@ async function getExpressionsList() { } async function setExpression(character, expression, force) { - if (live2d_var == false) { + if (extension_settings.expressions.live2d == false) { console.debug('entered setExpressions'); await validateImages(character); @@ -915,7 +914,9 @@ async function setExpression(character, expression, force) { } document.getElementById("expression-holder").style.display = ''; - if (live2d_var == true) { + } else { + + if (extension_settings.expressions.live2d == true) { // Find the element with id="expression-image" and class="expression" const imgElement = document.querySelector('img#expression-image.expression'); //console.log("searching"); @@ -1234,13 +1235,8 @@ function setExpressionOverrideHtml(forceClear = false) { $(window).on("resize", updateVisualNovelModeDebounced); $('.expression_settings').hide(); - - $('#image_type_toggle').on('change', function () { - const isChecked = this.checked; - if (isChecked) { - loadLiveChar(); - } - handleImageChange(isChecked); + $('#image_type_toggle').on('click', function () { + live2d(this.checked); }); } @@ -1253,7 +1249,6 @@ function setExpressionOverrideHtml(forceClear = false) { moduleWorker(); dragElement($("#expression-holder")) eventSource.on(event_types.CHAT_CHANGED, () => { - //console.log("checked: " + live2d_var); setExpressionOverrideHtml(); if (isVisualNovelMode()) { From aebdd6cd42f1d8162a2bbddead9154c544c49415 Mon Sep 17 00:00:00 2001 From: joe Date: Thu, 3 Aug 2023 19:23:15 +0900 Subject: [PATCH 6/9] Fallback expression and tweak --- public/scripts/extensions/expressions/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index 4213516af..ee9749c87 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -477,7 +477,8 @@ function handleImageChange() { } } } else { - setExpression(getContext().name2, "neutral", true); + imgElement.src = ""; //remove incase char doesnt have expressions + setExpression(getContext().name2, FALLBACK_EXPRESSION, true); } } From 4b7c837fe37193814bb31fdcbfc672326beaa530 Mon Sep 17 00:00:00 2001 From: joe Date: Thu, 3 Aug 2023 19:29:48 +0900 Subject: [PATCH 7/9] Removed unneeded IF --- public/scripts/extensions/expressions/index.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index ee9749c87..f6c593065 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -449,7 +449,7 @@ async function loadLiveChar() { function handleImageChange() { const imgElement = document.querySelector('img#expression-image.expression'); - + if (!imgElement) { console.log("Cannot find addExpressionImage()"); return; @@ -504,7 +504,7 @@ async function moduleWorker() { //set checkbox to global var $('#image_type_toggle').prop('checked', extension_settings.expressions.live2d); if(extension_settings.expressions.live2d == true){ - live2d(extension_settings.expressions.live2d); + setLive2dState(extension_settings.expressions.live2d); } } @@ -610,7 +610,7 @@ async function moduleWorker() { } } -function live2d(switch_var){ +function setLive2dState(switch_var){ extension_settings.expressions.live2d = switch_var; // Store setting saveSettingsDebounced(); @@ -916,16 +916,13 @@ async function setExpression(character, expression, force) { document.getElementById("expression-holder").style.display = ''; } else { - - if (extension_settings.expressions.live2d == true) { // Find the element with id="expression-image" and class="expression" const imgElement = document.querySelector('img#expression-image.expression'); //console.log("searching"); if (imgElement) { console.log("setting value"); imgElement.src = getApiUrl() + '/api/live2d/result_feed'; - } - } + } } } @@ -1237,7 +1234,7 @@ function setExpressionOverrideHtml(forceClear = false) { $('.expression_settings').hide(); $('#image_type_toggle').on('click', function () { - live2d(this.checked); + setLive2dState(this.checked); }); } From 0a12fe0bdba393c3cbdf6cedc4e67683b56d0a6a Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 3 Aug 2023 14:07:50 +0300 Subject: [PATCH 8/9] Unhide expression holder on setting live2d sprite --- public/scripts/extensions/expressions/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index f6c593065..64210a415 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -449,7 +449,7 @@ async function loadLiveChar() { function handleImageChange() { const imgElement = document.querySelector('img#expression-image.expression'); - + if (!imgElement) { console.log("Cannot find addExpressionImage()"); return; @@ -459,6 +459,7 @@ function handleImageChange() { previousSrc = imgElement.src; // Method get IP of endpoint const live2dResultFeedSrc = `${getApiUrl()}/api/live2d/result_feed`; + $('#expression-holder').css({ display: '' }); if (imgElement.src !== live2dResultFeedSrc) { const expressionImageElement = document.querySelector('.expression_list_image'); @@ -922,7 +923,7 @@ async function setExpression(character, expression, force) { if (imgElement) { console.log("setting value"); imgElement.src = getApiUrl() + '/api/live2d/result_feed'; - } + } } } From 37e653dcf477666997e9b0bb56a5ba870c7855fc Mon Sep 17 00:00:00 2001 From: Cohee Date: Thu, 3 Aug 2023 14:24:45 +0300 Subject: [PATCH 9/9] Add toggle for persona info notifications --- public/index.html | 8 ++++++++ public/script.js | 34 +++++++++++++++++++++++----------- public/scripts/power-user.js | 9 ++++++++- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/public/index.html b/public/index.html index 4a04a45e8..5170e54d5 100644 --- a/public/index.html +++ b/public/index.html @@ -2639,6 +2639,14 @@ +
+ +

diff --git a/public/script.js b/public/script.js index a5a84e7c5..bc63dee2e 100644 --- a/public/script.js +++ b/public/script.js @@ -4554,7 +4554,9 @@ export function setUserName(value) { name1 = default_user_name; console.log(`User name changed to ${name1}`); $("#your_name").val(name1); - toastr.success(`Your messages will now be sent as ${name1}`, 'Current persona updated'); + if (power_user.persona_show_notifications) { + toastr.success(`Your messages will now be sent as ${name1}`, 'Current persona updated'); + } saveSettings("change_name"); } @@ -4653,7 +4655,7 @@ function setUserAvatar() { const personaName = power_user.personas[user_avatar]; if (personaName && name1 !== personaName) { const lockedPersona = chat_metadata['persona']; - if (lockedPersona && lockedPersona !== user_avatar) { + if (lockedPersona && lockedPersona !== user_avatar && power_user.persona_show_notifications) { toastr.info( `To permanently set "${personaName}" as the selected persona, unlock and relock it using the "Lock" button. Otherwise, the selection resets upon reloading the chat.`, `This chat is locked to a different persona (${power_user.personas[lockedPersona]}).`, @@ -4760,7 +4762,9 @@ async function setDefaultPersona() { } console.log(`Removing default persona ${avatarId}`); - toastr.info('This persona will no longer be used by default when you open a new chat.', `Default persona removed`); + if (power_user.persona_show_notifications) { + toastr.info('This persona will no longer be used by default when you open a new chat.', `Default persona removed`); + } delete power_user.default_persona; } else { const confirm = await callPopup(`

Are you sure you want to set "${personaName}" as the default persona?

@@ -4772,7 +4776,9 @@ async function setDefaultPersona() { } power_user.default_persona = avatarId; - toastr.success('This persona will be used by default when you open a new chat.', `Default persona set to ${personaName}`); + if (power_user.persona_show_notifications) { + toastr.success('This persona will be used by default when you open a new chat.', `Default persona set to ${personaName}`); + } } saveSettingsDebounced(); @@ -4835,18 +4841,22 @@ function lockUserNameToChat() { console.log(`Unlocking persona for this chat ${chat_metadata['persona']}`); delete chat_metadata['persona']; saveMetadata(); - toastr.info('User persona is now unlocked for this chat. Click the "Lock" again to revert.', 'Persona unlocked'); + if (power_user.persona_show_notifications) { + toastr.info('User persona is now unlocked for this chat. Click the "Lock" again to revert.', 'Persona unlocked'); + } updateUserLockIcon(); return; } if (!(user_avatar in power_user.personas)) { console.log(`Creating a new persona ${user_avatar}`); - toastr.info( - 'Creating a new persona for currently selected user name and avatar...', - 'Persona not set for this avatar', - { timeOut: 10000, extendedTimeOut: 20000, }, - ); + if (power_user.persona_show_notifications) { + toastr.info( + 'Creating a new persona for currently selected user name and avatar...', + 'Persona not set for this avatar', + { timeOut: 10000, extendedTimeOut: 20000, }, + ); + } power_user.personas[user_avatar] = name1; power_user.persona_descriptions[user_avatar] = { description: '', position: persona_description_positions.BEFORE_CHAR }; } @@ -4855,7 +4865,9 @@ function lockUserNameToChat() { saveMetadata(); saveSettingsDebounced(); console.log(`Locking persona for this chat ${user_avatar}`); - toastr.success(`User persona is locked to ${name1} in this chat`); + if (power_user.persona_show_notifications) { + toastr.success(`User persona is locked to ${name1} in this chat`); + } updateUserLockIcon(); } diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 133db46e8..d28119a61 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -27,7 +27,7 @@ import { import { registerSlashCommand } from "./slash-commands.js"; -import { delay, debounce } from "./utils.js"; +import { delay } from "./utils.js"; export { loadPowerUserSettings, @@ -184,6 +184,7 @@ let power_user = { persona_description: '', persona_description_position: persona_description_positions.BEFORE_CHAR, + persona_show_notifications: true, custom_stopping_strings: '', fuzzy_search: false, @@ -678,6 +679,7 @@ function loadPowerUserSettings(settings, data) { $('#auto_swipe_blacklist_threshold').val(power_user.auto_swipe_blacklist_threshold); $('#custom_stopping_strings').val(power_user.custom_stopping_strings); $('#fuzzy_search_checkbox').prop("checked", power_user.fuzzy_search); + $('#persona_show_notifications').prop("checked", power_user.persona_show_notifications); $("#console_log_prompts").prop("checked", power_user.console_log_prompts); $('#auto_fix_generated_markdown').prop("checked", power_user.auto_fix_generated_markdown); @@ -1998,6 +2000,11 @@ $(document).ready(() => { saveSettingsDebounced(); }); + $('#persona_show_notifications').on('input', function () { + power_user.persona_show_notifications = !!$(this).prop('checked'); + saveSettingsDebounced(); + }); + $(window).on('focus', function () { browser_has_focus = true; });