mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add confirmation for regen with keystroke
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
|||||||
eventSource,
|
eventSource,
|
||||||
menu_type,
|
menu_type,
|
||||||
substituteParams,
|
substituteParams,
|
||||||
|
callPopup,
|
||||||
} from '../script.js';
|
} from '../script.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -995,9 +996,31 @@ export function initRossMods() {
|
|||||||
console.debug('Accepting edits with Ctrl+Enter');
|
console.debug('Accepting edits with Ctrl+Enter');
|
||||||
editMesDone.trigger('click');
|
editMesDone.trigger('click');
|
||||||
} else if (is_send_press == false) {
|
} else if (is_send_press == false) {
|
||||||
console.debug('Regenerating with Ctrl+Enter');
|
const skipConfirmKey = 'RegenerateWithCtrlEnter';
|
||||||
$('#option_regenerate').click();
|
const skipConfirm = LoadLocalBool(skipConfirmKey);
|
||||||
$('#options').hide();
|
function doRegenerate() {
|
||||||
|
console.debug('Regenerating with Ctrl+Enter');
|
||||||
|
$('#option_regenerate').trigger('click');
|
||||||
|
$('#options').hide();
|
||||||
|
}
|
||||||
|
if (skipConfirm) {
|
||||||
|
doRegenerate();
|
||||||
|
} else {
|
||||||
|
const popupText = `
|
||||||
|
<div class="marginBot10">Are you sure you want to regenerate the latest message?</div>
|
||||||
|
<label class="checkbox_label justifyCenter" for="regenerateWithCtrlEnter">
|
||||||
|
<input type="checkbox" id="regenerateWithCtrlEnter">
|
||||||
|
Don't ask again
|
||||||
|
</label>`;
|
||||||
|
callPopup(popupText, 'confirm').then(result =>{
|
||||||
|
if (!result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const regenerateWithCtrlEnter = $('#regenerateWithCtrlEnter').prop('checked');
|
||||||
|
SaveLocal(skipConfirmKey, regenerateWithCtrlEnter);
|
||||||
|
doRegenerate();
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.debug('Ctrl+Enter ignored');
|
console.debug('Ctrl+Enter ignored');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user