From 77589e9530ca74ad3f68740ff06205379dbc4279 Mon Sep 17 00:00:00 2001 From: Inoland Date: Tue, 24 Mar 2026 20:20:15 +0400 Subject: [PATCH] Update runpod_helper.py --- .../class_helpers/runpod_helper.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/comfyui_ino_nodes/class_helpers/runpod_helper.py b/src/comfyui_ino_nodes/class_helpers/runpod_helper.py index 436eada..238bd2f 100644 --- a/src/comfyui_ino_nodes/class_helpers/runpod_helper.py +++ b/src/comfyui_ino_nodes/class_helpers/runpod_helper.py @@ -48,6 +48,54 @@ class InoVllmRunSyncText: except Exception as e: return (False, -1, f"response failed: {e}", 0, 0, "", ) +class InoVllmRunSyncImage: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "enabled": ("BOOLEAN", {"default": True, "label_off": "OFF", "label_on": "ON"}), + "url": ("STRING", {"default": ""}), + "api_key": ("STRING", {"default": ""}), + "system_prompt": ("STRING", {"default": ""}), + "user_prompt": ("STRING", {"default": ""}), + "image": ("IMAGE", {}), + }, + "optional": { + "temperature": ("FLOAT", {"default": 0.7, "min": 0.0, "max": 1.0}), + "max_tokens": ("INT", {"default": 1024, "min": 32, "max": 4096}), + } + } + + CATEGORY = "InoRunpodHelper" + RETURN_TYPES = ("BOOLEAN", "INT", "STRING", "INT", "INT", "STRING",) + RETURN_NAMES = ("success", "id", "status", "delay_time", "execution_time", "response", ) + FUNCTION = "function" + + async def function(self, enabled, url, api_key, system_prompt, user_prompt, image, temperature, max_tokens): + if not enabled: + return (False, -1, "not enabled", "", "", "", ) + + try: + image = None + except Exception as e: + return (False, -1, f"image failed: {e}", 0, 0, "", ) + + try: + response = await InoRunpodHelper.serverless_vllm_runsync( + url=url, + api_key=api_key, + system_prompt=system_prompt, + user_prompt=user_prompt, + temperature=temperature, + max_tokens=max_tokens, + image=image + ) + if ino_is_err(response): + return (False, -1, response["msg"], 0, 0, "",) + + return (True, response["id"], response["status"], response["delay_time"], response["execution_time"], response["response"], ) + except Exception as e: + return (False, -1, f"response failed: {e}", 0, 0, "", ) LOCAL_NODE_CLASS = { "InoVllmRunSyncText": InoVllmRunSyncText,