diff --git a/public/script.js b/public/script.js index 4cdd68979..ebe0654b5 100644 --- a/public/script.js +++ b/public/script.js @@ -1472,6 +1472,14 @@ export async function reloadCurrentChat() { showSwipeButtons(); } +/** + * Send the message currently typed into the chat box. + */ +export function sendTextareaMessage() { + if (is_send_press) return; + Generate(); +} + function messageFormatting(mes, ch_name, isSystem, isUser) { if (!mes) { return ''; @@ -7971,12 +7979,7 @@ jQuery(async function () { }); $('#send_but').on('click', function () { - if (is_send_press == false) { - // This prevents from running /trigger command with a send button - // But send on Enter doesn't set is_send_press (it is done by the Generate itself) - // is_send_press = true; - Generate(); - } + sendTextareaMessage(); }); //menu buttons setup diff --git a/public/scripts/RossAscends-mods.js b/public/scripts/RossAscends-mods.js index 7a0c648f3..46e76e97f 100644 --- a/public/scripts/RossAscends-mods.js +++ b/public/scripts/RossAscends-mods.js @@ -1,5 +1,4 @@ import { - Generate, characters, online_status, main_api, @@ -18,6 +17,7 @@ import { menu_type, substituteParams, callPopup, + sendTextareaMessage, } from '../script.js'; import { @@ -954,9 +954,9 @@ export function initRossMods() { //Enter to send when send_textarea in focus if ($(':focus').attr('id') === 'send_textarea') { const sendOnEnter = shouldSendOnEnter(); - if (!event.shiftKey && !event.ctrlKey && !event.altKey && event.key == 'Enter' && is_send_press == false && sendOnEnter) { + if (!event.shiftKey && !event.ctrlKey && !event.altKey && event.key == 'Enter' && sendOnEnter) { event.preventDefault(); - Generate(); + sendTextareaMessage(); } } if ($(':focus').attr('id') === 'dialogue_popup_input' && !isMobile()) {