2.9 KiB
Node Banana - Development Guide
Model
The application uses these models for image generation. These models are very recently released and do exist. gemini-3-pro-image-preview gemini-2.5-flash-preview-image-generation
Node Connection System
Handle Types
Nodes communicate through typed handles. Each handle has a data type that determines what connections are valid.
| Handle Type | Data Format | Description |
|---|---|---|
image |
Base64 data URL | Visual content (photos, generated images, annotated images) |
text |
String | Text content (user prompts, LLM outputs, transformed text) |
Connection Rules
-
Type Matching: Handles can only connect to handles of the same type
image→image(valid)text→text(valid)image→text(invalid)
-
Direction: Connections flow from
source(output) totarget(input) -
Multiplicity:
- Image inputs on generation nodes accept multiple connections (for multi-image context)
- Text inputs accept single connections (last connected wins)
Data Flow in getConnectedInputs
When a node executes, it retrieves connected inputs via getConnectedInputs(nodeId) in workflowStore.ts. This function returns { images: string[], text: string | null }.
For image handles, extract from:
imageInput→data.imageannotation→data.outputImagenanoBanana→data.outputImage
For text handles, extract from:
prompt→data.promptllmGenerate→data.outputText
Adding New Node Types
When creating a new node type:
- Define the data interface in
src/types/index.ts - Add to
NodeTypeunion insrc/types/index.ts - Create default data in
createDefaultNodeData()inworkflowStore.ts - Add dimensions to
defaultDimensionsinworkflowStore.ts - Create the component in
src/components/nodes/ - Export from
src/components/nodes/index.ts - Register in nodeTypes in
WorkflowCanvas.tsx - Add minimap color in
WorkflowCanvas.tsx - Update
getConnectedInputsif the node produces output that other nodes consume - Add execution logic in
executeWorkflow()if the node requires processing - Update
ConnectionDropMenu.tsxto include the node in appropriate source/target lists
Handle Naming Convention
Use descriptive handle IDs that match the data type:
id="image"for image dataid="text"for text data
Future handle types might include:
audio- for audio datavideo- for video datajson- for structured datanumber- for numeric values
Validation
Connection validation happens in isValidConnection() in WorkflowCanvas.tsx. Update this function if adding new handle types with specific rules.
Workflow validation happens in validateWorkflow() in workflowStore.ts. Add checks for required inputs on new node types.