add slash command to change comfy workflows

This commit is contained in:
LenAnderson 2023-12-17 22:24:22 +00:00
parent 55b9ebad3f
commit 56b9398353

View File

@ -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. <tt>/imagine-comfy-workflow MyWorkflow</tt>')
$('#extensions_settings').append(renderExtensionTemplate('stable-diffusion', 'settings', defaultSettings));
$('#sd_source').on('change', onSourceChange);