mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Update SD extension to new popup
This commit is contained in:
@ -3,7 +3,6 @@ import {
|
|||||||
systemUserName,
|
systemUserName,
|
||||||
hideSwipeButtons,
|
hideSwipeButtons,
|
||||||
showSwipeButtons,
|
showSwipeButtons,
|
||||||
callPopup,
|
|
||||||
getRequestHeaders,
|
getRequestHeaders,
|
||||||
event_types,
|
event_types,
|
||||||
eventSource,
|
eventSource,
|
||||||
@ -29,10 +28,9 @@ import { getMultimodalCaption } from '../shared.js';
|
|||||||
import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
|
import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
|
||||||
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||||
import { resolveVariable } from '../../variables.js';
|
|
||||||
import { debounce_timeout } from '../../constants.js';
|
import { debounce_timeout } from '../../constants.js';
|
||||||
import { commonEnumProviders } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
|
|
||||||
import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
|
import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
|
||||||
|
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||||
export { MODULE_NAME };
|
export { MODULE_NAME };
|
||||||
|
|
||||||
const MODULE_NAME = 'sd';
|
const MODULE_NAME = 'sd';
|
||||||
@ -572,7 +570,7 @@ async function onDeleteStyleClick() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const confirmed = await callPopup(`Are you sure you want to delete the style "${selectedStyle}"?`, 'confirm', '', { okButton: 'Delete' });
|
const confirmed = await callGenericPopup(`Are you sure you want to delete the style "${selectedStyle}"?`, POPUP_TYPE.CONFIRM, '', { okButton: 'Delete', cancelButton: 'Cancel' });
|
||||||
|
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
@ -601,7 +599,7 @@ async function onDeleteStyleClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onSaveStyleClick() {
|
async function onSaveStyleClick() {
|
||||||
const userInput = await callPopup('Enter style name:', 'input', '', { okButton: 'Save' });
|
const userInput = await callGenericPopup('Enter style name:', POPUP_TYPE.INPUT);
|
||||||
|
|
||||||
if (!userInput) {
|
if (!userInput) {
|
||||||
return;
|
return;
|
||||||
@ -670,7 +668,7 @@ async function refinePrompt(prompt, allowExpand, isNegative = false) {
|
|||||||
|
|
||||||
if (extension_settings.sd.refine_mode) {
|
if (extension_settings.sd.refine_mode) {
|
||||||
const text = isNegative ? '<h3>Review and edit the <i>negative</i> prompt:</h3>' : '<h3>Review and edit the prompt:</h3>';
|
const text = isNegative ? '<h3>Review and edit the <i>negative</i> prompt:</h3>' : '<h3>Review and edit the prompt:</h3>';
|
||||||
const refinedPrompt = await callPopup(text + 'Press "Cancel" to abort the image generation.', 'input', prompt.trim(), { rows: 5, okButton: 'Continue' });
|
const refinedPrompt = await callGenericPopup(text + 'Press "Cancel" to abort the image generation.', POPUP_TYPE.INPUT, prompt.trim(), { rows: 5, okButton: 'Continue' });
|
||||||
|
|
||||||
if (refinedPrompt) {
|
if (refinedPrompt) {
|
||||||
return refinedPrompt;
|
return refinedPrompt;
|
||||||
@ -2978,7 +2976,7 @@ async function onComfyOpenWorkflowEditorClick() {
|
|||||||
}),
|
}),
|
||||||
})).json();
|
})).json();
|
||||||
const editorHtml = $(await $.get('scripts/extensions/stable-diffusion/comfyWorkflowEditor.html'));
|
const editorHtml = $(await $.get('scripts/extensions/stable-diffusion/comfyWorkflowEditor.html'));
|
||||||
const popupResult = callPopup(editorHtml, 'confirm', undefined, { okButton: 'Save', wide: true, large: true, rows: 1 });
|
const popupResult = callGenericPopup(editorHtml, POPUP_TYPE.CONFIRM, '', { okButton: 'Save', cancelButton: 'Cancel', wide: true, large: true });
|
||||||
const checkPlaceholders = () => {
|
const checkPlaceholders = () => {
|
||||||
workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
|
workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
|
||||||
$('.sd_comfy_workflow_editor_placeholder_list > li[data-placeholder]').each(function (idx) {
|
$('.sd_comfy_workflow_editor_placeholder_list > li[data-placeholder]').each(function (idx) {
|
||||||
@ -3058,7 +3056,7 @@ async function onComfyOpenWorkflowEditorClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onComfyNewWorkflowClick() {
|
async function onComfyNewWorkflowClick() {
|
||||||
let name = await callPopup('<h3>Workflow name:</h3>', 'input');
|
let name = await callGenericPopup('Workflow name:', POPUP_TYPE.INPUT);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3085,7 +3083,7 @@ async function onComfyNewWorkflowClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onComfyDeleteWorkflowClick() {
|
async function onComfyDeleteWorkflowClick() {
|
||||||
const confirm = await callPopup('Delete the workflow? This action is irreversible.', 'confirm');
|
const confirm = await callGenericPopup('Delete the workflow? This action is irreversible.', POPUP_TYPE.CONFIRM, '', { okButton: 'Delete', cancelButton: 'Cancel' });
|
||||||
if (!confirm) {
|
if (!confirm) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user