From ae26e9288b4b3ae96958e39cb86fd54dfc36a3ad Mon Sep 17 00:00:00 2001 From: mic Date: Sat, 14 Feb 2026 23:23:07 +0100 Subject: [PATCH] when using the same id in additional_text, the text is asked only once and then used in every occurrence. see #525 --- js/mzta-placeholders.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/mzta-placeholders.js b/js/mzta-placeholders.js index b06f82d3..c666e858 100644 --- a/js/mzta-placeholders.js +++ b/js/mzta-placeholders.js @@ -489,11 +489,16 @@ export const placeholdersUtils = { const regex = /{%\s*additional_text(?::(.*?))?\s*%}/g; let matches = []; let match; + let foundIds = new Set(); while ((match = regex.exec(prompt_text)) !== null) { - matches.push({ - placeholder: match[0], - info: match[1] ? match[1].trim() : "" - }); + let info = match[1] ? match[1].trim() : ""; + if (!foundIds.has(info)) { + foundIds.add(info); + matches.push({ + placeholder: match[0], + info: info + }); + } } return matches; },