From 8628480362512644463729c38c602a1ef07d1bd5 Mon Sep 17 00:00:00 2001 From: BennyKok Date: Tue, 16 Jan 2024 15:36:05 +0800 Subject: [PATCH] fix: external text input --- comfy-nodes/external_number.py | 4 ++-- comfy-nodes/external_number_int.py | 4 ++-- web/src/components/customInputNodes.tsx | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/comfy-nodes/external_number.py b/comfy-nodes/external_number.py index 2a6c596..34a2368 100644 --- a/comfy-nodes/external_number.py +++ b/comfy-nodes/external_number.py @@ -29,9 +29,9 @@ class ComfyUIDeployExternalNumber: CATEGORY = "number" def run(self, input_id, default_value=None): - if not input_id or len(input_id.strip()) == 0: + if not input_id or not input_id.strip().isdigit(): return [default_value] - return [input_id] + return [int(input_id)] NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalNumber": ComfyUIDeployExternalNumber} diff --git a/comfy-nodes/external_number_int.py b/comfy-nodes/external_number_int.py index bd2002b..d58c1e2 100644 --- a/comfy-nodes/external_number_int.py +++ b/comfy-nodes/external_number_int.py @@ -29,9 +29,9 @@ class ComfyUIDeployExternalNumberInt: CATEGORY = "number" def run(self, input_id, default_value=None): - if not input_id or len(input_id.strip()) == 0: + if not input_id or not input_id.strip().isdigit(): return [default_value] - return [input_id] + return [int(input_id)] NODE_CLASS_MAPPINGS = {"ComfyUIDeployExternalNumberInt": ComfyUIDeployExternalNumberInt} diff --git a/web/src/components/customInputNodes.tsx b/web/src/components/customInputNodes.tsx index e7f5a5f..1526483 100644 --- a/web/src/components/customInputNodes.tsx +++ b/web/src/components/customInputNodes.tsx @@ -2,5 +2,6 @@ export const customInputNodes: Record = { ComfyUIDeployExternalText: "string", ComfyUIDeployExternalImage: "string - (public image url)", ComfyUIDeployExternalImageAlpha: "string - (public image url)", - ComfyUIDeployExternalNumber: "number" + ComfyUIDeployExternalNumber: "float", + ComfyUIDeployExternalNumberInt: "integer", };