diff --git a/public/index.html b/public/index.html index 13f59da05..741871edd 100644 --- a/public/index.html +++ b/public/index.html @@ -3248,25 +3248,26 @@
+

+
+ Instruct Template + + + +
+
+ + +
+

-

-
- Instruct Template - - - -
-
- - -
-

+
@@ -3431,21 +3432,22 @@
+

+
+ System Prompt + + + +
+
+ +
+

-

-
- System Prompt - - - -
-
- -
-

+
@@ -5939,9 +5941,9 @@
- +
diff --git a/public/script.js b/public/script.js index b64104cc5..8d085b6d2 100644 --- a/public/script.js +++ b/public/script.js @@ -5428,6 +5428,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>')); } const isInstruct = power_user.instruct.enabled && main_api !== 'openai'; + const isNotEmpty = (str) => str && str.trim() !== ''; if (isInstruct && power_user.instruct.stop_sequence) { if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) { getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence)); @@ -5435,7 +5436,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc } // Hana: Only use the first sequence (should be <|model|>) // of the prompt before <|user|> (as KoboldAI Lite does it). - if (isInstruct && power_user.instruct.input_sequence) { + if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) { if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) { getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence)); } @@ -8477,12 +8478,22 @@ const CONNECT_API_MAP = { selected: 'novel', button: '#api_button_novel', }, + 'koboldcpp': { + selected: 'textgenerationwebui', + button: '#api_button_textgenerationwebui', + type: textgen_types.KOBOLDCPP, + }, // KoboldCpp alias 'kcpp': { selected: 'textgenerationwebui', button: '#api_button_textgenerationwebui', type: textgen_types.KOBOLDCPP, }, + 'openai': { + selected: 'openai', + button: '#api_button_openai', + source: chat_completion_sources.OPENAI, + }, // OpenAI alias 'oai': { selected: 'openai', diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 92278f35c..1a9e2d7d2 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -56,22 +56,25 @@ let counterNonce = Date.now(); const observerConfig = { childList: true, subtree: true }; const countTokensDebounced = debounce(RA_CountCharTokens, debounce_timeout.relaxed); +const countTokensShortDebounced = debounce(RA_CountCharTokens, debounce_timeout.short); +const checkStatusDebounced = debounce(RA_checkOnlineStatus, debounce_timeout.short); const observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { + if (!(mutation.target instanceof HTMLElement)) { + return; + } if (mutation.target.classList.contains('online_status_text')) { - RA_checkOnlineStatus(); + checkStatusDebounced(); } else if (mutation.target.parentNode === SelectedCharacterTab) { - setTimeout(RA_CountCharTokens, 200); + countTokensShortDebounced(); } else if (mutation.target.classList.contains('mes_text')) { - if (mutation.target instanceof HTMLElement) { - for (const element of mutation.target.getElementsByTagName('math')) { - element.childNodes.forEach(function (child) { - if (child.nodeType === Node.TEXT_NODE) { - child.textContent = ''; - } - }); - } + for (const element of mutation.target.getElementsByTagName('math')) { + element.childNodes.forEach(function (child) { + if (child.nodeType === Node.TEXT_NODE) { + child.textContent = ''; + } + }); } } }); @@ -159,8 +162,8 @@ export function shouldSendOnEnter() { export function humanizedDateTime() { const now = new Date(Date.now()); const dt = { - year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(), - hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(), + year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(), + hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(), }; for (const key in dt) { dt[key] = dt[key].toString().padStart(2, '0'); @@ -725,9 +728,7 @@ export function addSafariPatch() { export function initRossMods() { // initial status check - setTimeout(() => { - RA_checkOnlineStatus(); - }, 100); + checkStatusDebounced(); if (power_user.auto_load_chat) { RA_autoloadchat(); @@ -752,7 +753,7 @@ export function initRossMods() { setTimeout(() => RA_autoconnect(PrevAPI), 100); }); - $('#api_button').click(function () { setTimeout(RA_checkOnlineStatus, 100); }); + $('#api_button').on('click', () => checkStatusDebounced()); //toggle pin class when lock toggle clicked $(RPanelPin).on('click', function () { diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index 4efb90e65..22531eb15 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -2598,8 +2598,13 @@ async function askCharacter(args, text) { return; } - setCharacterId(prevChId); - setCharacterName(characters[prevChId].name); + if (prevChId !== undefined) { + setCharacterId(prevChId); + setCharacterName(characters[prevChId].name); + } else { + setCharacterId(undefined); + setCharacterName(neutralCharacterName); + } // Only force the new avatar if the character name is the same // This skips if an error was fired diff --git a/public/style.css b/public/style.css index 1c8096d86..7d55cf832 100644 --- a/public/style.css +++ b/public/style.css @@ -978,15 +978,15 @@ body .panelControlBar { justify-content: center; z-index: 9999; grid-row-start: 2; - grid-column-start: 4; - flex-flow: column; font-size: 30px; cursor: pointer; align-self: center; position: absolute; - bottom: 15px; +bottom: 15px; +flex-flow: column; } + .swipes-counter { color: var(--SmartThemeBodyColor); font-size: 12px; @@ -994,6 +994,9 @@ body .panelControlBar { font-family: var(--mainFontFamily); font-weight: 400; align-self: center; + min-width: 40px; + display: flex; + justify-content: center; } .swipe_left { @@ -1003,6 +1006,7 @@ body .panelControlBar { .swipe_right { right: 5px; + align-self:end; } .ui-settings { @@ -2634,6 +2638,11 @@ select option:not(:checked) { color: var(--active) !important; } +#instruct_enabled_label .menu_button:not(.toggleEnabled), +#sysprompt_enabled_label .menu_button:not(.toggleEnabled) { + color: Red; +} + .displayBlock { display: block !important; }