Comfy-Org / Comfy-Org/ComfyUI

Feature Request: Connection suggestions for flexible input types (AnyType/*)

Open
#9,893 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

## Problem

Custom nodes that use flexible input types (AnyType with `*`) cannot provide connection suggestions to users. When dragging from outputs or to inputs of AnyType, ComfyUI shows no compatible node suggestions, making workflows harder to build.

## Current Situation

**AnyType approach:**
```python
class AnyType(str):
def __ne__(self, __value: object) -> bool:
return False

any_typ = AnyType("*")

# In INPUT_TYPES:
"flexible_input": (any_typ, {"tooltip": "Accepts multiple types"})
```

**Result:** Accepts any connection but provides zero suggestions when dragging connections.

## Use Case

We have emotion control nodes that output `EMOTION_CONTROL` type, but our TTS engine needs to accept:
- `EMOTION_CONTROL` (from emotion vector nodes)
- `AUDIO` (direct audio emotion references)
- `NARRATOR_VOICE` (from character voice nodes)

Currently we must choose between:
1. **Flexible connections** (AnyType) = no suggestions
2. **Connection suggestions** (single type) = no flexibility
3. **Multiple types** `["TYPE1", "TYPE2"]` = creates dropdown widget, not input

## Proposed Solutions

**Option 1: Union Types**
```python
"flexible_input": (("EMOTION_CONTROL", "AUDIO", "NARRATOR_VOICE"), {...})
```

**Option 2: Enhanced AnyType**
```python
"flexible_input": (any_typ, {
"compatible_types": ["EMOTION_CONTROL", "AUDIO", "NARRATOR_VOICE"],
"tooltip": "..."
})
```

**Option 3: Connection Metadata**
Allow AnyType inputs to declare compatible types for suggestion purposes while maintaining runtime flexibility.

## Impact

This affects every custom node pack that needs flexible inputs:
- TTS engines accepting multiple emotion formats
- Image processors accepting various input types
- Universal converter nodes
- Workflow utility nodes

Currently all these nodes provide poor UX due to missing connection suggestions.

## Workaround

None that provides both flexibility and suggestions. AnyType is the current best practice but breaks discoverability.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.