Merge pull request #2598 from NearEDGE/quick-impersonate-regenerate-buttons Added quick Regenerate and Impersonate buttons

16172b410c386f80ff125a190368d493f67c5375

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

Signed
5 files changed, +30 -2Showing whitespace changes
public/index.html+7 -0
@@ -4161,6 +4161,12 @@
41614161 Quick "Continue" button
41624162 </small>
41634163 </label>
4164+ <label class="checkbox_label" for="quick_impersonate" title="Show a button in the input area to ask the AI to impersonate your character for a single message." data-i18n="[title]Show a button in the input area to ask the AI to impersonate your character for a single message">
4165+ <input id="quick_impersonate" type="checkbox" />
4166+ <small data-i18n="Quick 'Impersonate' button">
4167+ Quick "Impersonate" button
4168+ </small>
4169+ </label>
41644170 <div class="checkbox-container flex-container">
41654171 <label data-newbie-hidden class="checkbox_label" for="swipes-checkbox" title="Show arrow buttons on the last in-chat message to generate alternative AI responses. Both PC and mobile." data-i18n="[title]Show arrow buttons on the last in-chat message to generate alternative AI responses. Both PC and mobile">
41664172 <input id="swipes-checkbox" type="checkbox" />
@@ -6371,6 +6377,7 @@
63716377 <div id="mes_stop" title="Abort request" class="mes_stop" data-i18n="[title]Abort request">
63726378 <i class="fa-solid fa-circle-stop"></i>
63736379 </div>
6380+ <div id="mes_impersonate" class="fa-solid fa-user-secret interactable displayNone" title="Ask AI to write your message for you" data-i18n="[title]Ask AI to write your message for you" tabindex="0"></div>
63746381 <div id="mes_continue" class="fa-fw fa-solid fa-arrow-right interactable displayNone" title="Continue the last message" data-i18n="[title]Continue the last message"></div>
63756382 <div id="send_but" class="fa-solid fa-paper-plane interactable displayNone" title="Send a message" data-i18n="[title]Send a message"></div>
63766383 </div>
public/script.js+7 -2
@@ -5625,6 +5625,7 @@ export function activateSendButtons() {
56255625 is_send_press = false;
56265626 $('#send_but').removeClass('displayNone');
56275627 $('#mes_continue').removeClass('displayNone');
5628+ $('#mes_impersonate').removeClass('displayNone');
56285629 $('.mes_buttons:last').show();
56295630 hideStopButton();
56305631}
@@ -5632,6 +5633,7 @@ export function activateSendButtons() {
56325633export function deactivateSendButtons() {
56335634 $('#send_but').addClass('displayNone');
56345635 $('#mes_continue').addClass('displayNone');
5636+ $('#mes_impersonate').addClass('displayNone');
56355637 showStopButton();
56365638}
56375639
@@ -9112,14 +9114,14 @@ jQuery(async function () {
91129114 $('#send_textarea').on('focusin focus click', () => {
91139115 S_TAPreviouslyFocused = true;
91149116 });
91159117 $('#send_but, #option_regenerate, #option_continue, #mes_continue, #mes_impersonate').on('click', () => {
91169118 if (S_TAPreviouslyFocused) {
91179119 $('#send_textarea').focus();
91189120 }
91199121 });
91209122 $(document).click(event => {
91219123 if ($(':focus').attr('id') !== 'send_textarea') {
91229124 var validIDs = ['options_button', 'send_but', 'mes_impersonate', 'mes_continue', 'send_textarea', 'option_regenerate', 'option_continue'];
91239125 if (!validIDs.includes($(event.target).attr('id'))) {
91249126 S_TAPreviouslyFocused = false;
91259127 }
@@ -9155,6 +9157,9 @@ jQuery(async function () {
91559157 debouncedCharacterSearch(searchQuery);
91569158 });
91579159
9160+ $('#mes_impersonate').on('click', function () {
9161+ $('#option_impersonate').trigger('click');
9162+ });
91589163
91599164 $('#mes_continue').on('click', function () {
91609165 $('#option_continue').trigger('click');
public/scripts/RossAscends-mods.js+2 -0
@@ -311,6 +311,7 @@ function RA_checkOnlineStatus() {
311311 $('#send_form').addClass('no-connection'); //entire input form area is red when not connected
312312 $('#send_but').addClass('displayNone'); //send button is hidden when not connected;
313313 $('#mes_continue').addClass('displayNone'); //continue button is hidden when not connected;
314+ $('#mes_impersonate').addClass('displayNone'); //continue button is hidden when not connected;
314315 $('#API-status-top').removeClass('fa-plug');
315316 $('#API-status-top').addClass('fa-plug-circle-exclamation redOverlayGlow');
316317 connection_made = false;
@@ -327,6 +328,7 @@ function RA_checkOnlineStatus() {
327328 if (!is_send_press && !(selected_group && is_group_generating)) {
328329 $('#send_but').removeClass('displayNone'); //on connect, send button shows
329330 $('#mes_continue').removeClass('displayNone'); //continue button is shown when connected
331+ $('#mes_impersonate').removeClass('displayNone'); //continue button is shown when connected
330332 }
331333 }
332334 }
public/scripts/power-user.js+10 -0
@@ -197,6 +197,7 @@ let power_user = {
197197 prefer_character_prompt: true,
198198 prefer_character_jailbreak: true,
199199 quick_continue: false,
200+ quick_impersonate: false,
200201 continue_on_send: false,
201202 trim_spaces: true,
202203 relaxed_api_urls: false,
@@ -1592,7 +1593,9 @@ function loadPowerUserSettings(settings, data) {
15921593 $('#trim_spaces').prop('checked', power_user.trim_spaces);
15931594 $('#continue_on_send').prop('checked', power_user.continue_on_send);
15941595 $('#quick_continue').prop('checked', power_user.quick_continue);
1596+ $('#quick_impersonate').prop('checked', power_user.quick_continue);
15951597 $('#mes_continue').css('display', power_user.quick_continue ? '' : 'none');
1598+ $('#mes_impersonate').css('display', power_user.quick_impersonate ? '' : 'none');
15961599 $('#gestures-checkbox').prop('checked', power_user.gestures);
15971600 $('#auto_swipe').prop('checked', power_user.auto_swipe);
15981601 $('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length);
@@ -3739,6 +3742,13 @@ $(document).ready(() => {
37393742 saveSettingsDebounced();
37403743 });
37413744
3745+ $('#quick_impersonate').on('input', function () {
3746+ const value = !!$(this).prop('checked');
3747+ power_user.quick_impersonate = value;
3748+ $('#mes_impersonate').css('display', value ? '' : 'none');
3749+ saveSettingsDebounced();
3750+ });
3751+
37423752 $('#trim_spaces').on('input', function () {
37433753 const value = !!$(this).prop('checked');
37443754 power_user.trim_spaces = value;
public/style.css+4 -0
@@ -723,6 +723,10 @@ body .panelControlBar {
723723 order: 1;
724724}
725725
726+#mes_impersonate {
727+ order: 1;
728+}
729+
726730#send_form .mes_stop {
727731 display: none;
728732 order: 2;