From 1ac494d4680aaa49e54e9e4a018fdfd07abf872c Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 4 Dec 2023 21:28:36 +0200 Subject: [PATCH] Don't attempt to send files on dry runs. --- public/script.js | 6 +++--- public/scripts/chats.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/script.js b/public/script.js index 713300982..3d0977a2b 100644 --- a/public/script.js +++ b/public/script.js @@ -2914,7 +2914,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, let textareaText; if (type !== 'regenerate' && type !== 'swipe' && type !== 'quiet' && !isImpersonate && !dryRun) { is_send_press = true; - textareaText = $('#send_textarea').val(); + textareaText = String($('#send_textarea').val()); $('#send_textarea').val('').trigger('input'); } else { textareaText = ''; @@ -2960,7 +2960,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, //********************************* //for normal messages sent from user.. - if ((textareaText != '' || hasPendingFileAttachment()) && !automatic_trigger && type !== 'quiet') { + if ((textareaText != '' || hasPendingFileAttachment()) && !automatic_trigger && type !== 'quiet' && !dryRun) { // If user message contains no text other than bias - send as a system message if (messageBias && replaceBiasMarkup(textareaText).trim().length === 0) { sendSystemMessage(system_message_types.GENERIC, ' ', { bias: messageBias }); @@ -2969,7 +2969,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, await sendMessageAsUser(textareaText, messageBias); } } - else if (textareaText == '' && !automatic_trigger && type === undefined && main_api == 'openai' && oai_settings.send_if_empty.trim().length > 0) { + else if (textareaText == '' && !automatic_trigger && !dryRun && type === undefined && main_api == 'openai' && oai_settings.send_if_empty.trim().length > 0) { // Use send_if_empty if set and the user message is empty. Only when sending messages normally await sendMessageAsUser(oai_settings.send_if_empty.trim(), messageBias); } diff --git a/public/scripts/chats.js b/public/scripts/chats.js index 7ccfd1195..a53b8c712 100644 --- a/public/scripts/chats.js +++ b/public/scripts/chats.js @@ -302,7 +302,7 @@ async function viewMessageFile(messageId) { modalTemplate.addClass('file_modal'); addCopyToCodeBlocks(modalTemplate); - callPopup(modalTemplate, 'text'); + callPopup(modalTemplate, 'text', '', { wide: true, large: true }); } /**