GraphPage : Can drag output connector to connect to a new node

Added new ComfyUI workflows
This commit is contained in:
Bruno Fargnoli 2026-05-06 11:24:18 +02:00
parent be6fb05016
commit 4a1b4f3287
5 changed files with 1003 additions and 10 deletions

View file

@ -0,0 +1,272 @@
{
"9": {
"inputs": {
"filename_prefix": "Flux2-Klein",
"images": [
"97",
0
]
},
"class_type": "SaveImage",
"_meta": {
"title": "Save Image"
}
},
"84": {
"inputs": {
"sampler_name": "euler"
},
"class_type": "KSamplerSelect",
"_meta": {
"title": "KSamplerSelect"
}
},
"85": {
"inputs": {
"steps": 8,
"width": [
"90",
0
],
"height": [
"91",
0
]
},
"class_type": "Flux2Scheduler",
"_meta": {
"title": "Flux2Scheduler"
}
},
"86": {
"inputs": {
"cfg": 1.5,
"model": [
"93",
0
],
"positive": [
"96",
0
],
"negative": [
"89",
0
]
},
"class_type": "CFGGuider",
"_meta": {
"title": "CFGGuider"
}
},
"87": {
"inputs": {
"noise": [
"92",
0
],
"guider": [
"86",
0
],
"sampler": [
"84",
0
],
"sigmas": [
"85",
0
],
"latent_image": [
"88",
0
]
},
"class_type": "SamplerCustomAdvanced",
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"88": {
"inputs": {
"width": [
"90",
0
],
"height": [
"91",
0
],
"batch_size": 1
},
"class_type": "EmptyFlux2LatentImage",
"_meta": {
"title": "Empty Flux 2 Latent"
}
},
"89": {
"inputs": {
"text": "blurry, low detail, low contrast, deformed",
"clip": [
"94",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"90": {
"inputs": {
"value": 1024
},
"class_type": "PrimitiveInt",
"_meta": {
"title": "Width"
}
},
"91": {
"inputs": {
"value": 1024
},
"class_type": "PrimitiveInt",
"_meta": {
"title": "Height"
}
},
"92": {
"inputs": {
"noise_seed": 12345
},
"class_type": "RandomNoise",
"_meta": {
"title": "RandomNoise"
}
},
"93": {
"inputs": {
"unet_name": "flux-2-klein-9b-kv-fp8.safetensors",
"weight_dtype": "default"
},
"class_type": "UNETLoader",
"_meta": {
"title": "Load Diffusion Model"
}
},
"94": {
"inputs": {
"clip_name": "qwen_3_8b_fp8mixed.safetensors",
"type": "flux2",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "Load CLIP"
}
},
"95": {
"inputs": {
"vae_name": "flux2-vae.safetensors"
},
"class_type": "VAELoader",
"_meta": {
"title": "Load VAE"
}
},
"96": {
"inputs": {
"text": [
"98",
0
],
"clip": [
"94",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"97": {
"inputs": {
"samples": [
"87",
0
],
"vae": [
"95",
0
]
},
"class_type": "VAEDecode",
"_meta": {
"title": "VAE Decode"
}
},
"98": {
"inputs": {
"switch": [
"99",
0
],
"on_false": [
"100",
0
],
"on_true": [
"101",
0
]
},
"class_type": "ComfySwitchNode",
"_meta": {
"title": "Switch"
}
},
"99": {
"inputs": {
"value": true
},
"class_type": "PrimitiveBoolean",
"_meta": {
"title": "Enhance Prompt"
}
},
"100": {
"inputs": {
"value": "An anime dwarf sorcerer, standing in T-Pose with arms apart, front view, gray background"
},
"class_type": "PrimitiveStringMultiline",
"_meta": {
"title": "String (Multiline)"
}
},
"101": {
"inputs": {
"model_name": "Qwen3-VL-4B-Instruct",
"quantization": "None (FP16)",
"attention_mode": "auto",
"use_torch_compile": false,
"device": "auto",
"prompt_text": [
"100",
0
],
"enhancement_style": "📝 Refine",
"custom_system_prompt": "",
"max_tokens": 256,
"temperature": 0.7,
"top_p": 0.9,
"repetition_penalty": 1.1,
"keep_model_loaded": true,
"seed": 12345
},
"class_type": "AILab_QwenVL_PromptEnhancer",
"_meta": {
"title": "QwenVL Prompt Enhancer"
}
}
}

View file

@ -0,0 +1,207 @@
{
"90": {
"inputs": {
"filename_prefix": "Images/Image_1024",
"images": [
"113",
0
]
},
"class_type": "SaveImage",
"_meta": {
"title": "Save Image"
}
},
"110": {
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"class_type": "VAELoader",
"_meta": {
"title": "Load VAE"
}
},
"112": {
"inputs": {
"text": [
"123",
0
],
"clip": [
"118",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"113": {
"inputs": {
"samples": [
"116",
0
],
"vae": [
"110",
0
]
},
"class_type": "VAEDecode",
"_meta": {
"title": "VAE Decode"
}
},
"114": {
"inputs": {
"width": 1024,
"height": 1024,
"batch_size": 1
},
"class_type": "EmptySD3LatentImage",
"_meta": {
"title": "EmptySD3LatentImage"
}
},
"115": {
"inputs": {
"text": "低分辨率,低画质,肢体畸形,手指畸形,画面过饱和,蜡像感,人脸无细节,过度光滑,画面具有AI感。构图混乱。文字模糊,扭曲",
"clip": [
"118",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"116": {
"inputs": {
"seed": 12345,
"steps": 4,
"cfg": 1,
"sampler_name": "euler",
"scheduler": "simple",
"denoise": 1,
"model": [
"119",
0
],
"positive": [
"112",
0
],
"negative": [
"115",
0
],
"latent_image": [
"114",
0
]
},
"class_type": "KSampler",
"_meta": {
"title": "KSampler"
}
},
"117": {
"inputs": {
"unet_name": "qwen-image-2512-Q6_K.gguf"
},
"class_type": "UnetLoaderGGUF",
"_meta": {
"title": "Unet Loader (GGUF)"
}
},
"118": {
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"type": "qwen_image",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "Load CLIP"
}
},
"119": {
"inputs": {
"lora_name": "Qwen-Image-2512-Lightning-4steps-V1.0-bf16.safetensors",
"strength_model": 1,
"model": [
"117",
0
]
},
"class_type": "LoraLoaderModelOnly",
"_meta": {
"title": "Load LoRA"
}
},
"120": {
"inputs": {
"value": "An anime dwarf sorcerer, standing in T-Pose with arms apart, front view, gray background"
},
"class_type": "PrimitiveStringMultiline",
"_meta": {
"title": "String (Multiline)"
}
},
"121": {
"inputs": {
"model_name": "Qwen3-VL-4B-Instruct",
"quantization": "None (FP16)",
"attention_mode": "auto",
"use_torch_compile": false,
"device": "auto",
"prompt_text": [
"120",
0
],
"enhancement_style": "📝 Refine",
"custom_system_prompt": "",
"max_tokens": 256,
"temperature": 0.7,
"top_p": 0.9,
"repetition_penalty": 1.1,
"keep_model_loaded": true,
"seed": 12345
},
"class_type": "AILab_QwenVL_PromptEnhancer",
"_meta": {
"title": "QwenVL Prompt Enhancer"
}
},
"122": {
"inputs": {
"value": true
},
"class_type": "PrimitiveBoolean",
"_meta": {
"title": "Enhance Prompt"
}
},
"123": {
"inputs": {
"switch": [
"122",
0
],
"on_false": [
"120",
0
],
"on_true": [
"121",
0
]
},
"class_type": "ComfySwitchNode",
"_meta": {
"title": "Switch"
}
}
}

View file

@ -0,0 +1,193 @@
{
"43": {
"inputs": {
"filename_prefix": "z-image",
"images": [
"49",
0
]
},
"class_type": "SaveImage",
"_meta": {
"title": "Save Image"
}
},
"47": {
"inputs": {
"vae_name": "ae.safetensors"
},
"class_type": "VAELoader",
"_meta": {
"title": "Load VAE"
}
},
"48": {
"inputs": {
"conditioning": [
"50",
0
]
},
"class_type": "ConditioningZeroOut",
"_meta": {
"title": "ConditioningZeroOut"
}
},
"49": {
"inputs": {
"samples": [
"55",
0
],
"vae": [
"47",
0
]
},
"class_type": "VAEDecode",
"_meta": {
"title": "VAE Decode"
}
},
"50": {
"inputs": {
"text": [
"57",
0
],
"clip": [
"53",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Prompt)"
}
},
"52": {
"inputs": {
"width": 1024,
"height": 1024,
"batch_size": 1
},
"class_type": "EmptySD3LatentImage",
"_meta": {
"title": "EmptySD3LatentImage"
}
},
"53": {
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"type": "lumina2",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "Load CLIP"
}
},
"54": {
"inputs": {
"unet_name": "z_image_turbo_bf16.safetensors",
"weight_dtype": "default"
},
"class_type": "UNETLoader",
"_meta": {
"title": "Load Diffusion Model"
}
},
"55": {
"inputs": {
"seed": 12346,
"steps": 10,
"cfg": 1,
"sampler_name": "euler",
"scheduler": "linear_quadratic",
"denoise": 1,
"model": [
"54",
0
],
"positive": [
"50",
0
],
"negative": [
"48",
0
],
"latent_image": [
"52",
0
]
},
"class_type": "KSampler",
"_meta": {
"title": "KSampler"
}
},
"56": {
"inputs": {
"value": true
},
"class_type": "PrimitiveBoolean",
"_meta": {
"title": "Enhance Prompt"
}
},
"57": {
"inputs": {
"switch": [
"56",
0
],
"on_false": [
"59",
0
],
"on_true": [
"58",
0
]
},
"class_type": "ComfySwitchNode",
"_meta": {
"title": "Switch"
}
},
"58": {
"inputs": {
"model_name": "Qwen3-VL-4B-Instruct",
"quantization": "None (FP16)",
"attention_mode": "auto",
"use_torch_compile": false,
"device": "auto",
"prompt_text": [
"59",
0
],
"enhancement_style": "📝 Refine",
"custom_system_prompt": "",
"max_tokens": 256,
"temperature": 0.7,
"top_p": 0.9,
"repetition_penalty": 1.1,
"keep_model_loaded": true,
"seed": 12346
},
"class_type": "AILab_QwenVL_PromptEnhancer",
"_meta": {
"title": "QwenVL Prompt Enhancer"
}
},
"59": {
"inputs": {
"value": "An anime charismatic hero, standing in T-Pose with arms apart, front view, gray background"
},
"class_type": "PrimitiveStringMultiline",
"_meta": {
"title": "String (Multiline)"
}
}
}

View file

@ -0,0 +1,194 @@
{
"9": {
"inputs": {
"filename_prefix": "z-image",
"images": [
"65",
0
]
},
"class_type": "SaveImage",
"_meta": {
"title": "Save Image"
}
},
"62": {
"inputs": {
"clip_name": "qwen_3_4b.safetensors",
"type": "lumina2",
"device": "default"
},
"class_type": "CLIPLoader",
"_meta": {
"title": "Load CLIP"
}
},
"63": {
"inputs": {
"vae_name": "ae.safetensors"
},
"class_type": "VAELoader",
"_meta": {
"title": "Load VAE"
}
},
"65": {
"inputs": {
"samples": [
"69",
0
],
"vae": [
"63",
0
]
},
"class_type": "VAEDecode",
"_meta": {
"title": "VAE Decode"
}
},
"67": {
"inputs": {
"text": [
"84",
0
],
"clip": [
"62",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"68": {
"inputs": {
"width": 1024,
"height": 1024,
"batch_size": 1
},
"class_type": "EmptySD3LatentImage",
"_meta": {
"title": "EmptySD3LatentImage"
}
},
"69": {
"inputs": {
"seed": 12345,
"steps": 8,
"cfg": 1,
"sampler_name": "euler_ancestral",
"scheduler": "beta",
"denoise": 1,
"model": [
"80",
0
],
"positive": [
"67",
0
],
"negative": [
"71",
0
],
"latent_image": [
"68",
0
]
},
"class_type": "KSampler",
"_meta": {
"title": "KSampler"
}
},
"71": {
"inputs": {
"text": "blurry, low detail, low contrast, deformed",
"clip": [
"62",
0
]
},
"class_type": "CLIPTextEncode",
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"80": {
"inputs": {
"unet_name": "z-anime-distill-8step-fp8.safetensors",
"weight_dtype": "default"
},
"class_type": "UNETLoader",
"_meta": {
"title": "Load Diffusion Model"
}
},
"81": {
"inputs": {
"model_name": "Qwen3-VL-4B-Instruct",
"quantization": "None (FP16)",
"attention_mode": "auto",
"use_torch_compile": false,
"device": "auto",
"prompt_text": [
"82",
0
],
"enhancement_style": "📝 Refine",
"custom_system_prompt": "",
"max_tokens": 256,
"temperature": 0.7,
"top_p": 0.9,
"repetition_penalty": 1.1,
"keep_model_loaded": true,
"seed": 12345
},
"class_type": "AILab_QwenVL_PromptEnhancer",
"_meta": {
"title": "QwenVL Prompt Enhancer"
}
},
"82": {
"inputs": {
"value": "An anime dwarf sorcerer, standing in T-Pose with arms apart, front view, gray background"
},
"class_type": "PrimitiveStringMultiline",
"_meta": {
"title": "String (Multiline)"
}
},
"84": {
"inputs": {
"switch": [
"85",
0
],
"on_false": [
"82",
0
],
"on_true": [
"81",
0
]
},
"class_type": "ComfySwitchNode",
"_meta": {
"title": "Switch"
}
},
"85": {
"inputs": {
"value": true
},
"class_type": "PrimitiveBoolean",
"_meta": {
"title": "Enhance Prompt"
}
}
}

View file

@ -144,6 +144,34 @@ function getDefaultNodeOutputValue(nodeTypeName = '') {
return ''
}
function getDefaultTargetInputId(nodeTypeName = '') {
const nodeKind = getNodeKind(nodeTypeName)
if (nodeKind === 'imageCompare') {
return IMAGE_COMPARE_INPUT_IDS[0]
}
if (isValueNodeKind(nodeKind)) {
return null
}
return DEFAULT_INPUT_ID
}
function canNodeTypeAcceptIncomingConnection(nodeTypeName = '', outputType = null) {
const targetInputId = getDefaultTargetInputId(nodeTypeName)
if (!targetInputId) {
return false
}
if (getNodeKind(nodeTypeName) === 'imageCompare') {
return normalizeConnectorType(outputType) === 'image'
}
return true
}
function isValueNodeKind(nodeKind = '') {
return ['number', 'text', 'boolean'].includes(String(nodeKind || '').trim().toLowerCase())
}
@ -360,6 +388,19 @@ function buildEdgeId(connection) {
return `edge:${connection.sourceNodeId}:${connection.outputId}:${connection.targetNodeId}:${connection.inputId}`
}
function getPointerClientPosition(event) {
if ('clientX' in event && 'clientY' in event) {
return { x: event.clientX, y: event.clientY }
}
const touch = event.changedTouches?.[0] || event.touches?.[0]
if (touch) {
return { x: touch.clientX, y: touch.clientY }
}
return null
}
function toFlowEdge(connection) {
return {
id: buildEdgeId(connection),
@ -2103,6 +2144,8 @@ export default function GraphPage({ project }) {
const fileInputRef = useRef(null)
const pendingUploadNodeIdRef = useRef(null)
const pendingConnectionRef = useRef(null)
const skipNextPaneClickRef = useRef(false)
const progressSubscriptionsRef = useRef(new Map())
const libraryLoadedRef = useRef(false)
const workflowsLoadedRef = useRef(false)
@ -2579,34 +2622,105 @@ export default function GraphPage({ project }) {
return createdNode
}, [createProjectNode, handleDeleteNode, nodes.length, project.id, setNodes])
const handlePaneContextMenu = useCallback((event) => {
event.preventDefault()
const openNodePickerAt = useCallback((clientX, clientY, pendingConnection = null) => {
const canvasBounds = graphCanvasRef.current?.getBoundingClientRect()
const flowPosition = reactFlowInstance?.screenToFlowPosition
? reactFlowInstance.screenToFlowPosition({ x: event.clientX, y: event.clientY })
? reactFlowInstance.screenToFlowPosition({ x: clientX, y: clientY })
: { x: 96, y: 96 }
setNodePicker({
menuX: canvasBounds ? event.clientX - canvasBounds.left : event.clientX,
menuY: canvasBounds ? event.clientY - canvasBounds.top : event.clientY,
menuX: canvasBounds ? clientX - canvasBounds.left : clientX,
menuY: canvasBounds ? clientY - canvasBounds.top : clientY,
flowX: flowPosition.x,
flowY: flowPosition.y
flowY: flowPosition.y,
pendingConnection
})
}, [reactFlowInstance])
const handlePaneContextMenu = useCallback((event) => {
event.preventDefault()
openNodePickerAt(event.clientX, event.clientY)
}, [openNodePickerAt])
const handleCreateNodeFromPicker = useCallback(async (nodeTypeName) => {
if (!nodePicker) {
return
}
await handleCreateNode(nodeTypeName, {
const createdNode = await handleCreateNode(nodeTypeName, {
xPos: nodePicker.flowX,
yPos: nodePicker.flowY
})
if (nodePicker.pendingConnection && canNodeTypeAcceptIncomingConnection(nodeTypeName, nodePicker.pendingConnection.outputType)) {
try {
const createdConnection = await createProjectConnection(project.id, {
sourceNodeId: Number(nodePicker.pendingConnection.sourceNodeId),
targetNodeId: Number(createdNode.id),
inputId: getDefaultTargetInputId(nodeTypeName),
outputId: nodePicker.pendingConnection.outputId || DEFAULT_OUTPUT_ID
})
setEdges(currentEdges => {
const nextEdge = toFlowEdge(createdConnection)
if (currentEdges.some(edge => edge.id === nextEdge.id)) {
return currentEdges
}
return addEdge(nextEdge, currentEdges)
})
} catch (err) {
console.error('Failed to connect newly created graph node:', err)
}
}
setNodePicker(null)
}, [handleCreateNode, nodePicker])
}, [createProjectConnection, handleCreateNode, nodePicker, project.id, setEdges])
const handleConnectStart = useCallback((_event, params) => {
if (params?.handleType !== 'source' || !params?.nodeId) {
pendingConnectionRef.current = null
return
}
const sourceNode = nodes.find(node => node.id === String(params.nodeId))
pendingConnectionRef.current = {
sourceNodeId: String(params.nodeId),
outputId: params.handleId || DEFAULT_OUTPUT_ID,
outputType: getNodeOutputType(sourceNode)
}
}, [nodes])
const handleConnectEnd = useCallback((event, connectionState) => {
const pendingConnection = pendingConnectionRef.current
pendingConnectionRef.current = null
if (!pendingConnection || connectionState?.isValid) {
return
}
const pointerPosition = getPointerClientPosition(event)
if (!pointerPosition) {
return
}
const canvasBounds = graphCanvasRef.current?.getBoundingClientRect()
if (canvasBounds) {
const droppedInsideCanvas = (
pointerPosition.x >= canvasBounds.left
&& pointerPosition.x <= canvasBounds.right
&& pointerPosition.y >= canvasBounds.top
&& pointerPosition.y <= canvasBounds.bottom
)
if (!droppedInsideCanvas) {
return
}
}
skipNextPaneClickRef.current = true
openNodePickerAt(pointerPosition.x, pointerPosition.y, pendingConnection)
}, [openNodePickerAt])
const openActionDraft = useCallback((nodeId, nodeKind) => {
const inputSources = buildNodeInputSources(nodeId, nodes, edges)
@ -4087,6 +4201,11 @@ export default function GraphPage({ project }) {
}, [edges, nodes])
const handlePaneClick = useCallback(() => {
if (skipNextPaneClickRef.current) {
skipNextPaneClickRef.current = false
return
}
if (nodePicker) {
setNodePicker(null)
}
@ -4303,12 +4422,18 @@ export default function GraphPage({ project }) {
>
<div className="graph-page__node-picker-title font-label">ADD NODE</div>
<div className="graph-page__node-picker-options">
{GRAPH_NODE_TYPE_OPTIONS.map(nodeTypeName => (
{GRAPH_NODE_TYPE_OPTIONS
.filter(nodeTypeName => !nodePicker.pendingConnection || getDefaultTargetInputId(nodeTypeName))
.map(nodeTypeName => (
<button
key={nodeTypeName}
type="button"
className="graph-page__node-picker-option"
disabled={Boolean(nodePicker.pendingConnection) && !canNodeTypeAcceptIncomingConnection(nodeTypeName, nodePicker.pendingConnection.outputType)}
onClick={() => handleCreateNodeFromPicker(nodeTypeName)}
title={nodePicker.pendingConnection && !canNodeTypeAcceptIncomingConnection(nodeTypeName, nodePicker.pendingConnection.outputType)
? 'This node cannot accept the dragged connection'
: undefined}
>
{nodeTypeName}
</button>
@ -4327,7 +4452,9 @@ export default function GraphPage({ project }) {
onInit={setReactFlowInstance}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnectStart={handleConnectStart}
onConnect={handleConnect}
onConnectEnd={handleConnectEnd}
isValidConnection={isValidConnection}
onPaneClick={handlePaneClick}
onPaneContextMenu={handlePaneContextMenu}