Merge branch 'staging' into parser-v2

This commit is contained in:
LenAnderson
2024-03-26 13:14:28 -04:00
11 changed files with 218 additions and 41 deletions

View File

@ -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'. 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. 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 Method 2 - ZIP
If you insist on installing via a zip, here is the tedious process for doing the update: If you insist on installing via a zip, here is the tedious process for doing the update:

103
UpdateForkAndStart.bat Normal file
View File

@ -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

View File

@ -1167,7 +1167,7 @@
<div class="fa-solid fa-circle-info opacity50p" title="Set all samplers to their neutral/disabled state." data-i18n="[title]Set all samplers to their neutral/disabled state."></div> <div class="fa-solid fa-circle-info opacity50p" title="Set all samplers to their neutral/disabled state." data-i18n="[title]Set all samplers to their neutral/disabled state."></div>
</small> </small>
</div> </div>
<div data-newbie-hidden data-tg-type="aphrodite" class="flex-container flexFlowColumn alignitemscenter flexBasis100p flexGrow flexShrink gap0"> <div data-newbie-hidden data-tg-type="mancer, aphrodite" class="flex-container flexFlowColumn alignitemscenter flexBasis100p flexGrow flexShrink gap0">
<small data-i18n="Multiple swipes per generation">Multiple swipes per generation</small> <small data-i18n="Multiple swipes per generation">Multiple swipes per generation</small>
<input type="number" id="n_textgenerationwebui" class="text_pole textAlignCenter" min="1" value="1" step="1" /> <input type="number" id="n_textgenerationwebui" class="text_pole textAlignCenter" min="1" value="1" step="1" />
</div> </div>
@ -1228,7 +1228,7 @@
<input class="neo-range-slider" type="range" id="tfs_textgenerationwebui" name="volume" min="0" max="1" step="0.01"> <input class="neo-range-slider" type="range" id="tfs_textgenerationwebui" name="volume" min="0" max="1" step="0.01">
<input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="tfs_textgenerationwebui" id="tfs_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="1" step="0.01" data-for="tfs_textgenerationwebui" id="tfs_counter_textgenerationwebui">
</div> </div>
<div data-newbie-hidden data-tg-type="ooba" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div data-newbie-hidden data-tg-type="ooba,mancer" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small> <small>
<span data-i18n="Epsilon Cutoff">Epsilon Cutoff</span> <span data-i18n="Epsilon Cutoff">Epsilon Cutoff</span>
<div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Epsilon cutoff sets a probability floor below which tokens are excluded from being sampled" title="Epsilon cutoff sets a probability floor below which tokens are excluded from being sampled.&#13;In units of 1e-4; a reasonable value is 3.&#13;Set to 0 to disable."></div> <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Epsilon cutoff sets a probability floor below which tokens are excluded from being sampled" title="Epsilon cutoff sets a probability floor below which tokens are excluded from being sampled.&#13;In units of 1e-4; a reasonable value is 3.&#13;Set to 0 to disable."></div>
@ -1236,7 +1236,7 @@
<input class="neo-range-slider" type="range" id="epsilon_cutoff_textgenerationwebui" name="volume" min="0" max="9" step="0.01"> <input class="neo-range-slider" type="range" id="epsilon_cutoff_textgenerationwebui" name="volume" min="0" max="9" step="0.01">
<input class="neo-range-input" type="number" min="0" max="9" step="0.01" data-for="epsilon_cutoff_textgenerationwebui" id="epsilon_cutoff_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="9" step="0.01" data-for="epsilon_cutoff_textgenerationwebui" id="epsilon_cutoff_counter_textgenerationwebui">
</div> </div>
<div data-newbie-hidden data-tg-type="ooba" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div data-newbie-hidden data-tg-type="ooba,mancer" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small> <small>
<span data-i18n="Eta Cutoff">Eta Cutoff</span> <span data-i18n="Eta Cutoff">Eta Cutoff</span>
<div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Eta cutoff is the main parameter of the special Eta Sampling technique.&#13;In units of 1e-4; a reasonable value is 3.&#13;Set to 0 to disable.&#13;See the paper Truncation Sampling as Language Model Desmoothing by Hewitt et al. (2022) for details." title="Eta cutoff is the main parameter of the special Eta Sampling technique.&#13;In units of 1e-4; a reasonable value is 3.&#13;Set to 0 to disable.&#13;See the paper Truncation Sampling as Language Model Desmoothing by Hewitt et al. (2022) for details."></div> <div class="fa-solid fa-circle-info opacity50p" data-i18n="[title]Eta cutoff is the main parameter of the special Eta Sampling technique.&#13;In units of 1e-4; a reasonable value is 3.&#13;Set to 0 to disable.&#13;See the paper Truncation Sampling as Language Model Desmoothing by Hewitt et al. (2022) for details." title="Eta cutoff is the main parameter of the special Eta Sampling technique.&#13;In units of 1e-4; a reasonable value is 3.&#13;Set to 0 to disable.&#13;See the paper Truncation Sampling as Language Model Desmoothing by Hewitt et al. (2022) for details."></div>
@ -1274,7 +1274,7 @@
<input class="neo-range-slider" type="range" id="no_repeat_ngram_size_textgenerationwebui" name="volume" min="0" max="20" step="1"> <input class="neo-range-slider" type="range" id="no_repeat_ngram_size_textgenerationwebui" name="volume" min="0" max="20" step="1">
<input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="no_repeat_ngram_size_textgenerationwebui" id="no_repeat_ngram_size_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="no_repeat_ngram_size_textgenerationwebui" id="no_repeat_ngram_size_counter_textgenerationwebui">
</div> </div>
<div data-newbie-hidden data-tg-type="ooba, dreamgen" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div data-newbie-hidden data-tg-type="mancer, ooba, dreamgen" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="Min Length">Min Length</small> <small data-i18n="Min Length">Min Length</small>
<input class="neo-range-slider" type="range" id="min_length_textgenerationwebui" name="volume" min="0" max="2000" step="1" /> <input class="neo-range-slider" type="range" id="min_length_textgenerationwebui" name="volume" min="0" max="2000" step="1" />
<input class="neo-range-input" type="number" min="0" max="2000" step="1" data-for="min_length_textgenerationwebui" id="min_length_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="2000" step="1" data-for="min_length_textgenerationwebui" id="min_length_counter_textgenerationwebui">
@ -1284,22 +1284,24 @@
<input class="neo-range-slider" type="range" id="max_tokens_second_textgenerationwebui" name="volume" min="0" max="20" step="1" /> <input class="neo-range-slider" type="range" id="max_tokens_second_textgenerationwebui" name="volume" min="0" max="20" step="1" />
<input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="max_tokens_second_textgenerationwebui" id="max_tokens_second_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="20" step="1" data-for="max_tokens_second_textgenerationwebui" id="max_tokens_second_counter_textgenerationwebui">
</div> </div>
<div data-newbie-hidden name="smoothingBlock" class="wide100p"> <div data-newbie-hidden data-tg-type="mancer, ooba, koboldcpp, aphrodite, tabby" name="smoothingBlock" class="wide100p">
<h4 class="wide100p textAlignCenter"> <h4 class="wide100p textAlignCenter">
<label data-i18n="Smooth Sampling">Smooth Sampling</label> <label data-i18n="Smooth Sampling">Smooth Sampling</label>
<div class=" fa-solid fa-circle-info opacity50p " data-i18n="[title]Smooth Sampling" title="Allows you to use quadratic/cubic transformations to adjust the distribution. Lower Smoothing Factor values will be more creative, usually between 0.2-0.3 is the sweetspot (assuming the curve = 1). Higher Smoothing Curve values will make the curve steeper, which will punish low probability choices more aggressively. 1.0 curve is equivalent to only using Smoothing Factor."></div> <div class=" fa-solid fa-circle-info opacity50p " data-i18n="[title]Smooth Sampling" title="Allows you to use quadratic/cubic transformations to adjust the distribution. Lower Smoothing Factor values will be more creative, usually between 0.2-0.3 is the sweetspot (assuming the curve = 1). Higher Smoothing Curve values will make the curve steeper, which will punish low probability choices more aggressively. 1.0 curve is equivalent to only using Smoothing Factor."></div>
</h4> </h4>
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, aphrodite, tabby" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div class="flex-container flexFlowRow gap10px flexShrink">
<div data-newbie-hidden class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="Smoothing Factor">Smoothing Factor</small> <small data-i18n="Smoothing Factor">Smoothing Factor</small>
<input class="neo-range-slider" type="range" id="smoothing_factor_textgenerationwebui" name="volume" min="0" max="10" step="0.01" /> <input class="neo-range-slider" type="range" id="smoothing_factor_textgenerationwebui" name="volume" min="0" max="10" step="0.01" />
<input class="neo-range-input" type="number" min="0" max="10" step="0.01" data-for="smoothing_factor_textgenerationwebui" id="smoothing_factor_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="10" step="0.01" data-for="smoothing_factor_textgenerationwebui" id="smoothing_factor_counter_textgenerationwebui">
</div> </div>
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, aphrodite, tabby" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div data-newbie-hidden class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="Smoothing Curve">Smoothing Curve</small> <small data-i18n="Smoothing Curve">Smoothing Curve</small>
<input class="neo-range-slider" type="range" id="smoothing_curve_textgenerationwebui" name="volume" min="1" max="10" step="0.01" /> <input class="neo-range-slider" type="range" id="smoothing_curve_textgenerationwebui" name="volume" min="1" max="10" step="0.01" />
<input class="neo-range-input" type="number" min="1" max="10" step="0.01" data-for="smoothing_curve_textgenerationwebui" id="smoothing_curve_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="1" max="10" step="0.01" data-for="smoothing_curve_textgenerationwebui" id="smoothing_curve_counter_textgenerationwebui">
</div> </div>
</div> </div>
</div>
<!-- <!--
<div data-tg-type="aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" data-i18n="Responses"> <div data-tg-type="aphrodite" class="alignitemscenter flex-container flexFlowColumn flexBasis48p flexGrow flexShrink gap0" data-i18n="Responses">
<small>Responses</small> <small>Responses</small>
@ -1322,7 +1324,7 @@
<input class="neo-range-input" type="number" min="0" max="5" step="1" data-for="prompt_log_probs_aphrodite" id="prompt_log_probs_aphrodite_counter_textgenerationwebui"> <input class="neo-range-input" type="number" min="0" max="5" step="1" data-for="prompt_log_probs_aphrodite" id="prompt_log_probs_aphrodite_counter_textgenerationwebui">
</div> </div>
--> -->
<div data-newbie-hidden data-tg-type="ooba, koboldcpp, tabby, llamacpp, aphrodite" name="dynaTempBlock" class="wide100p"> <div data-newbie-hidden data-tg-type="ooba, mancer, koboldcpp, tabby, llamacpp, aphrodite" name="dynaTempBlock" class="wide100p">
<h4 class="wide100p textAlignCenter" data-i18n="DynaTemp"> <h4 class="wide100p textAlignCenter" data-i18n="DynaTemp">
<div class="flex-container alignitemscenter" style="justify-content: center;"> <div class="flex-container alignitemscenter" style="justify-content: center;">
<div class="checkbox_label" for="dynatemp_textgenerationwebui"> <div class="checkbox_label" for="dynatemp_textgenerationwebui">
@ -1492,7 +1494,7 @@
<div class="logit_bias_list"></div> <div class="logit_bias_list"></div>
</div> </div>
</div> </div>
<div data-newbie-hidden data-forAphro="False" class="wide100p"> <div data-newbie-hidden data-forAphro="False" data-tg-type="ooba, tabby" class="wide100p">
<hr class="width100p"> <hr class="width100p">
<h4 data-i18n="CFG" class="textAlignCenter">CFG <h4 data-i18n="CFG" class="textAlignCenter">CFG
<div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]Classifier Free Guidance. More helpful tip coming soon" title="Classifier Free Guidance. More helpful tip coming soon."></div> <div class="margin5 fa-solid fa-circle-info opacity50p " data-i18n="[title]Classifier Free Guidance. More helpful tip coming soon" title="Classifier Free Guidance. More helpful tip coming soon."></div>
@ -2040,7 +2042,7 @@
<div data-tg-type="dreamgen" class="flex-container flexFlowColumn"> <div data-tg-type="dreamgen" class="flex-container flexFlowColumn">
<h4 data-i18n="DreamGen API key"> <h4 data-i18n="DreamGen API key">
DreamGen API key DreamGen API key
<a href="https://dreamgen.com/account/api-keys" class="notes-link" target="_blank"> <a href="https://docs.sillytavern.app/usage/api-connections/dreamgen/" class="notes-link" target="_blank">
<span class="fa-solid fa-circle-question note-link-span"></span> <span class="fa-solid fa-circle-question note-link-span"></span>
</a> </a>
</h4> </h4>
@ -5242,12 +5244,12 @@
</div> </div>
<div id="movingDivs"> <div id="movingDivs">
<div id="floatingPrompt" class="drawer-content flexGap5"> <div id="floatingPrompt" class="drawer-content flexGap5">
<div class="panelControlBar flex-container flexGap10"> <div class="panelControlBar flex-container alignItemsBaseline">
<div id="floatingPromptheader" class="fa-solid fa-grip drag-grabber"></div> <div id="floatingPromptheader" class="fa-fw fa-solid fa-grip drag-grabber"></div>
<div id="floatingPromptMaximize" class="inline-drawer-maximize fa-solid"> <div id="floatingPromptMaximize" class="inline-drawer-maximize">
<i class="floating_panel_maximize fa-solid fa-window-maximize"></i> <i class="floating_panel_maximize fa-fw fa-solid fa-window-maximize"></i>
</div> </div>
<div id="ANClose" class="fa-solid fa-circle-xmark floating_panel_close"></div> <div id="ANClose" class="fa-fw fa-solid fa-circle-xmark floating_panel_close"></div>
</div> </div>
<div name="floatingPromptHolder" class="scrollY"> <div name="floatingPromptHolder" class="scrollY">
<div class="inline-drawer"> <div class="inline-drawer">
@ -5386,12 +5388,12 @@
</div> </div>
</div> </div>
<div id="cfgConfig" class="drawer-content flexGap5"> <div id="cfgConfig" class="drawer-content flexGap5">
<div class="panelControlBar flex-container flexGap10"> <div class="panelControlBar flex-container alignItemsBaseline">
<div id="cfgConfigheader" class="fa-solid fa-grip drag-grabber"></div> <div id="cfgConfigheader" class="fa-fw fa-solid fa-grip drag-grabber"></div>
<div id="cfgConfigMaximize" class="inline-drawer-maximize fa-solid"> <div id="cfgConfigMaximize" class="inline-drawer-maximize">
<i class="floating_panel_maximize fa-solid fa-window-maximize"></i> <i class="floating_panel_maximize fa-fw fa-solid fa-window-maximize"></i>
</div> </div>
<div id="CFGClose" class="fa-solid fa-circle-xmark floating_panel_close"></div> <div id="CFGClose" class="fa-fw fa-solid fa-circle-xmark floating_panel_close"></div>
</div> </div>
<div name="cfgConfigHolder" class="scrollY"> <div name="cfgConfigHolder" class="scrollY">
<div id="chat_cfg_container"> <div id="chat_cfg_container">
@ -5699,8 +5701,8 @@
<div class="draggable"> <div class="draggable">
<div class="dragTitle"></div> <div class="dragTitle"></div>
<div class="panelControlBar flex-container"> <div class="panelControlBar flex-container">
<div class="fa-solid fa-grip drag-grabber"></div> <div class="fa-fw fa-solid fa-grip drag-grabber"></div>
<div class="fa-solid fa-circle-xmark dragClose"></div> <div class="fa-fw fa-solid fa-circle-xmark dragClose"></div>
</div> </div>
</div> </div>
</template> </template>

View File

@ -2028,7 +2028,7 @@ function addOneMessage(mes, { type = 'normal', insertAfter = null, scroll = true
forceAvatar: mes.force_avatar, forceAvatar: mes.force_avatar,
timestamp: timestamp, timestamp: timestamp,
extra: mes.extra, 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), ...formatGenerationTimer(mes.gen_started, mes.gen_finished, mes.extra?.token_count),
}; };
@ -3237,8 +3237,9 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
} }
// Inject all Depth prompts. Chat Completion does it separately // Inject all Depth prompts. Chat Completion does it separately
let injectedIndices = [];
if (main_api !== 'openai') { 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) // 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; return combinedPrompt;
}; };
finalMesSend.forEach((item, i) => {
item.injected = Array.isArray(injectedIndices) && injectedIndices.includes(i);
});
let data = { let data = {
api: main_api, api: main_api,
combinedPrompt: null, combinedPrompt: null,
@ -3973,9 +3978,10 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
* Injects extension prompts into chat messages. * Injects extension prompts into chat messages.
* @param {object[]} messages Array of 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. * @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) { function doChatInject(messages, isContinue) {
const injectedIndices = [];
let totalInsertedMessages = 0; let totalInsertedMessages = 0;
messages.reverse(); messages.reverse();
@ -4014,10 +4020,16 @@ function doChatInject(messages, isContinue) {
const injectIdx = depth + totalInsertedMessages; const injectIdx = depth + totalInsertedMessages;
messages.splice(injectIdx, 0, ...roleMessages); messages.splice(injectIdx, 0, ...roleMessages);
totalInsertedMessages += roleMessages.length; 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(); messages.reverse();
return injectedIndices;
} }
function flushWIDepthInjections() { function flushWIDepthInjections() {
@ -4563,6 +4575,7 @@ function parseAndSaveLogprobs(data, continueFrom) {
logprobs = data?.completion_probabilities?.map(x => parseTextgenLogprobs(x.content, [x])) || null; logprobs = data?.completion_probabilities?.map(x => parseTextgenLogprobs(x.content, [x])) || null;
} break; } break;
case textgen_types.APHRODITE: case textgen_types.APHRODITE:
case textgen_types.MANCER:
case textgen_types.TABBY: { case textgen_types.TABBY: {
logprobs = parseTabbyLogprobs(data) || null; logprobs = parseTabbyLogprobs(data) || null;
} break; } break;
@ -4617,7 +4630,7 @@ function extractMultiSwipes(data, type) {
return swipes; return swipes;
} }
if (main_api === 'openai' || (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)) { if (!Array.isArray(data.choices)) {
return swipes; return swipes;
} }
@ -5657,7 +5670,7 @@ export async function getUserAvatars(doRender = true, openPageAt = '') {
function highlightSelectedAvatar() { function highlightSelectedAvatar() {
$('#user_avatar_block .avatar-container').removeClass('selected'); $('#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');
} }
/** /**

View File

@ -13,7 +13,15 @@
</label> </label>
</div> </div>
<div class="qr--modal-messageContainer"> <div class="qr--modal-messageContainer">
<label for="qr--modal-message">Message / Command:</label> <label for="qr--modal-message">
Message / Command:
</label>
<small>
<label class="checkbox_label">
<input type="checkbox" id="qr--modal-wrap">
<span>Word wrap</span>
</label>
</small>
<textarea class="monospace" id="qr--modal-message"></textarea> <textarea class="monospace" id="qr--modal-message"></textarea>
</div> </div>
</div> </div>

View File

@ -208,8 +208,23 @@ export class QuickReply {
title.addEventListener('input', () => { title.addEventListener('input', () => {
this.updateTitle(title.value); 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}*/ /**@type {HTMLTextAreaElement}*/
const message = dom.querySelector('#qr--modal-message'); const message = dom.querySelector('#qr--modal-message');
updateWrap();
message.value = this.message; message.value = this.message;
message.addEventListener('input', () => { message.addEventListener('input', () => {
this.updateMessage(message.value); this.updateMessage(message.value);

View File

@ -139,7 +139,7 @@ function renderTopLogprobs() {
const candidates = topLogprobs const candidates = topLogprobs
.sort(([, logA], [, logB]) => logB - logA) .sort(([, logA], [, logB]) => logB - logA)
.map(([text, log]) => { .map(([text, log]) => {
if (log < 0) { if (log <= 0) {
const probability = Math.exp(log); const probability = Math.exp(log);
sum += probability; sum += probability;
return [text, probability, log]; return [text, probability, log];

View File

@ -21,6 +21,8 @@ import {
saveChatConditional, saveChatConditional,
setAnimationDuration, setAnimationDuration,
ANIMATION_DURATION_DEFAULT, ANIMATION_DURATION_DEFAULT,
setActiveGroup,
setActiveCharacter,
} from '../script.js'; } from '../script.js';
import { isMobile, initMovingUI, favsToHotswap } from './RossAscends-mods.js'; import { isMobile, initMovingUI, favsToHotswap } from './RossAscends-mods.js';
import { import {
@ -2306,6 +2308,8 @@ async function doRandomChat() {
resetSelectedGroup(); resetSelectedGroup();
const characterId = Math.floor(Math.random() * characters.length).toString(); const characterId = Math.floor(Math.random() * characters.length).toString();
setCharacterId(characterId); setCharacterId(characterId);
setActiveCharacter(characters[characterId]?.avatar);
setActiveGroup(null);
await delay(1); await delay(1);
await reloadCurrentChat(); await reloadCurrentChat();
return characters[characterId]?.name; return characters[characterId]?.name;

View File

@ -25,6 +25,8 @@ import {
saveChatConditional, saveChatConditional,
sendMessageAsUser, sendMessageAsUser,
sendSystemMessage, sendSystemMessage,
setActiveCharacter,
setActiveGroup,
setCharacterId, setCharacterId,
setCharacterName, setCharacterName,
setExtensionPrompt, setExtensionPrompt,
@ -1251,11 +1253,15 @@ async function goToCharacterCallback(_, name) {
if (characterIndex !== -1) { if (characterIndex !== -1) {
await openChat(new String(characterIndex)); await openChat(new String(characterIndex));
setActiveCharacter(characters[characterIndex]?.avatar);
setActiveGroup(null);
return characters[characterIndex]?.name; return characters[characterIndex]?.name;
} else { } else {
const group = groups.find(it => it.name.toLowerCase() == name.toLowerCase()); const group = groups.find(it => it.name.toLowerCase() == name.toLowerCase());
if (group) { if (group) {
await openGroupById(group.id); await openGroupById(group.id);
setActiveCharacter(null);
setActiveGroup(group.id);
return group.name; return group.name;
} else { } else {
console.warn(`No matches found for name "${name}"`); console.warn(`No matches found for name "${name}"`);

View File

@ -850,6 +850,7 @@ export function parseTextgenLogprobs(token, logprobs) {
switch (settings.type) { switch (settings.type) {
case TABBY: case TABBY:
case APHRODITE: case APHRODITE:
case MANCER:
case OOBA: { case OOBA: {
/** @type {Record<string, number>[]} */ /** @type {Record<string, number>[]} */
const topLogprobs = logprobs.top_logprobs; const topLogprobs = logprobs.top_logprobs;
@ -971,6 +972,7 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'typical_p': settings.typical_p, 'typical_p': settings.typical_p,
'typical': settings.typical_p, 'typical': settings.typical_p,
'sampler_seed': settings.seed, 'sampler_seed': settings.seed,
'seed': settings.seed,
'min_p': settings.min_p, 'min_p': settings.min_p,
'repetition_penalty': settings.rep_pen, 'repetition_penalty': settings.rep_pen,
'frequency_penalty': settings.freq_pen, 'frequency_penalty': settings.freq_pen,
@ -1000,12 +1002,12 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'skip_special_tokens': settings.skip_special_tokens, 'skip_special_tokens': settings.skip_special_tokens,
'top_a': settings.top_a, 'top_a': settings.top_a,
'tfs': settings.tfs, 'tfs': settings.tfs,
'epsilon_cutoff': settings.type === OOBA ? settings.epsilon_cutoff : undefined, 'epsilon_cutoff': [OOBA, MANCER].includes(settings.type) ? settings.epsilon_cutoff : undefined,
'eta_cutoff': settings.type === OOBA ? settings.eta_cutoff : undefined, 'eta_cutoff': [OOBA, MANCER].includes(settings.type) ? settings.eta_cutoff : undefined,
'mirostat_mode': settings.mirostat_mode, 'mirostat_mode': settings.mirostat_mode,
'mirostat_tau': settings.mirostat_tau, 'mirostat_tau': settings.mirostat_tau,
'mirostat_eta': settings.mirostat_eta, 'mirostat_eta': settings.mirostat_eta,
'custom_token_bans': settings.type === textgen_types.APHRODITE ? 'custom_token_bans': [APHRODITE, MANCER].includes(settings.type) ?
toIntArray(getCustomTokenBans()) : toIntArray(getCustomTokenBans()) :
getCustomTokenBans(), getCustomTokenBans(),
'api_type': settings.type, 'api_type': settings.type,
@ -1022,7 +1024,6 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
'penalty_alpha': settings.type === OOBA ? settings.penalty_alpha : undefined, 'penalty_alpha': settings.type === OOBA ? settings.penalty_alpha : undefined,
'temperature_last': (settings.type === OOBA || settings.type === APHRODITE || settings.type == TABBY) ? settings.temperature_last : 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, 'do_sample': settings.type === OOBA ? settings.do_sample : undefined,
'seed': settings.seed,
'guidance_scale': cfgValues?.guidanceScale?.value ?? settings.guidance_scale ?? 1, 'guidance_scale': cfgValues?.guidanceScale?.value ?? settings.guidance_scale ?? 1,
'negative_prompt': cfgValues?.negativePrompt ?? substituteParams(settings.negative_prompt) ?? '', 'negative_prompt': cfgValues?.negativePrompt ?? substituteParams(settings.negative_prompt) ?? '',
'grammar_string': settings.grammar_string, 'grammar_string': settings.grammar_string,
@ -1045,6 +1046,17 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
//'logprobs': settings.log_probs_aphrodite, //'logprobs': settings.log_probs_aphrodite,
//'prompt_logprobs': settings.prompt_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.dynamic_temperature ? 1 : 0;
params.dynatemp_min = params.dynatemp_low;
params.dynatemp_max = params.dynatemp_high;
delete params.dynatemp_low, params.dynatemp_high;
}
if (settings.type === APHRODITE) { if (settings.type === APHRODITE) {
params = Object.assign(params, aphroditeParams); params = Object.assign(params, aphroditeParams);
} else { } else {

View File

@ -139,6 +139,7 @@ body {
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px;
scrollbar-gutter: stable; scrollbar-gutter: stable;
} }
@ -146,7 +147,7 @@ body {
overflow-y: auto !important; overflow-y: auto !important;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb:vertical {
background-color: var(--grey7070a); background-color: var(--grey7070a);
box-shadow: inset 0 0 0 1px var(--black50a); box-shadow: inset 0 0 0 1px var(--black50a);
border-radius: 10px; border-radius: 10px;
@ -155,6 +156,15 @@ body {
border-top: 20px solid transparent; border-top: 20px solid transparent;
min-height: 40px; 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 { table.responsiveTable {
width: 100%; width: 100%;
@ -518,6 +528,7 @@ body.reduced-motion #bg_custom {
top: 5px; top: 5px;
margin-right: 5px; margin-right: 5px;
z-index: 2000; z-index: 2000;
min-width: 55px;
} }
.panelControlBar .drag-grabber { .panelControlBar .drag-grabber {