caption: update for new popup

b901ed1be761d47361003215d146dc23a2d049e4

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +6 -5Ignore whitespace
public/scripts/extensions/caption/index.js+6 -5
@@ -1,6 +1,6 @@
1import { ensureImageFormatSupported, getBase64Async, isTrueBoolean, saveBase64AsFile } from '../../utils.js';1import { ensureImageFormatSupported, getBase64Async, isTrueBoolean, saveBase64AsFile } from '../../utils.js';
2import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js';2import { getContext, getApiUrl, doExtrasFetch, extension_settings, modules, renderExtensionTemplateAsync } from '../../extensions.js';
3import { appendMediaToMessage, callPopup, eventSource, event_types, getRequestHeaders, saveChatConditional, saveSettingsDebounced, substituteParamsExtended } from '../../../script.js';3import { appendMediaToMessage, eventSource, event_types, getRequestHeaders, saveChatConditional, saveSettingsDebounced, substituteParamsExtended } from '../../../script.js';
4import { getMessageTimeStamp } from '../../RossAscends-mods.js';4import { getMessageTimeStamp } from '../../RossAscends-mods.js';
5import { SECRET_KEYS, secret_state } from '../../secrets.js';5import { SECRET_KEYS, secret_state } from '../../secrets.js';
6import { getMultimodalCaption } from '../shared.js';6import { getMultimodalCaption } from '../shared.js';
@@ -9,6 +9,7 @@ import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
9import { SlashCommand } from '../../slash-commands/SlashCommand.js';9import { SlashCommand } from '../../slash-commands/SlashCommand.js';
10import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';10import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
11import { commonEnumProviders } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';11import { commonEnumProviders } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
12import { callGenericPopup, Popup, POPUP_TYPE } from '../../popup.js';
12export { MODULE_NAME };13export { MODULE_NAME };
1314
14const MODULE_NAME = 'caption';15const MODULE_NAME = 'caption';
@@ -98,9 +99,9 @@ async function wrapCaptionTemplate(caption) {
98 let messageText = substituteParamsExtended(template, { caption: caption });99 let messageText = substituteParamsExtended(template, { caption: caption });
99100
100 if (extension_settings.caption.refine_mode) {101 if (extension_settings.caption.refine_mode) {
101 messageText = await callPopup(102 messageText = await Popup.show.input(
102 '<h3>Review and edit the generated caption:</h3>Press "Cancel" to abort the caption sending.',103 'Review and edit the generated caption:',
103 'input',104 'Press "Cancel" to abort the caption sending.',
104 messageText,105 messageText,
105 { rows: 5, okButton: 'Send' });106 { rows: 5, okButton: 'Send' });
106107
@@ -278,7 +279,7 @@ async function captionMultimodal(base64Img, externalPrompt) {
278 let prompt = externalPrompt || extension_settings.caption.prompt || PROMPT_DEFAULT;279 let prompt = externalPrompt || extension_settings.caption.prompt || PROMPT_DEFAULT;
279280
280 if (!externalPrompt && extension_settings.caption.prompt_ask) {281 if (!externalPrompt && extension_settings.caption.prompt_ask) {
281 const customPrompt = await callPopup('<h3>Enter a comment or question:</h3>', 'input', prompt, { rows: 2 });282 const customPrompt = await callGenericPopup('Enter a comment or question:', POPUP_TYPE.INPUT, prompt, { rows: 2 });
282 if (!customPrompt) {283 if (!customPrompt) {
283 throw new Error('User aborted the caption sending.');284 throw new Error('User aborted the caption sending.');
284 }285 }