diff --git a/src/lib/components/admin/Settings/Images.svelte b/src/lib/components/admin/Settings/Images.svelte index ffbe894bc3..73aa9e435d 100644 --- a/src/lib/components/admin/Settings/Images.svelte +++ b/src/lib/components/admin/Settings/Images.svelte @@ -124,20 +124,24 @@ return null; } - const res = await updateConfig(localStorage.token, config).catch((error) => { + const res = await updateConfig(localStorage.token, { + ...config, + AUTOMATIC1111_PARAMS: + typeof config.AUTOMATIC1111_PARAMS === 'string' && config.AUTOMATIC1111_PARAMS.trim() !== '' + ? JSON.parse(config.AUTOMATIC1111_PARAMS) + : {} + }).catch((error) => { toast.error(`${error}`); return null; }); if (res) { - config = res; - - if (config.ENABLE_IMAGE_GENERATION) { + if (res.ENABLE_IMAGE_GENERATION) { backendConfig.set(await getBackendConfig()); getModels(); } - return config; + return res; } return null; @@ -245,6 +249,11 @@ } } + config.AUTOMATIC1111_PARAMS = + typeof config.AUTOMATIC1111_PARAMS === 'object' + ? JSON.stringify(config.AUTOMATIC1111_PARAMS ?? {}, null, 2) + : config.AUTOMATIC1111_PARAMS; + REQUIRED_EDIT_WORKFLOW_NODES = REQUIRED_EDIT_WORKFLOW_NODES.map((node) => { const n = config.IMAGES_EDIT_COMFYUI_WORKFLOW_NODES.find((n) => n.type === node.type) ?? node;