From 1d83c3a8c094f68c9da44447e1436fb29dd3a493 Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 16 Jan 2026 22:29:34 +0100 Subject: [PATCH] correctly handling empty body with no placeholders. see #614 --- js/mzta-utils-prompt.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/mzta-utils-prompt.js b/js/mzta-utils-prompt.js index d1c638b7..c19499f8 100644 --- a/js/mzta-utils-prompt.js +++ b/js/mzta-utils-prompt.js @@ -50,7 +50,9 @@ export const taPromptUtils = { if(!placeholdersUtils.hasPlaceholder(curr_prompt.text)){ // no placeholders, do as usual - fullPrompt = curr_prompt.text + (String(curr_prompt.need_signature) == "1" ? " " + await taPromptUtils.getDefaultSignature():"") + " " + chatgpt_lang + " \"" + (selection_text=='' ? body_text : selection_text) + "\" "; + const signature = String(curr_prompt.need_signature) === "1" ? await taPromptUtils.getDefaultSignature() : ""; + const content = selection_text || body_text; + fullPrompt = [curr_prompt.text, signature, chatgpt_lang, content ? `"${content}"` : ""].filter(Boolean).join(" "); }else{ // we have at least a placeholder, do the magic! // check if we have custom placeholders