From abfc7481d3823f7a74349bd980694d4c9213253b Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Fri, 21 Feb 2025 12:01:26 -0500 Subject: [PATCH] Remove 'clean' param from graphToPrompt (#2665) --- src/scripts/app.ts | 3 +-- src/utils/executionUtil.ts | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index c99823fcd..4b45c507c 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -1227,9 +1227,8 @@ export class ComfyApp { return graph.serialize({ sortNodes }) } - async graphToPrompt(graph = this.graph, clean = true) { + async graphToPrompt(graph = this.graph) { return graphToPrompt(graph, { - clean, sortNodes: useSettingStore().get('Comfy.Workflow.SortNodeIdOnSave') }) } diff --git a/src/utils/executionUtil.ts b/src/utils/executionUtil.ts index 4a990bff6..fa7bc00f9 100644 --- a/src/utils/executionUtil.ts +++ b/src/utils/executionUtil.ts @@ -10,9 +10,9 @@ import type { ComfyApiWorkflow, ComfyWorkflowJSON } from '@/types/comfyWorkflow' */ export const graphToPrompt = async ( graph: LGraph, - options: { clean?: boolean; sortNodes?: boolean } = {} + options: { sortNodes?: boolean } = {} ): Promise<{ workflow: ComfyWorkflowJSON; output: ComfyApiWorkflow }> => { - const { clean = true, sortNodes = false } = options + const { sortNodes = false } = options for (const outerNode of graph.computeExecutionOrder(false)) { if (outerNode.widgets) { @@ -165,16 +165,14 @@ export const graphToPrompt = async ( } // Remove inputs connected to removed nodes - if (clean) { - for (const o in output) { - for (const i in output[o].inputs) { - if ( - Array.isArray(output[o].inputs[i]) && - output[o].inputs[i].length === 2 && - !output[output[o].inputs[i][0]] - ) { - delete output[o].inputs[i] - } + for (const o in output) { + for (const i in output[o].inputs) { + if ( + Array.isArray(output[o].inputs[i]) && + output[o].inputs[i].length === 2 && + !output[output[o].inputs[i][0]] + ) { + delete output[o].inputs[i] } } }