Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5940ac899 | ||
|
|
67703abb8a | ||
|
|
dfee31f0ed |
@@ -12,11 +12,11 @@ class ComfyUIDeployExternalBoolean:
|
|||||||
"optional": {
|
"optional": {
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ class ComfyUIDeployExternalCheckpoint:
|
|||||||
"default_value": (folder_paths.get_filename_list("checkpoints"), ),
|
"default_value": (folder_paths.get_filename_list("checkpoints"), ),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ class ComfyUIDeployExternalImage:
|
|||||||
"default_value": ("IMAGE",),
|
"default_value": ("IMAGE",),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ class ComfyUIDeployExternalImageAlpha:
|
|||||||
"default_value": ("IMAGE",),
|
"default_value": ("IMAGE",),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ class ComfyUIDeployExternalImageBatch:
|
|||||||
"default_value": ("IMAGE",),
|
"default_value": ("IMAGE",),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,15 +31,11 @@ class ComfyUIDeployExternalLora:
|
|||||||
),
|
),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
|
||||||
"lora_url": (
|
|
||||||
"STRING",
|
|
||||||
{"multiline": False, "default": ""},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -51,12 +47,12 @@ class ComfyUIDeployExternalLora:
|
|||||||
|
|
||||||
CATEGORY = "deploy"
|
CATEGORY = "deploy"
|
||||||
|
|
||||||
def run(self, input_id, default_lora_name=None, lora_save_name=None, display_name=None, description=None, lora_url=None):
|
def run(self, input_id, default_lora_name=None, lora_save_name=None, display_name=None, description=None):
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
if lora_url and lora_url.startswith("http"):
|
if default_lora_name.startswith("http"):
|
||||||
if lora_save_name:
|
if lora_save_name:
|
||||||
existing_loras = folder_paths.get_filename_list("loras")
|
existing_loras = folder_paths.get_filename_list("loras")
|
||||||
# Check if lora_save_name exists in the list
|
# Check if lora_save_name exists in the list
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ComfyUIDeployExternalNumber:
|
|||||||
),
|
),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ComfyUIDeployExternalNumberInt:
|
|||||||
),
|
),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ class ComfyUIDeployExternalNumberSlider:
|
|||||||
),
|
),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ComfyUIDeployExternalText:
|
|||||||
),
|
),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ class ComfyUIDeployExternalTextList:
|
|||||||
"optional": {
|
"optional": {
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -764,14 +764,14 @@ class ComfyUIDeployExternalVideo:
|
|||||||
"optional": {
|
"optional": {
|
||||||
"meta_batch": ("VHS_BatchManager",),
|
"meta_batch": ("VHS_BatchManager",),
|
||||||
"vae": ("VAE",),
|
"vae": ("VAE",),
|
||||||
"default_video": (sorted(files),),
|
"default_value": (sorted(files),),
|
||||||
"display_name": (
|
"display_name": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": False, "default": ""},
|
{"multiline": False, "default": "Name of the node (optional)"},
|
||||||
),
|
),
|
||||||
"description": (
|
"description": (
|
||||||
"STRING",
|
"STRING",
|
||||||
{"multiline": True, "default": ""},
|
{"multiline": True, "default": "Description of the node (optional)"},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"hidden": {
|
"hidden": {
|
||||||
@@ -834,7 +834,7 @@ class ComfyUIDeployExternalVideo:
|
|||||||
):
|
):
|
||||||
out_file.write(chunk)
|
out_file.write(chunk)
|
||||||
else:
|
else:
|
||||||
video = kwargs.get("default_video", "")
|
video = kwargs.get("default_value", "")
|
||||||
if video is None:
|
if video is None:
|
||||||
raise "No default video given and no external video provided"
|
raise "No default video given and no external video provided"
|
||||||
video_path = folder_paths.get_annotated_filepath(video.strip('"'))
|
video_path = folder_paths.get_annotated_filepath(video.strip('"'))
|
||||||
|
|||||||
+15
-21
@@ -33,7 +33,7 @@ client_session = None
|
|||||||
# global client_session
|
# global client_session
|
||||||
# if client_session is None:
|
# if client_session is None:
|
||||||
# client_session = aiohttp.ClientSession()
|
# client_session = aiohttp.ClientSession()
|
||||||
|
|
||||||
async def ensure_client_session():
|
async def ensure_client_session():
|
||||||
global client_session
|
global client_session
|
||||||
if client_session is None:
|
if client_session is None:
|
||||||
@@ -43,7 +43,7 @@ async def cleanup():
|
|||||||
global client_session
|
global client_session
|
||||||
if client_session:
|
if client_session:
|
||||||
await client_session.close()
|
await client_session.close()
|
||||||
|
|
||||||
def exit_handler():
|
def exit_handler():
|
||||||
print("Exiting the application. Initiating cleanup...")
|
print("Exiting the application. Initiating cleanup...")
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
@@ -82,7 +82,7 @@ async def async_request_with_retry(method, url, disable_timeout=False, **kwargs)
|
|||||||
logger.error(f"Request failed after {max_retries} attempts: {e}")
|
logger.error(f"Request failed after {max_retries} attempts: {e}")
|
||||||
# raise
|
# raise
|
||||||
logger.warning(f"Request failed (attempt {attempt + 1}/{max_retries}): {e}")
|
logger.warning(f"Request failed (attempt {attempt + 1}/{max_retries}): {e}")
|
||||||
|
|
||||||
# Wait before retrying
|
# Wait before retrying
|
||||||
await asyncio.sleep(retry_delay)
|
await asyncio.sleep(retry_delay)
|
||||||
retry_delay *= retry_delay_multiplier # Exponential backoff
|
retry_delay *= retry_delay_multiplier # Exponential backoff
|
||||||
@@ -116,7 +116,7 @@ def log(level, message, **kwargs):
|
|||||||
getattr(logger, level)(message, **kwargs)
|
getattr(logger, level)(message, **kwargs)
|
||||||
else:
|
else:
|
||||||
getattr(logger, level)(f"{message} {kwargs}")
|
getattr(logger, level)(f"{message} {kwargs}")
|
||||||
|
|
||||||
# For a span, you might need to create a context manager
|
# For a span, you might need to create a context manager
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ def apply_random_seed_to_workflow(workflow_api):
|
|||||||
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to SamplerCustom")
|
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to SamplerCustom")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def apply_inputs_to_workflow(workflow_api: Any, inputs: Any, sid: str = None):
|
def apply_inputs_to_workflow(workflow_api: Any, inputs: Any, sid: str | None = None):
|
||||||
# Loop through each of the inputs and replace them
|
# Loop through each of the inputs and replace them
|
||||||
for key, value in workflow_api.items():
|
for key, value in workflow_api.items():
|
||||||
if 'inputs' in value:
|
if 'inputs' in value:
|
||||||
@@ -292,7 +292,7 @@ def apply_inputs_to_workflow(workflow_api: Any, inputs: Any, sid: str = None):
|
|||||||
value['inputs']["images"] = new_value
|
value['inputs']["images"] = new_value
|
||||||
|
|
||||||
if value["class_type"] == "ComfyUIDeployExternalLora":
|
if value["class_type"] == "ComfyUIDeployExternalLora":
|
||||||
value["inputs"]["lora_url"] = new_value
|
value["inputs"]["default_lora_name"] = new_value
|
||||||
|
|
||||||
if value["class_type"] == "ComfyUIDeployExternalSlider":
|
if value["class_type"] == "ComfyUIDeployExternalSlider":
|
||||||
value["inputs"]["default_value"] = new_value
|
value["inputs"]["default_value"] = new_value
|
||||||
@@ -855,19 +855,19 @@ async def send(event, data, sid=None):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(f"Exception: {e}")
|
logger.info(f"Exception: {e}")
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
@server.PromptServer.instance.routes.get('/comfydeploy/{tail:.*}')
|
@server.PromptServer.instance.routes.get('/comfydeploy/{tail:.*}')
|
||||||
@server.PromptServer.instance.routes.post('/comfydeploy/{tail:.*}')
|
@server.PromptServer.instance.routes.post('/comfydeploy/{tail:.*}')
|
||||||
async def proxy_to_comfydeploy(request):
|
async def proxy_to_comfydeploy(request):
|
||||||
# Get the base URL
|
# Get the base URL
|
||||||
base_url = f'https://www.comfydeploy.com/{request.match_info["tail"]}'
|
base_url = f'https://www.comfydeploy.com/{request.match_info["tail"]}'
|
||||||
|
|
||||||
# Get all query parameters
|
# Get all query parameters
|
||||||
query_params = request.query_string
|
query_params = request.query_string
|
||||||
|
|
||||||
# Construct the full target URL with query parameters
|
# Construct the full target URL with query parameters
|
||||||
target_url = f"{base_url}?{query_params}" if query_params else base_url
|
target_url = f"{base_url}?{query_params}" if query_params else base_url
|
||||||
|
|
||||||
# print(f"Proxying request to: {target_url}")
|
# print(f"Proxying request to: {target_url}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -992,22 +992,17 @@ async def send_json_override(self, event, data, sid=None):
|
|||||||
# await update_run_with_output(prompt_id, data)
|
# await update_run_with_output(prompt_id, data)
|
||||||
|
|
||||||
if event == 'executed' and 'node' in data and 'output' in data:
|
if event == 'executed' and 'node' in data and 'output' in data:
|
||||||
node_meta = None
|
|
||||||
if prompt_id in prompt_metadata:
|
if prompt_id in prompt_metadata:
|
||||||
node = data.get('node')
|
node = data.get('node')
|
||||||
class_type = prompt_metadata[prompt_id].workflow_api[node]['class_type']
|
class_type = prompt_metadata[prompt_id].workflow_api[node]['class_type']
|
||||||
logger.info(f"Executed {class_type} {data}")
|
logger.info(f"Executed {class_type} {data}")
|
||||||
node_meta = {
|
|
||||||
"node_id": node,
|
|
||||||
"node_class": class_type,
|
|
||||||
}
|
|
||||||
if class_type == "PreviewImage":
|
if class_type == "PreviewImage":
|
||||||
logger.info("Skipping preview image")
|
logger.info("Skipping preview image")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
logger.info(f"Executed {data}")
|
logger.info(f"Executed {data}")
|
||||||
|
|
||||||
await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node'), node_meta=node_meta)
|
await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node'))
|
||||||
# await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node'))
|
# await update_run_with_output(prompt_id, data.get('output'), node_id=data.get('node'))
|
||||||
# update_run_with_output(prompt_id, data.get('output'))
|
# update_run_with_output(prompt_id, data.get('output'))
|
||||||
|
|
||||||
@@ -1320,7 +1315,7 @@ async def upload_in_background(prompt_id: str, data, node_id=None, have_upload=T
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
await handle_error(prompt_id, data, e)
|
await handle_error(prompt_id, data, e)
|
||||||
|
|
||||||
async def update_run_with_output(prompt_id, data, node_id=None, node_meta=None):
|
async def update_run_with_output(prompt_id, data, node_id=None):
|
||||||
if prompt_id not in prompt_metadata:
|
if prompt_id not in prompt_metadata:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -1331,8 +1326,7 @@ async def update_run_with_output(prompt_id, data, node_id=None, node_meta=None):
|
|||||||
|
|
||||||
body = {
|
body = {
|
||||||
"run_id": prompt_id,
|
"run_id": prompt_id,
|
||||||
"output_data": data,
|
"output_data": data
|
||||||
"node_meta": node_meta,
|
|
||||||
}
|
}
|
||||||
have_upload_media = 'images' in data or 'files' in data or 'gifs' in data or 'mesh' in data
|
have_upload_media = 'images' in data or 'files' in data or 'gifs' in data or 'mesh' in data
|
||||||
if bypass_upload and have_upload_media:
|
if bypass_upload and have_upload_media:
|
||||||
@@ -1413,4 +1407,4 @@ if cd_enable_log:
|
|||||||
@server.PromptServer.instance.routes.get("/comfyui-deploy/filename_list_cache")
|
@server.PromptServer.instance.routes.get("/comfyui-deploy/filename_list_cache")
|
||||||
async def get_filename_list_cache(_):
|
async def get_filename_list_cache(_):
|
||||||
from folder_paths import filename_list_cache
|
from folder_paths import filename_list_cache
|
||||||
return web.json_response({'filename_list': filename_list_cache})
|
return web.json_response({'filename_list': filename_list_cache})
|
||||||
|
|||||||
Reference in New Issue
Block a user