MCPcopy Create free account
hub / github.com/6174/comflowyspace / ApiUpdateStableDiffusionConfig

Function ApiUpdateStableDiffusionConfig

apps/node/src/routes/api/bootstrap.ts:335–372  ·  view source on GitHub ↗
(req: Request, res: Response)

Source from the content-addressed store, hash-verified

333}
334
335export async function ApiUpdateStableDiffusionConfig(req: Request, res: Response) {
336 try {
337 const { data } = req.body;
338 const stableDiffusionPath = (data.stableDiffusionDir || "").trim();
339
340 if (stableDiffusionPath === "") {
341 throw new Error("SD WebUI path is empty")
342 }
343
344 if (stableDiffusionPath !== "") {
345 if (!fsExtra.existsSync(path.resolve(stableDiffusionPath, "webui.py"))) {
346 throw new Error("Can't find webui.py in stable diffusion path, please check if it's a valid diffusion path");
347 }
348
349 if (!fsExtra.existsSync(path.resolve(stableDiffusionPath, "models"))) {
350 throw new Error("Can't find models in stable diffusion path, please check if it's a valid diffusion path");
351 }
352 }
353
354 const comfyUIDir = getComfyUIDir();
355 const setupString = JSON.stringify({
356 comfyUIDir,
357 stableDiffusionDir: stableDiffusionPath
358 });
359
360 appConfigManager.set(CONFIG_KEYS.appSetupConfig, setupString);
361 createOrUpdateExtraConfigFileFromStableDiffusion(stableDiffusionPath)
362 res.send({
363 success: true,
364 });
365 } catch (err: any) {
366 logger.error(err.message + ":" + err.stack);
367 res.send({
368 success: false,
369 error: err.message
370 });
371 }
372}
373
374export async function ApiRestartComfyUI(req: Request, res: Response) {
375 try {

Callers

nothing calls this directly

Calls 3

getComfyUIDirFunction · 0.90
setMethod · 0.45

Tested by

no test coverage detected