diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index 546ad12bf..5328cd1f5 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -25,6 +25,7 @@ import { getMessageTimeStamp, humanizedDateTime } from '../../RossAscends-mods.j import { SECRET_KEYS, secret_state } from '../../secrets.js'; import { getNovelUnlimitedImageGeneration, getNovelAnlas, loadNovelSubscriptionData } from '../../nai-settings.js'; import { getMultimodalCaption } from '../shared.js'; +import { registerSlashCommand } from '../../slash-commands.js'; export { MODULE_NAME }; // Wraps a string into monospace font-face span @@ -831,6 +832,11 @@ function onComfyWorkflowChange() { extension_settings.sd.comfy_workflow = $('#sd_comfy_workflow').find(':selected').val(); saveSettingsDebounced(); } +function changeComfyWorkflow(_, name) { + extension_settings.sd.comfy_workflow = name.replace(/(\.json)?$/i, '.json'); + $('#sd_comfy_workflow').val(extension_settings.sd.comfy_workflow); + saveSettingsDebounced(); +} async function validateAutoUrl() { try { @@ -2530,6 +2536,7 @@ $('#sd_dropdown [id]').on('click', function () { jQuery(async () => { getContext().registerSlashCommand('imagine', generatePicture, ['sd', 'img', 'image'], helpString, true, true); + registerSlashCommand('imagine-comfy-workflow', changeComfyWorkflow, ['icw'], '(workflowName) - change the workflow to be used for image generation with ComfyUI, e.g. /imagine-comfy-workflow MyWorkflow') $('#extensions_settings').append(renderExtensionTemplate('stable-diffusion', 'settings', defaultSettings)); $('#sd_source').on('change', onSourceChange);