diff --git a/frontend/src/components/GraphCanvas.svelte b/frontend/src/components/GraphCanvas.svelte index 94a398b..c0f7ab0 100644 --- a/frontend/src/components/GraphCanvas.svelte +++ b/frontend/src/components/GraphCanvas.svelte @@ -144,9 +144,14 @@ const mergedName = getMergedName(nd.name); const existing = merged.get(mergedName); if (existing) { - // Merge port IDs existing.port_ids = [...new Set([...existing.port_ids, ...nd.port_ids])]; existing.name = mergedName; + // If merged node has both input and output ports, mark as duplex + const mergedInPorts = existing.port_ids.map(pid => portMap.get(pid)).filter((p): p is Port => !!p && p.mode === 'input'); + const mergedOutPorts = existing.port_ids.map(pid => portMap.get(pid)).filter((p): p is Port => !!p && p.mode === 'output'); + if (mergedInPorts.length > 0 && mergedOutPorts.length > 0) { + existing.mode = 'duplex'; + } } else { merged.set(mergedName, { ...nd, name: mergedName }); } @@ -573,9 +578,10 @@ {#each graphNodes as nd (nd.id)} {@const isSource = nd.mode === 'output'} {@const isSink = nd.mode === 'input'} - {@const bg = isSource ? '#1a2a1a' : isSink ? '#2a1a1a' : '#1e1e2e'} - {@const border = isSource ? '#4a9' : isSink ? '#a44' : '#555'} - {@const headerBg = isSource ? '#263826' : isSink ? '#382626' : '#262638'} + {@const isDuplex = nd.mode === 'duplex'} + {@const bg = isSource ? '#1a2a1a' : isSink ? '#2a1a1a' : isDuplex ? '#1a1a2a' : '#1e1e2e'} + {@const border = isSource ? '#4a9' : isSink ? '#a44' : isDuplex ? '#49a' : '#555'} + {@const headerBg = isSource ? '#263826' : isSink ? '#382626' : isDuplex ? '#262638' : '#262638'}