Timothy Jaeryang Baek 3 месяцев назад
Родитель
Сommit
8f48e96f5e
1 измененных файлов с 14 добавлено и 5 удалено
  1. 14 5
      src/lib/components/admin/Settings/Images.svelte

+ 14 - 5
src/lib/components/admin/Settings/Images.svelte

@@ -124,20 +124,24 @@
 			return null;
 			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}`);
 			toast.error(`${error}`);
 			return null;
 			return null;
 		});
 		});
 
 
 		if (res) {
 		if (res) {
-			config = res;
-
-			if (config.ENABLE_IMAGE_GENERATION) {
+			if (res.ENABLE_IMAGE_GENERATION) {
 				backendConfig.set(await getBackendConfig());
 				backendConfig.set(await getBackendConfig());
 				getModels();
 				getModels();
 			}
 			}
 
 
-			return config;
+			return res;
 		}
 		}
 
 
 		return null;
 		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) => {
 			REQUIRED_EDIT_WORKFLOW_NODES = REQUIRED_EDIT_WORKFLOW_NODES.map((node) => {
 				const n =
 				const n =
 					config.IMAGES_EDIT_COMFYUI_WORKFLOW_NODES.find((n) => n.type === node.type) ?? node;
 					config.IMAGES_EDIT_COMFYUI_WORKFLOW_NODES.find((n) => n.type === node.type) ?? node;