Files
nilor-corp-nilor-nodes/user_input.py
T
Sebastian Monroy 778ed5272f feat: Implement static naming for I/O contract (WIP)
This commit aligns the nilor-nodes with the project's new unified, name-based I/O system, as specified in the workflow override fix plan. This change establishes a stable, human-readable API contract for all workflows, replacing the previous fragile node-ID-based system.

Key Changes:
- **`MediaStreamInput` & `NilorUserInput`**: Added a static, non-overridable `input_name` string widget. Workflow authors now assign a logical name to each input, which is used by the Brain API to inject data.
- **`MediaStreamOutput`**: Added a static `output_name` widget. This provides a stable key for the Brain API to identify and retrieve specific outputs.
- **`MediaStreamOutput` (Logic)**: Corrected the completion logic to properly parse the full dictionary of named outputs it receives from the Brain API, ensuring it sends the correct, complete payload upon job completion.

These changes are a critical part of the larger refactor to improve the security, scalability, and maintainability of the ComfyUI integration.
2025-08-13 17:09:52 +01:00

68 lines
1.9 KiB
Python

category = "Nilor Nodes 👺"
subcategories = {
"io": "/IO",
}
class NilorUserInput_String:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"input_name": ("STRING", {"default": "my_string_input", "multiline": False}),
"value": ("STRING", {"default": "", "multiline": True}),
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("string",)
FUNCTION = "get_value"
CATEGORY = category + subcategories["io"]
def get_value(self, input_name, value):
return (value,)
class NilorUserInput_Int:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"input_name": ("STRING", {"default": "my_int_input", "multiline": False}),
"value": ("INT", {"default": 0}),
}
}
RETURN_TYPES = ("INT",)
RETURN_NAMES = ("int",)
FUNCTION = "get_value"
CATEGORY = category + subcategories["io"]
def get_value(self, input_name, value):
return (value,)
class NilorUserInput_Float:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"input_name": ("STRING", {"default": "my_float_input", "multiline": False}),
"value": ("FLOAT", {"default": 0.0}),
}
}
RETURN_TYPES = ("FLOAT",)
RETURN_NAMES = ("float",)
FUNCTION = "get_value"
CATEGORY = category + subcategories["io"]
def get_value(self, input_name, value):
return (value,)
NODE_CLASS_MAPPINGS = {
"NilorUserInput_String": NilorUserInput_String,
"NilorUserInput_Int": NilorUserInput_Int,
"NilorUserInput_Float": NilorUserInput_Float,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"NilorUserInput_String": "👺 User Input (String)",
"NilorUserInput_Int": "👺 User Input (Int)",
"NilorUserInput_Float": "👺 User Input (Float)",
}