Merge branch 'staging' into char-find-and-sendas-extended

0d83480e90064b22beced18df76094f6363d5d5e

Cohee <18619528+Cohee1207@users.noreply.github.com>

5 files changed, +43 -15Showing whitespace changes
public/index.html+6 -4
@@ -3248,7 +3248,6 @@
3248 </div>3248 </div>
3249 </div>3249 </div>
3250 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">3250 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3251 <div id="instructSettingsBlock">
3252 <h4 class="standoutHeader title_restorable justifySpaceBetween">3251 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3253 <div class="flex-container">3252 <div class="flex-container">
3254 <span data-i18n="Instruct Template">Instruct Template</span>3253 <span data-i18n="Instruct Template">Instruct Template</span>
@@ -3261,12 +3260,14 @@
3261 <input id="instruct_bind_to_context" type="checkbox" style="display:none;" />3260 <input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
3262 <small><i class="fa-solid fa-link menu_button margin0"></i></small>3261 <small><i class="fa-solid fa-link menu_button margin0"></i></small>
3263 </label>3262 </label>
3264 <label for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">3263 <label id="instruct_enabled_label"for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
3265 <input id="instruct_enabled" type="checkbox" style="display:none;" />3264 <input id="instruct_enabled" type="checkbox" style="display:none;" />
3266 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>3265 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3267 </label>3266 </label>
3268 </div>3267 </div>
3269 </h4>3268 </h4>
3269 <div id="instructSettingsBlock">
3270
32703271
3271 <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">3272 <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
3272 <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>3273 <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
@@ -3431,7 +3432,6 @@
3431 </div>3432 </div>
3432 </div>3433 </div>
3433 <div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">3434 <div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3434 <div id="SystemPromptBlock">
3435 <h4 class="standoutHeader title_restorable justifySpaceBetween">3435 <h4 class="standoutHeader title_restorable justifySpaceBetween">
3436 <div class="flex-container">3436 <div class="flex-container">
3437 <span data-i18n="System Prompt">System Prompt</span>3437 <span data-i18n="System Prompt">System Prompt</span>
@@ -3440,12 +3440,14 @@
3440 </a>3440 </a>
3441 </div>3441 </div>
3442 <div class="flex-container">3442 <div class="flex-container">
3443 <label for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">3443 <label id="sysprompt_enabled_label" for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
3444 <input id="sysprompt_enabled" type="checkbox" style="display:none;" />3444 <input id="sysprompt_enabled" type="checkbox" style="display:none;" />
3445 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>3445 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
3446 </label>3446 </label>
3447 </div>3447 </div>
3448 </h4>3448 </h4>
3449 <div id="SystemPromptBlock">
3450
34493451
3450 <div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">3452 <div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
3451 <select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>3453 <select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
public/script.js+12 -1
@@ -5428,6 +5428,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
5428 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));5428 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
5429 }5429 }
5430 const isInstruct = power_user.instruct.enabled && main_api !== 'openai';5430 const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
5431 const isNotEmpty = (str) => str && str.trim() !== '';
5431 if (isInstruct && power_user.instruct.stop_sequence) {5432 if (isInstruct && power_user.instruct.stop_sequence) {
5432 if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {5433 if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
5433 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));5434 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
@@ -5435,7 +5436,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
5435 }5436 }
5436 // Hana: Only use the first sequence (should be <|model|>)5437 // Hana: Only use the first sequence (should be <|model|>)
5437 // of the prompt before <|user|> (as KoboldAI Lite does it).5438 // of the prompt before <|user|> (as KoboldAI Lite does it).
5438 if (isInstruct && power_user.instruct.input_sequence) {5439 if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) {
5439 if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {5440 if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {
5440 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));5441 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
5441 }5442 }
@@ -8477,12 +8478,22 @@ const CONNECT_API_MAP = {
8477 selected: 'novel',8478 selected: 'novel',
8478 button: '#api_button_novel',8479 button: '#api_button_novel',
8479 },8480 },
8481 'koboldcpp': {
8482 selected: 'textgenerationwebui',
8483 button: '#api_button_textgenerationwebui',
8484 type: textgen_types.KOBOLDCPP,
8485 },
8480 // KoboldCpp alias8486 // KoboldCpp alias
8481 'kcpp': {8487 'kcpp': {
8482 selected: 'textgenerationwebui',8488 selected: 'textgenerationwebui',
8483 button: '#api_button_textgenerationwebui',8489 button: '#api_button_textgenerationwebui',
8484 type: textgen_types.KOBOLDCPP,8490 type: textgen_types.KOBOLDCPP,
8485 },8491 },
8492 'openai': {
8493 selected: 'openai',
8494 button: '#api_button_openai',
8495 source: chat_completion_sources.OPENAI,
8496 },
8486 // OpenAI alias8497 // OpenAI alias
8487 'oai': {8498 'oai': {
8488 selected: 'openai',8499 selected: 'openai',
public/scripts/RossAscends-mods.js+9 -8
@@ -56,15 +56,19 @@ let counterNonce = Date.now();
5656
57const observerConfig = { childList: true, subtree: true };57const observerConfig = { childList: true, subtree: true };
58const countTokensDebounced = debounce(RA_CountCharTokens, debounce_timeout.relaxed);58const countTokensDebounced = debounce(RA_CountCharTokens, debounce_timeout.relaxed);
59const countTokensShortDebounced = debounce(RA_CountCharTokens, debounce_timeout.short);
60const checkStatusDebounced = debounce(RA_checkOnlineStatus, debounce_timeout.short);
5961
60const observer = new MutationObserver(function (mutations) {62const observer = new MutationObserver(function (mutations) {
61 mutations.forEach(function (mutation) {63 mutations.forEach(function (mutation) {
64 if (!(mutation.target instanceof HTMLElement)) {
65 return;
66 }
62 if (mutation.target.classList.contains('online_status_text')) {67 if (mutation.target.classList.contains('online_status_text')) {
63 RA_checkOnlineStatus();68 checkStatusDebounced();
64 } else if (mutation.target.parentNode === SelectedCharacterTab) {69 } else if (mutation.target.parentNode === SelectedCharacterTab) {
65 setTimeout(RA_CountCharTokens, 200);70 countTokensShortDebounced();
66 } else if (mutation.target.classList.contains('mes_text')) {71 } else if (mutation.target.classList.contains('mes_text')) {
67 if (mutation.target instanceof HTMLElement) {
68 for (const element of mutation.target.getElementsByTagName('math')) {72 for (const element of mutation.target.getElementsByTagName('math')) {
69 element.childNodes.forEach(function (child) {73 element.childNodes.forEach(function (child) {
70 if (child.nodeType === Node.TEXT_NODE) {74 if (child.nodeType === Node.TEXT_NODE) {
@@ -73,7 +77,6 @@ const observer = new MutationObserver(function (mutations) {
73 });77 });
74 }78 }
75 }79 }
76 }
77 });80 });
78});81});
7982
@@ -725,9 +728,7 @@ export function addSafariPatch() {
725728
726export function initRossMods() {729export function initRossMods() {
727 // initial status check730 // initial status check
728 setTimeout(() => {731 checkStatusDebounced();
729 RA_checkOnlineStatus();
730 }, 100);
731732
732 if (power_user.auto_load_chat) {733 if (power_user.auto_load_chat) {
733 RA_autoloadchat();734 RA_autoloadchat();
@@ -752,7 +753,7 @@ export function initRossMods() {
752 setTimeout(() => RA_autoconnect(PrevAPI), 100);753 setTimeout(() => RA_autoconnect(PrevAPI), 100);
753 });754 });
754755
755 $('#api_button').click(function () { setTimeout(RA_checkOnlineStatus, 100); });756 $('#api_button').on('click', () => checkStatusDebounced());
756757
757 //toggle pin class when lock toggle clicked758 //toggle pin class when lock toggle clicked
758 $(RPanelPin).on('click', function () {759 $(RPanelPin).on('click', function () {
public/scripts/slash-commands.js+5 -0
@@ -2598,8 +2598,13 @@ async function askCharacter(args, text) {
2598 return;2598 return;
2599 }2599 }
26002600
2601 if (prevChId !== undefined) {
2601 setCharacterId(prevChId);2602 setCharacterId(prevChId);
2602 setCharacterName(characters[prevChId].name);2603 setCharacterName(characters[prevChId].name);
2604 } else {
2605 setCharacterId(undefined);
2606 setCharacterName(neutralCharacterName);
2607 }
26032608
2604 // Only force the new avatar if the character name is the same2609 // Only force the new avatar if the character name is the same
2605 // This skips if an error was fired2610 // This skips if an error was fired
public/style.css+11 -2
@@ -978,15 +978,15 @@ body .panelControlBar {
978 justify-content: center;978 justify-content: center;
979 z-index: 9999;979 z-index: 9999;
980 grid-row-start: 2;980 grid-row-start: 2;
981 grid-column-start: 4;
982 flex-flow: column;
983 font-size: 30px;981 font-size: 30px;
984 cursor: pointer;982 cursor: pointer;
985 align-self: center;983 align-self: center;
986 position: absolute;984 position: absolute;
987bottom: 15px;985bottom: 15px;
986flex-flow: column;
988}987}
989988
989
990.swipes-counter {990.swipes-counter {
991 color: var(--SmartThemeBodyColor);991 color: var(--SmartThemeBodyColor);
992 font-size: 12px;992 font-size: 12px;
@@ -994,6 +994,9 @@ body .panelControlBar {
994 font-family: var(--mainFontFamily);994 font-family: var(--mainFontFamily);
995 font-weight: 400;995 font-weight: 400;
996 align-self: center;996 align-self: center;
997 min-width: 40px;
998 display: flex;
999 justify-content: center;
997}1000}
9981001
999.swipe_left {1002.swipe_left {
@@ -1003,6 +1006,7 @@ body .panelControlBar {
10031006
1004.swipe_right {1007.swipe_right {
1005 right: 5px;1008 right: 5px;
1009 align-self:end;
1006}1010}
10071011
1008.ui-settings {1012.ui-settings {
@@ -2634,6 +2638,11 @@ select option:not(:checked) {
2634 color: var(--active) !important;2638 color: var(--active) !important;
2635}2639}
26362640
2641#instruct_enabled_label .menu_button:not(.toggleEnabled),
2642#sysprompt_enabled_label .menu_button:not(.toggleEnabled) {
2643 color: Red;
2644}
2645
2637.displayBlock {2646.displayBlock {
2638 display: block !important;2647 display: block !important;
2639}2648}