diff --git a/comfy-nodes/output_image.py b/comfy-nodes/output_image.py index 3198e4f..f1ecc48 100644 --- a/comfy-nodes/output_image.py +++ b/comfy-nodes/output_image.py @@ -80,7 +80,6 @@ class ShellAgentSaveVideoVHS: preview_image = os.path.relpath(preview_image) video_path = os.path.relpath(video_path) results = {"ui": {"image": [preview_image], "video": [video_path]}} - print(results) return results diff --git a/comfy-nodes/output_text.py b/comfy-nodes/output_text.py new file mode 100644 index 0000000..8b74fce --- /dev/null +++ b/comfy-nodes/output_text.py @@ -0,0 +1,74 @@ + +json_type_mapipng = { + "text": "string", + "float": "number", + "integer": "integer" +} + +class ShellAgentOutputText: + TYPE_STR = "text" + @classmethod + def INPUT_TYPES(s): + return { + "required": { + s.TYPE_STR: ("STRING", {"tooltip": f"The {s.TYPE_STR} to output."}), + "output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},), + }, + } + + RETURN_TYPES = () + FUNCTION = "output_var" + + OUTPUT_NODE = True + + CATEGORY = "shellagent" + DESCRIPTION = "output the text" + + @classmethod + def validate(cls, **kwargs): + schema = { + "title": kwargs["output_name"], + "type": json_type_mapipng[cls.TYPE_STR] + } + return schema + + def output_var(self, **kwargs): + results = {"ui": {"output": [kwargs[self.TYPE_STR]]}} + return results + +class ShellAgentOutputFloat(ShellAgentOutputText): + TYPE_STR = "float" + DESCRIPTION = "output the float" + @classmethod + def INPUT_TYPES(s): + return { + "required": { + s.TYPE_STR: ("STRING", {"tooltip": f"The {s.TYPE_STR} to output."}), + "output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},), + }, + } + + +class ShellAgentOutputInteger(ShellAgentOutputText): + TYPE_STR = "integer" + DESCRIPTION = "output the integer" + @classmethod + def INPUT_TYPES(s): + return { + "required": { + s.TYPE_STR: ("STRING", {"tooltip": f"The {s.TYPE_STR} to output."}), + "output_name": ("STRING", {"multiline": False, "default": f"output_{s.TYPE_STR}"},), + }, + } + + +NODE_CLASS_MAPPINGS = { + "ShellAgentPluginOutputText": ShellAgentOutputText, + "ShellAgentPluginOutputFloat": ShellAgentOutputFloat, + "ShellAgentPluginOutputInteger": ShellAgentOutputInteger +} +NODE_DISPLAY_NAME_MAPPINGS = { + "ShellAgentPluginOutputText": "Output Text (ShellAgent Plugin)", + "ShellAgentPluginOutputFloat": "Output Float (ShellAgent Plugin)", + "ShellAgentPluginOutputInteger": "Output Integer (ShellAgent Plugin)", +} \ No newline at end of file