Skip to content

Commit 6663c86

Browse files
webfilteredgithub-actions
authored andcommitted
Add Subgraphs (#3905)
Co-authored-by: github-actions <[email protected]>
1 parent 6c2dc05 commit 6663c86

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@alloc/quick-lru": "^5.2.0",
7878
"@atlaskit/pragmatic-drag-and-drop": "^1.3.1",
7979
"@comfyorg/comfyui-electron-types": "^0.4.43",
80-
"@comfyorg/litegraph": "^0.16.4",
80+
"@comfyorg/litegraph": "^0.16.0",
8181
"@primevue/forms": "^4.2.5",
8282
"@primevue/themes": "^4.2.5",
8383
"@sentry/vue": "^8.48.0",

src/composables/useCoreCommands.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,30 @@ export function useCoreCommands(): ComfyCommand[] {
775775
if (!(node instanceof LGraphNode)) return
776776
await addFluxKontextGroupNode(node)
777777
}
778+
},
779+
{
780+
id: 'Comfy.Graph.ConvertToSubgraph',
781+
icon: 'pi pi-sitemap',
782+
label: 'Convert Selection to Subgraph',
783+
versionAdded: '1.20.1',
784+
function: () => {
785+
const canvas = canvasStore.getCanvas()
786+
const graph = canvas.subgraph ?? canvas.graph
787+
if (!graph) throw new TypeError('Canvas has no graph or subgraph set.')
788+
789+
const res = graph.convertToSubgraph(canvas.selectedItems)
790+
if (!res) {
791+
toastStore.add({
792+
severity: 'error',
793+
summary: t('toastMessages.cannotCreateSubgraph'),
794+
detail: t('toastMessages.failedToConvertToSubgraph'),
795+
life: 3000
796+
})
797+
return
798+
}
799+
const { node } = res
800+
canvas.select(node)
801+
}
778802
}
779803
]
780804

0 commit comments

Comments
 (0)