From 0a493cad89969edfadb4c9a174eb0c58045675f1 Mon Sep 17 00:00:00 2001 From: feg <58643807+f-eg@users.noreply.github.com> Date: Sat, 25 Apr 2026 10:14:45 -0700 Subject: [PATCH] add macro support for image caption extension prompt (multimodal) (#5527) * added macro processing to caption ext added `prompt = substituteParamsExtended(prompt);` to the captionmultimodal function (so it can use macros and stuff) * caption ext updated from old substituteparams * removed comment --- public/scripts/extensions/caption/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/scripts/extensions/caption/index.js b/public/scripts/extensions/caption/index.js index 8b666945b..73cd394f6 100644 --- a/public/scripts/extensions/caption/index.js +++ b/public/scripts/extensions/caption/index.js @@ -1,6 +1,6 @@ import { ensureImageFormatSupported, getBase64Async, getFileExtension, isTrueBoolean, saveBase64AsFile } from '../../utils.js'; import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js'; -import { appendMediaToMessage, chat_metadata, eventSource, event_types, getRequestHeaders, saveChatConditional, saveSettingsDebounced, substituteParamsExtended } from '../../../script.js'; +import { appendMediaToMessage, chat_metadata, eventSource, event_types, getRequestHeaders, saveChatConditional, saveSettingsDebounced, substituteParams } from '../../../script.js'; import { getMessageTimeStamp } from '../../RossAscends-mods.js'; import { SECRET_KEYS, secret_state } from '../../secrets.js'; import { oai_settings } from '../../openai.js'; @@ -100,7 +100,7 @@ async function wrapCaptionTemplate(caption) { template += ' {{caption}}'; } - let messageText = substituteParamsExtended(template, { caption: caption }); + let messageText = substituteParams(template, { dynamicMacros: { caption: caption } }); if (extension_settings.caption.refine_mode) { messageText = await Popup.show.input( @@ -322,6 +322,8 @@ async function captionMultimodal(base64Img, externalPrompt) { prompt = String(customPrompt).trim(); } + prompt = substituteParams(prompt); + const caption = await getMultimodalCaption(base64Img, prompt); return { caption }; }