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 @@
32483248 </div>
32493249 </div>
32503250 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3251- <div id="instructSettingsBlock">
32523251 <h4 class="standoutHeader title_restorable justifySpaceBetween">
32533252 <div class="flex-container">
32543253 <span data-i18n="Instruct Template">Instruct Template</span>
@@ -3261,12 +3260,14 @@
32613260 <input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
32623261 <small><i class="fa-solid fa-link menu_button margin0"></i></small>
32633262 </label>
32643263 <label id="instruct_enabled_label"for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
32653264 <input id="instruct_enabled" type="checkbox" style="display:none;" />
32663265 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
32673266 </label>
32683267 </div>
32693268 </h4>
3269+ <div id="instructSettingsBlock">
3270+
32703271
32713272 <div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
32723273 <select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
@@ -3431,7 +3432,6 @@
34313432 </div>
34323433 </div>
34333434 <div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
3434- <div id="SystemPromptBlock">
34353435 <h4 class="standoutHeader title_restorable justifySpaceBetween">
34363436 <div class="flex-container">
34373437 <span data-i18n="System Prompt">System Prompt</span>
@@ -3440,12 +3440,14 @@
34403440 </a>
34413441 </div>
34423442 <div class="flex-container">
34433443 <label id="sysprompt_enabled_label" for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
34443444 <input id="sysprompt_enabled" type="checkbox" style="display:none;" />
34453445 <small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
34463446 </label>
34473447 </div>
34483448 </h4>
3449+ <div id="SystemPromptBlock">
3450+
34493451
34503452 <div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
34513453 <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
54285428 getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
54295429 }
54305430 const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
5431+ const isNotEmpty = (str) => str && str.trim() !== '';
54315432 if (isInstruct && power_user.instruct.stop_sequence) {
54325433 if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
54335434 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
@@ -5435,7 +5436,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
54355436 }
54365437 // Hana: Only use the first sequence (should be <|model|>)
54375438 // of the prompt before <|user|> (as KoboldAI Lite does it).
54385439 if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) {
54395440 if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {
54405441 getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
54415442 }
@@ -8477,12 +8478,22 @@ const CONNECT_API_MAP = {
84778478 selected: 'novel',
84788479 button: '#api_button_novel',
84798480 },
8481+ 'koboldcpp': {
8482+ selected: 'textgenerationwebui',
8483+ button: '#api_button_textgenerationwebui',
8484+ type: textgen_types.KOBOLDCPP,
8485+ },
84808486 // KoboldCpp alias
84818487 'kcpp': {
84828488 selected: 'textgenerationwebui',
84838489 button: '#api_button_textgenerationwebui',
84848490 type: textgen_types.KOBOLDCPP,
84858491 },
8492+ 'openai': {
8493+ selected: 'openai',
8494+ button: '#api_button_openai',
8495+ source: chat_completion_sources.OPENAI,
8496+ },
84868497 // OpenAI alias
84878498 'oai': {
84888499 selected: 'openai',
public/scripts/RossAscends-mods.js+9 -8
@@ -56,15 +56,19 @@ let counterNonce = Date.now();
5656
5757const observerConfig = { childList: true, subtree: true };
5858const countTokensDebounced = debounce(RA_CountCharTokens, debounce_timeout.relaxed);
59+const countTokensShortDebounced = debounce(RA_CountCharTokens, debounce_timeout.short);
60+const checkStatusDebounced = debounce(RA_checkOnlineStatus, debounce_timeout.short);
5961
6062const observer = new MutationObserver(function (mutations) {
6163 mutations.forEach(function (mutation) {
64+ if (!(mutation.target instanceof HTMLElement)) {
65+ return;
66+ }
6267 if (mutation.target.classList.contains('online_status_text')) {
6368 RA_checkOnlineStatuscheckStatusDebounced();
6469 } else if (mutation.target.parentNode === SelectedCharacterTab) {
6570 setTimeoutcountTokensShortDebounced(RA_CountCharTokens, 200);
6671 } else if (mutation.target.classList.contains('mes_text')) {
67- if (mutation.target instanceof HTMLElement) {
6872 for (const element of mutation.target.getElementsByTagName('math')) {
6973 element.childNodes.forEach(function (child) {
7074 if (child.nodeType === Node.TEXT_NODE) {
@@ -73,7 +77,6 @@ const observer = new MutationObserver(function (mutations) {
7377 });
7478 }
7579 }
76- }
7780 });
7881});
7982
@@ -725,9 +728,7 @@ export function addSafariPatch() {
725728
726729export function initRossMods() {
727730 // initial status check
728- setTimeout(() => {
731+ checkStatusDebounced();
729- RA_checkOnlineStatus();
730- }, 100);
731732
732733 if (power_user.auto_load_chat) {
733734 RA_autoloadchat();
@@ -752,7 +753,7 @@ export function initRossMods() {
752753 setTimeout(() => RA_autoconnect(PrevAPI), 100);
753754 });
754755
755756 $('#api_button').clickon(function'click', () {=> setTimeoutcheckStatusDebounced(RA_checkOnlineStatus, 100); });
756757
757758 //toggle pin class when lock toggle clicked
758759 $(RPanelPin).on('click', function () {
public/scripts/slash-commands.js+5 -0
@@ -2598,8 +2598,13 @@ async function askCharacter(args, text) {
25982598 return;
25992599 }
26002600
2601+ if (prevChId !== undefined) {
26012602 setCharacterId(prevChId);
26022603 setCharacterName(characters[prevChId].name);
2604+ } else {
2605+ setCharacterId(undefined);
2606+ setCharacterName(neutralCharacterName);
2607+ }
26032608
26042609 // Only force the new avatar if the character name is the same
26052610 // This skips if an error was fired
public/style.css+11 -2
@@ -978,15 +978,15 @@ body .panelControlBar {
978978 justify-content: center;
979979 z-index: 9999;
980980 grid-row-start: 2;
981- grid-column-start: 4;
982- flex-flow: column;
983981 font-size: 30px;
984982 cursor: pointer;
985983 align-self: center;
986984 position: absolute;
987985bottom: 15px;
986+flex-flow: column;
988987}
989988
989+
990990.swipes-counter {
991991 color: var(--SmartThemeBodyColor);
992992 font-size: 12px;
@@ -994,6 +994,9 @@ body .panelControlBar {
994994 font-family: var(--mainFontFamily);
995995 font-weight: 400;
996996 align-self: center;
997+ min-width: 40px;
998+ display: flex;
999+ justify-content: center;
9971000}
9981001
9991002.swipe_left {
@@ -1003,6 +1006,7 @@ body .panelControlBar {
10031006
10041007.swipe_right {
10051008 right: 5px;
1009+ align-self:end;
10061010}
10071011
10081012.ui-settings {
@@ -2634,6 +2638,11 @@ select option:not(:checked) {
26342638 color: var(--active) !important;
26352639}
26362640
2641+#instruct_enabled_label .menu_button:not(.toggleEnabled),
2642+#sysprompt_enabled_label .menu_button:not(.toggleEnabled) {
2643+ color: Red;
2644+}
2645+
26372646.displayBlock {
26382647 display: block !important;
26392648}