Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02f499a4dc | ||
|
|
67d27bd4aa | ||
|
|
8ee2f88e72 | ||
|
|
c17a029173 | ||
|
|
c82f0c2bf0 | ||
|
|
fdbf24207f | ||
|
|
0a9d0d3e3e | ||
|
|
d41c4de352 |
@@ -0,0 +1,46 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
class AnyType(str):
|
||||||
|
"""A special class that is always equal in not equal comparisons. Credit to pythongosssss"""
|
||||||
|
|
||||||
|
def __ne__(self, __value: object) -> bool:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
any = AnyType("*")
|
||||||
|
|
||||||
|
|
||||||
|
class ComfyDeployStdOutputAny:
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(cls): # pylint: disable = invalid-name, missing-function-docstring
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"name": ("STRING", {"default": "ComfyUI"}),
|
||||||
|
"source": (any, {}), # Use "*" to accept any input type
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
CATEGORY = "output"
|
||||||
|
RETURN_TYPES = ()
|
||||||
|
FUNCTION = "run"
|
||||||
|
OUTPUT_NODE = True
|
||||||
|
|
||||||
|
def run(self, name, source=None):
|
||||||
|
value = "None"
|
||||||
|
if source is not None:
|
||||||
|
try:
|
||||||
|
value = json.dumps(source)
|
||||||
|
except Exception:
|
||||||
|
try:
|
||||||
|
value = str(source)
|
||||||
|
except Exception:
|
||||||
|
value = "source exists, but could not be serialized."
|
||||||
|
|
||||||
|
return {"ui": {name: (value,)}}
|
||||||
|
|
||||||
|
|
||||||
|
NODE_CLASS_MAPPINGS = {"ComfyDeployStdOutputAny": ComfyDeployStdOutputAny}
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
"ComfyDeployStdOutputAny": "Standard Any Output (ComfyDeploy)"
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import os
|
||||||
|
import json
|
||||||
|
import numpy as np
|
||||||
|
from PIL import Image
|
||||||
|
from PIL.PngImagePlugin import PngInfo
|
||||||
|
import folder_paths
|
||||||
|
|
||||||
|
|
||||||
|
class ComfyDeployStdOutputImage:
|
||||||
|
def __init__(self):
|
||||||
|
self.output_dir = folder_paths.get_output_directory()
|
||||||
|
self.type = "output"
|
||||||
|
self.prefix_append = ""
|
||||||
|
self.compress_level = 4
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def INPUT_TYPES(s):
|
||||||
|
return {
|
||||||
|
"required": {
|
||||||
|
"images": ("IMAGE", {"tooltip": "The images to save."}),
|
||||||
|
"filename_prefix": (
|
||||||
|
"STRING",
|
||||||
|
{
|
||||||
|
"default": "ComfyUI",
|
||||||
|
"tooltip": "The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes.",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
"file_type": (["png", "jpg", "webp"], {"default": "webp"}),
|
||||||
|
"quality": ("INT", {"default": 80, "min": 1, "max": 100, "step": 1}),
|
||||||
|
},
|
||||||
|
"hidden": {"prompt": "PROMPT", "extra_pnginfo": "EXTRA_PNGINFO"},
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_TYPES = ()
|
||||||
|
FUNCTION = "run"
|
||||||
|
|
||||||
|
OUTPUT_NODE = True
|
||||||
|
|
||||||
|
CATEGORY = "output"
|
||||||
|
DESCRIPTION = "Saves the input images to your ComfyUI output directory."
|
||||||
|
|
||||||
|
def run(
|
||||||
|
self,
|
||||||
|
images,
|
||||||
|
filename_prefix="ComfyUI",
|
||||||
|
file_type="png",
|
||||||
|
quality=80,
|
||||||
|
prompt=None,
|
||||||
|
extra_pnginfo=None,
|
||||||
|
):
|
||||||
|
filename_prefix += self.prefix_append
|
||||||
|
full_output_folder, filename, counter, subfolder, filename_prefix = (
|
||||||
|
folder_paths.get_save_image_path(
|
||||||
|
filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
results = list()
|
||||||
|
for batch_number, image in enumerate(images):
|
||||||
|
i = 255.0 * image.cpu().numpy()
|
||||||
|
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||||
|
metadata = PngInfo()
|
||||||
|
if prompt is not None:
|
||||||
|
metadata.add_text("prompt", json.dumps(prompt))
|
||||||
|
if extra_pnginfo is not None:
|
||||||
|
for x in extra_pnginfo:
|
||||||
|
metadata.add_text(x, json.dumps(extra_pnginfo[x]))
|
||||||
|
|
||||||
|
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
|
||||||
|
file = f"{filename_with_batch_num}_{counter:05}_.{file_type}"
|
||||||
|
file_path = os.path.join(full_output_folder, file)
|
||||||
|
|
||||||
|
if file_type == "png":
|
||||||
|
img.save(
|
||||||
|
file_path, pnginfo=metadata, compress_level=self.compress_level
|
||||||
|
)
|
||||||
|
elif file_type == "jpg":
|
||||||
|
img.save(file_path, quality=quality, optimize=True)
|
||||||
|
elif file_type == "webp":
|
||||||
|
img.save(file_path, quality=quality)
|
||||||
|
|
||||||
|
results.append(
|
||||||
|
{"filename": file, "subfolder": subfolder, "type": self.type}
|
||||||
|
)
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
return {"ui": {"images": results}}
|
||||||
|
|
||||||
|
|
||||||
|
NODE_CLASS_MAPPINGS = {"ComfyDeployStdOutputImage": ComfyDeployStdOutputImage}
|
||||||
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||||
|
"ComfyDeployStdOutputImage": "Standard Image Output (ComfyDeploy)"
|
||||||
|
}
|
||||||
@@ -64,8 +64,7 @@ class ComfyUIDeployExternalLora:
|
|||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
if lora_url:
|
if lora_url and lora_url.startswith("http"):
|
||||||
if lora_url.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
|
||||||
@@ -80,12 +79,7 @@ class ComfyUIDeployExternalLora:
|
|||||||
folder_paths.folder_names_and_paths["loras"][0][0], lora_save_name
|
folder_paths.folder_names_and_paths["loras"][0][0], lora_save_name
|
||||||
)
|
)
|
||||||
print(destination_path)
|
print(destination_path)
|
||||||
print(
|
print("Downloading external lora - " + lora_url + " to " + destination_path)
|
||||||
"Downloading external lora - "
|
|
||||||
+ lora_url
|
|
||||||
+ " to "
|
|
||||||
+ destination_path
|
|
||||||
)
|
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
lora_url,
|
lora_url,
|
||||||
headers={"User-Agent": "Mozilla/5.0"},
|
headers={"User-Agent": "Mozilla/5.0"},
|
||||||
@@ -93,13 +87,9 @@ class ComfyUIDeployExternalLora:
|
|||||||
)
|
)
|
||||||
with open(destination_path, "wb") as out_file:
|
with open(destination_path, "wb") as out_file:
|
||||||
out_file.write(response.content)
|
out_file.write(response.content)
|
||||||
print(f"Ext Lora loading: {lora_url} to {lora_save_name}")
|
|
||||||
return (lora_save_name,)
|
return (lora_save_name,)
|
||||||
else:
|
else:
|
||||||
print(f"Ext Lora loading: {lora_url}")
|
print(f"using lora: {default_lora_name}")
|
||||||
return (lora_url,)
|
|
||||||
else:
|
|
||||||
print(f"Ext Lora loading: {default_lora_name}")
|
|
||||||
return (default_lora_name,)
|
return (default_lora_name,)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
class StringFunction:
|
|
||||||
@classmethod
|
|
||||||
def INPUT_TYPES(s):
|
|
||||||
return {
|
|
||||||
"required": {
|
|
||||||
"action": (["append", "replace"], {}),
|
|
||||||
"tidy_tags": (["yes", "no"], {}),
|
|
||||||
},
|
|
||||||
"optional": {
|
|
||||||
"text_a": ("STRING", {"multiline": True, "dynamicPrompts": False}),
|
|
||||||
"text_b": ("STRING", {"multiline": True, "dynamicPrompts": False}),
|
|
||||||
"text_c": ("STRING", {"multiline": True, "dynamicPrompts": False}),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
RETURN_TYPES = ("STRING",)
|
|
||||||
FUNCTION = "exec"
|
|
||||||
CATEGORY = "utils"
|
|
||||||
OUTPUT_NODE = True
|
|
||||||
|
|
||||||
def exec(self, action, tidy_tags, text_a="", text_b="", text_c=""):
|
|
||||||
tidy_tags = tidy_tags == "yes"
|
|
||||||
out = ""
|
|
||||||
if action == "append":
|
|
||||||
out = (", " if tidy_tags else "").join(
|
|
||||||
filter(None, [text_a, text_b, text_c])
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
if text_c is None:
|
|
||||||
text_c = ""
|
|
||||||
if text_b.startswith("/") and text_b.endswith("/"):
|
|
||||||
regex = text_b[1:-1]
|
|
||||||
out = re.sub(regex, text_c, text_a)
|
|
||||||
else:
|
|
||||||
out = text_a.replace(text_b, text_c)
|
|
||||||
if tidy_tags:
|
|
||||||
out = re.sub(r"\s{2,}", " ", out)
|
|
||||||
out = out.replace(" ,", ",")
|
|
||||||
out = re.sub(r",{2,}", ",", out)
|
|
||||||
out = out.strip()
|
|
||||||
return {"ui": {"text": (out,)}, "result": (out,)}
|
|
||||||
|
|
||||||
|
|
||||||
NODE_CLASS_MAPPINGS = {
|
|
||||||
"ComfyUIDeployStringCombine": StringFunction,
|
|
||||||
}
|
|
||||||
|
|
||||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
||||||
"ComfyUIDeployStringCombine": "String Combine (ComfyUI Deploy)",
|
|
||||||
}
|
|
||||||
@@ -1713,10 +1713,6 @@ async def upload_in_background(
|
|||||||
# await handle_upload(prompt_id, data, 'files', "content_type", "image/png")
|
# await handle_upload(prompt_id, data, 'files', "content_type", "image/png")
|
||||||
# await handle_upload(prompt_id, data, 'gifs', "format", "image/gif")
|
# await handle_upload(prompt_id, data, 'gifs', "format", "image/gif")
|
||||||
# await handle_upload(prompt_id, data, 'mesh', "format", "application/octet-stream")
|
# await handle_upload(prompt_id, data, 'mesh', "format", "application/octet-stream")
|
||||||
|
|
||||||
file_upload_endpoint = prompt_metadata[prompt_id].file_upload_endpoint
|
|
||||||
|
|
||||||
if file_upload_endpoint is not None and file_upload_endpoint != "":
|
|
||||||
upload_tasks = [
|
upload_tasks = [
|
||||||
handle_upload(prompt_id, data, "images", "content_type", "image/png"),
|
handle_upload(prompt_id, data, "images", "content_type", "image/png"),
|
||||||
handle_upload(prompt_id, data, "files", "content_type", "image/png"),
|
handle_upload(prompt_id, data, "files", "content_type", "image/png"),
|
||||||
@@ -1727,8 +1723,6 @@ async def upload_in_background(
|
|||||||
]
|
]
|
||||||
|
|
||||||
await asyncio.gather(*upload_tasks)
|
await asyncio.gather(*upload_tasks)
|
||||||
else:
|
|
||||||
print("No file upload endpoint, skipping file upload")
|
|
||||||
|
|
||||||
status_endpoint = prompt_metadata[prompt_id].status_endpoint
|
status_endpoint = prompt_metadata[prompt_id].status_endpoint
|
||||||
token = prompt_metadata[prompt_id].token
|
token = prompt_metadata[prompt_id].token
|
||||||
|
|||||||
+2
-287
@@ -4,39 +4,6 @@ import { ComfyWidgets, LGraphNode } from "./widgets.js";
|
|||||||
import { generateDependencyGraph } from "https://esm.sh/[email protected]";
|
import { generateDependencyGraph } from "https://esm.sh/[email protected]";
|
||||||
import { ComfyDeploy } from "https://esm.sh/[email protected]";
|
import { ComfyDeploy } from "https://esm.sh/[email protected]";
|
||||||
|
|
||||||
const styles = `
|
|
||||||
.comfydeploy-menu-item {
|
|
||||||
background: linear-gradient(to right, rgba(74, 144, 226, 0.9), rgba(103, 178, 111, 0.9)) !important;
|
|
||||||
color: white !important;
|
|
||||||
position: relative !important;
|
|
||||||
padding-left: 20px !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfydeploy-menu-item:hover {
|
|
||||||
filter: brightness(1.1) !important;
|
|
||||||
cursor: pointer !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comfydeploy-menu-item::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
left: 4px;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
background-image: url('https://www.comfydeploy.com/icon.svg');
|
|
||||||
background-size: contain;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Add stylesheet to document
|
|
||||||
const styleSheet = document.createElement("style");
|
|
||||||
styleSheet.textContent = styles;
|
|
||||||
document.head.appendChild(styleSheet);
|
|
||||||
|
|
||||||
const loadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#888888" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg>`;
|
const loadingIcon = `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><g fill="none" stroke="#888888" stroke-linecap="round" stroke-width="2"><path stroke-dasharray="60" stroke-dashoffset="60" stroke-opacity=".3" d="M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3Z"><animate fill="freeze" attributeName="stroke-dashoffset" dur="1.3s" values="60;0"/></path><path stroke-dasharray="15" stroke-dashoffset="15" d="M12 3C16.9706 3 21 7.02944 21 12"><animate fill="freeze" attributeName="stroke-dashoffset" dur="0.3s" values="15;0"/><animateTransform attributeName="transform" dur="1.5s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path></g></svg>`;
|
||||||
|
|
||||||
function sendEventToCD(event, data) {
|
function sendEventToCD(event, data) {
|
||||||
@@ -155,146 +122,6 @@ function setSelectedWorkflowInfo(info) {
|
|||||||
context.selectedWorkflowInfo = info;
|
context.selectedWorkflowInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const VALID_TYPES = [
|
|
||||||
"STRING",
|
|
||||||
"combo",
|
|
||||||
"number",
|
|
||||||
"toggle",
|
|
||||||
"BOOLEAN",
|
|
||||||
"text",
|
|
||||||
"string",
|
|
||||||
];
|
|
||||||
|
|
||||||
function hideWidget(node, widget, suffix = "") {
|
|
||||||
if (widget.type?.startsWith(CONVERTED_TYPE)) return;
|
|
||||||
widget.origType = widget.type;
|
|
||||||
widget.origComputeSize = widget.computeSize;
|
|
||||||
widget.origSerializeValue = widget.serializeValue;
|
|
||||||
widget.computeSize = () => [0, -4];
|
|
||||||
widget.type = CONVERTED_TYPE + suffix;
|
|
||||||
widget.serializeValue = () => {
|
|
||||||
if (!node.inputs) {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
let node_input = node.inputs.find((i) => i.widget?.name === widget.name);
|
|
||||||
if (!node_input || !node_input.link) {
|
|
||||||
return void 0;
|
|
||||||
}
|
|
||||||
return widget.origSerializeValue
|
|
||||||
? widget.origSerializeValue()
|
|
||||||
: widget.value;
|
|
||||||
};
|
|
||||||
if (widget.linkedWidgets) {
|
|
||||||
for (const w of widget.linkedWidgets) {
|
|
||||||
hideWidget(node, w, ":" + widget.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWidgetType(config) {
|
|
||||||
let type = config[0];
|
|
||||||
if (type instanceof Array) {
|
|
||||||
type = "COMBO";
|
|
||||||
}
|
|
||||||
return { type };
|
|
||||||
}
|
|
||||||
|
|
||||||
const GET_CONFIG = Symbol();
|
|
||||||
|
|
||||||
function convertToInput(node, widget, config) {
|
|
||||||
console.log(node);
|
|
||||||
if (node.type == "LoadImage") {
|
|
||||||
var inputNode = LiteGraph.createNode("ComfyUIDeployExternalImage");
|
|
||||||
console.log(widget);
|
|
||||||
|
|
||||||
const currentOutputsLinks = node.outputs[0].links;
|
|
||||||
|
|
||||||
// const index = node.inputs.findIndex((x) => x.name == widget.name);
|
|
||||||
// console.log(node.widgets_values, index);
|
|
||||||
// inputNode.configure({
|
|
||||||
// widgets_values: ["input_text", widget.value],
|
|
||||||
// });
|
|
||||||
inputNode.pos = node.pos;
|
|
||||||
inputNode.id = ++app.graph.last_node_id;
|
|
||||||
// inputNode.pos[0] += node.size[0] + 40;
|
|
||||||
node.pos[0] -= inputNode.size[0] + 20;
|
|
||||||
console.log(inputNode);
|
|
||||||
console.log(app.graph);
|
|
||||||
app.graph.add(inputNode);
|
|
||||||
|
|
||||||
const links = app.graph.links;
|
|
||||||
|
|
||||||
console.log(currentOutputsLinks);
|
|
||||||
|
|
||||||
for (let i = 0; i < currentOutputsLinks.length; i++) {
|
|
||||||
const link = currentOutputsLinks[i];
|
|
||||||
const llink = links[link];
|
|
||||||
console.log(links[link]);
|
|
||||||
setTimeout(
|
|
||||||
() => inputNode.connect(0, llink.target_id, llink.target_slot),
|
|
||||||
100,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
node.connect(0, inputNode, 0);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
hideWidget(node, widget);
|
|
||||||
const { type } = getWidgetType(config);
|
|
||||||
const sz = node.size;
|
|
||||||
const inputIsOptional = !!widget.options?.inputIsOptional;
|
|
||||||
const input = node.addInput(widget.name, type, {
|
|
||||||
widget: { name: widget.name, [GET_CONFIG]: () => config },
|
|
||||||
...(inputIsOptional ? { shape: LiteGraph.SlotShape.HollowCircle } : {}),
|
|
||||||
});
|
|
||||||
for (const widget2 of node.widgets) {
|
|
||||||
widget2.last_y += LiteGraph.NODE_SLOT_HEIGHT;
|
|
||||||
}
|
|
||||||
node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]);
|
|
||||||
|
|
||||||
if (type == "STRING") {
|
|
||||||
var inputNode = LiteGraph.createNode("ComfyUIDeployExternalText");
|
|
||||||
console.log(widget);
|
|
||||||
const index = node.inputs.findIndex((x) => x.name == widget.name);
|
|
||||||
console.log(node.widgets_values, index);
|
|
||||||
inputNode.configure({
|
|
||||||
widgets_values: ["input_text", widget.value],
|
|
||||||
});
|
|
||||||
inputNode.id = ++app.graph.last_node_id;
|
|
||||||
inputNode.pos = node.pos;
|
|
||||||
inputNode.pos[0] -= node.size[0] + 40;
|
|
||||||
console.log(inputNode);
|
|
||||||
console.log(app.graph);
|
|
||||||
app.graph.add(inputNode);
|
|
||||||
inputNode.connect(0, node, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CONVERTED_TYPE = "converted-widget";
|
|
||||||
|
|
||||||
function getConfig(widgetName) {
|
|
||||||
const { nodeData } = this.constructor;
|
|
||||||
return (
|
|
||||||
nodeData?.input?.required?.[widgetName] ??
|
|
||||||
nodeData?.input?.optional?.[widgetName]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isConvertibleWidget(widget, config) {
|
|
||||||
return (
|
|
||||||
(VALID_TYPES.includes(widget.type) || VALID_TYPES.includes(config[0])) &&
|
|
||||||
!widget.options?.forceInput
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
var __defProp = Object.defineProperty;
|
|
||||||
var __name = (target, value) =>
|
|
||||||
__defProp(target, "name", { value, configurable: true });
|
|
||||||
|
|
||||||
/** @typedef {import('../../../web/types/comfy.js').ComfyExtension} ComfyExtension*/
|
/** @typedef {import('../../../web/types/comfy.js').ComfyExtension} ComfyExtension*/
|
||||||
/** @type {ComfyExtension} */
|
/** @type {ComfyExtension} */
|
||||||
const ext = {
|
const ext = {
|
||||||
@@ -405,118 +232,6 @@ const ext = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async beforeRegisterNodeDef(nodeType, nodeData, app2) {
|
|
||||||
const origGetExtraMenuOptions = nodeType.prototype.getExtraMenuOptions;
|
|
||||||
nodeType.prototype.getExtraMenuOptions = function (_, options) {
|
|
||||||
const r = origGetExtraMenuOptions
|
|
||||||
? origGetExtraMenuOptions.apply(this, arguments)
|
|
||||||
: void 0;
|
|
||||||
if (this.widgets) {
|
|
||||||
let toInput = [];
|
|
||||||
let toWidget = [];
|
|
||||||
for (const w of this.widgets) {
|
|
||||||
if (w.options?.forceInput) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (w.type === CONVERTED_TYPE) {
|
|
||||||
toWidget.push({
|
|
||||||
content: `Convert ${w.name} to widget`,
|
|
||||||
callback: /* @__PURE__ */ __name(
|
|
||||||
() => convertToWidget(this, w),
|
|
||||||
"callback",
|
|
||||||
),
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const config = getConfig.call(this, w.name) ?? [
|
|
||||||
w.type,
|
|
||||||
w.options || {},
|
|
||||||
];
|
|
||||||
if (isConvertibleWidget(w, config)) {
|
|
||||||
toInput.push({
|
|
||||||
content: `Convert ${w.name} to external input`,
|
|
||||||
callback: /* @__PURE__ */ __name(
|
|
||||||
() => convertToInput(this, w, config),
|
|
||||||
"callback",
|
|
||||||
),
|
|
||||||
className: "comfydeploy-menu-item",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toInput.length) {
|
|
||||||
if (true) {
|
|
||||||
options.push();
|
|
||||||
|
|
||||||
let optionIndex = options.findIndex((o) => o.content === "Outputs");
|
|
||||||
if (optionIndex === -1) optionIndex = options.length;
|
|
||||||
else optionIndex++;
|
|
||||||
options.splice(
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
// {
|
|
||||||
// content: "[ComfyDeploy] Convert to External Input",
|
|
||||||
// submenu: {
|
|
||||||
// options: toInput,
|
|
||||||
// },
|
|
||||||
// className: "comfydeploy-menu-item"
|
|
||||||
// },
|
|
||||||
...toInput,
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
options.push(...toInput, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if (toWidget.length) {
|
|
||||||
// if (useConversionSubmenusSetting.value) {
|
|
||||||
// options.push({
|
|
||||||
// content: "Convert Input to Widget",
|
|
||||||
// submenu: {
|
|
||||||
// options: toWidget,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// options.push(...toWidget, null);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
};
|
|
||||||
|
|
||||||
// const origonNodeCreated = nodeType.prototype.onNodeCreated;
|
|
||||||
// nodeType.prototype.onNodeCreated = function () {
|
|
||||||
// const r = origonNodeCreated
|
|
||||||
// ? origonNodeCreated.apply(this, arguments)
|
|
||||||
// : void 0;
|
|
||||||
|
|
||||||
// if (!this.widgets) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log(this.widgets);
|
|
||||||
|
|
||||||
// this.widgets.forEach(element => {
|
|
||||||
// if (element.type != "customtext") return
|
|
||||||
|
|
||||||
// console.log(element.element);
|
|
||||||
|
|
||||||
// const parent = element.element.parentElement
|
|
||||||
|
|
||||||
// console.log(element.element.parentElement)
|
|
||||||
// const btn = document.createElement("button");
|
|
||||||
// // const div = document.createElement("div");
|
|
||||||
// // parent.removeChild(element.element)
|
|
||||||
// // div.appendChild(element.element)
|
|
||||||
// // parent.appendChild(div)
|
|
||||||
// // element.element = div
|
|
||||||
// // console.log(element.element);
|
|
||||||
// // btn.style = element.element.style
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return r
|
|
||||||
// };
|
|
||||||
},
|
|
||||||
|
|
||||||
registerCustomNodes() {
|
registerCustomNodes() {
|
||||||
/** @type {LGraphNode}*/
|
/** @type {LGraphNode}*/
|
||||||
class ComfyDeploy extends LGraphNode {
|
class ComfyDeploy extends LGraphNode {
|
||||||
@@ -748,11 +463,11 @@ const ext = {
|
|||||||
await app.ui.settings.setSettingValueAsync("Comfy.UseNewMenu", "Top");
|
await app.ui.settings.setSettingValueAsync("Comfy.UseNewMenu", "Top");
|
||||||
await app.ui.settings.setSettingValueAsync(
|
await app.ui.settings.setSettingValueAsync(
|
||||||
"Comfy.Sidebar.Size",
|
"Comfy.Sidebar.Size",
|
||||||
"small",
|
"small"
|
||||||
);
|
);
|
||||||
await app.ui.settings.setSettingValueAsync(
|
await app.ui.settings.setSettingValueAsync(
|
||||||
"Comfy.Sidebar.Location",
|
"Comfy.Sidebar.Location",
|
||||||
"right",
|
"right"
|
||||||
);
|
);
|
||||||
localStorage.setItem("Comfy.MenuPosition.Docked", "true");
|
localStorage.setItem("Comfy.MenuPosition.Docked", "true");
|
||||||
console.log("native mode manmanman");
|
console.log("native mode manmanman");
|
||||||
|
|||||||
Reference in New Issue
Block a user