Skip to content

Commit b99214b

Browse files
christian-byrnegithub-actions
andauthored
[feat] Show version-specific missing core nodes in workflow warnings (#4227)
Co-authored-by: github-actions <[email protected]>
1 parent 2ef760c commit b99214b

File tree

12 files changed

+540
-13
lines changed

12 files changed

+540
-13
lines changed

src/components/dialog/content/LoadWorkflowWarning.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
title="Missing Node Types"
66
message="When loading the graph, the following node types were not found"
77
/>
8+
<MissingCoreNodesMessage :missing-core-nodes="missingCoreNodes" />
89
<ListBox
910
:options="uniqueNodes"
1011
option-label="label"
@@ -47,6 +48,7 @@ import ListBox from 'primevue/listbox'
4748
import { computed } from 'vue'
4849
4950
import NoResultsPlaceholder from '@/components/common/NoResultsPlaceholder.vue'
51+
import MissingCoreNodesMessage from '@/components/dialog/content/MissingCoreNodesMessage.vue'
5052
import PackInstallButton from '@/components/dialog/content/manager/button/PackInstallButton.vue'
5153
import { useMissingNodes } from '@/composables/nodePack/useMissingNodes'
5254
import { useDialogService } from '@/services/dialogService'
@@ -61,7 +63,8 @@ const props = defineProps<{
6163
const aboutPanelStore = useAboutPanelStore()
6264
6365
// Get missing node packs from workflow with loading and error states
64-
const { missingNodePacks, isLoading, error } = useMissingNodes()
66+
const { missingNodePacks, isLoading, error, missingCoreNodes } =
67+
useMissingNodes()
6568
6669
// Determines if ComfyUI-Manager is installed by checking for its badge in the about panel
6770
// This allows us to conditionally show the Manager button only when the extension is available
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<template>
2+
<Message
3+
v-if="hasMissingCoreNodes"
4+
severity="info"
5+
icon="pi pi-info-circle"
6+
class="my-2 mx-2"
7+
:pt="{
8+
root: { class: 'flex-col' },
9+
text: { class: 'flex-1' }
10+
}"
11+
>
12+
<div class="flex flex-col gap-2">
13+
<div>
14+
{{
15+
currentComfyUIVersion
16+
? $t('loadWorkflowWarning.outdatedVersion', {
17+
version: currentComfyUIVersion
18+
})
19+
: $t('loadWorkflowWarning.outdatedVersionGeneric')
20+
}}
21+
</div>
22+
<div
23+
v-for="[version, nodes] in sortedMissingCoreNodes"
24+
:key="version"
25+
class="ml-4"
26+
>
27+
<div
28+
class="text-sm font-medium text-surface-600 dark-theme:text-surface-400"
29+
>
30+
{{
31+
$t('loadWorkflowWarning.coreNodesFromVersion', {
32+
version: version || 'unknown'
33+
})
34+
}}
35+
</div>
36+
<div class="ml-4 text-sm text-surface-500 dark-theme:text-surface-500">
37+
{{ getUniqueNodeNames(nodes).join(', ') }}
38+
</div>
39+
</div>
40+
</div>
41+
</Message>
42+
</template>
43+
44+
<script setup lang="ts">
45+
import type { LGraphNode } from '@comfyorg/litegraph'
46+
import { whenever } from '@vueuse/core'
47+
import Message from 'primevue/message'
48+
import { computed, ref } from 'vue'
49+
50+
import { useSystemStatsStore } from '@/stores/systemStatsStore'
51+
import { compareVersions } from '@/utils/formatUtil'
52+
53+
const props = defineProps<{
54+
missingCoreNodes: Record<string, LGraphNode[]>
55+
}>()
56+
57+
const systemStatsStore = useSystemStatsStore()
58+
59+
const hasMissingCoreNodes = computed(() => {
60+
return Object.keys(props.missingCoreNodes).length > 0
61+
})
62+
63+
const currentComfyUIVersion = ref<string | null>(null)
64+
whenever(
65+
hasMissingCoreNodes,
66+
async () => {
67+
if (!systemStatsStore.systemStats) {
68+
await systemStatsStore.fetchSystemStats()
69+
}
70+
currentComfyUIVersion.value =
71+
systemStatsStore.systemStats?.system?.comfyui_version ?? null
72+
},
73+
{
74+
immediate: true
75+
}
76+
)
77+
78+
const sortedMissingCoreNodes = computed(() => {
79+
return Object.entries(props.missingCoreNodes).sort(([a], [b]) => {
80+
// Sort by version in descending order (newest first)
81+
return compareVersions(b, a) // Reversed for descending order
82+
})
83+
})
84+
85+
const getUniqueNodeNames = (nodes: LGraphNode[]): string[] => {
86+
return nodes
87+
.reduce<string[]>((acc, node) => {
88+
if (node.type && !acc.includes(node.type)) {
89+
acc.push(node.type)
90+
}
91+
return acc
92+
}, [])
93+
.sort()
94+
}
95+
</script>

src/composables/nodePack/useMissingNodes.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
import { LGraphNode } from '@comfyorg/litegraph'
2+
import { NodeProperty } from '@comfyorg/litegraph/dist/LGraphNode'
3+
import { groupBy } from 'lodash'
14
import { computed, onMounted } from 'vue'
25

36
import { useWorkflowPacks } from '@/composables/nodePack/useWorkflowPacks'
7+
import { app } from '@/scripts/app'
48
import { useComfyManagerStore } from '@/stores/comfyManagerStore'
9+
import { useNodeDefStore } from '@/stores/nodeDefStore'
510
import type { components } from '@/types/comfyRegistryTypes'
611

712
/**
@@ -10,6 +15,7 @@ import type { components } from '@/types/comfyRegistryTypes'
1015
* Automatically fetches workflow pack data when initialized
1116
*/
1217
export const useMissingNodes = () => {
18+
const nodeDefStore = useNodeDefStore()
1319
const comfyManagerStore = useComfyManagerStore()
1420
const { workflowPacks, isLoading, error, startFetchWorkflowPacks } =
1521
useWorkflowPacks()
@@ -24,6 +30,36 @@ export const useMissingNodes = () => {
2430
return filterMissingPacks(workflowPacks.value)
2531
})
2632

33+
/**
34+
* Check if a pack is the ComfyUI builtin node pack (nodes that come pre-installed)
35+
* @param packId - The id of the pack to check
36+
* @returns True if the pack is the comfy-core pack, false otherwise
37+
*/
38+
const isCorePack = (packId: NodeProperty) => {
39+
return packId === 'comfy-core'
40+
}
41+
42+
/**
43+
* Check if a node is a missing core node
44+
* A missing core node is a node that is in the workflow and originates from
45+
* the comfy-core pack (pre-installed) but not registered in the node def
46+
* store (the node def was not found on the server)
47+
* @param node - The node to check
48+
* @returns True if the node is a missing core node, false otherwise
49+
*/
50+
const isMissingCoreNode = (node: LGraphNode) => {
51+
const packId = node.properties?.cnr_id
52+
if (packId === undefined || !isCorePack(packId)) return false
53+
const nodeName = node.type
54+
const isRegisteredNodeDef = !!nodeDefStore.nodeDefsByName[nodeName]
55+
return !isRegisteredNodeDef
56+
}
57+
58+
const missingCoreNodes = computed<Record<string, LGraphNode[]>>(() => {
59+
const missingNodes = app.graph.nodes.filter(isMissingCoreNode)
60+
return groupBy(missingNodes, (node) => String(node.properties?.ver || ''))
61+
})
62+
2763
// Automatically fetch workflow pack data when composable is used
2864
onMounted(async () => {
2965
if (!workflowPacks.value.length && !isLoading.value) {
@@ -33,6 +69,7 @@ export const useMissingNodes = () => {
3369

3470
return {
3571
missingNodePacks,
72+
missingCoreNodes,
3673
isLoading,
3774
error
3875
}

src/locales/en/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,11 @@
11951195
"missingModels": "Missing Models",
11961196
"missingModelsMessage": "When loading the graph, the following models were not found"
11971197
},
1198+
"loadWorkflowWarning": {
1199+
"outdatedVersion": "Some nodes require a newer version of ComfyUI (current: {version}). Please update to use all nodes.",
1200+
"outdatedVersionGeneric": "Some nodes require a newer version of ComfyUI. Please update to use all nodes.",
1201+
"coreNodesFromVersion": "Requires ComfyUI {version}:"
1202+
},
11981203
"errorDialog": {
11991204
"defaultTitle": "An error occurred",
12001205
"loadWorkflowTitle": "Loading aborted due to error reloading workflow data",

src/locales/es/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@
551551
"uploadBackgroundImage": "Subir imagen de fondo",
552552
"uploadTexture": "Subir textura"
553553
},
554+
"loadWorkflowWarning": {
555+
"coreNodesFromVersion": "Requiere ComfyUI {version}:",
556+
"outdatedVersion": "Algunos nodos requieren una versión más reciente de ComfyUI (actual: {version}). Por favor, actualiza para usar todos los nodos.",
557+
"outdatedVersionGeneric": "Algunos nodos requieren una versión más reciente de ComfyUI. Por favor, actualiza para usar todos los nodos."
558+
},
554559
"maintenance": {
555560
"None": "Ninguno",
556561
"OK": "OK",

src/locales/fr/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@
551551
"uploadBackgroundImage": "Télécharger l'image de fond",
552552
"uploadTexture": "Télécharger Texture"
553553
},
554+
"loadWorkflowWarning": {
555+
"coreNodesFromVersion": "Nécessite ComfyUI {version} :",
556+
"outdatedVersion": "Certains nœuds nécessitent une version plus récente de ComfyUI (actuelle : {version}). Veuillez mettre à jour pour utiliser tous les nœuds.",
557+
"outdatedVersionGeneric": "Certains nœuds nécessitent une version plus récente de ComfyUI. Veuillez mettre à jour pour utiliser tous les nœuds."
558+
},
554559
"maintenance": {
555560
"None": "Aucun",
556561
"OK": "OK",

src/locales/ja/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@
551551
"uploadBackgroundImage": "背景画像をアップロード",
552552
"uploadTexture": "テクスチャをアップロード"
553553
},
554+
"loadWorkflowWarning": {
555+
"coreNodesFromVersion": "ComfyUI {version} が必要です:",
556+
"outdatedVersion": "一部のノードはより新しいバージョンのComfyUIが必要です(現在のバージョン:{version})。すべてのノードを使用するにはアップデートしてください。",
557+
"outdatedVersionGeneric": "一部のノードはより新しいバージョンのComfyUIが必要です。すべてのノードを使用するにはアップデートしてください。"
558+
},
554559
"maintenance": {
555560
"None": "なし",
556561
"OK": "OK",

src/locales/ko/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@
551551
"uploadBackgroundImage": "배경 이미지 업로드",
552552
"uploadTexture": "텍스처 업로드"
553553
},
554+
"loadWorkflowWarning": {
555+
"coreNodesFromVersion": "ComfyUI {version} 이상 필요:",
556+
"outdatedVersion": "일부 노드는 더 최신 버전의 ComfyUI가 필요합니다 (현재: {version}). 모든 노드를 사용하려면 업데이트해 주세요.",
557+
"outdatedVersionGeneric": "일부 노드는 더 최신 버전의 ComfyUI가 필요합니다. 모든 노드를 사용하려면 업데이트해 주세요."
558+
},
554559
"maintenance": {
555560
"None": "없음",
556561
"OK": "확인",

src/locales/ru/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@
551551
"uploadBackgroundImage": "Загрузить фоновое изображение",
552552
"uploadTexture": "Загрузить текстуру"
553553
},
554+
"loadWorkflowWarning": {
555+
"coreNodesFromVersion": "Требуется ComfyUI {version}:",
556+
"outdatedVersion": "Некоторые узлы требуют более новой версии ComfyUI (текущая: {version}). Пожалуйста, обновите, чтобы использовать все узлы.",
557+
"outdatedVersionGeneric": "Некоторые узлы требуют более новой версии ComfyUI. Пожалуйста, обновите, чтобы использовать все узлы."
558+
},
554559
"maintenance": {
555560
"None": "Нет",
556561
"OK": "OK",

src/locales/zh/main.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,11 @@
551551
"uploadBackgroundImage": "上传背景图片",
552552
"uploadTexture": "上传纹理"
553553
},
554+
"loadWorkflowWarning": {
555+
"coreNodesFromVersion": "需要 ComfyUI {version}:",
556+
"outdatedVersion": "某些节点需要更高版本的 ComfyUI(当前版本:{version})。请更新以使用所有节点。",
557+
"outdatedVersionGeneric": "某些节点需要更高版本的 ComfyUI。请更新以使用所有节点。"
558+
},
554559
"maintenance": {
555560
"None": "",
556561
"OK": "确定",

0 commit comments

Comments
 (0)