diff --git a/__init__.py b/__init__.py index 440b4e2..e02654f 100644 --- a/__init__.py +++ b/__init__.py @@ -172,7 +172,6 @@ from .nodes.prompting.FL_PromptSelectorBasic import FL_PromptSelectorBasic # UTILITY NODES from .nodes.utility.FL_ClipScanner import FL_ClipScanner -from .nodes.utility.FL_Code_Node import FL_CodeNode from .nodes.utility.FL_DirectoryCrawl import FL_DirectoryCrawl from .nodes.utility.FL_Float import FL_Float from .nodes.utility.FL_InpaintCrop import FL_InpaintCrop @@ -249,7 +248,6 @@ NODE_CLASS_MAPPINGS = { "FL_ImageDimensionDisplay": FL_ImageDimensionDisplay, "FL_GeminiVideoCaptioner": FL_GeminiVideoCaptioner, "FL_GPT_Image1": FL_GPT_Image1, - "FL_CodeNode": FL_CodeNode, "FL_ImagePixelator": FL_ImagePixelator, "FL_ImageAddToBatch": FL_ImageAddToBatch, "FL_DirectoryCrawl": FL_DirectoryCrawl, @@ -439,7 +437,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "FL_ImageDimensionDisplay": "FL Image Size", "FL_GeminiVideoCaptioner": "FL Gemini Video Captioner", "FL_GPT_Image1": "FL GPT Image-1", - "FL_CodeNode": "FL Code Node", "FL_ImagePixelator": "FL Image Pixelator", "FL_ImageAddToBatch": "FL Image Add To Batch", "FL_DirectoryCrawl": "FL Directory Crawl", diff --git a/nodes/node_descriptions.json b/nodes/node_descriptions.json index 2968f98..066f2a9 100644 --- a/nodes/node_descriptions.json +++ b/nodes/node_descriptions.json @@ -746,12 +746,6 @@ "description": null, "category": "utility" }, - { - "class": "FL_CodeNode", - "file": "FL_Code_Node.py", - "description": null, - "category": "utility" - }, { "class": "FL_DirectoryCrawl", "file": "FL_DirectoryCrawl.py", diff --git a/nodes/utility/FL_Code_Node.py b/nodes/utility/FL_Code_Node.py deleted file mode 100644 index cbe94f7..0000000 --- a/nodes/utility/FL_Code_Node.py +++ /dev/null @@ -1,64 +0,0 @@ -from pathlib import Path -from ..sup import ROOT, AlwaysEqualProxy, parse_dynamic - - -class FL_CodeNode: - - @classmethod - def INPUT_TYPES(cls): - return { - "required": {}, - "optional": { - "code_input": ( - "STRING", {"default": "outputs[0] = 'hello, world!'", "multiline": True, "dynamicPrompts": False}), - "file": ("STRING", {"default": "", "multiline": False, "dynamicPrompts": False}), - "use_file": ("BOOLEAN", {"default": False}), - "run_always": ("BOOLEAN", {"default": False}) - }} - - CATEGORY = "🏵️Fill Nodes/Utility" - RETURN_TYPES = tuple(AlwaysEqualProxy("*") for _ in range(4)) - RETURN_NAMES = tuple(f"output_{i}" for i in range(4)) - DESCRIPTION = """ -FL_CodeNode is designed to execute custom user-provided Python code. The code can be directly entered as a string input or loaded from a specified file. This class processes dynamic inputs and provides four generic output slots. The execution environment includes predefined 'inputs' and 'outputs' dictionaries to facilitate interaction with the code. Proper error handling is included to ensure informative feedback in case of execution failures. This node is ideal for users needing to integrate custom logic or algorithms into their workflows. -""" - FUNCTION = "execute" - - @classmethod - def IS_CHANGED(self, code_input, file, use_file, run_always, **kwargs): - if run_always: - return float('nan') - hash = '$$' + str(kwargs) + '$$' + self.get_exec_string(self, code_input, file, use_file) + '$$' - # print(hash) - return hash - - def execute(self, code_input, file, use_file, run_always, **kwargs): - outputs = {i: None for i in range(4)} - inputs = kwargs.copy() - inputs.update({i: v for i, v in enumerate(kwargs.values())}) - code = self.get_exec_string(code_input, file, use_file) - - try: - exec(code, {"inputs": inputs, "outputs": outputs}) - except Exception as e: - raise RuntimeError(f"Error executing user code: {e}") - - return tuple(outputs[i] for i in range(4)) - - def get_exec_string(self, code_input, file, use_file): - if use_file: - # load the referenced file - code_input = "" - if not (fname := Path(ROOT / file)).is_file(): - # print(fname) - if not (fname := Path(file)).is_file(): - # print(fname) - fname = None - if fname is not None: - try: - with open(str(fname), 'r') as f: - code_input = f.read() - except Exception as e: - raise RuntimeError(f"[FL_CodeNode] error loading code file: {e}") - # print(code_input) - return code_input diff --git a/pyproject.toml b/pyproject.toml index 6897f8c..b4ebd64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_fill-nodes" description = "Fill-Nodes is a versatile collection of custom nodes for ComfyUI that extends functionality across multiple domains. Features include advanced image processing (pixelation, slicing, masking), visual effects generation (glitch, halftone, pixel art), comprehensive file handling (PDF creation/extraction, Google Drive integration), AI model interfaces (GPT, DALL-E, Hugging Face), utility nodes for workflow enhancement, and specialized tools for video processing, captioning, and batch operations. The pack provides both practical workflow solutions and creative tools within a unified node collection." -version = "2.3.7" +version = "2.3.8" license = "LICENSE" dependencies = ["librosa", "sounddevice", "glitch_this", "PyOpenGL", "glfw", "scipy>=1.13.1", "requests", "aiohttp", "moviepy", "matplotlib", "reportlab", "openai", "PyPDF2", "pdf2image", "PyMuPDF", "reportlab", "PyPDF2", "ollama", "kornia", "opencv-python", "gdown", "open_clip_torch", "google-genai"] diff --git a/web/betterCombos.js b/web/betterCombos.js index 4b89d63..83b490d 100644 --- a/web/betterCombos.js +++ b/web/betterCombos.js @@ -1,5 +1,5 @@ /** - File: fl_code_node.js + File: betterCombos.js Project: ComfyUI_Fill-Nodes pythongossss to the rescue again diff --git a/web/nodes/utility/fl_code_node.js b/web/nodes/utility/fl_code_node.js deleted file mode 100644 index 1391640..0000000 --- a/web/nodes/utility/fl_code_node.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * File: fl_code_node.js - * Project: ComfyUI_Fill-Nodes - * - */ - -import { app } from "../../../../scripts/app.js" -import { node_add_dynamic } from "../../widget.js" - -const _id = "FL_CodeNode" -const _prefix = 'input' - -app.registerExtension({ - name: 'fl.node.' + _id, - async beforeRegisterNodeDef(nodeType, nodeData, app) { - if (nodeData.name !== _id) { - return; - } - nodeType = node_add_dynamic(nodeType, _prefix); - } -}) \ No newline at end of file