Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc51306504 | ||
|
|
9dca10cb23 | ||
|
|
02aa0bbc90 | ||
|
|
30983261ca | ||
|
|
df215cd27d | ||
|
|
ed1322e5fd | ||
|
|
a97c497ff5 | ||
|
|
8d440db432 | ||
|
|
51048427ac | ||
|
|
58b9e0e87c | ||
|
|
910bdde2ca | ||
|
|
a09f0533ab | ||
|
|
ee29a55478 | ||
|
|
b03bd2574c | ||
|
|
9cfc9085d6 | ||
|
|
6247ea9c0b | ||
|
|
8a1bbe9c2a | ||
|
|
e5cad2d407 | ||
|
|
ec367d2fbf | ||
|
|
90d706296c | ||
|
|
a36c74714c | ||
|
|
1aa9a8335a | ||
|
|
da98222269 | ||
|
|
9ff9a37a39 | ||
|
|
8c98bb95e1 | ||
|
|
bf7a45a46c | ||
|
|
faf00d91e2 | ||
|
|
5604063aaf | ||
|
|
b31209b310 | ||
|
|
f9466e029a | ||
|
|
71e18925e9 | ||
|
|
a83d902507 | ||
|
|
8a2ec63a3f | ||
|
|
5abbc50890 | ||
|
|
0545ceb556 | ||
|
|
92bc0ce868 |
@@ -1,5 +1,9 @@
|
||||
# ChangeLog
|
||||
|
||||
## v1.7.0 - 2023-01-14
|
||||
|
||||
- Add xyz_plot and select_inputs nodes
|
||||
|
||||
## v1.6.1 - 2023-12-31
|
||||
|
||||
- Fix some bugs about CollectionsTab
|
||||
|
||||
@@ -16,6 +16,25 @@ https://github.com/talesofai/comfyui-browser/assets/828837/803ce57a-1cf2-4e1c-be
|
||||
- Sync your 'Saves' anywhere by Git.
|
||||
- Subscribe workflow sources by Git and load them more easily.
|
||||
- Search your workflow by keywords.
|
||||
- Some useful custom nodes like xyz_plot, inputs_select.
|
||||
|
||||
## Custom Nodes
|
||||
|
||||
#### Select Inputs
|
||||
|
||||
- Select any inputs of the current graph.
|
||||
|
||||
<img width="256" alt="image" src="https://github.com/talesofai/comfyui-browser/assets/828837/8e505f62-f709-426a-8a0a-fca291784b08">
|
||||
|
||||
|
||||
#### XYZ Plot
|
||||
|
||||
- Simple XYZ Plot by selecting inputs and filling in the values.
|
||||
|
||||
<img width="256" alt="image" src="https://github.com/talesofai/comfyui-browser/assets/828837/23ce6a4d-3311-4058-9b46-ddb50d07e22a">
|
||||
|
||||
<img width="256" alt="image" src="https://github.com/talesofai/comfyui-browser/assets/828837/347cad17-17c0-46f1-8df3-4b188b16a354">
|
||||
|
||||
|
||||
## Preview
|
||||
|
||||
@@ -38,9 +57,9 @@ https://github.com/talesofai/comfyui-browser/assets/828837/803ce57a-1cf2-4e1c-be
|
||||
|
||||
## Installation
|
||||
|
||||
### Comfy Manager
|
||||
### ComfyUI Manager
|
||||
|
||||
Search for `comfyui-browser` and install it.
|
||||
Install [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager), search `comfyui-browser` in Install Custom Node and install it.
|
||||
|
||||
### Manually
|
||||
|
||||
@@ -58,26 +77,30 @@ cd custom_nodes && git clone https://github.com/tzwm/comfyui-browser.git
|
||||
|
||||
## Development
|
||||
|
||||
- Prerequisite
|
||||
- Install [Node](https://nodejs.org/en/download/current)
|
||||
|
||||
|
||||
- Framework
|
||||
|
||||
- Frontend: [Svelte](https://kit.svelte.dev/)
|
||||
- Backend: [aiohttp](https://docs.aiohttp.org/)(the same with ComfyUI)
|
||||
- Backend: [aiohttp](https://docs.aiohttp.org/)(the same as ComfyUI)
|
||||
|
||||
- Project Structure
|
||||
|
||||
```
|
||||
├── __init__.py (Backend Server)
|
||||
├── web (Frontend code loaded by ComfyUI)
|
||||
├── build (Built by Svelte)
|
||||
├── build (Built in Svelte)
|
||||
└── index.js (Frontend that interact with ComfyUI)
|
||||
├── svelte (Frontend in the Modal as a iframe, written by Svelte)
|
||||
├── svelte (Frontend in the Modal as a iframe, written in Svelte)
|
||||
```
|
||||
|
||||
- Build and Run
|
||||
|
||||
- Copy or link `comfyui-browser` to `ComfyUI/custom_nodes/`
|
||||
- Start backend by `cd ComfyUI && python main.py --enable-cors-header`
|
||||
- Start frontend by `cd ComfyUI/comfyui-browser/svelte && npm i && npm run dev`
|
||||
- Start frontend by `cd ComfyUI/custom_nodes/comfyui-browser/svelte && npm i && npm run dev`
|
||||
- Open and debug by `http://localhost:5173/?comfyUrl=http://localhost:8188`
|
||||
- It will use `localhost:8188` as ComfyUI server
|
||||
- `localhost:5173` is a Vite dev server
|
||||
|
||||
+6
-4
@@ -29,9 +29,8 @@ https://www.bilibili.com/video/BV1qc411m7Gp/
|
||||
|
||||
## 安装方式
|
||||
|
||||
### Comfy Manager
|
||||
|
||||
搜索 `comfyui-browser` 来安装。
|
||||
### ComfyUI Manager
|
||||
安装[ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager), 在 Install Custom Node 中搜索 `comfyui-browser` 来安装。
|
||||
|
||||
### 手动
|
||||
|
||||
@@ -43,6 +42,9 @@ cd custom_nodes && git clone https://github.com/tzwm/comfyui-browser.git
|
||||
|
||||
## 开发
|
||||
|
||||
- 前置需求
|
||||
- 安装[Node](https://nodejs.org/en/download/current)
|
||||
|
||||
- 使用的框架
|
||||
|
||||
- 前端: [Svelte](https://kit.svelte.dev/)
|
||||
@@ -62,7 +64,7 @@ cd custom_nodes && git clone https://github.com/tzwm/comfyui-browser.git
|
||||
|
||||
- 复制或者链接 `comfyui-browser` 到 `ComfyUI/custom_nodes/`
|
||||
- 启动服务端: `cd ComfyUI && python main.py --enable-cors-header`
|
||||
- 启动前端: `cd ComfyUI/comfyui-browser/svelte && npm i && npm run dev`
|
||||
- 启动前端: `cd ComfyUI/custom_nodes/comfyui-browser/svelte && npm i && npm run dev`
|
||||
- 调试地址 `http://localhost:5173/?comfyUrl=http://localhost:8188`
|
||||
- `localhost:8188` 是 ComfyUI server 地址
|
||||
- `localhost:5173` 是 Vite dev server
|
||||
|
||||
+17
-8
@@ -1,11 +1,12 @@
|
||||
from os import path, mkdir
|
||||
import os
|
||||
from aiohttp import web
|
||||
|
||||
import server
|
||||
|
||||
from .utils import collections_path, browser_path, sources_path, download_logs_path
|
||||
from .utils import collections_path, browser_path, sources_path, download_logs_path, outputs_path
|
||||
from .routes import sources, collections, config, files, downloads
|
||||
from .nodes import load_image_by_url
|
||||
from .nodes import select_inputs, load_image_by_url, xyz_plot, dify_text_generator, upload_to_remote
|
||||
|
||||
|
||||
browser_app = web.Application()
|
||||
browser_app.add_routes([
|
||||
@@ -31,18 +32,26 @@ browser_app.add_routes([
|
||||
web.get("/downloads", downloads.api_list_downloads),
|
||||
web.get("/downloads/{uuid}", downloads.api_show_download),
|
||||
|
||||
web.static("/web", path.join(browser_path, 'web/build')),
|
||||
web.static("/web", os.path.join(browser_path, 'web/build')),
|
||||
|
||||
web.static("/s/outputs", outputs_path),
|
||||
web.static("/s/collections", collections_path),
|
||||
web.static("/s/sources", sources_path),
|
||||
])
|
||||
server.PromptServer.instance.app.add_subapp("/browser/", browser_app)
|
||||
|
||||
for dir in [collections_path, sources_path, download_logs_path]:
|
||||
if not path.exists(dir):
|
||||
mkdir(dir)
|
||||
|
||||
WEB_DIRECTORY = "web"
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"LoadImageByUrl //Browser": load_image_by_url.LoadImageByUrl,
|
||||
"SelectInputs //Browser": select_inputs.SelectInputs,
|
||||
"XyzPlot //Browser": xyz_plot.XyzPlot,
|
||||
"DifyTextGenerator //Browser": dify_text_generator.DifyTextGenerator,
|
||||
"UploadToRemote //Browser": upload_to_remote.UploadToRemote,
|
||||
}
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"LoadImageByUrl //Browser": "Load Image By URL",
|
||||
"SelectInputs //Browser": "Select Node Inputs",
|
||||
"XyzPlot //Browser": "XYZ Plot",
|
||||
"DifyTextGenerator //Browser": "Dify Text Generator",
|
||||
"UploadToRemote //Browser": "Upload To Remote",
|
||||
}
|
||||
|
||||
@@ -42,6 +42,13 @@
|
||||
"type": "git",
|
||||
"description": "Some workflows includes CUTE YOU, Real-time design, Extended image, AI Dialogue Game..."
|
||||
},
|
||||
{
|
||||
"title": "IF-Animation-Workflows",
|
||||
"author": "if-ai",
|
||||
"url": "https://github.com/if-ai/IF-Animation-Workflows",
|
||||
"type": "git",
|
||||
"description": "This are a series of ComfyUI workflows that work together to create and repurpose animation"
|
||||
},
|
||||
{
|
||||
"title": "wyrde-comfyui-workflows",
|
||||
"author": "wyrde",
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
class DifyTextGenerator:
|
||||
CATEGORY = "Browser"
|
||||
|
||||
RETURN_TYPES = ("STRING", )
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"dify_api_endpoint": ["STRING", {}],
|
||||
"api_key": ["STRING", {}],
|
||||
},
|
||||
"optional": {
|
||||
"query": ["STRING", {"multiline": True, "placeholder": "Input as the Query field."}],
|
||||
"inputs_json_str": ["STRING", {"multiline": True, "placeholder": "JSON format. It will overwrite the query field above."}],
|
||||
},
|
||||
}
|
||||
|
||||
def run(self, dify_api_endpoint, api_key, query, inputs_json_str=None):
|
||||
# for some special network environments like AutoDL
|
||||
proxies = {"http": "", "https": ""}
|
||||
header = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Bearer {api_key}",
|
||||
}
|
||||
data = {
|
||||
"user": "comfyui-browser",
|
||||
"response_mode": "blocking",
|
||||
"inputs" : { "query": query },
|
||||
}
|
||||
if inputs_json_str and len(inputs_json_str.strip()) > 0:
|
||||
# something weird, I have to add '{' and '}' manually
|
||||
data["inputs"] = json.loads("{" + inputs_json_str + "}")
|
||||
|
||||
r = requests.post(
|
||||
dify_api_endpoint,
|
||||
headers=header,
|
||||
data=json.dumps(data),
|
||||
proxies=proxies
|
||||
)
|
||||
|
||||
if not r.ok:
|
||||
raise Exception(f"Request Dify Error: {r.text}")
|
||||
|
||||
content = json.loads(r.content)
|
||||
return (content["answer"], )
|
||||
@@ -7,7 +7,6 @@ import torch
|
||||
|
||||
|
||||
import folder_paths
|
||||
from ..utils import log
|
||||
|
||||
class LoadImageByUrl:
|
||||
CATEGORY = "Browser"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
class SelectInputs:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"input_1": [["none"], {}],
|
||||
"input_2": [["none"], {}],
|
||||
"input_3": [["none"], {}],
|
||||
"input_4": [["none"], {}],
|
||||
"preview": ["STRING", {"multiline": True}],
|
||||
}
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, input_1, input_2, input_3, input_4, preview):
|
||||
return True
|
||||
|
||||
# {
|
||||
# "node_id": 4,
|
||||
# "node_title": "CheckpointLoaderSimple",
|
||||
# "widget_name": "ckpt_name",
|
||||
# }
|
||||
RETURN_TYPES = ("INPUT", "INPUT", "INPUT", "INPUT",)
|
||||
RETURN_NAMES = ("input_1", "input_2", "input_3", "input_4",)
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
CATEGORY = "Browser"
|
||||
|
||||
|
||||
def run(self, input_1, input_2, input_3, input_4, preview):
|
||||
ret = ()
|
||||
for input in [input_1, input_2, input_3, input_4]:
|
||||
node_id, node_title, widget_name = input.split("::")
|
||||
ret = ret + ({
|
||||
"node_id": node_id[1:],
|
||||
"node_title": node_title,
|
||||
"widget_name": widget_name,
|
||||
},)
|
||||
|
||||
return ret
|
||||
@@ -0,0 +1,93 @@
|
||||
import requests
|
||||
import threading
|
||||
import asyncio
|
||||
import json
|
||||
from PIL import Image
|
||||
from PIL.PngImagePlugin import PngInfo
|
||||
import numpy as np
|
||||
import io
|
||||
import base64
|
||||
|
||||
class UploadToRemote:
|
||||
CATEGORY = "Browser"
|
||||
|
||||
RETURN_TYPES = ()
|
||||
RETURN_NAMES = ()
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"images": ["IMAGE", {}],
|
||||
"remote_url": ["STRING", {}],
|
||||
"extension": (['jpeg', 'webp', 'png', 'jpg', 'gif'], ),
|
||||
"quality": ("INT", {"default": 85, "min": 1, "max": 100, "step": 1}),
|
||||
"embed_workflow": (["false", "true"],),
|
||||
},
|
||||
"optional": {
|
||||
"track_id": ["STRING", {"placeholder": "Optional. Post it as the track_id field."}],
|
||||
},
|
||||
"hidden": {
|
||||
"unique_id": "UNIQUE_ID",
|
||||
"prompt": "PROMPT",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def run(self, images, remote_url, extension='jpeg', quality=85, embed_workflow='false', track_id=None, unique_id=None, prompt=None):
|
||||
def process_images(images, extension='jpeg', quality=85, embed_workflow='false', prompt=None):
|
||||
results = list()
|
||||
for image in images:
|
||||
i = 255. * image.cpu().numpy()
|
||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||
|
||||
# Delegate metadata/pnginfo
|
||||
if extension == 'webp':
|
||||
img_exif = img.getexif()
|
||||
if embed_workflow == 'true' and prompt is not None:
|
||||
img_exif[0x010f] = "Prompt:" + json.dumps(prompt)
|
||||
exif_data = img_exif.tobytes()
|
||||
else:
|
||||
metadata = PngInfo()
|
||||
if embed_workflow == 'true' and prompt is not None:
|
||||
metadata.add_text("prompt", json.dumps(prompt))
|
||||
exif_data = metadata
|
||||
|
||||
output = io.BytesIO()
|
||||
if extension in ["jpg", "jpeg"]:
|
||||
img.save(output, quality=quality, optimize=True, format="JPEG")
|
||||
elif extension == 'webp':
|
||||
img.save(output, quality=quality, exif=exif_data, format="WEBP")
|
||||
else:
|
||||
img.save(output, pnginfo=exif_data, optimize=True, format="PNG")
|
||||
image_bytes = output.getvalue()
|
||||
image_base64 = base64.b64encode(image_bytes)
|
||||
image_base64_str = image_base64.decode('utf-8')
|
||||
results.append(image_base64_str)
|
||||
|
||||
return results
|
||||
|
||||
async def callback(images, remote_url, extension='jpeg', quality=85, embed_workflow='false', track_id=None, unique_id=None, prompt=None):
|
||||
data = {
|
||||
"images": process_images(images, extension, quality, embed_workflow, prompt)
|
||||
}
|
||||
if track_id:
|
||||
data['track_id'] = track_id
|
||||
if unique_id:
|
||||
data['unique_id'] = unique_id
|
||||
data = json.dumps(data).encode('utf-8')
|
||||
res = requests.post(remote_url, data=data)
|
||||
# TODO: check the response
|
||||
|
||||
|
||||
threading.Thread(
|
||||
target=asyncio.run,
|
||||
args=(callback(images, remote_url, extension, quality, embed_workflow, track_id, unique_id, prompt),),
|
||||
).start()
|
||||
|
||||
return ()
|
||||
@@ -0,0 +1,154 @@
|
||||
import requests
|
||||
import json
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
import os
|
||||
import copy
|
||||
import pandas as pd
|
||||
|
||||
import folder_paths
|
||||
|
||||
from ..utils import SERVER_BASE_URL
|
||||
|
||||
class XyzPlot:
|
||||
CATEGORY = "Browser"
|
||||
|
||||
RETURN_TYPES = ()
|
||||
RETURN_NAMES = ()
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
OUTPUT_NODE = True
|
||||
|
||||
# xyz_data = {
|
||||
# "source_unique_id": "",
|
||||
# "output_folder_name": "",
|
||||
# "x_index": 0,
|
||||
# "y_index": 0,
|
||||
# }
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"images": ["IMAGE", {}],
|
||||
"input_x": ["INPUT", {}],
|
||||
"input_y": ["INPUT", {}],
|
||||
"value_x": ["STRING", {"multiline": True, "placeholder": 'X values split by semicolon such as "1girl; 1boy"'}],
|
||||
"value_y": ["STRING", {"multiline": True, "placeholder": 'Y values split by semicolon such as "1girl; 1boy"'}],
|
||||
"output_folder_name": ["STRING", {"default": "xyz_plot"}],
|
||||
"result_filename": ["STRING", {"default": "result"}],
|
||||
},
|
||||
"hidden": {
|
||||
"prompt": "PROMPT",
|
||||
"unique_id": "UNIQUE_ID",
|
||||
"extra_pnginfo": "EXTRA_PNGINFO",
|
||||
# "xyz_data": "XYZ",
|
||||
},
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def IS_CHANGED(s, *args):
|
||||
return True
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.output_folder_name = os.path.join(folder_paths.get_output_directory(), "xyz_plot")
|
||||
self.x_index = 0
|
||||
self.y_index = 0
|
||||
|
||||
@staticmethod
|
||||
def get_filename(ix, iy, i):
|
||||
return f"x{ix}_y{iy}_{i}.jpeg"
|
||||
|
||||
@staticmethod
|
||||
def get_preview_url(folder_name, filename):
|
||||
return f"/browser/files/view?folder_type=outputs&filename={filename}&folder_path={folder_name}"
|
||||
|
||||
def save_images(self, images):
|
||||
if not os.path.exists(self.output_folder_name):
|
||||
os.mkdir(self.output_folder_name)
|
||||
|
||||
for index, image in enumerate(images):
|
||||
i = 255. * image.cpu().numpy()
|
||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||
img = img.convert('RGB')
|
||||
filename = self.get_filename(self.x_index, self.y_index, index)
|
||||
target_path = os.path.join(self.output_folder_name, filename)
|
||||
img.save(target_path, 'JPEG', quality=90)
|
||||
|
||||
def run(self, images, input_x, input_y, value_x, value_y, output_folder_name, result_filename, prompt, unique_id, extra_pnginfo=None):
|
||||
self.output_folder_name = os.path.join(folder_paths.get_output_directory(), output_folder_name)
|
||||
if 'xyz_data' in prompt[unique_id]['inputs']:
|
||||
self.x_index = prompt[unique_id]['inputs']['xyz_data']['x_index']
|
||||
self.y_index = prompt[unique_id]['inputs']['xyz_data']['y_index']
|
||||
self.save_images(images)
|
||||
return ()
|
||||
|
||||
batch_size = len(images)
|
||||
values_x = value_x.split(";")
|
||||
values_y = value_y.split(";")
|
||||
new_prompt = copy.deepcopy(prompt)
|
||||
ret = {}
|
||||
for ix, vx in enumerate(values_x):
|
||||
vx = vx.strip()
|
||||
row = {}
|
||||
for iy, vy in enumerate(values_y):
|
||||
vy = vy.strip()
|
||||
new_prompt[input_x["node_id"]]["inputs"][input_x["widget_name"]] = vx
|
||||
new_prompt[input_y["node_id"]]["inputs"][input_y["widget_name"]] = vy
|
||||
new_prompt[unique_id]['inputs']['xyz_data'] = {
|
||||
"source_unique_id": unique_id,
|
||||
"output_folder_name": output_folder_name,
|
||||
"x_index": ix,
|
||||
"y_index": iy,
|
||||
}
|
||||
data = json.dumps({
|
||||
'prompt': new_prompt
|
||||
}).encode('utf-8')
|
||||
|
||||
# for some special network environments like AutoDL
|
||||
proxies = {"http": "", "https": ""}
|
||||
r = requests.post(SERVER_BASE_URL + '/prompt', data=data, proxies=proxies)
|
||||
|
||||
row[vy] = ""
|
||||
for i in range(batch_size):
|
||||
filename = self.get_filename(ix, iy, i)
|
||||
preview_url = self.get_preview_url(output_folder_name, filename)
|
||||
row[vy] += f'<img src="{preview_url}" width="100">'
|
||||
|
||||
ret[vx] = row
|
||||
|
||||
# Check if the directory exists
|
||||
if not os.path.exists(self.output_folder_name):
|
||||
try:
|
||||
os.makedirs(self.output_folder_name)
|
||||
except Exception as e:
|
||||
raise Exception(f"Failed to create directory: {e}")
|
||||
|
||||
browser_base_url = f"/browser/s/outputs/{output_folder_name}"
|
||||
|
||||
workflow_html = ""
|
||||
if extra_pnginfo:
|
||||
workflow_filename = f"{result_filename}_workflow.json"
|
||||
with open(f"{self.output_folder_name}/{workflow_filename}", "w") as f:
|
||||
json.dump(extra_pnginfo, f)
|
||||
workflow_html = f'<p><a target="_blank" href="{browser_base_url}/{workflow_filename}">Open the workflow</a></p>'
|
||||
|
||||
|
||||
# To generate grid HTML
|
||||
def gird_title(input):
|
||||
return f"#{input['node_id']} {input['node_title']} - {input['widget_name']}"
|
||||
|
||||
df = pd.DataFrame(ret)
|
||||
html = workflow_html
|
||||
html += f"<p>X: {gird_title(input_x)}</p><p>Y: {gird_title(input_y)}</p>"
|
||||
html += df.to_html(escape=False)
|
||||
target_path = f"{self.output_folder_name}/{result_filename}.html"
|
||||
with open(target_path, "w") as f:
|
||||
f.write(html)
|
||||
|
||||
return {
|
||||
"ui": {
|
||||
"result_path": [f"{browser_base_url}/{result_filename}.html"],
|
||||
},
|
||||
"result": (),
|
||||
}
|
||||
@@ -1 +1,3 @@
|
||||
tqdm
|
||||
pandas
|
||||
numpy
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { onLoadWorkflow, onScroll, fetchFiles } from './utils';
|
||||
import { onLoadWorkflow, onScroll, fetchFiles, WHITE_EXTS } from './utils';
|
||||
import { t } from 'svelte-i18n';
|
||||
import type { FOLDER_TYPES } from './utils';
|
||||
import MediaShow from './MediaShow.svelte';
|
||||
@@ -140,7 +140,7 @@
|
||||
{#each files
|
||||
.filter((f) => searchRegex.test(f.name.toLowerCase()))
|
||||
.slice(0, showCursor) as file}
|
||||
{#if ['dir', 'image', 'video', 'json'].includes(file.fileType)}
|
||||
{#if WHITE_EXTS.includes(file.fileType)}
|
||||
<div class="p-2 bg-info-content">
|
||||
<div class="flex items-center">
|
||||
<MediaShow {file} styleClass="w-full h-16 sm:h-36" {onClickDir} />
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if file.fileType === 'html'}
|
||||
<div class="w-full h-full flex items-center justify-center">
|
||||
<span class="font-bold text-xl">
|
||||
HTML
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
{#if file.fileType === 'image'}
|
||||
<img
|
||||
class="h-full w-full object-contain"
|
||||
|
||||
@@ -135,4 +135,11 @@
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="hidden sm:flex flex-0 items-center justify-center p-2">
|
||||
<a href="https://discord.gg/f49R9dTKwM" target="_blank">
|
||||
<svg class="hidden h-6 w-6 fill-current opacity-60 sm:inline-block " viewBox="0 -28.5 256 256" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
||||
<path d="M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z" fill="#5764f2" fill-rule="nonzero"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
});
|
||||
|
||||
function onClickSource(source: any) {
|
||||
console.log(folderPath);
|
||||
folderPath = source.name;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,18 @@ export type FOLDER_TYPES = 'outputs' | 'collections' | 'sources';
|
||||
export const IMAGE_EXTS = ['png', 'webp', 'jpeg', 'jpg', 'gif'];
|
||||
export const VIDEO_EXTS = ['mp4', 'webm', 'mov', 'avi', 'mkv'];
|
||||
export const JSON_EXTS = ['json'];
|
||||
export const WHITE_EXTS = ['html', 'image', 'video', 'json', 'dir'];
|
||||
|
||||
const localStorageKey = 'comfyui-browser';
|
||||
|
||||
function getFileUrl(comfyUrl: string, folderType: string, file: any) {
|
||||
if (file.folder_path) {
|
||||
return `${comfyUrl}/browser/s/${folderType}/${file.folder_path}/${file.name}`;
|
||||
} else {
|
||||
return `${comfyUrl}/browser/s/${folderType}/${file.name}`;
|
||||
}
|
||||
}
|
||||
|
||||
function findFile(filename: string, exts: Array<string>, files: Array<any>) {
|
||||
let fn: any = filename.split('.');
|
||||
fn.pop();
|
||||
@@ -29,10 +38,12 @@ function processFile(
|
||||
files: Array<any>,
|
||||
) {
|
||||
const extname = file.name.split('.').pop().toLowerCase();
|
||||
if (JSON_EXTS.includes(extname)) {
|
||||
file['fileType'] = 'json';
|
||||
if (findFile(file.name, IMAGE_EXTS.concat(VIDEO_EXTS), files)) {
|
||||
return;
|
||||
if (WHITE_EXTS.includes(extname)) {
|
||||
file['fileType'] = extname;
|
||||
if (extname === 'json') {
|
||||
if (findFile(file.name, IMAGE_EXTS.concat(VIDEO_EXTS), files)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (IMAGE_EXTS.includes(extname)) {
|
||||
@@ -45,13 +56,13 @@ function processFile(
|
||||
return;
|
||||
}
|
||||
|
||||
file['url'] = `${comfyUrl}/browser/files/view?folder_type=${folderType}&filename=${file.name}&folder_path=${file.folder_path}`;
|
||||
file['url'] = getFileUrl(comfyUrl, folderType, file);
|
||||
if (['image', 'video'].includes(file['fileType'])) {
|
||||
file['previewUrl'] = `${comfyUrl}/browser/files/view?folder_type=${folderType}&filename=${file.name}&folder_path=${file.folder_path}`;
|
||||
file['previewUrl'] = getFileUrl(comfyUrl, folderType, file);
|
||||
|
||||
let jsonFile = findFile(file.name, JSON_EXTS, files);
|
||||
if (jsonFile) {
|
||||
file['url'] = `${comfyUrl}/browser/files/view?folder_type=${folderType}&filename=${jsonFile.name}&folder_path=${jsonFile.folder_path}`;
|
||||
file['url'] = getFileUrl(comfyUrl, folderType, jsonFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
import json
|
||||
from os import path, scandir
|
||||
from os import path, scandir, mkdir
|
||||
import subprocess
|
||||
import time
|
||||
from typing import TypedDict, List
|
||||
|
||||
import folder_paths
|
||||
from comfy.cli_args import args
|
||||
|
||||
SERVER_BASE_URL = f'http://{args.listen}:{args.port}'
|
||||
|
||||
browser_path = path.dirname(__file__)
|
||||
collections_path = path.join(browser_path, 'collections')
|
||||
config_path = path.join(browser_path, 'config.json')
|
||||
sources_path = path.join(browser_path, 'sources')
|
||||
download_logs_path = path.join(browser_path, 'download_logs')
|
||||
outputs_path = folder_paths.get_output_directory()
|
||||
if args.output_directory:
|
||||
outputs_path = path.abspath(args.output_directory)
|
||||
|
||||
for dir in [collections_path, sources_path, download_logs_path, outputs_path]:
|
||||
if not path.exists(dir):
|
||||
mkdir(dir)
|
||||
|
||||
|
||||
image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.webp']
|
||||
video_extensions = ['.mp4', '.mov', '.avi', '.webm', '.mkv']
|
||||
white_extensions = ['.json', '.html'] + image_extensions + video_extensions
|
||||
|
||||
info_file_suffix = '.info'
|
||||
|
||||
@@ -60,7 +72,7 @@ def get_parent_path(folder_type: str):
|
||||
return sources_path
|
||||
|
||||
# outputs
|
||||
return folder_paths.output_directory
|
||||
return outputs_path
|
||||
|
||||
# folder_type = 'outputs', 'collections', 'sources'
|
||||
def get_target_folder_files(folder_path: str, folder_type: str = 'outputs'):
|
||||
@@ -85,7 +97,7 @@ def get_target_folder_files(folder_path: str, folder_type: str = 'outputs'):
|
||||
if name == '' or name[0] == '.':
|
||||
continue
|
||||
if item.is_file():
|
||||
if not (ext in (image_extensions + video_extensions + ['.json'])):
|
||||
if not (ext in white_extensions):
|
||||
continue
|
||||
|
||||
created_at = item.stat().st_ctime
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{w as u}from"./index.KGH7dGZH.js";const b=globalThis.__sveltekit_pn8i7p?.base??"",v=globalThis.__sveltekit_pn8i7p?.assets??b,k="1703985909010",R="sveltekit:snapshot",T="sveltekit:scroll",w="sveltekit:states",I="sveltekit:pageurl",S="sveltekit:history",y="sveltekit:navigation",f={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},_=location.origin;function N(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function U(){return{x:pageXOffset,y:pageYOffset}}function c(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const d={...f,"":f.hover};function g(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function L(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=g(e)}}function O(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!a||m(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),l=n?.origin===_&&e.hasAttribute("download");return{url:n,external:r,target:a,download:l}}function Y(e){let t=null,n=null,a=null,r=null,l=null,o=null,s=e;for(;s&&s!==document.documentElement;)a===null&&(a=c(s,"preload-code")),r===null&&(r=c(s,"preload-data")),t===null&&(t=c(s,"keepfocus")),n===null&&(n=c(s,"noscroll")),l===null&&(l=c(s,"reload")),o===null&&(o=c(s,"replacestate")),s=g(s);function i(h){switch(h){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:d[a??"off"],preload_data:d[r??"off"],keepfocus:i(t),noscroll:i(n),reload:i(l),replace_state:i(o)}}function p(e){const t=u(e);let n=!0;function a(){n=!0,t.update(o=>o)}function r(o){n=!1,t.set(o)}function l(o){let s;return t.subscribe(i=>{(s===void 0||n&&i!==s)&&o(s=i)})}return{notify:a,set:r,subscribe:l}}function E(){const{set:e,subscribe:t}=u(!1);let n;async function a(){clearTimeout(n);try{const r=await fetch(`${v}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const o=(await r.json()).version!==k;return o&&(e(!0),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:a}}function m(e,t){return e.origin!==_||!e.pathname.startsWith(t)}function x(e){e.client}const P={url:p({}),page:p({}),navigating:u(null),updated:E()};export{S as H,y as N,I as P,T as S,w as a,R as b,Y as c,P as d,b as e,L as f,O as g,f as h,m as i,x as j,_ as o,N as r,U as s};
|
||||
import{w as u}from"./index.KGH7dGZH.js";const b=globalThis.__sveltekit_vb5m50?.base??"",v=globalThis.__sveltekit_vb5m50?.assets??b,k="1705164974856",R="sveltekit:snapshot",T="sveltekit:scroll",w="sveltekit:states",I="sveltekit:pageurl",S="sveltekit:history",y="sveltekit:navigation",f={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},_=location.origin;function N(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function U(){return{x:pageXOffset,y:pageYOffset}}function c(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const d={...f,"":f.hover};function g(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function L(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=g(e)}}function O(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!a||E(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),l=n?.origin===_&&e.hasAttribute("download");return{url:n,external:r,target:a,download:l}}function Y(e){let t=null,n=null,a=null,r=null,l=null,o=null,s=e;for(;s&&s!==document.documentElement;)a===null&&(a=c(s,"preload-code")),r===null&&(r=c(s,"preload-data")),t===null&&(t=c(s,"keepfocus")),n===null&&(n=c(s,"noscroll")),l===null&&(l=c(s,"reload")),o===null&&(o=c(s,"replacestate")),s=g(s);function i(h){switch(h){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:d[a??"off"],preload_data:d[r??"off"],keepfocus:i(t),noscroll:i(n),reload:i(l),replace_state:i(o)}}function p(e){const t=u(e);let n=!0;function a(){n=!0,t.update(o=>o)}function r(o){n=!1,t.set(o)}function l(o){let s;return t.subscribe(i=>{(s===void 0||n&&i!==s)&&o(s=i)})}return{notify:a,set:r,subscribe:l}}function m(){const{set:e,subscribe:t}=u(!1);let n;async function a(){clearTimeout(n);try{const r=await fetch(`${v}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const o=(await r.json()).version!==k;return o&&(e(!0),clearTimeout(n)),o}catch{return!1}}return{subscribe:t,check:a}}function E(e,t){return e.origin!==_||!e.pathname.startsWith(t)}function x(e){e.client}const P={url:p({}),page:p({}),navigating:u(null),updated:m()};export{S as H,y as N,I as P,T as S,w as a,R as b,Y as c,P as d,b as e,L as f,O as g,f as h,E as i,x as j,_ as o,N as r,U as s};
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import{_ as I}from"../chunks/preload-helper.0HuHagjb.js";import{s as S,a as j,o as C,t as M,b as P}from"../chunks/scheduler.3IkOjBO1.js";import{S as U,i as z,s as B,e as p,c as F,a as w,t as d,b as N,d as h,f as g,g as G,h as H,j as J,k as R,l as m,m as K,n as Q,o as W,p as D,q as k,r as v,u as V,v as E,w as y}from"../chunks/index.b4_itZyM.js";const ie={};function X(r){let e,n,i;var s=r[1][0];function _(t,o){return{props:{data:t[3],form:t[2]}}}return s&&(e=k(s,_(r)),r[12](e)),{c(){e&&v(e.$$.fragment),n=p()},l(t){e&&V(e.$$.fragment,t),n=p()},m(t,o){e&&E(e,t,o),w(t,n,o),i=!0},p(t,o){if(o&2&&s!==(s=t[1][0])){if(e){D();const a=e;d(a.$$.fragment,1,0,()=>{y(a,1)}),N()}s?(e=k(s,_(t)),t[12](e),v(e.$$.fragment),h(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(s){const a={};o&8&&(a.data=t[3]),o&4&&(a.form=t[2]),e.$set(a)}},i(t){i||(e&&h(e.$$.fragment,t),i=!0)},o(t){e&&d(e.$$.fragment,t),i=!1},d(t){t&&g(n),r[12](null),e&&y(e,t)}}}function Y(r){let e,n,i;var s=r[1][0];function _(t,o){return{props:{data:t[3],$$slots:{default:[Z]},$$scope:{ctx:t}}}}return s&&(e=k(s,_(r)),r[11](e)),{c(){e&&v(e.$$.fragment),n=p()},l(t){e&&V(e.$$.fragment,t),n=p()},m(t,o){e&&E(e,t,o),w(t,n,o),i=!0},p(t,o){if(o&2&&s!==(s=t[1][0])){if(e){D();const a=e;d(a.$$.fragment,1,0,()=>{y(a,1)}),N()}s?(e=k(s,_(t)),t[11](e),v(e.$$.fragment),h(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(s){const a={};o&8&&(a.data=t[3]),o&8215&&(a.$$scope={dirty:o,ctx:t}),e.$set(a)}},i(t){i||(e&&h(e.$$.fragment,t),i=!0)},o(t){e&&d(e.$$.fragment,t),i=!1},d(t){t&&g(n),r[11](null),e&&y(e,t)}}}function Z(r){let e,n,i;var s=r[1][1];function _(t,o){return{props:{data:t[4],form:t[2]}}}return s&&(e=k(s,_(r)),r[10](e)),{c(){e&&v(e.$$.fragment),n=p()},l(t){e&&V(e.$$.fragment,t),n=p()},m(t,o){e&&E(e,t,o),w(t,n,o),i=!0},p(t,o){if(o&2&&s!==(s=t[1][1])){if(e){D();const a=e;d(a.$$.fragment,1,0,()=>{y(a,1)}),N()}s?(e=k(s,_(t)),t[10](e),v(e.$$.fragment),h(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(s){const a={};o&16&&(a.data=t[4]),o&4&&(a.form=t[2]),e.$set(a)}},i(t){i||(e&&h(e.$$.fragment,t),i=!0)},o(t){e&&d(e.$$.fragment,t),i=!1},d(t){t&&g(n),r[10](null),e&&y(e,t)}}}function A(r){let e,n=r[6]&&L(r);return{c(){e=G("div"),n&&n.c(),this.h()},l(i){e=H(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var s=J(e);n&&n.l(s),s.forEach(g),this.h()},h(){R(e,"id","svelte-announcer"),R(e,"aria-live","assertive"),R(e,"aria-atomic","true"),m(e,"position","absolute"),m(e,"left","0"),m(e,"top","0"),m(e,"clip","rect(0 0 0 0)"),m(e,"clip-path","inset(50%)"),m(e,"overflow","hidden"),m(e,"white-space","nowrap"),m(e,"width","1px"),m(e,"height","1px")},m(i,s){w(i,e,s),n&&n.m(e,null)},p(i,s){i[6]?n?n.p(i,s):(n=L(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&g(e),n&&n.d()}}}function L(r){let e;return{c(){e=K(r[7])},l(n){e=Q(n,r[7])},m(n,i){w(n,e,i)},p(n,i){i&128&&W(e,n[7])},d(n){n&&g(e)}}}function $(r){let e,n,i,s,_;const t=[Y,X],o=[];function a(f,u){return f[1][1]?0:1}e=a(r),n=o[e]=t[e](r);let c=r[5]&&A(r);return{c(){n.c(),i=B(),c&&c.c(),s=p()},l(f){n.l(f),i=F(f),c&&c.l(f),s=p()},m(f,u){o[e].m(f,u),w(f,i,u),c&&c.m(f,u),w(f,s,u),_=!0},p(f,[u]){let b=e;e=a(f),e===b?o[e].p(f,u):(D(),d(o[b],1,1,()=>{o[b]=null}),N(),n=o[e],n?n.p(f,u):(n=o[e]=t[e](f),n.c()),h(n,1),n.m(i.parentNode,i)),f[5]?c?c.p(f,u):(c=A(f),c.c(),c.m(s.parentNode,s)):c&&(c.d(1),c=null)},i(f){_||(h(n),_=!0)},o(f){d(n),_=!1},d(f){f&&(g(i),g(s)),o[e].d(f),c&&c.d(f)}}}function x(r,e,n){let{stores:i}=e,{page:s}=e,{constructors:_}=e,{components:t=[]}=e,{form:o}=e,{data_0:a=null}=e,{data_1:c=null}=e;j(i.page.notify);let f=!1,u=!1,b=null;C(()=>{const l=i.page.subscribe(()=>{f&&(n(6,u=!0),M().then(()=>{n(7,b=document.title||"untitled page")}))});return n(5,f=!0),l});function O(l){P[l?"unshift":"push"](()=>{t[1]=l,n(0,t)})}function T(l){P[l?"unshift":"push"](()=>{t[0]=l,n(0,t)})}function q(l){P[l?"unshift":"push"](()=>{t[0]=l,n(0,t)})}return r.$$set=l=>{"stores"in l&&n(8,i=l.stores),"page"in l&&n(9,s=l.page),"constructors"in l&&n(1,_=l.constructors),"components"in l&&n(0,t=l.components),"form"in l&&n(2,o=l.form),"data_0"in l&&n(3,a=l.data_0),"data_1"in l&&n(4,c=l.data_1)},r.$$.update=()=>{r.$$.dirty&768&&i.page.set(s)},[t,_,o,a,c,f,u,b,i,s,O,T,q]}class se extends U{constructor(e){super(),z(this,e,x,$,S,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const oe=[()=>I(()=>import("../nodes/0.z_vse_tt.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),()=>I(()=>import("../nodes/1.-1LX1TgW.js"),__vite__mapDeps([7,4,5,8,3]),import.meta.url),()=>I(()=>import("../nodes/2.xEXAmtjr.js"),__vite__mapDeps([9,4,5,2,3]),import.meta.url)],re=[],ae={"/":[2]},fe={handleError:({error:r})=>{console.error(r)}};export{ae as dictionary,fe as hooks,ie as matchers,oe as nodes,se as root,re as server_loads};
|
||||
import{_ as I}from"../chunks/preload-helper.0HuHagjb.js";import{s as S,a as j,o as C,t as M,b as P}from"../chunks/scheduler.3IkOjBO1.js";import{S as U,i as z,s as B,e as p,c as F,a as w,t as d,b as N,d as h,f as g,g as G,h as H,j as J,k as R,l as m,m as K,n as Q,o as W,p as D,q as k,r as v,u as V,v as E,w as y}from"../chunks/index.b4_itZyM.js";const ie={};function X(r){let e,n,i;var s=r[1][0];function _(t,o){return{props:{data:t[3],form:t[2]}}}return s&&(e=k(s,_(r)),r[12](e)),{c(){e&&v(e.$$.fragment),n=p()},l(t){e&&V(e.$$.fragment,t),n=p()},m(t,o){e&&E(e,t,o),w(t,n,o),i=!0},p(t,o){if(o&2&&s!==(s=t[1][0])){if(e){D();const a=e;d(a.$$.fragment,1,0,()=>{y(a,1)}),N()}s?(e=k(s,_(t)),t[12](e),v(e.$$.fragment),h(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(s){const a={};o&8&&(a.data=t[3]),o&4&&(a.form=t[2]),e.$set(a)}},i(t){i||(e&&h(e.$$.fragment,t),i=!0)},o(t){e&&d(e.$$.fragment,t),i=!1},d(t){t&&g(n),r[12](null),e&&y(e,t)}}}function Y(r){let e,n,i;var s=r[1][0];function _(t,o){return{props:{data:t[3],$$slots:{default:[Z]},$$scope:{ctx:t}}}}return s&&(e=k(s,_(r)),r[11](e)),{c(){e&&v(e.$$.fragment),n=p()},l(t){e&&V(e.$$.fragment,t),n=p()},m(t,o){e&&E(e,t,o),w(t,n,o),i=!0},p(t,o){if(o&2&&s!==(s=t[1][0])){if(e){D();const a=e;d(a.$$.fragment,1,0,()=>{y(a,1)}),N()}s?(e=k(s,_(t)),t[11](e),v(e.$$.fragment),h(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(s){const a={};o&8&&(a.data=t[3]),o&8215&&(a.$$scope={dirty:o,ctx:t}),e.$set(a)}},i(t){i||(e&&h(e.$$.fragment,t),i=!0)},o(t){e&&d(e.$$.fragment,t),i=!1},d(t){t&&g(n),r[11](null),e&&y(e,t)}}}function Z(r){let e,n,i;var s=r[1][1];function _(t,o){return{props:{data:t[4],form:t[2]}}}return s&&(e=k(s,_(r)),r[10](e)),{c(){e&&v(e.$$.fragment),n=p()},l(t){e&&V(e.$$.fragment,t),n=p()},m(t,o){e&&E(e,t,o),w(t,n,o),i=!0},p(t,o){if(o&2&&s!==(s=t[1][1])){if(e){D();const a=e;d(a.$$.fragment,1,0,()=>{y(a,1)}),N()}s?(e=k(s,_(t)),t[10](e),v(e.$$.fragment),h(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(s){const a={};o&16&&(a.data=t[4]),o&4&&(a.form=t[2]),e.$set(a)}},i(t){i||(e&&h(e.$$.fragment,t),i=!0)},o(t){e&&d(e.$$.fragment,t),i=!1},d(t){t&&g(n),r[10](null),e&&y(e,t)}}}function A(r){let e,n=r[6]&&L(r);return{c(){e=G("div"),n&&n.c(),this.h()},l(i){e=H(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var s=J(e);n&&n.l(s),s.forEach(g),this.h()},h(){R(e,"id","svelte-announcer"),R(e,"aria-live","assertive"),R(e,"aria-atomic","true"),m(e,"position","absolute"),m(e,"left","0"),m(e,"top","0"),m(e,"clip","rect(0 0 0 0)"),m(e,"clip-path","inset(50%)"),m(e,"overflow","hidden"),m(e,"white-space","nowrap"),m(e,"width","1px"),m(e,"height","1px")},m(i,s){w(i,e,s),n&&n.m(e,null)},p(i,s){i[6]?n?n.p(i,s):(n=L(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&g(e),n&&n.d()}}}function L(r){let e;return{c(){e=K(r[7])},l(n){e=Q(n,r[7])},m(n,i){w(n,e,i)},p(n,i){i&128&&W(e,n[7])},d(n){n&&g(e)}}}function $(r){let e,n,i,s,_;const t=[Y,X],o=[];function a(f,u){return f[1][1]?0:1}e=a(r),n=o[e]=t[e](r);let c=r[5]&&A(r);return{c(){n.c(),i=B(),c&&c.c(),s=p()},l(f){n.l(f),i=F(f),c&&c.l(f),s=p()},m(f,u){o[e].m(f,u),w(f,i,u),c&&c.m(f,u),w(f,s,u),_=!0},p(f,[u]){let b=e;e=a(f),e===b?o[e].p(f,u):(D(),d(o[b],1,1,()=>{o[b]=null}),N(),n=o[e],n?n.p(f,u):(n=o[e]=t[e](f),n.c()),h(n,1),n.m(i.parentNode,i)),f[5]?c?c.p(f,u):(c=A(f),c.c(),c.m(s.parentNode,s)):c&&(c.d(1),c=null)},i(f){_||(h(n),_=!0)},o(f){d(n),_=!1},d(f){f&&(g(i),g(s)),o[e].d(f),c&&c.d(f)}}}function x(r,e,n){let{stores:i}=e,{page:s}=e,{constructors:_}=e,{components:t=[]}=e,{form:o}=e,{data_0:a=null}=e,{data_1:c=null}=e;j(i.page.notify);let f=!1,u=!1,b=null;C(()=>{const l=i.page.subscribe(()=>{f&&(n(6,u=!0),M().then(()=>{n(7,b=document.title||"untitled page")}))});return n(5,f=!0),l});function O(l){P[l?"unshift":"push"](()=>{t[1]=l,n(0,t)})}function T(l){P[l?"unshift":"push"](()=>{t[0]=l,n(0,t)})}function q(l){P[l?"unshift":"push"](()=>{t[0]=l,n(0,t)})}return r.$$set=l=>{"stores"in l&&n(8,i=l.stores),"page"in l&&n(9,s=l.page),"constructors"in l&&n(1,_=l.constructors),"components"in l&&n(0,t=l.components),"form"in l&&n(2,o=l.form),"data_0"in l&&n(3,a=l.data_0),"data_1"in l&&n(4,c=l.data_1)},r.$$.update=()=>{r.$$.dirty&768&&i.page.set(s)},[t,_,o,a,c,f,u,b,i,s,O,T,q]}class se extends U{constructor(e){super(),z(this,e,x,$,S,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const oe=[()=>I(()=>import("../nodes/0.z_vse_tt.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url),()=>I(()=>import("../nodes/1.2vGAU644.js"),__vite__mapDeps([7,4,5,8,3]),import.meta.url),()=>I(()=>import("../nodes/2.g-1vMRVf.js"),__vite__mapDeps([9,4,5,2,3]),import.meta.url)],re=[],ae={"/":[2]},fe={handleError:({error:r})=>{console.error(r)}};export{ae as dictionary,fe as hooks,ie as matchers,oe as nodes,se as root,re as server_loads};
|
||||
function __vite__mapDeps(indexes) {
|
||||
if (!__vite__mapDeps.viteFileDeps) {
|
||||
__vite__mapDeps.viteFileDeps = ["../nodes/0.z_vse_tt.js","../chunks/preload-helper.0HuHagjb.js","../chunks/runtime.-hGPaMd1.js","../chunks/index.KGH7dGZH.js","../chunks/scheduler.3IkOjBO1.js","../chunks/index.b4_itZyM.js","../assets/0.S8gUIXi-.css","../nodes/1.-1LX1TgW.js","../chunks/singletons.s-6DOT2Q.js","../nodes/2.xEXAmtjr.js"]
|
||||
__vite__mapDeps.viteFileDeps = ["../nodes/0.z_vse_tt.js","../chunks/preload-helper.0HuHagjb.js","../chunks/runtime.-hGPaMd1.js","../chunks/index.KGH7dGZH.js","../chunks/scheduler.3IkOjBO1.js","../chunks/index.b4_itZyM.js","../assets/0.S8gUIXi-.css","../nodes/1.2vGAU644.js","../chunks/singletons.SrwXqy11.js","../nodes/2.g-1vMRVf.js"]
|
||||
}
|
||||
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
||||
}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
import{s as E,n as b,e as x}from"../chunks/scheduler.3IkOjBO1.js";import{S,i as j,g as _,m as f,s as q,h as d,j as g,n as h,f as p,c as y,a as l,x as v,o as $}from"../chunks/index.b4_itZyM.js";import{d as C}from"../chunks/singletons.s-6DOT2Q.js";const H=()=>{const s=C;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},P={subscribe(s){return H().page.subscribe(s)}};function k(s){let t,r=s[0].status+"",o,n,i,c=s[0].error?.message+"",u;return{c(){t=_("h1"),o=f(r),n=q(),i=_("p"),u=f(c)},l(e){t=d(e,"H1",{});var a=g(t);o=h(a,r),a.forEach(p),n=y(e),i=d(e,"P",{});var m=g(i);u=h(m,c),m.forEach(p)},m(e,a){l(e,t,a),v(t,o),l(e,n,a),l(e,i,a),v(i,u)},p(e,[a]){a&1&&r!==(r=e[0].status+"")&&$(o,r),a&1&&c!==(c=e[0].error?.message+"")&&$(u,c)},i:b,o:b,d(e){e&&(p(t),p(n),p(i))}}}function w(s,t,r){let o;return x(s,P,n=>r(0,o=n)),[o]}let D=class extends S{constructor(t){super(),j(this,t,w,k,E,{})}};export{D as component};
|
||||
import{s as E,n as b,e as x}from"../chunks/scheduler.3IkOjBO1.js";import{S,i as j,g as _,m as f,s as q,h as d,j as g,n as h,f as p,c as y,a as l,x as v,o as $}from"../chunks/index.b4_itZyM.js";import{d as C}from"../chunks/singletons.SrwXqy11.js";const H=()=>{const s=C;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},P={subscribe(s){return H().page.subscribe(s)}};function k(s){let t,r=s[0].status+"",o,n,i,c=s[0].error?.message+"",u;return{c(){t=_("h1"),o=f(r),n=q(),i=_("p"),u=f(c)},l(e){t=d(e,"H1",{});var a=g(t);o=h(a,r),a.forEach(p),n=y(e),i=d(e,"P",{});var m=g(i);u=h(m,c),m.forEach(p)},m(e,a){l(e,t,a),v(t,o),l(e,n,a),l(e,i,a),v(i,u)},p(e,[a]){a&1&&r!==(r=e[0].status+"")&&$(o,r),a&1&&c!==(c=e[0].error?.message+"")&&$(u,c)},i:b,o:b,d(e){e&&(p(t),p(n),p(i))}}}function w(s,t,r){let o;return x(s,P,n=>r(0,o=n)),[o]}let D=class extends S{constructor(t){super(),j(this,t,w,k,E,{})}};export{D as component};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
{"version":"1703985909010"}
|
||||
{"version":"1705164974856"}
|
||||
@@ -6,23 +6,23 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<link href="./_app/immutable/assets/0.S8gUIXi-.css" rel="stylesheet">
|
||||
<link rel="modulepreload" href="./_app/immutable/entry/start.yoO5R0Im.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/entry/start.nCHSlQ_r.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/scheduler.3IkOjBO1.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.s-6DOT2Q.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/singletons.SrwXqy11.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/index.KGH7dGZH.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/entry/app.-AUXghue.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/entry/app.bKNUjLue.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/preload-helper.0HuHagjb.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/index.b4_itZyM.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/nodes/0.z_vse_tt.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/chunks/runtime.-hGPaMd1.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/nodes/2.xEXAmtjr.js">
|
||||
<link rel="modulepreload" href="./_app/immutable/nodes/2.g-1vMRVf.js">
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents"> <div class="flex"><ul class="menu menu-horizontal bg-base-200 rounded-box flex-1"><li><button class="active"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"></path></svg> Outputs</button></li> <li><button class=""><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0111.186 0z"></path></svg> Saves</button></li> <li><button class=""><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="M12.75 19.5v-.75a7.5 7.5 0 00-7.5-7.5H4.5m0-6.75h.75c7.87 0 14.25 6.38 14.25 14.25v.75M6 18.75a.75.75 0 11-1.5 0 .75.75 0 011.5 0z"></path></svg> Sources</button></li> <li><button class=""><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5"><path stroke-linecap="round" stroke-linejoin="round" d="m21 7.5-9-5.25L3 7.5m18 0-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9"></path></svg> Models</button></li></ul> <div class="dropdown dropdown-hover"><div tabindex="0" role="button" class="m-1 btn btn-ghost" data-svelte-h="svelte-1uytjka"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"></path></svg> <svg width="12px" height="12px" class="hidden h-2 w-2 fill-current opacity-60 sm:inline-block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2048 2048"><path d="M1799 349l242 241-1017 1017L7 590l242-241 775 775 775-775z"></path></svg></div> <ul class="p-2 shadow menu dropdown-content z-[1] bg-base-100 rounded-box w-24"><li><button class="active">En</button> </li><li><button class="">中文</button> </li></ul></div> <div class="hidden sm:flex flex-0 items-center justify-center p-2" data-svelte-h="svelte-104clx6"><a href="https://github.com/talesofai/comfyui-browser" target="_blank"><img src="https://img.shields.io/github/stars/talesofai/comfyui-browser?style=social" alt="stars - comfyui-browser"></a></div></div> <div class="max-w-full text-sm breadcrumbs flex flex-row ml-4"><ul class="basis-3/4"><li><button>Root</button></li> <li><button></button></li></ul> <input type="text" placeholder="Filter by filename" class="input input-bordered w-full h-full rounded-none border-slate-600 text-sm basis-1/4" value=""></div> <div class="grid grid-cols-4 lg:grid-cols-6 gap-2"></div> <div class="w-full h-full flex items-center justify-center"><span class="font-bold text-4xl">No data</span></div>
|
||||
|
||||
<script>
|
||||
{
|
||||
__sveltekit_pn8i7p = {
|
||||
__sveltekit_vb5m50 = {
|
||||
base: new URL(".", location).pathname.slice(0, -1),
|
||||
env: null
|
||||
};
|
||||
@@ -32,8 +32,8 @@
|
||||
const data = [null,null];
|
||||
|
||||
Promise.all([
|
||||
import("./_app/immutable/entry/start.yoO5R0Im.js"),
|
||||
import("./_app/immutable/entry/app.-AUXghue.js")
|
||||
import("./_app/immutable/entry/start.nCHSlQ_r.js"),
|
||||
import("./_app/immutable/entry/app.bKNUjLue.js")
|
||||
]).then(([kit, app]) => {
|
||||
kit.start(app, element, {
|
||||
node_ids: [0, 2],
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
import { app } from "../../../scripts/app.js";
|
||||
|
||||
const selectInputsNodeType = 'SelectInputs //Browser';
|
||||
const SPLITTER = '::';
|
||||
|
||||
function getGraphInputs(graph) {
|
||||
let inputs = [];
|
||||
graph._nodes?.forEach(n => {
|
||||
n.widgets?.forEach(w => {
|
||||
inputs.push([`#${n.id}`, n.title, w.name].join(SPLITTER));
|
||||
});
|
||||
});
|
||||
|
||||
return inputs;
|
||||
}
|
||||
|
||||
function refreshPreview(node) {
|
||||
let values = [];
|
||||
node.widgets.forEach(w => {
|
||||
if (w.type === 'combo' && w.name.startsWith('input_')) {
|
||||
const v = w.value.split(SPLITTER);
|
||||
values.push({
|
||||
node_id: v[0].substring(1),
|
||||
node_title: v[1],
|
||||
widget_name: v[2],
|
||||
});
|
||||
}
|
||||
});
|
||||
const preview = node.widgets.find(w => w.name === 'preview');
|
||||
preview.value = JSON.stringify(values);
|
||||
}
|
||||
|
||||
function refreshInputs(node, app) {
|
||||
const inputs = getGraphInputs(app.graph);
|
||||
node.widgets.forEach(w => {
|
||||
if (w.type != 'combo') {
|
||||
return;
|
||||
}
|
||||
|
||||
w.options.values = inputs;
|
||||
w.value = inputs[0];
|
||||
});
|
||||
const size = node.computeSize();
|
||||
node.setSize([size[0] * 1.5, size[1]]);
|
||||
|
||||
refreshPreview(node);
|
||||
}
|
||||
|
||||
app.registerExtension({
|
||||
name: "Browser.Nodes.SelectInputs",
|
||||
nodeCreated(node, app) {
|
||||
if (node.constructor.type != selectInputsNodeType) {
|
||||
return;
|
||||
}
|
||||
|
||||
node.widgets.forEach(w => {
|
||||
if (w.name === 'preview') {
|
||||
if (w.element) {
|
||||
w.element.disabled = true;
|
||||
}
|
||||
}
|
||||
if (w.type === 'combo' && w.name.startsWith('input_')) {
|
||||
const oriCallback = w.callback;
|
||||
w.callback = () => {
|
||||
oriCallback?.apply(arguments);
|
||||
refreshPreview(node)
|
||||
};
|
||||
}
|
||||
});
|
||||
node.addWidget(
|
||||
"button", 'Refresh', '',
|
||||
() => refreshInputs(node, app)
|
||||
);
|
||||
refreshInputs(node, app);
|
||||
},
|
||||
loadedGraphNode(node, app) {
|
||||
if (node.type != selectInputsNodeType) {
|
||||
return;
|
||||
}
|
||||
|
||||
refreshInputs(node, app);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import { app } from "../../../scripts/app.js";
|
||||
|
||||
const xyzPlotNodeType = 'XyzPlot //Browser';
|
||||
|
||||
app.registerExtension({
|
||||
name: "Browser.Nodes.XyzPlot",
|
||||
async beforeRegisterNodeDef(nodeType, nodeData, app) {
|
||||
if (nodeData.name != xyzPlotNodeType) {
|
||||
return;
|
||||
}
|
||||
const orig = nodeType.prototype.onExecuted;
|
||||
nodeType.prototype.onExecuted = function(message) {
|
||||
const ret = orig?.apply(this, arguments);
|
||||
|
||||
const resultPath = message.result_path[0];
|
||||
if (!resultPath) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
let button = this.widgets.find(w => w.type === 'button');
|
||||
const callback = () => { window.open(window.location.origin + resultPath, "_blank"); };
|
||||
if (!button) {
|
||||
this.addWidget("button", 'Open the result', '', callback);
|
||||
} else {
|
||||
button.callback = callback;
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user