#976 Add "quick continue" button. Remove "send to continue" option.

This commit is contained in:
Cohee 2023-08-24 01:37:44 +03:00
parent 52c2fcd407
commit e2507e8840
7 changed files with 35 additions and 25 deletions

View File

@ -128,7 +128,7 @@
"max_context_unlocked": false,
"prefer_character_prompt": true,
"prefer_character_jailbreak": true,
"continue_on_send": false,
"quick_continue": false,
"trim_spaces": true,
"relaxed_api_urls": false,
"default_instruct": "",

View File

@ -2816,10 +2816,10 @@
<input id="prefer_character_jailbreak" type="checkbox" />
<span data-i18n="Prefer Character Card Jailbreak">Prefer Char. JB</span>
</label>
<label class="checkbox_label" for="continue_on_send">
<input id="continue_on_send" type="checkbox" />
<label class="checkbox_label" for="quick_continue">
<input id="quick_continue" type="checkbox" />
<span data-i18n="Press Send to continue">
Press "Send" to continue
Show quick "Continue" button
</span>
</label>
<label class="checkbox_label" for="auto-load-chat-checkbox">
@ -4202,7 +4202,8 @@
<div id="mes_stop" title="Abort request" class="mes_stop" data-i18n="[title]Abort request">
<i class="fa-solid fa-circle-stop"></i>
</div>
<div id="send_but" class="fa-solid fa-paper-plane" title="Send a message" data-i18n="[title]Send a message"></div>
<div id="mes_continue" class="fa-fw fa-solid fa-arrow-right displayNone" title="Continue the last message" data-i18n="[title]Continue the last message"></div>
<div id="send_but" class="fa-solid fa-paper-plane displayNone" title="Send a message" data-i18n="[title]Send a message"></div>
</div>
</form>
</div>

View File

@ -2320,10 +2320,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
}
}
if (!type && !textareaText && power_user.continue_on_send && !selected_group && chat.length && !chat[chat.length - 1]['is_user']) {
type = 'continue';
}
const isContinue = type == 'continue';
if (!dryRun) {
@ -3966,14 +3962,16 @@ export function isMultigenEnabled() {
export function activateSendButtons() {
is_send_press = false;
$("#send_but").css("display", "flex");
$("#send_but").removeClass("displayNone");
$("#mes_continue").removeClass("displayNone");
$("#send_textarea").attr("disabled", false);
$('.mes_buttons:last').show();
hideStopButton();
}
export function deactivateSendButtons() {
$("#send_but").css("display", "none");
$("#send_but").addClass("displayNone");
$("#mes_continue").addClass("displayNone");
showStopButton();
}
@ -7160,7 +7158,7 @@ $(document).ready(function () {
S_TAPreviouslyFocused = true;
});
$('#send_textarea').on('focusout blur', () => S_TAFocused = false);
$('#options_button, #send_but, #option_regenerate').on('click', () => {
$('#options_button, #send_but, #option_regenerate, #option_continue, #mes_continue').on('click', () => {
if (S_TAPreviouslyFocused) {
$('#send_textarea').focus();
S_TAFocused = true;
@ -7168,8 +7166,8 @@ $(document).ready(function () {
});
$(document).click(event => {
if ($(':focus').attr('id') !== 'send_textarea') {
var validIDs = ["options_button", "send_but", "send_textarea", "option_regenerate"];
if ($(event.target).attr('id') !== validIDs) {
var validIDs = ["options_button", "send_but", "mes_continue", "send_textarea", "option_regenerate", "option_continue"];
if (!validIDs.includes($(event.target).attr('id'))) {
S_TAFocused = false;
S_TAPreviouslyFocused = false;
}
@ -7203,7 +7201,11 @@ $(document).ready(function () {
entitiesFilter.setFilterData(FILTER_TYPES.SEARCH, searchValue);
});
$("#send_but").click(function () {
$("#mes_continue").on('click', function () {
$("#option_continue").trigger('click');
});
$("#send_but").on('click', function () {
if (is_send_press == false) {
is_send_press = true;
Generate();

View File

@ -315,7 +315,8 @@ function RA_checkOnlineStatus() {
if (online_status == "no_connection") {
$("#send_textarea").attr("placeholder", "Not connected to API!"); //Input bar placeholder tells users they are not connected
$("#send_form").addClass('no-connection'); //entire input form area is red when not connected
$("#send_but").css("display", "none"); //send button is hidden when not connected;
$("#send_but").addClass("displayNone"); //send button is hidden when not connected;
$("#mes_continue").addClass("displayNone"); //continue button is hidden when not connected;
$("#API-status-top").removeClass("fa-plug");
$("#API-status-top").addClass("fa-plug-circle-exclamation redOverlayGlow");
connection_made = false;
@ -330,7 +331,8 @@ function RA_checkOnlineStatus() {
RA_AC_retries = 1;
if (!is_send_press && !(selected_group && is_group_generating)) {
$("#send_but").css("display", "flex"); //on connect, send button shows
$("#send_but").removeClass("displayNone"); //on connect, send button shows
$("#mes_continue").removeClass("displayNone"); //continue button is shown when connected
}
}
}

View File

@ -818,7 +818,7 @@ function addSDGenButtons() {
$(document).on('click touchend', function (e) {
const target = $(e.target);
if (target.is(dropdown)) return;
if (target.is(button) && !dropdown.is(":visible") && $("#send_but").css('display') === 'flex') {
if (target.is(button) && !dropdown.is(":visible") && $("#send_but").is(":visible")) {
e.preventDefault();
dropdown.fadeIn(250);

View File

@ -151,7 +151,7 @@ let power_user = {
max_context_unlocked: false,
prefer_character_prompt: true,
prefer_character_jailbreak: true,
continue_on_send: false,
quick_continue: false,
trim_spaces: true,
relaxed_api_urls: false,
@ -708,7 +708,8 @@ function loadPowerUserSettings(settings, data) {
$('#relaxed_api_urls').prop("checked", power_user.relaxed_api_urls);
$('#trim_spaces').prop("checked", power_user.trim_spaces);
$('#continue_on_send').prop("checked", power_user.continue_on_send);
$('#quick_continue').prop("checked", power_user.quick_continue);
$('#mes_continue').css('display', power_user.quick_continue ? '' : 'none');
$('#auto_swipe').prop("checked", power_user.auto_swipe);
$('#auto_swipe_minimum_length').val(power_user.auto_swipe_minimum_length);
$('#auto_swipe_blacklist').val(power_user.auto_swipe_blacklist.join(", "));
@ -1967,9 +1968,10 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$("#continue_on_send").on("input", function () {
$("#quick_continue").on("input", function () {
const value = !!$(this).prop('checked');
power_user.continue_on_send = value;
power_user.quick_continue = value;
$("#mes_continue").css('display', value ? '' : 'none');
saveSettingsDebounced();
});

View File

@ -543,13 +543,16 @@ hr {
}
#send_but {
display: none;
order: 99999;
}
#mes_continue {
order: 99998;
}
.mes_stop {
display: none;
order: 99998;
order: 99997;
}
#options_button {
@ -3510,4 +3513,4 @@ a {
z-index: 10;
margin-left: 10px;
/* Give some space between the button and search box */
}
}