diff --git a/src/lib/convertVanillaWorkflow.ts b/src/lib/convertVanillaWorkflow.ts index 3d13fed..6f73e7b 100644 --- a/src/lib/convertVanillaWorkflow.ts +++ b/src/lib/convertVanillaWorkflow.ts @@ -296,6 +296,7 @@ function convertPrimitiveNode(vanillaWorkflow: ComfyVanillaWorkflow, node: Seria link[5] = widgetInputType // link data type if (foundInput != null) { foundInput.type = widgetInputType; + (foundInput as IComfyInputSlot).serialize = true; // IMPORTANT!!! } // Change the title of the widget to the name of the first input connected to @@ -305,7 +306,10 @@ function convertPrimitiveNode(vanillaWorkflow: ComfyVanillaWorkflow, node: Seria } } } - // Remove links on the old node so they won't be double-removed when it's pruned + + // Remove links on the old node so they won't be double-removed when + // it's pruned (removeSerializedNode will remove any links still + // connected to other inputs, but we want to keep the ones we rewrote) mainOutput.links = [] } else { @@ -423,7 +427,7 @@ export default function convertVanillaWorkflow(vanillaWorkflow: ComfyVanillaWork config: inputOpts, defaultWidgetNode: null, widgetNodeType, - serialize: true, + serialize: true, // IMPORTANT! properties: {} } diff --git a/src/tests/convertVanillaWorkflowTests.ts b/src/tests/convertVanillaWorkflowTests.ts index 6f9ba05..9dc3cb7 100644 --- a/src/tests/convertVanillaWorkflowTests.ts +++ b/src/tests/convertVanillaWorkflowTests.ts @@ -8,6 +8,7 @@ import layoutStates, { defaultWorkflowAttributes, type IDragItem, type WidgetLay import ComfyApp from '$lib/components/ComfyApp'; import { LiteGraph } from '@litegraph-ts/core'; import type { ComfyNodeDef } from '$lib/ComfyNodeDef'; +import type IComfyInputSlot from '$lib/IComfyInputSlot'; const objectInfo: Record = await import("./data/objectInfo.json") const json1: ComfyVanillaWorkflow = await import("./data/convertedWidget.json") @@ -103,6 +104,7 @@ export default class convertVanillaWorkflowTests extends UnitTest { const targetNode = widget.node.getOutputNodes(0)[0] expect(targetNode.inputs[links[0].target_slot].type).toEqual("number") + expect((targetNode.inputs[links[0].target_slot] as IComfyInputSlot).serialize).toEqual(true) expect(links[0].type).toEqual("number"); }