diff --git a/src/components/graph/NodeTooltip.vue b/src/components/graph/NodeTooltip.vue index 8054f86a8..f473cb3a5 100644 --- a/src/components/graph/NodeTooltip.vue +++ b/src/components/graph/NodeTooltip.vue @@ -85,6 +85,9 @@ const onIdle = () => { ctor.title_mode !== LiteGraph.NO_TITLE && canvas.graph_mouse[1] < node.pos[1] // If we are over a node, but not within the node then we are on its title ) { + if (Array.isArray(nodeDef.description)) { + return showTooltip(nodeDef.description[0]) + } return showTooltip(nodeDef.description) } diff --git a/src/components/node/NodePreview.vue b/src/components/node/NodePreview.vue index 4046db39d..064962e3e 100644 --- a/src/components/node/NodePreview.vue +++ b/src/components/node/NodePreview.vue @@ -74,7 +74,11 @@ https://github.com/Nuked88/ComfyUI-N-Sidebar/blob/7ae7da4a9761009fb6629bc04c6830 backgroundColor: litegraphColors.WIDGET_BGCOLOR }" > - {{ nodeDef.description }} + {{ + Array.isArray(nodeDef.description) + ? nodeDef.description[0] + : nodeDef.description + }} diff --git a/src/extensions/core/documentationSidebar.ts b/src/extensions/core/documentationSidebar.ts index 9cb2d46f4..ba49d8f1f 100644 --- a/src/extensions/core/documentationSidebar.ts +++ b/src/extensions/core/documentationSidebar.ts @@ -149,8 +149,8 @@ function updateNode(node) { return } helpDOM.def = def - if (def.longDescription) { - helpDOM.innerHTML = def.longDescription + if (Array.isArray(def.description)) { + helpDOM.innerHTML = def.description[1] } else { //do additional parsing to prettify output and combine tooltips let content = '' @@ -189,15 +189,6 @@ function updateNode(node) { helpDOM.innerHTML = content } } -app.registerExtension({ - name: 'Comfy.longformDocumentation', - async beforeRegisterNodeDef(nodeType, nodeData, app) { - //TODO: Find better method. Likely require explicit opt in - if (nodeData.description.includes('') && !nodeData.longDescription) { - nodeData.longDescription = nodeData.description - } - } -}) var bringToFront let documentationSidebar = { id: 'documentationSidebar', diff --git a/src/types/apiTypes.ts b/src/types/apiTypes.ts index fced6cc35..f3c5710d9 100644 --- a/src/types/apiTypes.ts +++ b/src/types/apiTypes.ts @@ -345,6 +345,11 @@ const zComfyComboOutput = z.array(z.any()) const zComfyOutputTypesSpec = z.array( z.union([zComfyNodeDataType, zComfyComboOutput]) ) +const zDescriptionSpec = z.union([ + z.string(), + z.tuple([z.string(), z.string()]), + z.tuple([z.string(), z.string(), z.record(z.string(), z.any())]) +]) const zComfyNodeDef = z.object({ input: zComfyInputsSpec.optional(), @@ -354,7 +359,7 @@ const zComfyNodeDef = z.object({ output_tooltips: z.array(z.string()).optional(), name: z.string(), display_name: z.string(), - description: z.string(), + description: zDescriptionSpec, category: z.string(), output_node: z.boolean(), python_module: z.string(), diff --git a/src/types/comfy.d.ts b/src/types/comfy.d.ts index 7704e3d60..db9b8eb60 100644 --- a/src/types/comfy.d.ts +++ b/src/types/comfy.d.ts @@ -117,7 +117,7 @@ export interface ComfyExtension { export type ComfyObjectInfo = { name: string display_name?: string - description?: string + description?: [string | string, string | string, string, Record] category: string input?: { required?: Record