|
| 1 | +/** |
| 2 | + * Single source of truth for Essentials tab node categorization and ordering. |
| 3 | + * |
| 4 | + * Adding a new node to the Essentials tab? Add it here and nowhere else. |
| 5 | + * |
| 6 | + * Source: https://www.notion.so/comfy-org/2fe6d73d365080d0a951d14cdf540778 |
| 7 | + */ |
| 8 | + |
| 9 | +export const ESSENTIALS_CATEGORIES = [ |
| 10 | + 'basics', |
| 11 | + 'text generation', |
| 12 | + 'image generation', |
| 13 | + 'video generation', |
| 14 | + 'image tools', |
| 15 | + 'video tools', |
| 16 | + 'audio', |
| 17 | + '3D' |
| 18 | +] as const |
| 19 | + |
| 20 | +export type EssentialsCategory = (typeof ESSENTIALS_CATEGORIES)[number] |
| 21 | + |
| 22 | +/** |
| 23 | + * Ordered list of nodes per category. |
| 24 | + * Array order = display order in the Essentials tab. |
| 25 | + * Presence in a category = the node's essentials_category mock fallback. |
| 26 | + */ |
| 27 | +export const ESSENTIALS_NODES: Record<EssentialsCategory, readonly string[]> = { |
| 28 | + basics: [ |
| 29 | + 'LoadImage', |
| 30 | + 'LoadVideo', |
| 31 | + 'Load3D', |
| 32 | + 'SaveImage', |
| 33 | + 'SaveVideo', |
| 34 | + 'SaveGLB', |
| 35 | + 'PrimitiveStringMultiline', |
| 36 | + 'PreviewImage' |
| 37 | + ], |
| 38 | + 'text generation': ['OpenAIChatNode'], |
| 39 | + 'image generation': [ |
| 40 | + 'LoraLoader', |
| 41 | + 'LoraLoaderModelOnly', |
| 42 | + 'ConditioningCombine' |
| 43 | + ], |
| 44 | + 'video generation': [ |
| 45 | + 'SubgraphBlueprint.pose_to_video_ltx_2_0', |
| 46 | + 'SubgraphBlueprint.canny_to_video_ltx_2_0', |
| 47 | + 'KlingLipSyncAudioToVideoNode', |
| 48 | + 'KlingOmniProEditVideoNode' |
| 49 | + ], |
| 50 | + 'image tools': [ |
| 51 | + 'ImageBatch', |
| 52 | + 'ImageCrop', |
| 53 | + 'ImageCropV2', |
| 54 | + 'ImageScale', |
| 55 | + 'ImageScaleBy', |
| 56 | + 'ImageRotate', |
| 57 | + 'ImageBlur', |
| 58 | + 'ImageBlend', |
| 59 | + 'ImageInvert', |
| 60 | + 'ImageCompare', |
| 61 | + 'Canny', |
| 62 | + 'RecraftRemoveBackgroundNode', |
| 63 | + 'RecraftVectorizeImageNode', |
| 64 | + 'LoadImageMask', |
| 65 | + 'GLSLShader' |
| 66 | + ], |
| 67 | + 'video tools': ['GetVideoComponents', 'CreateVideo', 'Video Slice'], |
| 68 | + audio: [ |
| 69 | + 'LoadAudio', |
| 70 | + 'SaveAudio', |
| 71 | + 'SaveAudioMP3', |
| 72 | + 'StabilityTextToAudio', |
| 73 | + 'EmptyLatentAudio' |
| 74 | + ], |
| 75 | + '3D': ['TencentTextToModelNode', 'TencentImageToModelNode'] |
| 76 | +} |
| 77 | + |
| 78 | +/** |
| 79 | + * Flat map: node name → category (derived from ESSENTIALS_NODES). |
| 80 | + * Used as mock/fallback when backend doesn't provide essentials_category. |
| 81 | + */ |
| 82 | +export const ESSENTIALS_CATEGORY_MAP: Record<string, EssentialsCategory> = |
| 83 | + Object.fromEntries( |
| 84 | + Object.entries(ESSENTIALS_NODES).flatMap(([category, nodes]) => |
| 85 | + nodes.map((node) => [node, category]) |
| 86 | + ) |
| 87 | + ) as Record<string, EssentialsCategory> |
| 88 | + |
| 89 | +/** |
| 90 | + * Case-insensitive lookup: lowercase category → canonical category. |
| 91 | + * Used to normalize backend categories (which may be title-cased) to the |
| 92 | + * canonical form used in ESSENTIALS_CATEGORIES. |
| 93 | + */ |
| 94 | +export const ESSENTIALS_CATEGORY_CANONICAL: ReadonlyMap< |
| 95 | + string, |
| 96 | + EssentialsCategory |
| 97 | +> = new Map(ESSENTIALS_CATEGORIES.map((c) => [c.toLowerCase(), c])) |
| 98 | + |
| 99 | +/** |
| 100 | + * "Novel" toolkit nodes for telemetry — basics excluded. |
| 101 | + * Derived from ESSENTIALS_NODES minus the 'basics' category. |
| 102 | + */ |
| 103 | +export const TOOLKIT_NOVEL_NODE_NAMES: ReadonlySet<string> = new Set( |
| 104 | + Object.entries(ESSENTIALS_NODES) |
| 105 | + .filter(([cat]) => cat !== 'basics') |
| 106 | + .flatMap(([, nodes]) => nodes) |
| 107 | + .filter((n) => !n.startsWith('SubgraphBlueprint.')) |
| 108 | +) |
| 109 | + |
| 110 | +/** |
| 111 | + * python_module values that identify toolkit blueprint nodes. |
| 112 | + */ |
| 113 | +export const TOOLKIT_BLUEPRINT_MODULES: ReadonlySet<string> = new Set([ |
| 114 | + 'comfy_essentials' |
| 115 | +]) |
0 commit comments