From 6f7e7b85ab866ed60b1e4b26868f9889e4917cbc Mon Sep 17 00:00:00 2001 From: 50h100a Date: Sun, 24 Mar 2024 14:45:37 -0400 Subject: [PATCH 01/15] For Mancer: - Allow logprobs (works) - Allow multiswipe (not yet) - Adjust visible samplers Fix: 0 logprob is 100% chance, handle accordingly. --- public/index.html | 34 ++++++++++++++++-------------- public/script.js | 3 ++- public/scripts/logprobs.js | 2 +- public/scripts/textgen-settings.js | 20 ++++++++++++++---- 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/public/index.html b/public/index.html index 7c82d0b1b..fd08949a0 100644 --- a/public/index.html +++ b/public/index.html @@ -1167,7 +1167,7 @@
-
+
Multiple swipes per generation
@@ -1228,7 +1228,7 @@
-
+
Epsilon Cutoff
@@ -1236,7 +1236,7 @@
-
+
Eta Cutoff
@@ -1274,7 +1274,7 @@
-
+
Min Length @@ -1284,20 +1284,22 @@
-
+

-
- Smoothing Factor - - -
-
- Smoothing Curve - - +
+
+ Smoothing Factor + + +
+
+ Smoothing Curve + + +
-
+

@@ -1492,7 +1494,7 @@
-
+

CFG
diff --git a/public/script.js b/public/script.js index 5f2e92c4d..8d25226c7 100644 --- a/public/script.js +++ b/public/script.js @@ -4531,6 +4531,7 @@ function parseAndSaveLogprobs(data, continueFrom) { logprobs = data?.completion_probabilities?.map(x => parseTextgenLogprobs(x.content, [x])) || null; } break; case textgen_types.APHRODITE: + case textgen_types.MANCER: case textgen_types.TABBY: { logprobs = parseTabbyLogprobs(data) || null; } break; @@ -4585,7 +4586,7 @@ function extractMultiSwipes(data, type) { return swipes; } - if (main_api === 'openai' || (main_api === 'textgenerationwebui' && textgen_settings.type === textgen_types.APHRODITE)) { + if (main_api === 'openai' || main_api === 'mancer' || (main_api === 'textgenerationwebui' && textgen_settings.type === textgen_types.APHRODITE)) { if (!Array.isArray(data.choices)) { return swipes; } diff --git a/public/scripts/logprobs.js b/public/scripts/logprobs.js index 44884b898..2aef6e61b 100644 --- a/public/scripts/logprobs.js +++ b/public/scripts/logprobs.js @@ -139,7 +139,7 @@ function renderTopLogprobs() { const candidates = topLogprobs .sort(([, logA], [, logB]) => logB - logA) .map(([text, log]) => { - if (log < 0) { + if (log <= 0) { const probability = Math.exp(log); sum += probability; return [text, probability, log]; diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 7f22d0311..e12146f83 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -850,6 +850,7 @@ export function parseTextgenLogprobs(token, logprobs) { switch (settings.type) { case TABBY: case APHRODITE: + case MANCER: case OOBA: { /** @type {Record[]} */ const topLogprobs = logprobs.top_logprobs; @@ -971,6 +972,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'typical_p': settings.typical_p, 'typical': settings.typical_p, 'sampler_seed': settings.seed, + 'seed': settings.seed, 'min_p': settings.min_p, 'repetition_penalty': settings.rep_pen, 'frequency_penalty': settings.freq_pen, @@ -1000,12 +1002,12 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'skip_special_tokens': settings.skip_special_tokens, 'top_a': settings.top_a, 'tfs': settings.tfs, - 'epsilon_cutoff': settings.type === OOBA ? settings.epsilon_cutoff : undefined, - 'eta_cutoff': settings.type === OOBA ? settings.eta_cutoff : undefined, + 'epsilon_cutoff': [OOBA, MANCER].includes(settings.type) ? settings.epsilon_cutoff : undefined, + 'eta_cutoff': [OOBA, MANCER].includes(settings.type) ? settings.eta_cutoff : undefined, 'mirostat_mode': settings.mirostat_mode, 'mirostat_tau': settings.mirostat_tau, 'mirostat_eta': settings.mirostat_eta, - 'custom_token_bans': settings.type === textgen_types.APHRODITE ? + 'custom_token_bans': [APHRODITE, MANCER].includes(settings.type) ? toIntArray(getCustomTokenBans()) : getCustomTokenBans(), 'api_type': settings.type, @@ -1022,7 +1024,6 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'penalty_alpha': settings.type === OOBA ? settings.penalty_alpha : undefined, 'temperature_last': (settings.type === OOBA || settings.type === APHRODITE || settings.type == TABBY) ? settings.temperature_last : undefined, 'do_sample': settings.type === OOBA ? settings.do_sample : undefined, - 'seed': settings.seed, 'guidance_scale': cfgValues?.guidanceScale?.value ?? settings.guidance_scale ?? 1, 'negative_prompt': cfgValues?.negativePrompt ?? substituteParams(settings.negative_prompt) ?? '', 'grammar_string': settings.grammar_string, @@ -1045,6 +1046,17 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, //'logprobs': settings.log_probs_aphrodite, //'prompt_logprobs': settings.prompt_log_probs_aphrodite, }; + + if (settings.type === MANCER) { + params.n = canMultiSwipe ? settings.n : 1 + params.epsilon_cutoff /= 1000 + params.eta_cutoff /= 1000 + params.dynatemp_mode = + params.dynatemp_min = params.dynamic_temperature ? params.dynatemp_low : 0 + params.dynatemp_max = params.dynamic_temperature ? params.dynatemp_high : 0 + delete params.dynatemp_low, params.dynatemp_high + } + if (settings.type === APHRODITE) { params = Object.assign(params, aphroditeParams); } else { From df805d692b7c4db54cda87b99428251ade2f4d0a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:42:27 +0200 Subject: [PATCH 02/15] Fix some code --- public/script.js | 2 +- public/scripts/textgen-settings.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/script.js b/public/script.js index 8d25226c7..9349097c8 100644 --- a/public/script.js +++ b/public/script.js @@ -4586,7 +4586,7 @@ function extractMultiSwipes(data, type) { return swipes; } - if (main_api === 'openai' || main_api === 'mancer' || (main_api === 'textgenerationwebui' && textgen_settings.type === textgen_types.APHRODITE)) { + if (main_api === 'openai' || (main_api === 'textgenerationwebui' && [MANCER, APHRODITE].includes(textgen_settings.type))) { if (!Array.isArray(data.choices)) { return swipes; } diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index e12146f83..4236762e6 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -1048,13 +1048,13 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, }; if (settings.type === MANCER) { - params.n = canMultiSwipe ? settings.n : 1 - params.epsilon_cutoff /= 1000 - params.eta_cutoff /= 1000 - params.dynatemp_mode = - params.dynatemp_min = params.dynamic_temperature ? params.dynatemp_low : 0 - params.dynatemp_max = params.dynamic_temperature ? params.dynatemp_high : 0 - delete params.dynatemp_low, params.dynatemp_high + params.n = canMultiSwipe ? settings.n : 1; + params.epsilon_cutoff /= 1000; + params.eta_cutoff /= 1000; + params.dynatemp_mode = params.dynamic_temperature ? true : false; + params.dynatemp_min = params.dynamic_temperature ? params.dynatemp_low : 0; + params.dynatemp_max = params.dynamic_temperature ? params.dynatemp_high : 0; + delete params.dynatemp_low, params.dynatemp_high; } if (settings.type === APHRODITE) { From 4caa3b4f208c45e8c7ea612f849410a3c4c66463 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 24 Mar 2024 21:49:12 +0200 Subject: [PATCH 03/15] And then there were none --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index fd08949a0..66de9a383 100644 --- a/public/index.html +++ b/public/index.html @@ -1494,7 +1494,7 @@

-
+

CFG
From 7c3ffcb3b1b9b9a8d5b505e0493445ab6203b346 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Mon, 25 Mar 2024 09:04:41 -0400 Subject: [PATCH 04/15] qr editor wrap toggle --- .../extensions/quick-reply/html/qrEditor.html | 10 +++++++++- .../extensions/quick-reply/src/QuickReply.js | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/quick-reply/html/qrEditor.html b/public/scripts/extensions/quick-reply/html/qrEditor.html index 74027cbd7..24a149333 100644 --- a/public/scripts/extensions/quick-reply/html/qrEditor.html +++ b/public/scripts/extensions/quick-reply/html/qrEditor.html @@ -13,7 +13,15 @@

- + + + +
diff --git a/public/scripts/extensions/quick-reply/src/QuickReply.js b/public/scripts/extensions/quick-reply/src/QuickReply.js index 8a6477f67..2cc817fb5 100644 --- a/public/scripts/extensions/quick-reply/src/QuickReply.js +++ b/public/scripts/extensions/quick-reply/src/QuickReply.js @@ -207,8 +207,23 @@ export class QuickReply { title.addEventListener('input', () => { this.updateTitle(title.value); }); + /**@type {HTMLInputElement}*/ + const wrap = dom.querySelector('#qr--modal-wrap'); + wrap.checked = JSON.parse(localStorage.getItem('qr--wrap')); + wrap.addEventListener('click', () => { + localStorage.setItem('qr--wrap', JSON.stringify(wrap.checked)); + updateWrap(); + }); + const updateWrap = () => { + if (wrap.checked) { + message.style.whiteSpace = 'pre-wrap'; + } else { + message.style.whiteSpace = 'pre'; + } + }; /**@type {HTMLTextAreaElement}*/ const message = dom.querySelector('#qr--modal-message'); + updateWrap(); message.value = this.message; message.addEventListener('input', () => { this.updateMessage(message.value); From f3f954f5dafffc11441a9db800f61c509637404f Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Mon, 25 Mar 2024 09:04:57 -0400 Subject: [PATCH 05/15] add style for horizontal scrollbars --- public/style.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/style.css b/public/style.css index 5eae58cab..40e64641c 100644 --- a/public/style.css +++ b/public/style.css @@ -139,6 +139,7 @@ body { ::-webkit-scrollbar { width: 10px; + height: 10px; scrollbar-gutter: stable; } @@ -146,7 +147,7 @@ body { overflow-y: auto !important; } -::-webkit-scrollbar-thumb { +::-webkit-scrollbar-thumb:vertical { background-color: var(--grey7070a); box-shadow: inset 0 0 0 1px var(--black50a); border-radius: 10px; @@ -155,6 +156,15 @@ body { border-top: 20px solid transparent; min-height: 40px; } +::-webkit-scrollbar-thumb:horizontal { + background-color: var(--grey7070a); + box-shadow: inset 0 0 0 1px var(--black50a); + border-radius: 10px; + background-clip: content-box; + border: 2px solid transparent; + border-left: 20px solid transparent; + min-width: 40px; +} table.responsiveTable { width: 100%; From c6f2504549a6949d1d8821b01e418e32669e90fc Mon Sep 17 00:00:00 2001 From: DreamGenX Date: Mon, 25 Mar 2024 16:18:56 +0100 Subject: [PATCH 06/15] DreamGen API Help: Link to guide rather than API Keys page. --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 1a93e0c31..0a6525ab0 100644 --- a/public/index.html +++ b/public/index.html @@ -2040,7 +2040,7 @@

DreamGen API key - +

From 8b092adc149f7c7875011a0752d558e673b663a4 Mon Sep 17 00:00:00 2001 From: 50h100a <136940546+50h100a@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:25:03 -0400 Subject: [PATCH 07/15] Use mode enum to toggle dynatemp behavior. --- public/scripts/textgen-settings.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 4236762e6..b16b67173 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -1051,9 +1051,9 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, params.n = canMultiSwipe ? settings.n : 1; params.epsilon_cutoff /= 1000; params.eta_cutoff /= 1000; - params.dynatemp_mode = params.dynamic_temperature ? true : false; - params.dynatemp_min = params.dynamic_temperature ? params.dynatemp_low : 0; - params.dynatemp_max = params.dynamic_temperature ? params.dynatemp_high : 0; + params.dynatemp_mode = params.dynamic_temperature ? 1 : 0; + params.dynatemp_min = params.dynatemp_low; + params.dynatemp_max = params.dynatemp_high; delete params.dynatemp_low, params.dynatemp_high; } From e9b05d4adc716b12cb9d90f4b643dd35510fea4f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:37:32 +0200 Subject: [PATCH 08/15] Indicate injected items by extension prompts in finalMesSend --- public/script.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 7d45e9e8d..9d71f2b81 100644 --- a/public/script.js +++ b/public/script.js @@ -3237,8 +3237,9 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu } // Inject all Depth prompts. Chat Completion does it separately + let injectedIndices = []; if (main_api !== 'openai') { - doChatInject(coreChat, isContinue); + injectedIndices = doChatInject(coreChat, isContinue); } // Insert character jailbreak as the last user message (if exists, allowed, preferred, and not using Chat Completion) @@ -3656,6 +3657,10 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu return combinedPrompt; }; + finalMesSend.forEach((item, i) => { + item.injected = Array.isArray(injectedIndices) && injectedIndices.includes(i); + }); + let data = { api: main_api, combinedPrompt: null, @@ -3973,9 +3978,10 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu * Injects extension prompts into chat messages. * @param {object[]} messages Array of chat messages * @param {boolean} isContinue Whether the generation is a continuation. If true, the extension prompts of depth 0 are injected at position 1. - * @returns {void} + * @returns {number[]} Array of indices where the extension prompts were injected */ function doChatInject(messages, isContinue) { + const injectedIndices = []; let totalInsertedMessages = 0; messages.reverse(); @@ -4014,10 +4020,16 @@ function doChatInject(messages, isContinue) { const injectIdx = depth + totalInsertedMessages; messages.splice(injectIdx, 0, ...roleMessages); totalInsertedMessages += roleMessages.length; + injectedIndices.push(...Array.from({ length: roleMessages.length }, (_, i) => injectIdx + i)); } } + for (let i = 0; i < injectedIndices.length; i++) { + injectedIndices[i] = messages.length - injectedIndices[i] - 1; + } + messages.reverse(); + return injectedIndices; } function flushWIDepthInjections() { From 5216d5c8c06fb2981ab937b374f76ab9f05f06e1 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 25 Mar 2024 19:00:14 +0200 Subject: [PATCH 09/15] Fallback for token count display --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index e319cce64..418149c72 100644 --- a/public/script.js +++ b/public/script.js @@ -2028,7 +2028,7 @@ function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll = true forceAvatar: mes.force_avatar, timestamp: timestamp, extra: mes.extra, - tokenCount: mes.extra?.token_count, + tokenCount: mes.extra?.token_count ?? 0, ...formatGenerationTimer(mes.gen_started, mes.gen_finished, mes.extra?.token_count), }; From f65d4fd589fb847432dc105a5d9c5d6d05e3a0a4 Mon Sep 17 00:00:00 2001 From: DreamGenX Date: Mon, 25 Mar 2024 18:08:29 +0100 Subject: [PATCH 10/15] DreamGen API Help: Link to guide rather than API Keys page. --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 0a6525ab0..80d61b8fe 100644 --- a/public/index.html +++ b/public/index.html @@ -2040,7 +2040,7 @@

DreamGen API key - +

From 4527880c59aa91bc1e303669dce772cc3a53d58c Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Mon, 25 Mar 2024 20:55:48 +0100 Subject: [PATCH 11/15] Add additional update script for forks/branches (#1963) --- Update-Instructions.txt | 3 ++ UpdateForkAndStart.bat | 103 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 UpdateForkAndStart.bat diff --git a/Update-Instructions.txt b/Update-Instructions.txt index b862f8907..f153660b2 100644 --- a/Update-Instructions.txt +++ b/Update-Instructions.txt @@ -22,6 +22,9 @@ You can also try running the 'UpdateAndStart.bat' file, which will almost do the Alternatively, if the command prompt gives you problems (and you have GitHub Desktop installed), you can use the 'Repository' menu and select 'Pull'. The updates are applied automatically and safely. +If you are a developer and use a fork of ST or switch branches regularly, you can use the 'UpdateForkAndStart.bat', which works similarly to 'UpdateAndStart.bat', +but automatically pulls changes into your fork and handles switched branches gracefully by asking if you want to switch back. + Method 2 - ZIP If you insist on installing via a zip, here is the tedious process for doing the update: diff --git a/UpdateForkAndStart.bat b/UpdateForkAndStart.bat new file mode 100644 index 000000000..5052b9aa0 --- /dev/null +++ b/UpdateForkAndStart.bat @@ -0,0 +1,103 @@ +@echo off +@setlocal enabledelayedexpansion +pushd %~dp0 + +echo Checking Git installation +git --version > nul 2>&1 +if %errorlevel% neq 0 ( + echo Git is not installed on this system. Skipping update. + echo If you installed with a zip file, you will need to download the new zip and install it manually. + goto end +) + +REM Checking current branch +FOR /F "tokens=*" %%i IN ('git rev-parse --abbrev-ref HEAD') DO SET CURRENT_BRANCH=%%i +echo Current branch: %CURRENT_BRANCH% + +REM Checking for automatic branch switching configuration +set AUTO_SWITCH= +FOR /F "tokens=*" %%j IN ('git config --local script.autoSwitch') DO SET AUTO_SWITCH=%%j + +SET TARGET_BRANCH=%CURRENT_BRANCH% + +if NOT "!AUTO_SWITCH!"=="" ( + if "!AUTO_SWITCH!"=="s" ( + goto autoswitch-staging + ) + if "!AUTO_SWITCH!"=="r" ( + goto autoswitch-release + ) + + if "!AUTO_SWITCH!"=="staging" ( + :autoswitch-staging + echo Auto-switching to staging branch + git checkout staging + SET TARGET_BRANCH=staging + goto update + ) + if "!AUTO_SWITCH!"=="release" ( + :autoswitch-release + echo Auto-switching to release branch + git checkout release + SET TARGET_BRANCH=release + goto update + ) + + echo Auto-switching defined to stay on current branch + goto update +) + +if "!CURRENT_BRANCH!"=="staging" ( + echo Staying on the current branch + goto update +) +if "!CURRENT_BRANCH!"=="release" ( + echo Staying on the current branch + goto update +) + +echo You are not on 'staging' or 'release'. You are on '!CURRENT_BRANCH!'. +set /p "CHOICE=Do you want to switch to 'staging' (s), 'release' (r), or stay (any other key)? " +if /i "!CHOICE!"=="s" ( + echo Switching to staging branch + git checkout staging + SET TARGET_BRANCH=staging + goto update +) +if /i "!CHOICE!"=="r" ( + echo Switching to release branch + git checkout release + SET TARGET_BRANCH=release + goto update +) + +echo Staying on the current branch + +:update +REM Checking for 'upstream' remote +git remote | findstr "upstream" > nul +if %errorlevel% equ 0 ( + echo Updating and rebasing against 'upstream' + git fetch upstream + git rebase upstream/%TARGET_BRANCH% --autostash + goto install +) + +echo Updating and rebasing against 'origin' +git pull --rebase --autostash origin %TARGET_BRANCH% + + +:install +if %errorlevel% neq 0 ( + echo There were errors while updating. Please check manually. + goto end +) + +echo Installing npm packages and starting server +set NODE_ENV=production +call npm install --no-audit --no-fund --quiet --omit=dev +node server.js %* + +:end +pause +popd From 7c0cf50d806ad4f09dc1829b1d505c9e43e2e984 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 26 Mar 2024 00:07:26 +0200 Subject: [PATCH 12/15] #1966 Fix selector --- public/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 418149c72..38ed270cd 100644 --- a/public/script.js +++ b/public/script.js @@ -5670,7 +5670,7 @@ export async function getUserAvatars(doRender = true, openPageAt = '') { function highlightSelectedAvatar() { $('#user_avatar_block .avatar-container').removeClass('selected'); - $(`#user_avatar_block .avatar-container[imgfile='${user_avatar}']`).addClass('selected'); + $(`#user_avatar_block .avatar-container[imgfile="${user_avatar}"]`).addClass('selected'); } /** From 6fa6f0c81552d2c43e38086072e826b14e431933 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:10:55 +0200 Subject: [PATCH 13/15] Fix panel buttons alignment --- public/index.html | 24 ++++++++++++------------ public/style.css | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/public/index.html b/public/index.html index b793f87f6..751cce6b3 100644 --- a/public/index.html +++ b/public/index.html @@ -5236,12 +5236,12 @@
-
-
-
- +
+
+
+
-
+
@@ -5380,12 +5380,12 @@
-
-
-
- +
+
+
+
-
+
@@ -5693,8 +5693,8 @@
-
-
+
+
diff --git a/public/style.css b/public/style.css index d4c4a1855..91932cb47 100644 --- a/public/style.css +++ b/public/style.css @@ -528,6 +528,7 @@ body.reduced-motion #bg_custom { top: 5px; margin-right: 5px; z-index: 2000; + min-width: 55px; } .panelControlBar .drag-grabber { From 78ba88f94ffdb840a9b8a367bebcdbf6fb1eb1cf Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Tue, 26 Mar 2024 12:21:22 -0400 Subject: [PATCH 14/15] set active character / active group in /go command --- public/scripts/slash-commands.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index a954404c0..76d4b11db 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -25,6 +25,8 @@ import { saveChatConditional, sendMessageAsUser, sendSystemMessage, + setActiveCharacter, + setActiveGroup, setCharacterId, setCharacterName, setExtensionPrompt, @@ -1248,11 +1250,15 @@ async function goToCharacterCallback(_, name) { if (characterIndex !== -1) { await openChat(new String(characterIndex)); + setActiveCharacter(characters[characterIndex]?.avatar); + setActiveGroup(null); return characters[characterIndex]?.name; } else { const group = groups.find(it => it.name.toLowerCase() == name.toLowerCase()); if (group) { await openGroupById(group.id); + setActiveCharacter(null); + setActiveGroup(group.id); return group.name; } else { console.warn(`No matches found for name "${name}"`); From 4e7cd6d63b096f3242e2303c8d3902717c056954 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:30:12 +0200 Subject: [PATCH 15/15] Set active character for /random --- public/scripts/power-user.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index 5628793bc..d0cc3fc06 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -21,6 +21,8 @@ import { saveChatConditional, setAnimationDuration, ANIMATION_DURATION_DEFAULT, + setActiveGroup, + setActiveCharacter, } from '../script.js'; import { isMobile, initMovingUI, favsToHotswap } from './RossAscends-mods.js'; import { @@ -2302,6 +2304,8 @@ async function doRandomChat() { resetSelectedGroup(); const characterId = Math.floor(Math.random() * characters.length).toString(); setCharacterId(characterId); + setActiveCharacter(characters[characterId]?.avatar); + setActiveGroup(null); await delay(1); await reloadCurrentChat(); return characters[characterId]?.name;