HEL-892: add source-bound SeedVR2 image reference documentation

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-31 00:22:02 +08:00
co-authored by multica-agent
parent 1d04c00c0c
commit 291ff48e6f
96 changed files with 43781 additions and 1 deletions
@@ -15,6 +15,11 @@ DEFINITION_SHA256 = "c4c7f04fde29dc7485a341207397fcf6191e3fcbe89ecc2d238f4a4f5bc
# Explicit path allowlist; a recomputed caller-supplied digest cannot extend trust.
DEFINITIONS = {
(
"example_ComfyUI_workflows/0-基础处理:图像合并-音频"
"分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像"
"放大.json"
): "d623448c377ac5883c52bd3689aca85a9e4dafb2060f407f66e8d7bba83ed817",
(
"example_ComfyUI_workflows/0-基础处理:图像合并-音频"
"分离-视频截取合并-图像视频放大/高清放大/RTX_video_upscale."
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,283 @@
"""SeedVR2 scope/boundary, dual storage, exact source and editorial trust checks."""
import copy
import hashlib
import json
import subprocess
from pathlib import Path
import pytest
from calliope.comfyui.fixed_document import DEFINITIONS, canonical
from calliope.comfyui.library import build_document
from calliope.comfyui.source_reviews import review_for
REPO = Path(__file__).resolve().parents[2]
OUT = REPO / "docs/hel-892/seedvr2-document-evidence"
PATH = next(p for p in DEFINITIONS if p.endswith("/Seedvr2_3b_int8_图像放大.json"))
SOURCE = json.loads((REPO / PATH).read_bytes())
REVIEW = review_for(PATH, hashlib.sha1((REPO / PATH).read_bytes()).hexdigest())
BLOCK = REVIEW["fixed_version_document"]
SUB = SOURCE["definitions"]["subgraphs"][0]
SCOPES = [("", SOURCE), ("/definitions/subgraphs/0", SUB)]
NODES = [(f"{prefix}/nodes/{i}", n) for prefix, g in SCOPES for i, n in enumerate(g["nodes"])]
EDGES = [(f"{prefix}/links/{i}", e) for prefix, g in SCOPES for i, e in enumerate(g["links"])]
def pointer(obj, path):
for k in path.strip("/").split("/"):
obj = obj[int(k)] if isinstance(obj, list) else obj[k.replace("~1", "/").replace("~0", "~")]
return obj
def doc(source=SOURCE, review=REVIEW):
return build_document(PATH, source, None, None, [], review)
def refuse(source, review):
b = review["fixed_version_document"]
b["canonical_sha256"] = hashlib.sha256(canonical(source)).hexdigest()
review["caller_digest"] = hashlib.sha256(canonical(b)).hexdigest()
assert not doc(source, review)["fixed_version"]["matched"]
@pytest.mark.parametrize(
"f", BLOCK["fields"], ids=lambda f: f["scope"] + ":" + f["node_id"] + "." + f["field"]
)
def test_each_saved_position_dual_storage_type_scope_and_exact_source(f):
v = pointer(SOURCE, f["pointer"])
named = pointer(SOURCE, f["named_pointer"])
assert canonical(v) == canonical(f["value"]) and type(v).__name__ == f["json_type"]
assert named == ({"images": v} if f["field"] == "rgthree_comparer" else v)
for k in [
"effect",
"limits",
"schema_default",
"unit",
"execution_note",
"role",
"label",
"type",
]:
assert f[k]
assert f["named_pointer"] in f["execution_note"]
for k in f["evidence"]:
e = BLOCK["sources"][k]
raw = (OUT / e["local_file"]).read_bytes()
assert hashlib.sha256(raw).hexdigest() == e["sha256"]
assert (
1 <= e["lines"][0] <= e["lines"][1] <= len(raw.decode().splitlines())
and len(e["commit"]) == 40
)
@pytest.mark.parametrize("f", BLOCK["fields"])
@pytest.mark.parametrize("variant", ["saved", "named", "text"])
def test_every_field_forgery_rejected_even_recomputed_caller_digest(f, variant):
s, r = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
if variant == "text":
r["fixed_version_document"]["fields"][BLOCK["fields"].index(f)]["limits"] = "forged"
else:
p = f["pointer"] if variant == "saved" else f["named_pointer"]
base, _, k = p.rpartition("/")
parent = pointer(s, base)
parent[int(k) if isinstance(parent, list) else k] = None
refuse(s, r)
@pytest.mark.parametrize("pair", NODES, ids=lambda pair: pair[0])
@pytest.mark.parametrize("variant", ["mode", "identity"])
def test_all_root_and_definition_nodes_bound(pair, variant):
s, r = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
n = pointer(s, pair[0])
if variant == "mode":
n["mode"] = 4
else:
n["properties"]["ver"] = "forged"
refuse(s, r)
@pytest.mark.parametrize("pair", EDGES, ids=lambda pair: pair[0])
def test_every_physical_and_boundary_edge_record_bound(pair):
s, r = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
e = pointer(s, pair[0])
if isinstance(e, list):
e[3] = 99999
else:
e["target_id"] = 99999
refuse(s, r)
@pytest.mark.parametrize("b", BLOCK["boundaries"])
@pytest.mark.parametrize("variant", ["host", "definition", "target"])
def test_all_13_host_child_boundary_endpoints_bound(b, variant):
s, r = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
p = b[variant + "_pointer"]
port = pointer(s, p)
if variant == "definition":
port["linkIds"] = []
elif variant == "host":
port["name"] = "forged"
else:
port["link"] = 99999
refuse(s, r)
@pytest.mark.parametrize(
"variant",
[
"note",
"named_note",
"missing_to_empty",
"comparer_empty_to_object",
"save_output",
"seed_control",
"unet_case",
"vae_name",
"preview",
"guhai",
"ue",
"frontend",
"citation",
"source_sha",
"path",
"overview",
"layout",
"proxy",
],
)
def test_special_shapes_missing_identity_note_and_binding_fail_closed(variant):
s, r = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
ns = {n["id"]: n for n in s["nodes"]}
sub = s["definitions"]["subgraphs"][0]
inner = {n["id"]: n for n in sub["nodes"]}
block = r["fixed_version_document"]
if variant == "note":
ns[72]["widgets_values"][0] = "forged"
elif variant == "named_note":
ns[72]["widgets_values_named"]["text"] = "forged"
elif variant == "missing_to_empty":
inner[58]["widgets_values"] = []
elif variant == "comparer_empty_to_object":
ns[73]["widgets_values"] = [{}]
elif variant == "save_output":
ns[9]["outputs"] = []
elif variant == "seed_control":
ns[66]["widgets_values"].insert(2, "fixed")
elif variant == "unet_case":
ns[66]["widgets_values"][7] = inner[52]["widgets_values"][0]
elif variant == "vae_name":
ns[66]["widgets_values"][8] = inner[51]["widgets_values"][0]
elif variant == "preview":
ns[66]["properties"]["previewExposures"][0]["sourceNodeId"] = "9"
elif variant == "guhai":
ns[1]["properties"]["guhaiImageValue"] = "forged"
elif variant == "ue":
ns[66]["properties"]["ue_properties"]["version"] = "7.7"
elif variant == "frontend":
s["extra"]["frontendVersion"] = "1.39.19"
elif variant == "citation":
block["sources"][0]["commit"] = "0" * 40
elif variant == "source_sha":
block["source_sha1"] = "0" * 40
elif variant == "path":
block["source_path"] = "forged"
elif variant == "overview":
block["user_overview"] = "forged"
elif variant == "layout":
ns[66]["pos"][0] += 1
elif variant == "proxy":
ns[66]["properties"]["proxyWidgets"] = [["54", "seed"]]
refuse(s, r)
def test_independent_inventory_and_semantics():
assert len(SOURCE["nodes"]) == 5 and len(SOURCE["links"]) == 5
assert len(SUB["nodes"]) == 10 and len(SUB["links"]) == 28
assert all(n["mode"] == 0 for _, n in NODES)
actual = {
f"{prefix}/nodes/{i}/widgets_values/{k}"
for prefix, g in SCOPES
for i, n in enumerate(g["nodes"])
if n["type"] != "MarkdownNote"
for k in range(len(n.get("widgets_values", [])))
}
assert actual == {f["pointer"] for f in BLOCK["fields"]} and len(actual) == 37
assert len([f for f in BLOCK["fields"] if f["scope"] == "root"]) == 15
assert sum(isinstance(f["value"], list) for f in BLOCK["fields"]) == 1
assert [n["id"] for _, n in NODES if "widgets_values" not in n] == [50, 58, 61]
assert len(BLOCK["boundaries"]) == 13 and SUB["widgets"] == []
for b in BLOCK["boundaries"]:
assert (
pointer(SOURCE, b["host_pointer"])["name"]
== pointer(SOURCE, b["definition_pointer"])["name"]
== b["name"]
)
assert pointer(SOURCE, b["target_pointer"])["link"] == b["edge"]["id"]
for prefix, g in SCOPES:
nodes = {n["id"]: n for n in g["nodes"]}
for e in g["links"]:
edge, src, slot, dst, inp, _ = (
e
if isinstance(e, list)
else (
e["id"],
e["origin_id"],
e["origin_slot"],
e["target_id"],
e["target_slot"],
e["type"],
)
)
if src >= 0:
assert edge in nodes[src]["outputs"][slot]["links"]
else:
assert edge in g["inputs"][slot]["linkIds"]
if dst >= 0:
assert nodes[dst]["inputs"][inp]["link"] == edge
else:
assert edge in g["outputs"][inp]["linkIds"]
assert doc()["fixed_version"]["matched"] and len(doc()["source_notes"]) == 1
assert BLOCK["comments"][0]["text"] == SOURCE["nodes"][0]["widgets_values"][0]
assert doc()["dependencies"]["check_state"] == "unchecked" and doc()["status"] == dict(
imported=True, doc_done=False, exec_verified=False
)
text = " ".join(BLOCK["flow"])
for word in [
"13宿主输入",
"SaveImage有IMAGE出口",
"无显式result",
"不借新版本",
"seedvr2_ema_vae_fp16",
"fixed",
"guhaiImageValue",
"previewExposures",
"4096",
"未实跑",
]:
assert word in text
method = next(f for f in BLOCK["fields"] if f["field"] == "scale_method")
assert method["value"] == "lanczos" and method["schema_default"] == "area"
assert review_for(PATH, "0" * 40) is None
def test_old_thirty_review_objects_exactly_preserved():
resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
old = json.loads(subprocess.check_output(["git", "show", "1d04c00:" + resource], cwd=REPO))
now = json.loads((REPO / resource).read_bytes())
now[PATH].pop("fixed_version_document")
assert now == old and len(DEFINITIONS) == 31
blocks = [r["fixed_version_document"] for r in old.values() if "fixed_version_document" in r]
assert (
len(blocks) == 30
and sum(len(b["fields"]) for b in blocks) == 904
and sum(
len(
build_document(p, json.loads((REPO / p).read_bytes()), None, None, [], r)[
"source_notes"
]
)
for p, r in old.items()
if "fixed_version_document" in r
)
== 21
)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,24 @@
{
"total": 155,
"audit_scope": "current_delivery",
"source_files": 156,
"target_files": 155,
"user_excluded": 1,
"source_structure_purpose_partially_reviewed": 155,
"full_documents_completed": 0,
"files_with_selected_named_fields_reviewed": 41,
"selected_named_fields_reviewed": 1217,
"real_executions": 0,
"states": {
"pending_check": 16,
"needs_conversion": 139
},
"named_values_preserved": 1217,
"unnamed_widget_nodes": 3660,
"semantic_batch_files": 139,
"semantic_batch_without_named_fields": 114,
"semantic_batch_named_fields": 490,
"named_values_without_manual_field_review": 0,
"named_values_without_verified_units_ranges_effects": 1217,
"scope_limit": "人工结论与机械原值清单分开;源语义局部审校非完整说明定稿"
}
@@ -0,0 +1 @@
authored diff check exit=0; upstream/raw logs preserved byte-for-byte
@@ -0,0 +1,11 @@
........................................................................ [ 25%]
........................................................................ [ 50%]
........................................................................ [ 76%]
................................................................... [100%]
=============================== warnings summary ===============================
calliope-backend/.venv/lib/python3.11/site-packages/starlette/testclient.py:53
/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-892-d1175e415253/workdir/aigc-home/calliope-backend/.venv/lib/python3.11/site-packages/starlette/testclient.py:53: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
283 passed, 1 warning in 4.96s
@@ -0,0 +1,67 @@
........................................................................ [ 25%]
........................................................................ [ 50%]
........................................................................ [ 76%]
....................................................FF............. [100%]
=================================== FAILURES ===================================
___________________ test_independent_inventory_and_semantics ___________________
def test_independent_inventory_and_semantics():
assert len(SOURCE['nodes'])==5 and len(SOURCE['links'])==5
assert len(SUB['nodes'])==10 and len(SUB['links'])==28
assert all(n['mode']==0 for _,n in NODES)
actual={f'{prefix}/nodes/{i}/widgets_values/{k}' for prefix,g in SCOPES for i,n in enumerate(g['nodes']) if n['type']!='MarkdownNote' for k in range(len(n.get('widgets_values',[])))}
assert actual=={f['pointer'] for f in BLOCK['fields']} and len(actual)==37
assert len([f for f in BLOCK['fields'] if f['scope']=='root'])==15
assert sum(isinstance(f['value'],list) for f in BLOCK['fields'])==1
assert [n['id'] for _,n in NODES if 'widgets_values' not in n]==[50,58,61]
assert len(BLOCK['boundaries'])==13 and SUB['widgets']==[]
for b in BLOCK['boundaries']:
assert pointer(SOURCE,b['host_pointer'])['name']==pointer(SOURCE,b['definition_pointer'])['name']==b['name']
assert pointer(SOURCE,b['target_pointer'])['link']==b['edge']['id']
for prefix,g in SCOPES:
nodes={n['id']:n for n in g['nodes']}
for e in g['links']:
edge,src,slot,dst,inp,_=e if isinstance(e,list) else (e['id'],e['origin_id'],e['origin_slot'],e['target_id'],e['target_slot'],e['type'])
if src>=0: assert edge in nodes[src]['outputs'][slot]['links']
else: assert edge in g['inputs'][slot]['linkIds']
if dst>=0: assert nodes[dst]['inputs'][inp]['link']==edge
else: assert edge in g['outputs'][inp]['linkIds']
assert doc()['fixed_version']['matched'] and len(doc()['source_notes'])==1
assert BLOCK['comments'][0]['text']==SOURCE['nodes'][0]['widgets_values'][0]
assert doc()['dependencies']['check_state']=='unchecked' and doc()['status']==dict(imported=True,doc_done=False,exec_verified=False)
text=' '.join(BLOCK['flow'])
for word in ['13宿主输入','SaveImage有IMAGE出口','未显式result','不借新版本','seedvr2_ema_vae_fp16','fixed','guhaiImageValue','previewExposures','4096','未实跑']:
> assert word in text
E assert '未显式result' in '这张图读取一张图片及遮罩,送入子图做缩放、编码、采样和解码,再保存并比较处理结果。保存倍率4、lanczos插值;比较A来自子图,B来自保存节点,不能当成原图与放大图对比。准确core支持SaveImage图像出口,但三类SeedVR... 12, "target_id": 48, "target_slot": 4, "type": "INT"}, "target_pointer": "/definitions/subgraphs/0/nodes/9/inputs/4"}'
calliope-backend/tests/test_seedvr2_fixed_document.py:134: AssertionError
_______________ test_old_thirty_review_objects_exactly_preserved _______________
def test_old_thirty_review_objects_exactly_preserved():
resource='calliope-backend/src/calliope/comfyui/source_reviews.json'
old=json.loads(subprocess.check_output(['git','show','1d04c00:'+resource],cwd=REPO)); now=json.loads((REPO/resource).read_bytes()); now[PATH].pop('fixed_version_document')
assert now==old and len(DEFINITIONS)==31
blocks=[r['fixed_version_document'] for r in old.values() if 'fixed_version_document' in r]
> assert len(blocks)==30 and sum(len(b['fields']) for b in blocks)==904 and sum(len(b['comments']) for b in blocks)==21
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
calliope-backend/tests/test_seedvr2_fixed_document.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <list_iterator object at 0x7fa1480ef910>
> assert len(blocks)==30 and sum(len(b['fields']) for b in blocks)==904 and sum(len(b['comments']) for b in blocks)==21
^^^^^^^^^^^^^
E KeyError: 'comments'
calliope-backend/tests/test_seedvr2_fixed_document.py:142: KeyError
=============================== warnings summary ===============================
calliope-backend/.venv/lib/python3.11/site-packages/starlette/testclient.py:53
/home/xiaomo/multica_workspaces/hello-af23464d222e/hel-892-d1175e415253/workdir/aigc-home/calliope-backend/.venv/lib/python3.11/site-packages/starlette/testclient.py:53: DeprecationWarning: The anyio.abc.BlockingPortal alias is deprecated, use anyio.from_thread.BlockingPortal instead.
_PortalFactoryType = Callable[[], AbstractContextManager[anyio.abc.BlockingPortal]]
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED calliope-backend/tests/test_seedvr2_fixed_document.py::test_independent_inventory_and_semantics
FAILED calliope-backend/tests/test_seedvr2_fixed_document.py::test_old_thirty_review_objects_exactly_preserved
2 failed, 281 passed, 1 warning in 4.82s
@@ -0,0 +1,728 @@
{
"base": "1d04c00c0cc75df1d782b39ca7b70bb37362517b",
"files": [
{
"path": "example_ComfyUI_workflows/minimax_h3-Turbo_Text2Video_20260813_API.json",
"sha256": "55c6d0e7fb323e05c3d9373606607e0e8fefb3127cac356b03e29f19b7aaa4ed"
},
{
"path": "example_ComfyUI_workflows/Krea2_t2i_20260818_API.json",
"sha256": "dcf5fad9b464e4154d8ec7ba7af1c21987cb0153c7df747266a02de9f24e1313"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_2ref_API.json",
"sha256": "56ab7cbf2402f94000eb1df2b5415f90f36a2821e68f1c35af17a2d9498e7c49"
},
{
"path": "example_ComfyUI_workflows/MiniMax-H3-Turbo-R2V-Extend-2Refs1Vid_API.json",
"sha256": "080a17d7ae079f278518de1af15b880a4404105ec89edbac4fd82cf16097b757"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_4ref_API.json",
"sha256": "0b00bfc29ad48f8af3c7b6ebc1dcaa03b809b33c24bc31dadc628289480b154a"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_API.json",
"sha256": "29f440f7123b9ce64e0fda01ee3cdafb7f87408c47c1fe46c2b73f88682eae0c"
},
{
"path": "example_ComfyUI_workflows/krea2_T2I_CharSheetV1_API.json",
"sha256": "6a991229721d0a501846bf0bc55f793d1ab5225be28b2c9eea485fed56ed5b40"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_5ref_API.json",
"sha256": "0b6c1bee6507c2485aa115d3b6c038c6c3dabf1ce8569205f8ece50e58f4e909"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_3ref_API.json",
"sha256": "2a687133f175180584ebfc3b4318f29cfcac3a24a0f422e1b9c77e6b16c9862a"
},
{
"path": "example_ComfyUI_workflows/minimax_h3-Turbo_Image2Video_20260813_API.json",
"sha256": "3d895b01e72c10008c036a9c65fa281b3dfe0d0808417089960fd8f4b56c48ce"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-ASR-语音转文字.json",
"sha256": "958a3b7cb7070f4207901c79f13863b44ffcd0ed5c2c7fb4cd779e7964da0d65"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-TTS_语音设计+语音克隆.json",
"sha256": "9c75272e418064f46da96f6167448216a9390566e4b5d5e168d8cc5955447ab1"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/index-TTS2-情绪控制-音频参考-文本控制-克隆-多人对话.json",
"sha256": "d2c469a8a17c6d1fcffb9a96700c38290895873d99c40d13d669bd45f6ea79de"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-TTS_多角色对话.json",
"sha256": "549a6502b3e0d4386323e6e67d6a9b4943b7a01eb59bdbe7adc7a920cfe5b690"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-ASR-Subtitle语音转字幕.json",
"sha256": "47f9afa955a6a5dce37000cb6a15bac7516d26ff50b6398bda334c825552cfd8"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/肖像大师_美女提示词生成.json",
"sha256": "4ff20f7350813ec74fc054971b4532200d61661951c103c89f7729f89f7be2ff"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan_Animate2_动作迁移_for循环长视频.json",
"sha256": "22b7853e22629822dd354b0b768e2961a53b4c2f480cfaceeaea9dc51c0f0d0b"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.1_Scail-2_动作迁移_WanAnimatePlus_v4.2.json",
"sha256": "f0da1e6c1eab5706d29d8d12897db0cea0d9d5f7a73b4882cf07ef2a626dda45"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.2_Animate_SAM3-人物迁移-动作迁移-长视频循环(KJ流).json",
"sha256": "3ea95e56f193c046937ad246087292865a809d2cc26571357c22fff415295f41"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.1_SCAIL2_角色迁移_动作迁移_FOR循环长视频.json",
"sha256": "60d7a6c9b1b567d726ffd0981de3d8afb3675f88b320733d8442081d849b0ba8"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.1_Scail-2_角色迁移_WanAnimatePlus_v4.2.json",
"sha256": "395dc48ad21d9da6a3a815654922193a9893696015154f53be0cc6f484882637"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.2_Animate_人物遮罩替换(官流整理).json",
"sha256": "394c3c31ad05255d3eb130f309d8445764f4d3772b40fa07fbf19708bfcc1002"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_I2V_InfiniteTalk_提示词调度动作控制图生视频数字人(KJ版).json",
"sha256": "98b4c399948f99aeac9326b4de9638d9a7bc3d718edd2561ab745f6bec12478c"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_infinitetalk_音频驱动视频配音-单人for循环长视频(官流).json",
"sha256": "ebd0c2823b70e5121f9642f781f2d0fa32cda6abe7d4a68fb0eecacc30e92d06"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_I2V_InfiniteTalk_rCM_数字人对口型多动态(KJ版).json",
"sha256": "90fb512939d5bbaebfd3462d8edd019ad388611951748e6df09993ddd7f3a36f"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_infinitetalk_音频驱动视频配音-双人for循环长视频(官流).json",
"sha256": "87412366e6bedd2a2f4490d1a945d0fc005251bb49a20e4ba1157cd6c4ddfbcd"
},
{
"path": "example_ComfyUI_workflows/2-音乐生成/minimax_music_文生音乐.json",
"sha256": "0a655ead5a0da406159dceb46451439df0c02050becaaa25b3018abb41840284"
},
{
"path": "example_ComfyUI_workflows/2-音乐生成/ace_step_1.5+Qwen3.5_自动歌词音乐生成.json",
"sha256": "518085b1e8d12257e68427dcc0f01e6cda5018ec353fd90fdf366afb4fc89b85"
},
{
"path": "example_ComfyUI_workflows/2-音乐生成/ace_step1_5_xl_turbo_8Step极速音乐生成.json",
"sha256": "668fae23de5f84cc530fa4cab7381299cbc787b30c4597345b47e7f5c17415ef"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/sam3_图像视频-提示词遮罩分割.json",
"sha256": "5dbe1a7ab608ba6e9158369ff6498e9bb3f926d151a0ed31cf711c31b167c488"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/双图像或视频合并显示.json",
"sha256": "61a0b1a2aa17a7d8c4f09f4f57e276eaf37227f69b5fc5789193005e593548c9"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像分割-多宫格分割.json",
"sha256": "aeceb3fd00eb0966eebf8d8c89d90e2ad29d0aa8d02589aa05d52a6c145a4bcc"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/Minimax-H3提示词增强.json",
"sha256": "ffea53b27d52c63aa9ec9c60144489cc4f9e5a44d9478bcc297be9d9008f1a4c"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频转gif动图图片.json",
"sha256": "39f7ddf60bf5958882215bd4227a85707f1f9003f2c5aaefc709a28b1ef16827"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/加载本地latent解码.json",
"sha256": "1fd83bd3f2d7950440189932b4c17718190af88daa4a93ac86474081dea9005b"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像4种添加水印节点.json",
"sha256": "2eecd407d667d2ef6249061181edfdcfc417a2151627622f280d74aaac1794d8"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/手动按分镜视频截取.json",
"sha256": "381bb5f3a6e2788d0dd3ee9594a97eaedb153611194d4f8fdde420cf47814132"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像合并成四宫格.json",
"sha256": "fb5e5b346d51a79c19e611b76d39cf4b9491493723684bbb85ab3c49923467bb"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/多视频合成分屏展示.json",
"sha256": "3c2f6558c199a7689546dc881df2b26dc31c02715fbc7b32f51caaa4601c13d7"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/ControlNet_aux_常用样例.json",
"sha256": "8898689d777330c4749a079cd762f573bb12a278c47a2fefbd066ffbdc122b6b"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/birefnet_图像移除背景.json",
"sha256": "a6799c5022c13e46d2b1cf27809cd3c1e1d140a605fa226c19359682751fd036"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/截取视频每一帧.json",
"sha256": "43858b9121439a92e7ab35c2fb62b78e56fa93bcd0ad62679f2387f71fdec1fa"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/音频人声分离.json",
"sha256": "3c4bc0f7b1891e298a5d4e00072c6243a61b98d5fc0d86d82a476ecead43a1a2"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像嵌入文字描述.json",
"sha256": "938ad9ad0eed2253e9a5a9a9dc16dc6b0a22bf976a80af90aa1d0b56e42ba7d3"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频-音频分离.json",
"sha256": "4861e3e33291ed962d2215b1d8cc976a4706d19719e3541e9cbb2c636683afc3"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频倒放.json",
"sha256": "8c760ea58d7ff664323f92a1174fe88300cd931c00201ccf437df1ad0067cb24"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/音频转MP3格式.json",
"sha256": "c46e83b4fe8fc291e9de45b4af6cc50b566ab9377a51b50767315917dd13861b"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/加载图片合成视频.json",
"sha256": "f5245d225f77cd64aefe6d0b8bb9342ec48a8a6293a533d65ea7304ce1b03f93"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_孤海智能一体化(多合一简化版).json",
"sha256": "827f43d5d9bdb6f2d6f4d8b69e86708e6d08642ed0df04bee15087d10b9a0e35"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_双采样多段循环-PV动画尾帧衔接.json",
"sha256": "c8a442bd8cae8dcd75a6a01847ca99b75dcc37ef8ff0a855c82213ed25e943e0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_短剧创作-多宫格分镜参考.json",
"sha256": "d2850f5fb3e5b54e3e4ec9e17f34bdb11bf7009728b5e585c769fb2f11f80275"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频人物替换.json",
"sha256": "dce57cfc239c9f90cda2107fff5614b2cb0944e0441d9d8137b3f1c325f41a7a"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_音频MV_多参长视频分段_Selflift双采潜放大_Qwen3.8官方Skills自动提示词.json",
"sha256": "bdc93d36fb8a4728dfa8031d1f00782d68e8e6aedd718b166f57e54216f2882f"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双时钟采样_图生视频-8步高质量极速版.json",
"sha256": "97f188c9295af0dbe6358a4b23117ca1612e812d2fa3df67dd7b10ee68e96fb5"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台MiniMaxH3_多合一多分段拼接.json",
"sha256": "34fde3a91f9ef932adc2837cc9d4254bf75a3251ad5c6474d90e4085690cbafc"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_FastH3_t2v_文生图8步极速.json",
"sha256": "ed4a30da03245f35ff9006ac64cd045c1b9c64eb8b585520dbbb418f6793fc78"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_r2v_参考生视频_双采样潜空间放大+Qwen3.8官方Skills自动提示词.json",
"sha256": "4c1305fdfe6d5643e64a7b6c99cc92e331ffc9475f30fef5e0119c887367aab0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_文-图-参考-分段循环-双采放大_多合一.json",
"sha256": "698430e2b234a107b15f1bebf7704833afeea819bd21a3af56f7121daa1383e0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频参考+多参图.json",
"sha256": "40f92a22aa66c9d87b876784e33b02471339d64504e22e1672155608fbcbf079"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/minimax_h3_i2v_图生视频.json",
"sha256": "a071e6070ee933396f225b4447c363bbf6b0df059b3cd43da567e81bc7937e84"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_文_图_首尾_参考多合一(单采样).json",
"sha256": "526986a02875bbefebeb8a81cce9b58a8e764ab0c0092b2d8e858ecfac771638"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_短剧创作-音频参考.json",
"sha256": "c188a7383a6c7a0dbd5d4d0717527b096ec73c1232373ee50c731bceefcfe7fb"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/minimax_h3_t2v_文生视频.json",
"sha256": "039d46a5bbb809b84fab3b42c777118f91d0c06835555d54410631742584f1be"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_FastH3_i2v_图生视频8步极速.json",
"sha256": "c5eff277eeeeefacb39c4af2e5ac41251785cc18ca90c1678a653367f4dd5942"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双时钟采样_文生音视频-8步高质量极速版.json",
"sha256": "5b45b49ebe4402c207e7d894e03a1bb53482b24a0c09ce50d549be4a01f9c6d0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双采样_潜空间放大_参考生视频.json",
"sha256": "fab48be409cf423aaed7be268c6655ae39ecd1733218413c51874c5ba2ad0bdf"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_双采样潜空间放大.json",
"sha256": "2434bd48e3c29abf9e6ed0931f3c8825481772a134a065f6cfdd3c0b89ba81b7"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台时间线素材_双采样潜空间放大_多分段拼接.json",
"sha256": "172eb8af3aca70082941427520fdcca06568957bab3d39101c5e9d6641b45e4a"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_视频动作参考_SelfLift双采样潜放大_Qwen3.8官方Skills自动提示词.json",
"sha256": "2be3981360fff849a53a928a6a2040c97bcf1944dce2df82d716a805c0ef2594"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_多参考_双采样潜空间放大.json",
"sha256": "8b97388e142ddb67c84f2cbe0bb68c10f519e7615d75f1ea0005580fe4537ab2"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/minimax_h3_r2v_多参生视频.json",
"sha256": "89166eb9cce4c9177a0f9a0a3a058e140429413e7beb3692e7ee5c30b76bc4fb"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_音频数字人_单采样.json",
"sha256": "77b665bf6bcd11195f424d42d88f5142b43b0c608af776eef5744aca896f4b56"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频参考+多参图-SelfLift双采样潜放大.json",
"sha256": "97ec7f73f32126aa24798fc65736734dfa839b74d25c4b2a94021abe063f06d7"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_音频数字人_SelfLift双采样潜放大分块_Qwen3.8官方Skills自动提示词.json",
"sha256": "903e32248fc0c53df36c5841f4f4ccdb5fb8190a39c6c9015d3e55a451aaf7eb"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双时钟采样_参考生视频-8步高质量极速版.json",
"sha256": "fae96106a128342a6903bd32680463d1be98c0d5ad738d2fff40fc0f52a35389"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/uncensored/minimax-h3多参生视频无审核版.json",
"sha256": "e501089f36c4c7f76a9e926e09ab9c467316d0778e62dff4c9e9faa6b155cb83"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/uncensored/minimax-h3首尾帧生视频无审核版.json",
"sha256": "d47d3e995858a9c581863a593d89d4f6a24ea04014a1df3faeffa7e07cb19537"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/uncensored/minimax-h3文生视频无审核版.json",
"sha256": "07baed6dd4a259701f7e5563fa1f19799fbbb558668d09a74876db3729fff3a2"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Anima/Anima_Klein放大_超强动漫模型.json",
"sha256": "000843bc0e46844e556b04fc820ae1b2f7fa9bba1dd0ec21805c0c7ab27a647c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_赛博朋克现实风格.json",
"sha256": "a353acdb89b02462abed5f1513acfcb4f538c50ab5bc8ede8e8597f3ce8eea60"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图.json",
"sha256": "6b317af2bda225d9441074ef330669b4537e95c705987223efafd2705dbbc344"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_细节增强.json",
"sha256": "faa28f85fbd80ec9c3aba76749d6447c1d3b4a8489c88853ebde665a4f78ef10"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_2万提示词随机模板+4千种风格选择.json",
"sha256": "599bb58d48d68de929e7ec476f77e9f7c736c00235b68570416d214d3b4e391c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2-Edit-Anything2Real_动漫转真人v3.json",
"sha256": "0d482e6c6fac70af6dd5549e8a464ee080a0ec135350d72d32a4ce4a8fd05bbe"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_图像风格参考.json",
"sha256": "8c248ccc44df79b475c81e0bb260596ece066d65f2a21c0b2a72dc6b2441b170"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_Qwen3.5自动提示词生成.json",
"sha256": "afafb0e0ebdc445a7534041589b7f6a580e0b15b8293c2fd26907474892f5957"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_动漫风格2.5D半写实.json",
"sha256": "3faf9b1f0a20c7d21367af1721583a7402f048e18991025f9afff192ff8fe077"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图 (N版).json",
"sha256": "935fc592ead1a89614470d41c512e2d7b4a41a6887f71a0a8d8f4c071a60e3c9"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_动漫风格线条动漫.json",
"sha256": "9bab028943604b4b167a56dcc51475f67bac897c9eae3c7bf9d311b2c5cb7d91"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_美学质量增强.json",
"sha256": "fbca5f24abf71f10ed5e2b90012aab1c25c6632a18541fbf0412b8845f603b85"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_identity_edit_图像编辑.json",
"sha256": "c208883f17eb873063a4febaef636f0fa065131fc82bc4b0b26eff41f442719a"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_极致写实(N版).json",
"sha256": "ec98804940c28956af1719096751bba2d274eef8a251b97207ac655a05779384"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_动漫风格Image2风格.json",
"sha256": "bf65d0080ab80a5934855a0dbc7a5e167300bb54e24a18e05e4321a70ec838ea"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_奇幻现实风格.json",
"sha256": "7a2af26c48114c7f1a7741a5cded07c0cceb68c4e69410de8af6429eb6b5041c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/Krea2_turbo_文生图_角色三视图双采样2k版.json",
"sha256": "64bb5eb4e5399d307c12553717b8a1f0046f48b625b16e62d40e962b6bec1847"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/Krea2_turbo_文生图_4_6_8宫格故事板.json",
"sha256": "776b2f92f8906232c2ffe1b25c8b9cfe3398bfe45a9f80715f6ce5acc03e96b4"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/Krea2_turbo_文生图_极致写实双采样2k版(N版).json",
"sha256": "50433cee0d5bab60a2cce44d73adbe5fe9b486c039bc89e1caef640fe6e0b28d"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/7_Z-image+Controlnet_图像扩展.json",
"sha256": "82cda5dca2e224a5b042daecba4c3c1405a825648a9e9ced29fe21e58f7e55f8"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/9_Z-Image+Flux2-Klein_风格重新编辑.json",
"sha256": "3734f261691c3ad13d29b30d88e91f671d9c548f723e77d78651c7155b06c408"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/8_Z-image+Controlnet_姿势控制-洗图.json",
"sha256": "babc1dbeb3bb4981e338d8317ff9fb6fd8c28913bf47a2e2e3eb5409439447bf"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/6_Z-image_局部重绘.json",
"sha256": "f60e734b6ed9e678571ad7666411d6282065c38abe3e9c29ea4c5cc1c3455505"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/5_Z-Image+Qwen3.5提示词反推_文生图.json",
"sha256": "910317a123e658f26e48ad5cd144d28b7f31e0d43cbdb3ed567048c7917b5c73"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/10_Z_Image双采样+Fluax2-klein修复-高清直出.json",
"sha256": "043cd2abe731996b80637d87b9a799e412e08b9a15e4b7c2f4440fbcff2487b9"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_通用b.json",
"sha256": "8d9e66744e0266c5f53a6396e030c38bb90053f2525ac9c3c6cc1b321006a976"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/11_Z_Image_Turbo+模型放大_图像4K高清放大.json",
"sha256": "baaa0cd969a28abe5e6ab19b3d7f6e161468cd15c970fe4bd9922afbe09ab4da"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/12_Z_Image_Tubro_文生图_SeedVR2高清放大8K.json",
"sha256": "8d79bcd44a7843ac5df9fbcd372a6327ba72274260ef463c46ec85709da7846a"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/1_Z-Image-Tubro_文生图.json",
"sha256": "36713b1a3f5c4f2992c7edef2e1e8c3246d44d28ecc750b87f4353a08c3b5ab0"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_照片摄影.json",
"sha256": "740d7d41b3248978dca2046d9a2ea99d3a66ef081d45609782d2847f04f7e0c8"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_通用a_.json",
"sha256": "e58341a99587077a69baf3cec62d9ae7bb0ce02a87cb3973ce3134c04a119b23"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/2_Z-Image+Base+Turbo+双重采样工作流.json",
"sha256": "27108ae85715b147f63d8640ee032484c70a21633e2c6234eed346079b9aba2c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/4_Z-Image+Qwen3.5-文生图.json",
"sha256": "56bd28b5253fe734e851abd81c7851d00c62e4dbf37a22d97781d93ec367a35d"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_插图漫画.json",
"sha256": "02ea31b959de72f9b5c00a92f21b4e17bbc2bf5a54495093a204957771a88039"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/3_Z-Image_文生图(摇光梦幻).app.json",
"sha256": "58e88cacc6e1375cad39023e39eb1728eb36e63acce3c46fca40898d706b1d42"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_提示词增强.json",
"sha256": "ebf173eb9d871717534a379d451d4a08ca06c3b677b552de12a5d51dbe8febf2"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生图_角色表四视图.json",
"sha256": "6fd307b02b7ba29858723e283580c1cf4ab1fce8804a3ced1f4fc37934965392"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_角色BFS头部迁移.json",
"sha256": "6a9da127ee2bccafeff7499ab3d62f349aec1eff4265cb211bdec578dba1fe7b"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生_多图编辑_8步lora加速.json",
"sha256": "172b8fff0b531fbea367e79aa6b5ed1e6b59cab2ce6cb23d324092d5b55a3f97"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_角色表四视图.json",
"sha256": "0036c02e1ab22f44c94bd9f311d5254d7b3b0cea25211bc4ff1e92cd90e0acdf"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_深度-姿势-线稿-硬边缘-控图洗图.json",
"sha256": "b6e232082089dd9c4046e0dc5bd1d046907525b8cb01758fb804b5f4aa11275e"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_动漫转真人.json",
"sha256": "1aa1d3641f82533f99d99567c2708919438b9efbfc6623d684a9a88b876b75cd"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生_多图编辑_透明背景.json",
"sha256": "5853f21657d56e97a6b625c4487e23473b846fa8c96dc292f3700b3075245a39"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生图_提示词增强.json",
"sha256": "dfe10917d101bf1a8a8c20750f4360690ecd478e9eb33d16a59ea0c6f12c086c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_背景移除.json",
"sha256": "d225102993ad5aa08e619bd7f1e5abbfd54e2d5ac8d8be1eacf09722107c4c9e"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_Image2.1_图像编辑_VNCCS任意角度-任意姿势.json",
"sha256": "a5a675500a473214eaeb1d25dc1eda83b57bba3a17d18f1f0042bee62b474314"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_一键16张姿势图.json",
"sha256": "248b6c5ae28d5a44035c5ad91bcdfa458360a67598eaa4d195c3fb6853b18a49"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生_多图编辑_提示词增强(N版).json",
"sha256": "ae6521e5f42bef0b887f754c2fec5961d612afc464fbd98940a976a9795662c6"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/5_flux2_klein_图生图_扩图.json",
"sha256": "ad8c09e81b07aa7809a7d42f633d0b9069f704187e7a983bc2ac12bc3cbb8507"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/10_flux2_klein_文生图-角色三视图.json",
"sha256": "e04e5bd04f03ce32b5221d37c5f7cffb0405b1471cb7be90b47b407d900a49b7"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_图生图_人物迁移.json",
"sha256": "81409bdcd546102a7a6d5b7e32578912bf7ad4f89b35718de0401ceed624225e"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/4_flux2_klein_图生图_局部重绘.json",
"sha256": "d1d57bd401959975cbe6fd70f97706cec21bbed0a5ec3747447b9f192631f414"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/1_flux2_klein_文生图.json",
"sha256": "523905ac41323c626d7a156c88d02156cfa4758a70175cd7a3fba2a8c4fd449b"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein-图生图_人物动作迁移.json",
"sha256": "fc6daf483ac05fdc904ca402271223d14cc217ea4c81a17ba2ef4cae993aefe7"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/3_flux2_klein_图生图一致性增强(大雄lora).json",
"sha256": "c6af28d5bd72df5577f1e4d336974397494dd500fff23efd4afe81037514be71"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/6_flux2-klein+Qwen3.5_转线稿洗图.json",
"sha256": "40a9fee073066914ac610f74dc7f7a49022bda63f5b89560d4bd635094a5c757"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/8_flux2_klein_双图编辑.json",
"sha256": "9d00eb7af7e8d49c54396e6dc2afe7770f99cf75ae765dc1b906c8c9e6b69d83"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_图生图_印花提取.json",
"sha256": "8768dec340e35dbd70f928d8bbc34813b2bd45f5c270c405d4495b92da478337"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/2_flux2_klein_图生图.json",
"sha256": "c0472959097f4e785205f41109c941dab26d12a874311834a7dc02c4616bbe9b"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_服装迁移.json",
"sha256": "e3f01ba44f3628297e714b4307ed959758f04e0415093dc5ec690857384a8386"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_图生图_老照片修复.json",
"sha256": "922c534d70b85beacc2cd51354552ed1d850dbb611b20f2d6981c4e524ce06c5"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/7_flux2_klein_图生图-动漫转真人.json",
"sha256": "8cab62c6b7b2401bb6b51ff4426aaad2a644fc6cfe49d974769fadf19c16a0a1"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/3_flux2_klein_图生图一致性增强(小志lora).json",
"sha256": "43995837f89e5112afa74a57180dc356f7b4d4ef9e3a325984a2fc5ca1b7c651"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/深度图/moge3_深度图_几何图_线稿图.json",
"sha256": "a50e8b9961fbdd83fa42ca121ff77b3c1b058c7e454ad374b0de7c60e7b8c4a9"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/人物骨骼姿势提取/sdpose_视频人物姿势骨架提取.json",
"sha256": "4586c72d8a906d4a956fb7d62307b81e57e4e345324c7e73f63103e56bfffd14"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/人物骨骼姿势提取/NLF_视频人物动作骨架获取.json",
"sha256": "1edc7ae5cca8e059577a9572d296c84e1683695e4f13a72388ff70473795ce97"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/人物骨骼姿势提取/openpose-video-姿态检测.json",
"sha256": "43f76f599f15058b6e62ae0dfb105518a37532008eed23ef7118e4950b37a608"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/Llama-cpp+Qwen3.5-提示词.json",
"sha256": "9071928ce74d5133401942583603a6bc98873263fbe4c32a438fe73cee81ce90"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"sha256": "1a94bdd5987955a29e403d128c2ea5ca0b6bc8a8d5ece145e1baba07146588b0"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/VOSR2_图像超分放大.json",
"sha256": "87484f700a9a18d1bffbc61834af2b489a58171dcb4a225e210e695a30c85dd5"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/RTX_video_upscale.json",
"sha256": "ce189e5efdb1d608eaf7f7905f0dbf3776be2c199e143193c226ab497f2eb9ec"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"sha256": "2be6b137efaaf25a54aaedc841a14ff3089afdc8a01a04af6353634b8457393f"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/VOSR2_视频放大_分批循环长视频.json",
"sha256": "0f55316d2961a293a7d9f77b7993fd6f01bd5a41a4dca58f69f4d0b35c0aa6ea"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_视频放大FOR循环长视频.json",
"sha256": "576a9516292ed3e63b50c2a03fbfc1a99f9d643f526dc7fa3b98f6cb9832c893"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/图像放大比较.json",
"sha256": "1ca5938a963921b16c96649a97d3b1a9f75d810d3aabcd7ce472a30e5805f3e4"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_视频放大.json",
"sha256": "06c427c688c13b87ed5724ac6b1ed432c31f8ea6c44212b3e7596b94128619da"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/RTX_image_upscale.json",
"sha256": "35bf9b7731e6199b5ccc113e31c248573f9ae74d1bb9302071a3a97524fea8c4"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/视频模型放大插帧(简单快速版).json",
"sha256": "bf47ba2462a3f683fe4f1d742b7dcde81a7a3f95e7e63c021e942a6c4f9ef071"
},
{
"path": "docs/hel-892/supplied-api/02.api.json",
"sha256": "daa40971b730076691721afe95e165932df94e3423f1fc44dcb7707026e7125b"
},
{
"path": "docs/hel-892/supplied-api/01.api.json",
"sha256": "0ed76e088a23af43d6fecbf273fc0a983d7112e2b046d347f715afffac56d57e"
},
{
"path": "docs/hel-892/supplied-api/07.api.json",
"sha256": "b1b4f6a6c02d8d21701943c67b62805b1210fed17e7e26b618c58e112ea1d70d"
},
{
"path": "docs/hel-892/supplied-api/06.api.json",
"sha256": "3e9176a5346ce8b8122b6da10f377fbeb894dc7c2c82a415f85ffc0dbfefc90b"
},
{
"path": "docs/hel-892/supplied-api/04.api.json",
"sha256": "2066b07b2ca5390ba3e795df6b43934dab83865b12870b6ff26d8c0ef24f091e"
},
{
"path": "docs/hel-892/supplied-api/03.api.json",
"sha256": "91e6c2cea3747a03bbb71f661dbd016b28040781482b956365ff76a7a8b647ce"
},
{
"path": "docs/hel-892/supplied-api/05.api.json",
"sha256": "95a01c1ea27a8279a6dc202820505099a94161d91e0789189b61208b09007af8"
},
{
"path": "calliope-backend/src/calliope/comfyui/registry.py",
"sha256": "0382eda52a31f23c1c29dd7a62d0ffc93e10fcbb88872a5893b8fc93a2b2734d"
},
{
"path": "calliope-backend/src/calliope/comfyui/library_cli.py",
"sha256": "04bfa8cfbe3f9378e78594958973118ec95aa1ff0bcdbdf4da0311abbdbcd380"
},
{
"path": "calliope-backend/src/calliope/comfyui/client.py",
"sha256": "ce30b3b3587d8f0dac86d534b99f31b95f1f4d0acb361babb45fd2be9513fe72"
},
{
"path": "calliope-backend/src/calliope/comfyui/output_map.py",
"sha256": "36ed4ced825e4f7e1d389602085451b5cb9336b319d220f423f59f83fed6a70e"
},
{
"path": "calliope-backend/src/calliope/comfyui/protocol_references.py",
"sha256": "ab9d948dd1bbf83dfce27186d6e48d9c3d5dff129305afd760fb3e77570b2916"
},
{
"path": "calliope-backend/src/calliope/comfyui/protocol_references.json",
"sha256": "a10aaf98db9bb3b5ac6d1fc30b18c40cf315b34eee57ebb19470a6664e9221a4"
},
{
"path": "calliope-backend/src/calliope/routers/workflows.py",
"sha256": "3f1d5fdacc841080973dcafb9cd87a42433ec19080a3ff14a29561f13d512c97"
},
{
"path": "calliope-backend/src/calliope/queue/worker.py",
"sha256": "54f5505ae78802f77fedf23690579444c9ccfbb0949b32f9e96980e8d55c2d3b"
},
{
"path": "docs/hel-892/h3-chain-evidence/library.json",
"sha256": "667c09ebd5ba14c281366a1b9f7647d74f74e055a863b121d9324ac75a423cd4"
},
{
"path": "docs/hel-892/media-evidence/protected-six-cases.json",
"sha256": "c2b9dffd7f1a9c5f0de51c26c9dd81beedd3ad7f6b67a54aa3eb5cead55c8c5f"
},
{
"path": "calliope-backend/src/calliope/comfyui/structure_reference.py",
"sha256": "a9f3a8ed314a0c0a424c6781db4e83af3a85cb8b66b16b01380b5fecc3e1f0bb"
},
{
"path": "calliope-backend/src/calliope/comfyui/serialization_reference.py",
"sha256": "67724fac65acbd397198271e1ed17b91f592f52da7ce8299e575d4c597d57fa1"
},
{
"path": "calliope-backend/src/calliope/comfyui/ui2api.py",
"sha256": "86a9c98ad72afa15aaf706bab8b39589a1cbca2e93da40d0aed9f963c14c0d1f"
},
{
"path": "calliope-backend/src/calliope/comfyui/h3_core_reference.py",
"sha256": "2913654b6ec3dabac1d36b1894064b8e077dd1d743d546e81667b317339f8a5f"
},
{
"path": "calliope-backend/src/calliope/comfyui/h3_chain_reference.py",
"sha256": "a5c0ab92d99757c168648ddbc0418b23d2b871f674b153e9a240b75409cf5741"
},
{
"path": "calliope-backend/src/calliope/comfyui/library.py",
"sha256": "b9cbfce28267642e6db3ebe9d591cf8dd260c7772a5a21a8d36cb98915eca13c"
}
],
"originals": 163,
"old_thirty_blocks_unchanged": true,
"drawer_css_unchanged": true,
"drawer_whole_file_unchanged": true,
"drawer_sha256": "3e3c7602bae3a031e7fb1c38792f8ba5a1f37172e7b8850d304502ea1be010c1",
"conversion_rerun": false,
"profiles_28_candidates_9_diffs_6": "unchanged"
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,4 @@
Building source distribution...
Building wheel from source distribution...
Successfully built calliope-backend/dist/calliope-1.5.8.tar.gz
Successfully built calliope-backend/dist/calliope-1.5.8-py3-none-any.whl
@@ -0,0 +1,662 @@
"""Source-bound SeedVR2 single-image editorial reference; never an execution profile."""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
REPO = Path(__file__).resolve().parents[3]
OUT = Path(__file__).resolve().parent
REF = OUT.parent / "seedvr2-reference"
PATHS = [
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json"
]
def canonical(v):
return json.dumps(v, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()
def build(index=0):
path = PATHS[index]
raw = (REPO / path).read_bytes()
graph = json.loads(raw)
sub = graph["definitions"]["subgraphs"][0]
entries = json.loads((REF / "sources.json").read_bytes())["sources"]
refs = []
def ref(key, file, first, last, claim):
e = next(e for e in entries if e["id"] == key and e["file"] == file)
data = (REF / e["local_file"]).read_bytes()
assert hashlib.sha256(data).hexdigest() == e["sha256"]
assert 1 <= first <= last <= len(data.decode().splitlines())
refs.append(
{
**e,
"local_file": "../seedvr2-reference/" + e["local_file"],
"lines": [first, last],
"claim": claim,
}
)
return len(refs) - 1
load = ref(
"core",
"nodes.py",
1720,
1795,
"core0.27.0 LoadImage动态枚举、IMAGE/MASK及反向alpha;文件内容未读",
)
save = ref(
"core",
"nodes.py",
1643,
1705,
"准确SaveImage有IMAGE出口并返回原images;PNG文件与UI描述符分开",
)
ref(
"core",
"nodes.py",
1707,
1719,
"准确PreviewImage继承SaveImage并改用temp目录与随机预览前缀;不执行",
)
ref("core", "comfy/samplers.py", 970, 975, "准确KSAMPLER_NAMES含euler;完整别名链另引")
ref(
"rgthree",
"py/constants.py",
1,
len((REF / "rgthree__py__constants.py").read_text().splitlines()),
"准确get_name/category给注册节点名添加rgthree后缀",
)
vae = ref(
"core",
"nodes.py",
754,
849,
"VAELoader动态vae/vae_approx枚举、装载路径与特殊分支;不加载权重",
)
unet = ref(
"core",
"nodes.py",
966,
990,
"UNETLoader动态diffusion_models及weight_dtype选项;不证明实际精度",
)
sampler = ref(
"core",
"nodes.py",
1555,
1607,
"KSampler默认/范围/调用;control_after_generate标记与后端seed分开",
)
enc = ref(
"core", "nodes.py", 387, 405, "VAEEncodeTiled schema与encode_tiled参数;仅视频VAE时间窗口"
)
dec = ref("core", "nodes.py", 343, 372, "VAEDecodeTiled schema、重叠限幅和压缩换算;非显存保证")
resize = ref(
"core",
"comfy_extras/nodes_post_processing.py",
412,
513,
"ResizeImageMaskNode动态倍率/算法schema与分支;不是模型超分效果",
)
resize_impl = ref(
"core",
"comfy_extras/nodes_post_processing.py",
256,
308,
"倍率按round计算宽高再common_upscale;无输入尺寸实测",
)
ref("core", "nodes.py", 2048, 2140, "准确核心静态注册表,含SaveImage和采样/编解码/加载器")
extra = ref(
"core", "nodes.py", 2372, 2513, "准确核心内置extras模块调查集合,nodes_seed.py为必要候选"
)
seed_file = ref(
"core",
"comfy_extras/nodes_seed.py",
1,
len((REF / "core__comfy_extras__nodes_seed.py").read_text().splitlines()),
"准确nodes_seed.py全文调查;只对该集合下结论,不借新版或插件同名实现",
)
ref(
"core",
"comfy_extras/nodes_compositing.py",
188,
223,
"JoinImageWithAlpha准确schema/注册及alpha合并实现,保留MASK物理边",
)
samplers = ref(
"core",
"comfy/samplers.py",
1337,
1410,
"准确采样器/调度器枚举与继承,不执行采样或求随机数",
)
widgets = ref(
"frontend",
"src/scripts/widgets.ts",
70,
270,
"准确前端seed附加生成后控制与控件schema,fixed不当宿主第二个seed",
)
dynamic = ref(
"frontend",
"src/core/graph/widgets/dynamicWidgets.ts",
1,
len(
(REF / "frontend__src__core__graph__widgets__dynamicWidgets.ts")
.read_text()
.splitlines()
),
"准确动态分支序列化/恢复;不制造未保存分支",
)
host = ref(
"frontend",
"src/lib/litegraph/src/LGraphNode.ts",
870,
940,
"宿主属性、widgets_values恢复再onConfigure;扩展次序不能据此确认",
)
subfront = ref(
"frontend",
"src/lib/litegraph/src/subgraph/SubgraphNode.ts",
990,
1090,
"准确子图按定义重建槽后super.configure并恢复代理;没有保存的promoted条目不臆造",
)
subwidgets = ref(
"frontend",
"src/lib/litegraph/src/subgraph/SubgraphNode.ts",
648,
733,
"子图无原生widgets,合成视图与内部目标;不据数组猜可执行prompt",
)
callbacks = ref(
"frontend",
"src/scripts/app.ts",
815,
835,
"图级扩展configure回调与宿主次序;UE7.8实现/加载未知",
)
upload = ref(
"frontend",
"src/extensions/core/uploadImage.ts",
1,
len((REF / "frontend__src__extensions__core__uploadImage.ts").read_text().splitlines()),
"LoadImage上传占位扩展,不是第二后端图片参数",
)
compare = ref(
"rgthree",
"py/image_comparer.py",
1,
40,
"准确Comparer继承PreviewImage、可选A/B与UI描述符;未显式result出口",
)
comparefront = ref(
"rgthree",
"src_web/comfyui/image_comparer.ts",
1,
len((REF / "rgthree__src_web__comfyui__image_comparer.ts").read_text().splitlines()),
"准确Comparer前端Slide属性、rgthree_comparer对象/数组恢复;保存空列表不是历史图片",
)
comparereg = ref(
"rgthree",
"__init__.py",
1,
len((REF / "rgthree____init__.py").read_text().splitlines()),
"准确rgthree注册入口",
)
for key in ["core", "frontend", "rgthree"]:
ref(
key,
"LICENSE",
1,
len((REF / (key + "__LICENSE")).read_text().splitlines()),
"准确提交许可原文;未推目标安装或许可适用性",
)
# Defaults and citations; saved values are read from source.
common = {
"seed": (
"随机噪声种子",
"0",
"无量纲整数",
"0~18446744073709551615;control_after_generate为前端控制",
"保存959948902156062用于噪声种子;宿主seed边51覆盖内部54.seed缓存,内部fixed是另一个前端控制,不求随机数或补宿主控制。",
[sampler, widgets, samplers],
),
"steps": (
"采样步数",
"20",
"步",
"1~10000",
"保存1;宿主边52覆盖内部54.steps。单步仅参数,不保证清晰度、速度或成功。",
[sampler],
),
"cfg": (
"条件引导强度",
"8.0",
"无量纲",
"0.0~100.0,step0.1/round0.01",
(
"原JSON int1与FLOAT schema分开;宿主边53覆盖内部54.cfg。"
"条件来自61正负出口,效果/兼容未知。"
),
[sampler],
),
"sampler_name": (
"采样算法",
"schema未显式指定",
"枚举",
"准确SAMPLERS含euler;实际安装未知",
"保存euler;宿主边54覆盖内部54.sampler_name,不保证SeedVR2兼容。",
[sampler, samplers],
),
"scheduler": (
"噪声调度方式",
"schema未显式指定",
"枚举",
"准确SCHEDULERS含simple",
"保存simple;宿主边55覆盖内部54.scheduler。不是实跑调度证明。",
[sampler, samplers],
),
"denoise": (
"去噪强度",
"1.0",
"无量纲",
"0.0~1.0,step0.01",
"原JSON int1;宿主边56覆盖内部54.denoise。1不是修复效果或保真保证。",
[sampler],
),
"unet_name": (
"扩散模型文件引用",
"动态枚举,无固定文件默认",
"文件引用",
"来自diffusion_models;路径是否存在未知",
(
"宿主Seedvr2\\seedvr2_3b_int8_convrot.safete"
"nsors与内部seedvr2\\seedvr2_3b_int8_convrot."
"safetensors大小写不同,逐字保留;边57覆盖内部52.unet_nam"
"e,不改源、不验证磁盘或权重。"
),
[unet, subfront],
),
"vae_name": (
"VAE文件引用",
"动态枚举,无固定文件默认",
"文件引用",
"vae/vae_approx和特殊枚举;模型兼容未知",
(
"宿主seedvr2_ema_vae_fp16.safetensors经边58覆盖"
"内部51缓存ema_vae_fp16.safetensors;Note推荐ema"
"_vae_fp16不替换源保存值,也不证明安装。"
),
[vae, subfront],
),
"resize_type.multiplier": (
"缩放倍率",
"1.0",
"无量纲倍率",
"0.01~8.0、step0.01;仅scale by multiplier分支",
(
"原JSON int4;宿主边50覆盖内部57倍率缓存。"
"准确resize先round宽高再插值,lanczos为插值算法,"
"与后续模型超分分别说明;输入/输出尺寸和效果未知。"
),
[resize, resize_impl, dynamic],
),
"color_correction_method": (
"颜色后处理选择",
"未知:准确调查集合未证实对应SeedVR2类",
"枚举标签",
"仅保存none;默认/选项/范围/效果未知",
"宿主none经边64覆盖内部59缓存none;SeedVR2PostProcessing只有源口声明,准确实现未知,不能将none解释为已证明无任何颜色处理。",
[extra, seed_file],
),
"temporal_size": (
"时间分块窗口",
"64",
"帧(仅视频VAE适用)",
"8~4096,step4;不是单图数量或显存容量",
"保存4096。宿主边65只覆盖48编码temporal_size;55解码4096是独立保存值,无该外线。仅视频VAE才使用时间窗口,实际单图批次/显存/压缩结构未知。",
[enc, dec],
),
"tile_size": (
"空间分块尺寸",
"512",
"像素(按准确VAE压缩换算)",
"64~4096;编码step64,解码step32",
"编码48与解码55各保存512。空间分块可影响内存和拼接条件,不保证显存足够或无接缝;解码按压缩比换算tile_x/y。",
[enc, dec],
),
"overlap": (
"空间分块重叠",
"64",
"像素(解码按压缩换算)",
"0~4096,step32",
"编码48与解码55各保存128。准确解码在tile_size<overlap*4时限幅,不改源保存值;实际图像和显存未知。",
[enc, dec],
),
"temporal_overlap": (
"时间分块重叠",
"8",
"帧(仅视频VAE适用)",
"4~4096,step4",
"编码48与解码55各保存8;准确解码根据temporal_compression换算/限幅,无时间压缩则时间参数为None。不是当前单图批次或多帧输出保证。",
[enc, dec],
),
"weight_dtype": (
"模型加载精度策略",
"schema首项default;未显式默认",
"枚举",
"default/fp8_e4m3fn/fp8_e4m3fn_fast/fp8_e5m2",
"内部52保存default,未由宿主暴露覆盖;文件名含int8不证明实际计算/加载dtype或GPU支持。",
[unet],
),
"control_after_generate": (
"生成后种子控制",
"准确addValueControlWidget入口缺省randomize;源保存fixed另列",
"前端枚举",
"fixed/increment/decrement/randomize;执行前/后受宿主设置控制,非后端参数",
"仅内部54保存fixed;和seed=959948902156062分开。宿主没有单独保存该控制,不构造随机值/额外prompt参数。",
[widgets, sampler],
),
"resize_type": (
"缩放模式",
"schema未显式指定",
"模式枚举",
"动态所选分支;本图scale by multiplier",
"内部57保存倍率分支;不补target width/height等未保存字段,不把插值当模型生成。",
[resize, dynamic],
),
"scale_method": (
"缩放插值算法",
"area",
"枚举",
"nearest-exact/bilinear/area/bicubic/lanczos",
"内部57保存lanczos,作用于倍率缩放步骤;不是SeedVR2模型算法或画质保证。",
[resize, resize_impl],
),
"image": (
"输入图像文件引用",
"动态input图片列表,无固定文件默认",
"文件引用",
"按image内容类型过滤;素材实际情况未知",
"保存ComfyUI_02159_.png,经1.IMAGE/MASK→66;guhaiImageValue同名仅额外属性,恢复实现未知,不读取图片或保证有alpha。",
[load, upload],
),
"upload": (
"上传控件保存状态",
"前端注入,无后端第二参数默认",
"前端状态",
"保存image字符串,不是素材路径",
"LoadImage上传占位image;不证明已上传,不作为第二幅图或后端参数。",
[upload, host],
),
"filename_prefix": (
"保存图像文件名前缀",
"ComfyUI",
"文本,无数值单位",
"未声明长度范围;output配置和计数命名",
(
"保存seedvr2_after/image;准确core0.27.0 SaveI"
"mage有images IMAGE出口并result=(images,),与源边"
"67兼容。条件PNG保存/UI文件描述符不是已保存证明,也不是再次加载文件。"
),
[save],
),
"rgthree_comparer": (
"比较器前端图像列表",
"准确前端空数组状态",
"前端复合状态",
"完整保存单个[]位置;named为{images:[]},按准确前端恢复条件",
(
"Comparer73保存[[]]中的一个空列表,Slide另在propertie"
"s;没有历史图像。A从66结果,B从9.SaveImage出口,二者都是处理链结"
"果,不标成原图/放大图对比。准确后端继承PreviewImage但compare"
"_images只返回UI,未显式result;源声明images IMAGE出口"
"未接,实际可消费性未知,保持转换关闭。"
),
[compare, comparefront, save, comparereg],
),
}
fields = []
missing = []
boundary = []
for scope, g, prefix in [("root", graph, ""), (sub["id"], sub, "/definitions/subgraphs/0")]:
for i, n in enumerate(g["nodes"]):
base = f"{prefix}/nodes/{i}"
if "widgets_values" not in n:
missing.append(
dict(
node_id=str(n["id"]),
class_type=n["type"],
pointer=base,
value_state="missing",
effect="源未保存widgets_values,不等同[],零位置,不补参数;"
+ (
"准确SeedVR2实现未知。"
if n["type"].startswith("SeedVR")
else "只按准确schema和物理口说明。"
),
)
)
continue
if n["type"] == "MarkdownNote":
continue
names = list(n["widgets_values_named"])
assert len(names) == len(n["widgets_values"])
for k, (name, v) in enumerate(zip(names, n["widgets_values"])):
label, default, unit, limits, effect, ev = common[name]
named = base + "/widgets_values_named/" + name.replace("~", "~0").replace("/", "~1")
input_idx = next((j for j, p in enumerate(n["inputs"]) if p["name"] == name), None)
inp = (
f"{base}/inputs/{input_idx}"
if input_idx is not None
else (
base + "/properties/comparer_mode"
if name == "rgthree_comparer"
else base + "/widgets_values_named/control_after_generate"
)
)
role = "scalar"
if isinstance(v, list):
role = "frontend_state"
elif name in ["upload", "control_after_generate"]:
role = "frontend_control"
elif input_idx is not None and n["inputs"][input_idx].get("link") is not None:
role = "linked_saved"
named_value = n["widgets_values_named"][name]
if name == "rgthree_comparer":
assert named_value == {"images": v}
else:
assert canonical(v) == canonical(named_value)
fields.append(
dict(
node_id=str(n["id"]),
scope="root" if not prefix else "subgraph:" + scope,
class_type=n["type"],
field=name,
label=label,
pointer=f"{base}/widgets_values/{k}",
named_pointer=named,
input_pointer=inp,
value=v,
json_type=type(v).__name__,
type=next(
(p["type"] for p in n["inputs"] if p["name"] == name), "前端状态"
),
schema_default=default,
unit=unit,
limits=limits,
effect=effect,
role=role,
evidence=list(
dict.fromkeys(
ev
+ ([subfront, subwidgets] if prefix or n["id"] == 66 else [])
+ [host, callbacks]
)
),
execution_note="原mode0仅保存活动态,未构造prompt/未实跑。作用域与源具名保存双指针:"
+ named
+ ";源口/前端属性:"
+ inp,
)
)
assert len(fields) == 37
ns = {n["id"]: n for n in sub["nodes"]}
for j, port in enumerate(sub["inputs"]):
edges = [e for e in sub["links"] if e["origin_id"] == -10 and e["origin_slot"] == j]
assert {e["id"] for e in edges} == set(port["linkIds"])
for e in edges:
target = ns[e["target_id"]]["inputs"][e["target_slot"]]
assert target["link"] == e["id"]
boundary.append(
dict(
host_slot=j,
name=port["name"],
host_pointer=f"/nodes/4/inputs/{j}",
definition_pointer=f"/definitions/subgraphs/0/inputs/{j}",
edge=e,
target_pointer=f"/definitions/subgraphs/0/nodes/{sub['nodes'].index(ns[e['target_id']])}/inputs/{e['target_slot']}",
)
)
note = graph["nodes"][0]
assert note["widgets_values"][0] == note["widgets_values_named"]["text"]
overview = (
"这张图读取图片及遮罩,送入子图做缩放、编码、采样和解码,再保存并比较处"
"理结果。保存倍率4、lanczos插值;比较A来自子图,B来自保存节点"
",都来自处理链,不能当成原图与放大图对比。保存节点能继续传出图像,但S"
"eedVR2预处理、条件和后处理的准确实现仍未核实,模型路径也有差异;"
"仅参考、转换关闭、未实跑,实际尺寸、显存和画质未知。"
)
flow = [
overview,
(
"根5节点5边、定义10节点28含边界记录,均mode0。1.IMAGE边46→6"
"6.image;1.MASK边47→66.alpha;66.images边49→"
"9.images,边66→73.image_a;9.images边67→73.i"
"mage_b。准确SaveImage有IMAGE出口,未发现此处schema冲突"
",不删口补线;Comparer源出口未接,不能保证其输出可消费。"
),
(
"子图-10.image/alpha→50.JoinImageWithAlpha→"
"57.ResizeImageMaskNode→58.SeedVR2Preproc"
"ess→48.VAEEncodeTiled。52.UNETLoader→54.m"
"odel及61.SeedVR2Conditioning.model;48.lat"
"ent→61.vae_conditioning和54.latent_image;"
"61正/负槽→54.positive/negative;54→55.VAEDec"
"odeTiled→59.SeedVR2PostProcessing.images"
"。51.VAE→48/55,57另→59.original_resized_im"
"ages;59→-20.images→宿主66出口。这里只复述源边,三类Seed"
"VR2实际含义/单位/范围/实现未知。"
),
(
"13宿主输入=图像/MASK两物理输入+11控件边界。定义widgets=[]零"
"条目;没有proxyWidgets/promoted保存记录,不制造代理列表或s"
"eed控制。边50倍率→57.slot2;51seed→54.slot4;52s"
"teps→54.slot5;53cfg→54.slot6;54sampler_n"
"ame→54.slot7;55scheduler→54.slot8;56deno"
"ise→54.slot9;57unet_name→52.slot0;58vae_"
"name→51.slot0;64color_correction_method→"
"59.slot2;65temporal_size→48.slot4。宿主与被覆盖"
"内部保存值分别保留,连线不证明扩展最终值。"
),
(
"宿主UNET路径Seedvr2\\seedvr2_3b_int8_convrot."
"safetensors,内部seedvr2\\seedvr2_3b_int8_co"
"nvrot.safetensors;宿主VAE seedvr2_ema_vae_"
"fp16.safetensors与内部ema_vae_fp16.safetens"
"ors不同。Note模型URL与目录仅推荐源文本,不执行链接/下载,不替换保存值"
"或证明安装。"
),
(
"倍率4/lanczos是准确resize插值条件,模型超分和三类SeedVR2链"
"另层未知;steps/cfg/denoise=1非效果保证。temporal_s"
"ize4096仅视频VAE窗口,实际单图批次、输入尺寸、内存与设备未知。54内部"
"fixed前端控制与宿主seed分开,不求随机数/不构造prompt。"
),
(
"准确core0.27.0内置注册表、extras列表、nodes_seed.py"
"全文和相关nodes/Mask/Resize源码为有界调查集合;tree无see"
"dvr命名文件且这些文本未证实SeedVR2Preprocess/Conditi"
"oning/PostProcessing,不能证明全仓绝对不存在,更不借新版本/"
"插件同名补缺。该实现身份、默认/单位/范围和模型适配均未知。"
),
(
"core0.27.0/frontend1.45.20/rgthree27b4f4"
"cdcf3b127c29d5d8135ac1536ecbd4c383均固定准确G"
"it文本/许可。Comparer继承PreviewImage,父core Sav"
"eImage有IMAGE返回但override compare_images仅U"
"I无显式result;前端Slide与rgthree_comparer恢复分层,"
"保存[[]]不是缓存图片。"
),
(
"全节点UE7.8仅源声明;宿主66倍率可连接true,其余空绑定表、root/s"
"ubgraph ue_links与links_added_by_ue空不证明无改"
"写。guhaiImageValue、previewExposures源指54均仅"
"属性,身份/恢复实现未知,不生成预览。准确宿主先属性/保存值再onConfigu"
"re,子图先定义槽再父configure、再代理恢复;不能推UE/guhai/p"
"review扩展加载和最终值。"
),
(
"独立37位置=根15+内部22,含36标量和1空列表;另1完整MarkdownN"
"ote(双存储相同)。50/58/61缺widgets_values,非[],不"
"补值。旧30块904位置+21注释逐对象不变;现31块941位置+22注释仅参考"
"。155完整定稿0/必要实跑0/新增转换0;145UI仍9参考候选136关闭。"
),
]
for scope, g in [("root", graph), ("subgraph:" + sub["id"], sub)]:
flow.extend("原边 " + scope + " " + json.dumps(e, ensure_ascii=False) for e in g["links"])
flow.extend("边界 " + json.dumps(e, ensure_ascii=False) for e in boundary)
versions = [
f"{k}→{next(e['commit'] for e in entries if e['id'] == k)}"
for k in ["core", "frontend", "rgthree"]
]
return dict(
source_path=path,
source_sha1=hashlib.sha1(raw).hexdigest(),
source_sha256=hashlib.sha256(raw).hexdigest(),
canonical_sha256=hashlib.sha256(canonical(graph)).hexdigest(),
notice="仅准确来源参考;SeedVR2实现、模型/素材/扩展恢复与实际效果未知,保持转换关闭、未实跑。",
user_overview=overview,
versions=versions,
counts=dict(
saved_fields=37,
source_nodes=15,
physical_edges=33,
source_notes=1,
history_objects=0,
linked_saved_fields=sum(f["role"] == "linked_saved" for f in fields),
frontend_only=3,
final_scalars=0,
final_prompt_constructed=False,
),
fields=fields,
sources=refs,
comments=[
dict(
node_id="72",
pointer="/nodes/0/widgets_values/0",
named_pointer="/nodes/0/widgets_values_named/text",
text=note["widgets_values"][0],
meaning=(
"完整原Note含子图指南、VAE/UNET推荐链接、SEEDVR2和diffus"
"ion_models目录及更新/报错入口;只保留源文字,不执行链接、不下载、不证"
"明模型安装或适配。"
),
)
],
flow=flow,
flow_evidence=list(range(len(refs))),
zero_saved_nodes=missing,
boundaries=boundary,
steps=[
overview,
"操作1:核宿主图像/MASK、13边界与内部链,保持停用;不上传素材或执行子图。",
"操作2:分别核对宿主/内部模型路径、VAE名、11控件覆盖和fixed控制;不按标题猜原图比较。",
"操作3:准确版本缺失的SeedVR2类与UE/素材/模型/设备仍未知;后续实机验证前不能作为可靠转换或生成入口。",
],
)
@@ -0,0 +1,476 @@
{
"base": "1d04c00c0cc75df1d782b39ca7b70bb37362517b",
"self_manifest_excluded": true,
"files": [
{
"path": "calliope-backend/src/calliope/comfyui/fixed_document.py",
"sha256": "2443993bec9f5456ee31312535d33e05653e0e7cd205f553cca19d8dd10cf7c8",
"purpose": "单路径及定义摘要信任"
},
{
"path": "calliope-backend/src/calliope/comfyui/source_reviews.json",
"sha256": "5fee876e9ac3ba844b4004533add134461f1a64668a207a2f743db85f4b8868b",
"purpose": "单图37位置/1Note实际固定说明"
},
{
"path": "calliope-backend/tests/test_seedvr2_fixed_document.py",
"sha256": "088ba744f1a05eb7619409f321f95874b475de3a66ca9fbbef7725c1dc15c299",
"purpose": "双存储/边界/引用/失败关闭专项"
},
{
"path": "docs/hel-892/SeedVR2单图放大固定参考中文说明.md",
"sha256": "b93da0f4269df2df5625be90e416ea5c900ede5279eb036971b51a72ff347a83",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/actual-Seedvr2_3b_int8_图像放大.json",
"sha256": "5297369e26f5aff7a19c173cb2a84887b469e5faf67f33a20b82a3793a36f9e3",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/audit-summary.json",
"sha256": "b79c3f138241cc4c82f8530637349ec411fc8bd92de0668a07e2a88c4a2cbb7a",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/backend-final.txt",
"sha256": "79ee1073eaa68df235234125104e27048b65cd7ae04f1229a32bde4e44b694cd",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/backend-initial.txt",
"sha256": "3d2e113dc0d16960ce44161d52318f98c6dc66b5910474ee5de181fe16359f96",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/boundaries.json",
"sha256": "3cc3b8d1bb2ae45707ae75d608c9f2c5c9261bbd9a02876fbdd446067df98ef8",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/browser-final.txt",
"sha256": "765c2bfb2768d71d8e047119f793a0f6a41cbf246bb9966de5b32b7b5ba3b0ae",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/browser-initial.txt",
"sha256": "765c2bfb2768d71d8e047119f793a0f6a41cbf246bb9966de5b32b7b5ba3b0ae",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/browser-results.json",
"sha256": "729450f9ddaadef03eeb0d35a05443aa77ccfaed7d6db2af8ac22cc36a1b4fcb",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/build-final.txt",
"sha256": "c00444fef525c4c1ed8a45e13530a1c95be11554e0ee19ff95f40e5dab717cee",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/build_definition.py",
"sha256": "a6afd8cd4e6abda6115781f9cff629f0d14202fea6b39b91dbd16ad916f3d47b",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/check_code.py",
"sha256": "8a39231bdede5c31b8f4c80ea80216f2de7a69a853280b9aac12ccb3f895840e",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/definition-0.json",
"sha256": "27174be24e88566024ae146f994bd5d98e3355ab6a34f6d2c593af186e405f4f",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/delivery-summary.md",
"sha256": "dca3f9f2ff3b4ef8794e5be9233d4007dbf1542c12fe9ff17549340b42abaf32",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/development-notes.txt",
"sha256": "05985b68876e1d4837c4c7557dca62e84ade5aa5ebfbb88c3a4d7105850475b8",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/fetch-final.txt",
"sha256": "d35691ae372a8a32f25ee2b377c6fbba3610028b7c32306cc943ee79093c348d",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/fetch_sources.py",
"sha256": "4104ecf28e9bd8c782d97d863f9127b4c2443166af40ae7177108e2183b53011",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/fixed-source-index.json",
"sha256": "3da4689055cf8d78156f276e8080ef4c6e2e25514d50b02e5aa9142ca1892a0b",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/format-final.txt",
"sha256": "0ad17653b42427c899752d9e3faad7eff5bbf64dcb379046594b1eecfe920f9d",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/format-fix.txt",
"sha256": "bc6984cdb5a32379c079c9b02d292367a207b61d4361fdbcafce2f0ee9ddf48d",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/frozen-resource-check.json",
"sha256": "adf5fecc9506707fa4cf8ad0024391f61ad4dea3eefdf5bb5611f2b2c8a6f523",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/import-protection.json",
"sha256": "4d6cd291679bdcb3aa2d20805a7f340cd5e1a9a8369084cee0be9bd11642fef2",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/lint-final.txt",
"sha256": "ba3ad488d916696d5b35456e7287d7d18bf5b5b11a65c8345c7fc47948bddea9",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/lint-fix.txt",
"sha256": "0fac674316ea8e678c3ac48e47230ff72deb566bf0ed157b58e23e5e32e008e7",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/lint-initial.txt",
"sha256": "2afa52b3fe2609971fd85aeef8fda9f1883b022a01300ca1f4098ce342c70400",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/npm-ci.txt",
"sha256": "99aec36e74054441a1e4c2ee0d37b5e5cbe2e3ce61938cf82941f876a338315b",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/package-check.json",
"sha256": "ee143d258766f13b14a6cbf35cb9fbaf90ff4df3fc54b20e2be3680ca5448a12",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/pins.json",
"sha256": "a267a69d41f8bc3ec84e0319e3e51d2512bd7426a4d6df1f8dec1f189bfe9bfa",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/provider-pr-before.json",
"sha256": "cf34f0df82b4f1b01d17d92fe475bbb8bdc869933ef706aaf21d6778fe85cd12",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/python-check-files.json",
"sha256": "84de7d31e37879863d5f55aa4dc860d2451b8f44af59d74c04d8b3c3f8209294",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/rebuild-final.txt",
"sha256": "3e9285a83a01ddf94fb12f2ad73dd3eac076c10029c073b83eb3efa8fcca0958",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/rebuild-initial.txt",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/rebuild.py",
"sha256": "e334a2984afe1e0d1238716bbf44a8ea3e89633048f7223ebf874993199a646d",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/recompute-final.txt",
"sha256": "7922edfee788646add687fed82a59b0f761af9b5a693a644f9d7cb6a640aa51c",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/recompute.py",
"sha256": "17a3cfef8839f8c453a9ea8f0bb9d563584c620787a22e77102d42c915da0d3b",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/render_report.py",
"sha256": "63adb886cdd2cb62d41000bbfa794929949d3e513900327bd34810aa3260c2b0",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/repeat-final.txt",
"sha256": "1c4de890cacc8abbcb119c86e6ebbea50780922b17bc7883685bfe4e0b261a96",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/repeat.py",
"sha256": "fbaccfa4d7d36ce7659be7753acf6e0dfa148e00bc8f0d6ad705a3e6a0c774c5",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/repeatability.json",
"sha256": "2c4bf6c8a2ad4ed712c45d47c7f3ca640a380c3f3773c83a44bb4bd914e5cf95",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/request-counts.txt",
"sha256": "3552cbff56cf22efab14cc639578824fb56560122b130db145807322550bda40",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/request_counts.py",
"sha256": "982d4859e01e9a3e3ef9746fc8b7f447b4ea63fbdf414f13de3bbaaaedd2d58f",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/review-delta.json",
"sha256": "3578f2f1be01e8560e15079f3e0d4140b4a9694524393cc02b93fbdc6120a6d7",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/server-request-accounting.json",
"sha256": "254f181ddf2062113b27a75ba29c1c7001b886d712364e6ef598f3e3f695686a",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/service-0.txt",
"sha256": "123cdd28f3f85d8db4d43c3cd24d70c43a60e18f6cfe4fe3d4acff862c3d41f3",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/service-1.txt",
"sha256": "6b8b8dc7aa512b2c8c9ee35b02dce6825c014ae3b391c524d7403d37e1321e12",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/service-stop.json",
"sha256": "26a1c53a887aaa01778530a87c33062e6121fde93e9eacea671c3561b8fe5594",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/source-check.json",
"sha256": "80e0881df6c3ea6a4e532a2d1dcf710abb475cfd0ddc1a14fcfefa19b04b1b64",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/tested-files.json",
"sha256": "6c48415fd377c3c07d078a664a30efd14b567d9f7dc68a520fddbc8325098498",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/validation-commands.txt",
"sha256": "3c7996274f5b3603167d414040393f381bcf1773ea6bb33607d7b50f3a3a27b3",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/verify_sources.py",
"sha256": "3eccf0b4ed61048dec18a6bee95f21233fb7f8a4ce904d50a565e2d0c2e47d58",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/visual-review.txt",
"sha256": "0a06a1b995fd1e6a1bb1be36a08af5b06dbc72113191e4e44a5f07838b8bc7e7",
"purpose": "检查/交付证据"
},
{
"path": "docs/hel-892/seedvr2-reference/core-tag.json",
"sha256": "c3bf0d1f3f6fcea0b54d87d369f979b17141ccbbbb4d14f5fbfa9dac5a8888eb",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/core-tree.json",
"sha256": "0dc2446485c88dacb3570811cd980afbe221a2195a47dcff6f2d99a61f1964a1",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/core__LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy__samplers.py",
"sha256": "d882256ae9baa1d23f1367ab2ec3b021fdc15fe39ce4cb49ea2c1ee10026a649",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy__utils.py",
"sha256": "8b8805ca837e20c922a846854156d10e214654f69df96be90969522f9def2bdb",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_api__latest___io.py",
"sha256": "ac986092cace7600461b8547e21f770126958d8c15eef59d79d6709cca4b7717",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_api__latest___ui.py",
"sha256": "842ac7eeb8484fbd1746436daf4368b002e2268ff4aafd4d4682a5b24c6ba794",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_compositing.py",
"sha256": "e001e2963baaa5ea9f031e6b7920e4d70dae248588a70ed31ab595706a29efae",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_images.py",
"sha256": "a57638bf58f93698b8b5ed44e53d31ac3d4ac608cc5c49d38c3768fdf722e448",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_mask.py",
"sha256": "9ff6c44f6114e36cfd17886a92b6cfb1d824013b43242ea1ee6b86c93a71b7dc",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_post_processing.py",
"sha256": "96ec39e8d0e9fe9a70b332f97f994d507e1fa223a26699a3c9c9fbeedacf6575",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_sd3.py",
"sha256": "90a79847332fed7cc97379abbc7092116e6b1b883a7c9e933ac88167a521f693",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_seed.py",
"sha256": "f1566b448ca9e4b4a1cbd15767301635905cf36a44a17f586c18b848e23e5932",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__folder_paths.py",
"sha256": "380961714742085363301f980a6c9458f36aca05b1e36ed9b8afa3fb64ccdb50",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/core__nodes.py",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend-tag.json",
"sha256": "19e013a55c5289946fd8f5387b48ae1c8e858082717b94258d1273b725e7aeef",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend-tree.json",
"sha256": "55db75185a80084619cd6577d99f866fd8d8f1a623cc50d26bfcd7d0d3dbfbc2",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__core__graph__subgraph__promotedWidgetView.ts",
"sha256": "21b0068dc03cf45bc5100a1741484bd04ff09c51b96c4ff2293f758034ba83e3",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__core__graph__subgraph__resolveSubgraphInputTarget.ts",
"sha256": "cbd6d3d16cf94acc0ca3d333028a0b6b91f4c1a011fe5947345c4a31048ba6ed",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__core__graph__widgets__dynamicWidgets.ts",
"sha256": "cbc7d1a9eccb1c64f90cf2f87db9ad3ba9a301d81ec3f8daea2af48e2ccb8e32",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__extensions__core__dynamicPrompts.ts",
"sha256": "31004dc7ba9b8ea5c8caa92ab3a15a0e63af8a822f57cb487079aad84d06f4bd",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__extensions__core__noteNode.ts",
"sha256": "1014f719e3d67d9c5183a5e8631d4c2d6581dfe67083f32eb23774ec3074bef2",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__extensions__core__uploadImage.ts",
"sha256": "48d062c2ee95bd77c537c539e6c8f8bc03bd71dcec94c5b82487c014ea3e9c06",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__lib__litegraph__src__LGraphNode.ts",
"sha256": "d7c22582f6a0a5c05521d8b848a04a21e0d6df3339401be746b252b8d0ac5588",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__lib__litegraph__src__subgraph__Subgraph.ts",
"sha256": "321403ca3ba2faa0b448dec6e8bf379e49ddea4bfbe8619547d29926e30d62d2",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__lib__litegraph__src__subgraph__SubgraphNode.ts",
"sha256": "bc0436dc3e21ccfa6f1dccf40935c0d0b97b607932f7025b975a4138efe1e24e",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__scripts__app.ts",
"sha256": "6a0fd5cc4da6aad850ac05d312a22fd2f545fd296735ed7b927b62d7a564c08e",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__scripts__widgets.ts",
"sha256": "2afe2e069a0e163d36b892a7d46e3074d087f48faeef240610b6e4d55c6fba5c",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree-tree.json",
"sha256": "fee075750e09eed5ea8498c4baf8dd58242a035d977bdd1550726bd86808e647",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__LICENSE",
"sha256": "b34faf7c3e2975fe08d0169958e2b39f076d4d4289cbe2560dd7dd5b1a613ed1",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree____init__.py",
"sha256": "06174f22e7246b2b0771961cc0681846f452b853ccb927ca507e074f340abc61",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__py__constants.py",
"sha256": "50dee946013b1d88d01fe9d63c2a7ab4d4c59be218cf80171f3542b43f0d8558",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__py__image_comparer.py",
"sha256": "43ccce9b6f9413d5196ce4a7a3ef544969ae1ce2b52c44345f6cc8fb28c596fc",
"purpose": "可复现构建/核对工具"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__src_web__comfyui__base_node.ts",
"sha256": "5aa0ec6dc78ad00ecf46ef05922fa53c09526152f07eb3762a1e2c052b040623",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__src_web__comfyui__base_node_mode_changer.ts",
"sha256": "ecd92d0b5275dace15e65a33c2bfd3aab49b4604f47cc0ce2e793c486e36921d",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__src_web__comfyui__image_comparer.ts",
"sha256": "cb15118af030e39aaecdde072a79a7edd501344d2742dd6e296db55e12c14d34",
"purpose": "固定文本及Git身份"
},
{
"path": "docs/hel-892/seedvr2-reference/sources.json",
"sha256": "8b30c5e127ad164e8eb521e8893eb75c2b67f886acfbb8da8887345eb2cbec2b",
"purpose": "固定文本及Git身份"
},
{
"path": "e2e/run-seedvr2-document.py",
"sha256": "db34660e0834d134da7d683a5d99a2fee8c768c4f796fc76bca1747738604630",
"purpose": "复用宿主的浏览验证"
},
{
"path": "e2e/seedvr2-document.mjs",
"sha256": "f1956117ad225fd2ab4ae3cfd93f9d9fe73b2f328411acc86130256c75d9fdce",
"purpose": "复用宿主的浏览验证"
}
]
}
@@ -0,0 +1,40 @@
"Check changed authored Python only; upstream originals remain byte-for-byte."
import json
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
OUT = Path(__file__).resolve().parent
FILES = [
"calliope-backend/src/calliope/comfyui/fixed_document.py",
"calliope-backend/tests/test_seedvr2_fixed_document.py",
"e2e/run-seedvr2-document.py",
] + [str(p.relative_to(ROOT)) for p in sorted(OUT.glob("*.py"))]
def main():
for command in [["check"], ["format", "--check"]]:
subprocess.run(
[
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"ruff",
*command,
"--config",
"calliope-backend/pyproject.toml",
*FILES,
],
cwd=ROOT,
check=True,
)
subprocess.run(["node", "--check", "e2e/seedvr2-document.mjs"], cwd=ROOT, check=True)
(OUT / "python-check-files.json").write_text(json.dumps(FILES, indent=2) + "\n")
print("PASS", len(FILES), "authored Python files and one JS syntax check")
if __name__ == "__main__":
main()
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,13 @@
第50批只新增 Seedvr2_3b_int8_图像放大 单图固定参考说明。生产增量只有source_reviews.json的一个source-bound块和fixed_document.py的一条路径/硬编码摘要;SQLite导入→GET→既有Drawer路径复用,不改执行器、转换、界面、依赖或配置。
独立根5/5、定义10/28,全部mode0。37位置=根15/内部22,36标量+1空列表,另1完整MarkdownNote;13宿主/定义/子节点边界逐条绑定。宿主/内部UNET大小写路径和VAE名差异、sampler固定控制与seed、倍率4/lanczos与模型超分、4096时间窗口与实际单图批次分别记录。比较器A来自66、B来自SaveImage9;core0.27.0 SaveImage的IMAGE出口兼容边67,不制造冲突。Comparer继承PreviewImage,但compare_images仅UI无显式result,源空出口未接仍保留限制。
准确core0.27.0→bb131be9e83d2f773c90f1d6f1e4b248a498c8c5,frontend1.45.20→7bd9f8b0d0b854ccb5a947623468f36a392ea0ff,rgthree→27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383。32准确Git文本、2tag/3完整tree、30精确行号引用及3份许可;local_file以docs/hel-892/seedvr2-document-evidence为基准。有界注册表/extra列表/nodes_seed及相关源码调查未证实3类SeedVR2,不作全仓绝对不存在结论,不用新版本或插件同名补缺。UE7.8/guhaiImageValue/previewExposures与宿主恢复次序分层,未知不猜。
本次283后台通过=270新图专项+13库回归;1334浏览=598本图+720旧30概要+2汇总+14共享。12改动自写Python Ruff check/format、JS语法、离线wheel/sdist资源原字节与重建/渲染双次确定性通过。真实基线1d04c00代码建立旧库,1update/154skip,其他154整行不变;重复155skip、精确回退1、再导1update;升级前后编辑各1conflict/29列保护通过。155全停用未检查/定稿实跑时间戳空、16/139与1217/3660/294不变。
原30块904/21逐对象不变,现31图941/22仅参考;163源原件(156仓库+7配套API)、191冻结资源、28profiles/9候选hash/6差分、Drawer整文件和执行资格不变;case06排除。145UI仍9参考候选136关闭;155完整定稿0/必要实跑0/新增转换0。未跑全后台/全前端/冻结转换,历史5个业务失败及I001仅沿用上批记录,不称全仓绿。
浏览仅本地GET:浏览固定106/轮询10;后端固定101含就绪1/轮询10;6次本地详情夹具拦截(3回退、1迟到、2次500;逐次记录在browser-results.json的interceptions),1字体CSS拦截,禁止请求0。浏览记录与后端差额5=6详情拦截减后端就绪1。finally两服务停止、8247/5173端口释放。代表5图实际目验;Note部分装饰符号受本地字体覆盖限制,原码点保留。失败/修正日志保留,截图仅附件。
模型/素材/准确SeedVR2实现、UE恢复、GPU/显存/效果待实机核实;本轮不需要用户材料或机器窗口。不连接目标、不停TTS、不启动ComfyUI、不提交prompt、不执行上游/媒体/GPU/随机种子、不下载模型素材字体、不引依赖付费、不写在线库、不合并部署。全量目标未完成,交总管功能与界面审核。
@@ -0,0 +1,7 @@
Initial rebuild rejected an out-of-range JoinImageWithAlpha citation (226, then 225 vs actual223). Corrected to188-223 before accepting definition. No source/graph was modified.
Initial backend run: 281 passed, 2 failed. Both were test defects: text searched 未显式result while flow said 无显式result; some old definitions have no comments key, so frozen notes are counted via actual build_document/source_notes. Corrected without relaxing preserved old review equality or failure closure.
Initial Ruff rejected dense source formatting, unused ref assignments and long literals. During cleanup a substring replacement temporarily changed comparereg into compareref; corrected before final test/build. All upstream text and diagnostic logs kept raw, authored Python reformatted. No skips or rule suppression added.
First full browser pass: 1334 assertions. Then the default overview was rewritten in plain language, the seed control schema default corrected to accurate entry fallback randomize (source fixed remains distinct; before/after depends on setting), citations narrowed and PreviewImage/rgthree registration references completed. Final test/build/protection/browser results refer to that final data.
No full backend/frontend/conversion run was necessary: execution/conversion/Drawer code are frozen. Historical 5 business failures and older I001 findings are inherited evidence, not a new run or a claim that whole repo is green.
Final manual schema reread found ResizeImageMaskNode.scale_method has explicit default area (saved lanczos). Corrected the previously unspecified-default text, added saved-vs-default semantic assertion, and reran final definition/lint/test/build/protection/repeat/browser validation. No source saved value changed.
@@ -0,0 +1,5 @@
core bb131be9e83d2f773c90f1d6f1e4b248a498c8c5 seed matches []
frontend 7bd9f8b0d0b854ccb5a947623468f36a392ea0ff seed matches []
rgthree 27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383 seed matches []
comparer files ['py/image_comparer.py', 'src_web/comfyui/image_comparer.ts', 'web/comfyui/image_comparer.js']
static texts 31
@@ -0,0 +1,126 @@
"""Read only bounded exact Git metadata and necessary text. Never execute upstream."""
import hashlib
import json
import urllib.request
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
REF = Path(__file__).resolve().parent.parent / "seedvr2-reference"
REPOS = {
"core": ("Comfy-Org/ComfyUI", "v0.27.0"),
"frontend": ("Comfy-Org/ComfyUI_frontend", "v1.45.20"),
"rgthree": ("rgthree/rgthree-comfy", "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383"),
}
FILES = {
"core": [
"nodes.py",
"comfy_extras/nodes_images.py",
"comfy_extras/nodes_post_processing.py",
"comfy_extras/nodes_seedvr2.py",
"comfy_extras/nodes_seed.py",
"comfy_extras/nodes_mask.py",
"comfy_extras/nodes_compositing.py",
"comfy_api/latest/_io.py",
"comfy_api/latest/_ui.py",
"comfy/utils.py",
"comfy_extras/nodes_sd3.py",
"comfy/samplers.py",
"folder_paths.py",
"LICENSE",
],
"frontend": [
"src/lib/litegraph/src/LGraphNode.ts",
"src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"src/lib/litegraph/src/subgraph/Subgraph.ts",
"src/scripts/app.ts",
"src/scripts/widgets.ts",
"src/extensions/core/uploadImage.ts",
"src/core/graph/widgets/dynamicWidgets.ts",
"src/extensions/core/dynamicPrompts.ts",
"src/extensions/core/noteNode.ts",
"src/core/graph/subgraph/resolveSubgraphInputTarget.ts",
"src/core/graph/subgraph/promotedWidgetView.ts",
"LICENSE",
],
"rgthree": [
"__init__.py",
"py/image_comparer.py",
"py/image_output.py",
"src_web/comfyui/image_comparer.ts",
"src_web/comfyui/base_node.ts",
"src_web/comfyui/base_node_mode_changer.ts",
"py/constants.py",
"LICENSE",
],
}
def get(url):
with urllib.request.urlopen(url, timeout=45) as r:
b = r.read(3000001)
assert len(b) < 3000000
return b
def main():
expected = {
"core": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"frontend": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"rgthree": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
}
entries = []
for key, (repo, version) in REPOS.items():
if version.startswith("v"):
raw = get(f"https://api.github.com/repos/{repo}/git/ref/tags/{version}")
(REF / f"{key}-tag.json").write_bytes(raw)
obj = json.loads(raw)["object"]
assert obj["type"] == "commit"
commit = obj["sha"]
else:
commit = version
assert commit == expected[key], "Exact tag binding changed; stop"
raw = get(f"https://api.github.com/repos/{repo}/git/trees/{commit}?recursive=1")
tree = json.loads(raw)
assert not tree["truncated"] and tree["sha"] == commit
(REF / f"{key}-tree.json").write_bytes(raw)
paths = {e["path"]: e for e in tree["tree"] if e["type"] == "blob"}
print(key, commit, "seed matches", [p for p in paths if "seedvr" in p.lower()], flush=True)
selected = [p for p in FILES[key] if p in paths]
# Include registration/seed matching text only, not weights or media.
if key == "core":
selected += [
p
for p in paths
if "seedvr" in p.lower() and p.endswith(".py") and p not in selected
]
if key == "rgthree":
print("comparer files", [p for p in paths if "comparer" in p.lower()], flush=True)
def fetch(p):
url = f"https://raw.githubusercontent.com/{repo}/{commit}/{p}"
b = get(url)
blob = hashlib.sha1(b"blob " + str(len(b)).encode() + b"\0" + b).hexdigest()
assert blob == paths[p]["sha"]
name = key + "__" + p.replace("/", "__")
(REF / name).write_bytes(b)
return dict(
id=key,
file=p,
local_file=name,
url=url,
commit=commit,
sha256=hashlib.sha256(b).hexdigest(),
git_blob_sha1=blob,
)
with ThreadPoolExecutor(max_workers=4) as pool:
entries.extend(pool.map(fetch, selected))
(REF / "sources.json").write_text(
json.dumps({"sources": entries}, ensure_ascii=False, indent=2) + "\n"
)
print("static texts", len(entries))
if __name__ == "__main__":
main()
@@ -0,0 +1,452 @@
[
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
1720,
1795
],
"claim": "core0.27.0 LoadImage动态枚举、IMAGE/MASK及反向alpha;文件内容未读"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
1643,
1705
],
"claim": "准确SaveImage有IMAGE出口并返回原images;PNG文件与UI描述符分开"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
1707,
1719
],
"claim": "准确PreviewImage继承SaveImage并改用temp目录与随机预览前缀;不执行"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "comfy/samplers.py",
"local_file": "../seedvr2-reference/core__comfy__samplers.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy/samplers.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "d882256ae9baa1d23f1367ab2ec3b021fdc15fe39ce4cb49ea2c1ee10026a649",
"git_blob_sha1": "25c5a855fd0435d5d2fd98b2eb016bc54273b07f",
"lines": [
970,
975
],
"claim": "准确KSAMPLER_NAMES含euler;完整别名链另引"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "rgthree",
"file": "py/constants.py",
"local_file": "../seedvr2-reference/rgthree__py__constants.py",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/py/constants.py",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "50dee946013b1d88d01fe9d63c2a7ab4d4c59be218cf80171f3542b43f0d8558",
"git_blob_sha1": "73b7d687ad24999c3b441f2c2ef39e4e8b3f3d54",
"lines": [
1,
11
],
"claim": "准确get_name/category给注册节点名添加rgthree后缀"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
754,
849
],
"claim": "VAELoader动态vae/vae_approx枚举、装载路径与特殊分支;不加载权重"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
966,
990
],
"claim": "UNETLoader动态diffusion_models及weight_dtype选项;不证明实际精度"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
1555,
1607
],
"claim": "KSampler默认/范围/调用;control_after_generate标记与后端seed分开"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
387,
405
],
"claim": "VAEEncodeTiled schema与encode_tiled参数;仅视频VAE时间窗口"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
343,
372
],
"claim": "VAEDecodeTiled schema、重叠限幅和压缩换算;非显存保证"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "comfy_extras/nodes_post_processing.py",
"local_file": "../seedvr2-reference/core__comfy_extras__nodes_post_processing.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_post_processing.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "96ec39e8d0e9fe9a70b332f97f994d507e1fa223a26699a3c9c9fbeedacf6575",
"git_blob_sha1": "763b8a52fa84fbee9432ee116000f131c0002400",
"lines": [
412,
513
],
"claim": "ResizeImageMaskNode动态倍率/算法schema与分支;不是模型超分效果"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "comfy_extras/nodes_post_processing.py",
"local_file": "../seedvr2-reference/core__comfy_extras__nodes_post_processing.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_post_processing.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "96ec39e8d0e9fe9a70b332f97f994d507e1fa223a26699a3c9c9fbeedacf6575",
"git_blob_sha1": "763b8a52fa84fbee9432ee116000f131c0002400",
"lines": [
256,
308
],
"claim": "倍率按round计算宽高再common_upscale;无输入尺寸实测"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
2048,
2140
],
"claim": "准确核心静态注册表,含SaveImage和采样/编解码/加载器"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "nodes.py",
"local_file": "../seedvr2-reference/core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1",
"lines": [
2372,
2513
],
"claim": "准确核心内置extras模块调查集合,nodes_seed.py为必要候选"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "comfy_extras/nodes_seed.py",
"local_file": "../seedvr2-reference/core__comfy_extras__nodes_seed.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_seed.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "f1566b448ca9e4b4a1cbd15767301635905cf36a44a17f586c18b848e23e5932",
"git_blob_sha1": "e64f1d7e3cbcb1f882b4370a5b2413af8b7cc228",
"lines": [
1,
33
],
"claim": "准确nodes_seed.py全文调查;只对该集合下结论,不借新版或插件同名实现"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "comfy_extras/nodes_compositing.py",
"local_file": "../seedvr2-reference/core__comfy_extras__nodes_compositing.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_compositing.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "e001e2963baaa5ea9f031e6b7920e4d70dae248588a70ed31ab595706a29efae",
"git_blob_sha1": "8fcbe720e7398d24d7dbc957787f68ec0d123713",
"lines": [
188,
223
],
"claim": "JoinImageWithAlpha准确schema/注册及alpha合并实现,保留MASK物理边"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "comfy/samplers.py",
"local_file": "../seedvr2-reference/core__comfy__samplers.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy/samplers.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "d882256ae9baa1d23f1367ab2ec3b021fdc15fe39ce4cb49ea2c1ee10026a649",
"git_blob_sha1": "25c5a855fd0435d5d2fd98b2eb016bc54273b07f",
"lines": [
1337,
1410
],
"claim": "准确采样器/调度器枚举与继承,不执行采样或求随机数"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/scripts/widgets.ts",
"local_file": "../seedvr2-reference/frontend__src__scripts__widgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/scripts/widgets.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "2afe2e069a0e163d36b892a7d46e3074d087f48faeef240610b6e4d55c6fba5c",
"git_blob_sha1": "f1259180cac03fca9a8e4809b5a47c23c3ef625c",
"lines": [
70,
270
],
"claim": "准确前端seed附加生成后控制与控件schema,fixed不当宿主第二个seed"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/core/graph/widgets/dynamicWidgets.ts",
"local_file": "../seedvr2-reference/frontend__src__core__graph__widgets__dynamicWidgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/core/graph/widgets/dynamicWidgets.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "cbc7d1a9eccb1c64f90cf2f87db9ad3ba9a301d81ec3f8daea2af48e2ccb8e32",
"git_blob_sha1": "0a304c07f15c06d3d8aaa96725be2c7b5a04f018",
"lines": [
1,
615
],
"claim": "准确动态分支序列化/恢复;不制造未保存分支"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/lib/litegraph/src/LGraphNode.ts",
"local_file": "../seedvr2-reference/frontend__src__lib__litegraph__src__LGraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/lib/litegraph/src/LGraphNode.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "d7c22582f6a0a5c05521d8b848a04a21e0d6df3339401be746b252b8d0ac5588",
"git_blob_sha1": "934239cc7dc9f7af3bcedec4649d95034d987815",
"lines": [
870,
940
],
"claim": "宿主属性、widgets_values恢复再onConfigure;扩展次序不能据此确认"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"local_file": "../seedvr2-reference/frontend__src__lib__litegraph__src__subgraph__SubgraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "bc0436dc3e21ccfa6f1dccf40935c0d0b97b607932f7025b975a4138efe1e24e",
"git_blob_sha1": "f31f5a05280a3788b6b9ca02ff7a4d0fc99ac30c",
"lines": [
990,
1090
],
"claim": "准确子图按定义重建槽后super.configure并恢复代理;没有保存的promoted条目不臆造"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"local_file": "../seedvr2-reference/frontend__src__lib__litegraph__src__subgraph__SubgraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "bc0436dc3e21ccfa6f1dccf40935c0d0b97b607932f7025b975a4138efe1e24e",
"git_blob_sha1": "f31f5a05280a3788b6b9ca02ff7a4d0fc99ac30c",
"lines": [
648,
733
],
"claim": "子图无原生widgets,合成视图与内部目标;不据数组猜可执行prompt"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/scripts/app.ts",
"local_file": "../seedvr2-reference/frontend__src__scripts__app.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/scripts/app.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "6a0fd5cc4da6aad850ac05d312a22fd2f545fd296735ed7b927b62d7a564c08e",
"git_blob_sha1": "e326db4703c6fdf1098910dab81d3eefad91b009",
"lines": [
815,
835
],
"claim": "图级扩展configure回调与宿主次序;UE7.8实现/加载未知"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "src/extensions/core/uploadImage.ts",
"local_file": "../seedvr2-reference/frontend__src__extensions__core__uploadImage.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/extensions/core/uploadImage.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "48d062c2ee95bd77c537c539e6c8f8bc03bd71dcec94c5b82487c014ea3e9c06",
"git_blob_sha1": "58e43bb218171534c4713bdced29171ecb96d903",
"lines": [
1,
40
],
"claim": "LoadImage上传占位扩展,不是第二后端图片参数"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "rgthree",
"file": "py/image_comparer.py",
"local_file": "../seedvr2-reference/rgthree__py__image_comparer.py",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/py/image_comparer.py",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "43ccce9b6f9413d5196ce4a7a3ef544969ae1ce2b52c44345f6cc8fb28c596fc",
"git_blob_sha1": "079ebdbf6051fa86cf89f75f55f8502904d0c93f",
"lines": [
1,
40
],
"claim": "准确Comparer继承PreviewImage、可选A/B与UI描述符;未显式result出口"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "rgthree",
"file": "src_web/comfyui/image_comparer.ts",
"local_file": "../seedvr2-reference/rgthree__src_web__comfyui__image_comparer.ts",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/src_web/comfyui/image_comparer.ts",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "cb15118af030e39aaecdde072a79a7edd501344d2742dd6e296db55e12c14d34",
"git_blob_sha1": "3c648f8f8a36040cd6122ebc510dcc90bfb865fe",
"lines": [
1,
480
],
"claim": "准确Comparer前端Slide属性、rgthree_comparer对象/数组恢复;保存空列表不是历史图片"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "rgthree",
"file": "__init__.py",
"local_file": "../seedvr2-reference/rgthree____init__.py",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/__init__.py",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "06174f22e7246b2b0771961cc0681846f452b853ccb927ca507e074f340abc61",
"git_blob_sha1": "edf954cbbeafef1f99748e7927aa405ab73e3a1d",
"lines": [
1,
126
],
"claim": "准确rgthree注册入口"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "core",
"file": "LICENSE",
"local_file": "../seedvr2-reference/core__LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/LICENSE",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"git_blob_sha1": "f288702d2fa16d3cdf0035b15a9fcbc552cd88e7",
"lines": [
1,
674
],
"claim": "准确提交许可原文;未推目标安装或许可适用性"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "frontend",
"file": "LICENSE",
"local_file": "../seedvr2-reference/frontend__LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/LICENSE",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"git_blob_sha1": "f288702d2fa16d3cdf0035b15a9fcbc552cd88e7",
"lines": [
1,
674
],
"claim": "准确提交许可原文;未推目标安装或许可适用性"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"id": "rgthree",
"file": "LICENSE",
"local_file": "../seedvr2-reference/rgthree__LICENSE",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/LICENSE",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "b34faf7c3e2975fe08d0169958e2b39f076d4d4289cbe2560dd7dd5b1a613ed1",
"git_blob_sha1": "5a4eb87c0791b74af3db40c2a4d362469a8b6b43",
"lines": [
1,
21
],
"claim": "准确提交许可原文;未推目标安装或许可适用性"
}
]
@@ -0,0 +1 @@
2 files reformatted, 8 files left unchanged
@@ -0,0 +1 @@
5 files reformatted, 7 files left unchanged
@@ -0,0 +1,771 @@
{
"base": "1d04c00c0cc75df1d782b39ca7b70bb37362517b",
"files": [
{
"path": "calliope-backend/src/calliope/comfyui/__init__.py",
"sha256": "1d3488bcc2eadcd8a8f2e84ab4f6e9bdf52096b8af637c4da399db041d5a0543"
},
{
"path": "calliope-backend/src/calliope/comfyui/client.py",
"sha256": "ce30b3b3587d8f0dac86d534b99f31b95f1f4d0acb361babb45fd2be9513fe72"
},
{
"path": "calliope-backend/src/calliope/comfyui/companions.py",
"sha256": "7dde205059bf489e3d39539a8b42333b3947c3989d890441f70a45cf67d9ab04"
},
{
"path": "calliope-backend/src/calliope/comfyui/delivery_scope.json",
"sha256": "3a85718f877a63be54c843e2610b24dcc3013a6011f705d6348c91e2c7f78fd6"
},
{
"path": "calliope-backend/src/calliope/comfyui/delivery_scope.py",
"sha256": "0b849256dbb06f709c1ba856c34b3df04d2fccf09984a6e1fe1284b792eaf867"
},
{
"path": "calliope-backend/src/calliope/comfyui/dry_run.py",
"sha256": "f8bf4d1b91d959044de1dbc4aeb11bf0bb521f51f1928d36a46c670381a08ed7"
},
{
"path": "calliope-backend/src/calliope/comfyui/endpoints.py",
"sha256": "fc99a623850b581ae38843bbc3baf1b71ca9fd633e6103a34cb809a345e5a647"
},
{
"path": "calliope-backend/src/calliope/comfyui/h3_chain_reference.py",
"sha256": "a5c0ab92d99757c168648ddbc0418b23d2b871f674b153e9a240b75409cf5741"
},
{
"path": "calliope-backend/src/calliope/comfyui/h3_core_reference.py",
"sha256": "2913654b6ec3dabac1d36b1894064b8e077dd1d743d546e81667b317339f8a5f"
},
{
"path": "calliope-backend/src/calliope/comfyui/library.py",
"sha256": "b9cbfce28267642e6db3ebe9d591cf8dd260c7772a5a21a8d36cb98915eca13c"
},
{
"path": "calliope-backend/src/calliope/comfyui/library_cli.py",
"sha256": "04bfa8cfbe3f9378e78594958973118ec95aa1ff0bcdbdf4da0311abbdbcd380"
},
{
"path": "calliope-backend/src/calliope/comfyui/lint.py",
"sha256": "9b79bf162e13fb68321727fb17f96d6fc0c217d60db85de38235c4270bf9b4e3"
},
{
"path": "calliope-backend/src/calliope/comfyui/output_map.py",
"sha256": "36ed4ced825e4f7e1d389602085451b5cb9336b319d220f423f59f83fed6a70e"
},
{
"path": "calliope-backend/src/calliope/comfyui/parser.py",
"sha256": "a02d583c6a1cf7f85e77341a20308823771c233fb95241118a264e202a5230a0"
},
{
"path": "calliope-backend/src/calliope/comfyui/patcher.py",
"sha256": "8ac1417f0f78d952cdb219b10811a6ed7d4ce3bb0d561708858c4a8f5d15b45d"
},
{
"path": "calliope-backend/src/calliope/comfyui/preflight.py",
"sha256": "6629961d33204cbe5b3fc3d8a5a0a4de0c86d235e73f542d191429cf7f4bd2ec"
},
{
"path": "calliope-backend/src/calliope/comfyui/profiles.py",
"sha256": "4ca33343fc3f20e0fb82558cb428548f6415af04fb90213a694fb759515732f2"
},
{
"path": "calliope-backend/src/calliope/comfyui/protocol_references.json",
"sha256": "a10aaf98db9bb3b5ac6d1fc30b18c40cf315b34eee57ebb19470a6664e9221a4"
},
{
"path": "calliope-backend/src/calliope/comfyui/protocol_references.py",
"sha256": "ab9d948dd1bbf83dfce27186d6e48d9c3d5dff129305afd760fb3e77570b2916"
},
{
"path": "calliope-backend/src/calliope/comfyui/registry.py",
"sha256": "0382eda52a31f23c1c29dd7a62d0ffc93e10fcbb88872a5893b8fc93a2b2734d"
},
{
"path": "calliope-backend/src/calliope/comfyui/roles.py",
"sha256": "cc0b45eac2d881a6f7cc5ea88ceadb03f71715240a45257fef3a76bfc53d56c4"
},
{
"path": "calliope-backend/src/calliope/comfyui/serialization_reference.py",
"sha256": "67724fac65acbd397198271e1ed17b91f592f52da7ce8299e575d4c597d57fa1"
},
{
"path": "calliope-backend/src/calliope/comfyui/smart_fill.py",
"sha256": "adc34e80cca7a2b38cc834a713c9e64001caac84413af288389e5554e304bab6"
},
{
"path": "calliope-backend/src/calliope/comfyui/source_reviews.py",
"sha256": "b85e26f1e4fce77f75429b7bc0653401065b2cd28151bdf5d9edc87c096e9419"
},
{
"path": "calliope-backend/src/calliope/comfyui/structure_reference.py",
"sha256": "a9f3a8ed314a0c0a424c6781db4e83af3a85cb8b66b16b01380b5fecc3e1f0bb"
},
{
"path": "calliope-backend/src/calliope/comfyui/ui2api.py",
"sha256": "86a9c98ad72afa15aaf706bab8b39589a1cbca2e93da40d0aed9f963c14c0d1f"
},
{
"path": "calliope-backend/src/calliope/comfyui/validate.py",
"sha256": "c27fca69a604705b06809fdd692975ca0e7a08d05d558172962f8910a6a0491d"
},
{
"path": "docs/hel-892/supplied-api/01.api.json",
"sha256": "0ed76e088a23af43d6fecbf273fc0a983d7112e2b046d347f715afffac56d57e"
},
{
"path": "docs/hel-892/supplied-api/02.api.json",
"sha256": "daa40971b730076691721afe95e165932df94e3423f1fc44dcb7707026e7125b"
},
{
"path": "docs/hel-892/supplied-api/03.api.json",
"sha256": "91e6c2cea3747a03bbb71f661dbd016b28040781482b956365ff76a7a8b647ce"
},
{
"path": "docs/hel-892/supplied-api/04.api.json",
"sha256": "2066b07b2ca5390ba3e795df6b43934dab83865b12870b6ff26d8c0ef24f091e"
},
{
"path": "docs/hel-892/supplied-api/05.api.json",
"sha256": "95a01c1ea27a8279a6dc202820505099a94161d91e0789189b61208b09007af8"
},
{
"path": "docs/hel-892/supplied-api/06.api.json",
"sha256": "3e9176a5346ce8b8122b6da10f377fbeb894dc7c2c82a415f85ffc0dbfefc90b"
},
{
"path": "docs/hel-892/supplied-api/07.api.json",
"sha256": "b1b4f6a6c02d8d21701943c67b62805b1210fed17e7e26b618c58e112ea1d70d"
},
{
"path": "docs/hel-892/supplied-api/manifest.json",
"sha256": "f1367b4fa7a8377fb57512d17c80bc697d4d3abd0adb77adc3c06c6dedab69ea"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/ControlNet_aux_常用样例.json",
"sha256": "8898689d777330c4749a079cd762f573bb12a278c47a2fefbd066ffbdc122b6b"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/Minimax-H3提示词增强.json",
"sha256": "ffea53b27d52c63aa9ec9c60144489cc4f9e5a44d9478bcc297be9d9008f1a4c"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/birefnet_图像移除背景.json",
"sha256": "a6799c5022c13e46d2b1cf27809cd3c1e1d140a605fa226c19359682751fd036"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/sam3_图像视频-提示词遮罩分割.json",
"sha256": "5dbe1a7ab608ba6e9158369ff6498e9bb3f926d151a0ed31cf711c31b167c488"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/人物骨骼姿势提取/NLF_视频人物动作骨架获取.json",
"sha256": "1edc7ae5cca8e059577a9572d296c84e1683695e4f13a72388ff70473795ce97"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/人物骨骼姿势提取/openpose-video-姿态检测.json",
"sha256": "43f76f599f15058b6e62ae0dfb105518a37532008eed23ef7118e4950b37a608"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/人物骨骼姿势提取/sdpose_视频人物姿势骨架提取.json",
"sha256": "4586c72d8a906d4a956fb7d62307b81e57e4e345324c7e73f63103e56bfffd14"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/加载图片合成视频.json",
"sha256": "f5245d225f77cd64aefe6d0b8bb9342ec48a8a6293a533d65ea7304ce1b03f93"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/加载本地latent解码.json",
"sha256": "1fd83bd3f2d7950440189932b4c17718190af88daa4a93ac86474081dea9005b"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/双图像或视频合并显示.json",
"sha256": "61a0b1a2aa17a7d8c4f09f4f57e276eaf37227f69b5fc5789193005e593548c9"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像4种添加水印节点.json",
"sha256": "2eecd407d667d2ef6249061181edfdcfc417a2151627622f280d74aaac1794d8"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像分割-多宫格分割.json",
"sha256": "aeceb3fd00eb0966eebf8d8c89d90e2ad29d0aa8d02589aa05d52a6c145a4bcc"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像合并成四宫格.json",
"sha256": "fb5e5b346d51a79c19e611b76d39cf4b9491493723684bbb85ab3c49923467bb"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/图像嵌入文字描述.json",
"sha256": "938ad9ad0eed2253e9a5a9a9dc16dc6b0a22bf976a80af90aa1d0b56e42ba7d3"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/多视频合成分屏展示.json",
"sha256": "3c2f6558c199a7689546dc881df2b26dc31c02715fbc7b32f51caaa4601c13d7"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/截取视频每一帧.json",
"sha256": "43858b9121439a92e7ab35c2fb62b78e56fa93bcd0ad62679f2387f71fdec1fa"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/手动按分镜视频截取.json",
"sha256": "381bb5f3a6e2788d0dd3ee9594a97eaedb153611194d4f8fdde420cf47814132"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/Llama-cpp+Qwen3.5-提示词.json",
"sha256": "9071928ce74d5133401942583603a6bc98873263fbe4c32a438fe73cee81ce90"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"sha256": "1a94bdd5987955a29e403d128c2ea5ca0b6bc8a8d5ece145e1baba07146588b0"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/深度图/moge3_深度图_几何图_线稿图.json",
"sha256": "a50e8b9961fbdd83fa42ca121ff77b3c1b058c7e454ad374b0de7c60e7b8c4a9"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频-音频分离.json",
"sha256": "4861e3e33291ed962d2215b1d8cc976a4706d19719e3541e9cbb2c636683afc3"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频倒放.json",
"sha256": "8c760ea58d7ff664323f92a1174fe88300cd931c00201ccf437df1ad0067cb24"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/视频转gif动图图片.json",
"sha256": "39f7ddf60bf5958882215bd4227a85707f1f9003f2c5aaefc709a28b1ef16827"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/音频人声分离.json",
"sha256": "3c4bc0f7b1891e298a5d4e00072c6243a61b98d5fc0d86d82a476ecead43a1a2"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/音频转MP3格式.json",
"sha256": "c46e83b4fe8fc291e9de45b4af6cc50b566ab9377a51b50767315917dd13861b"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/RTX_image_upscale.json",
"sha256": "35bf9b7731e6199b5ccc113e31c248573f9ae74d1bb9302071a3a97524fea8c4"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/RTX_video_upscale.json",
"sha256": "ce189e5efdb1d608eaf7f7905f0dbf3776be2c199e143193c226ab497f2eb9ec"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json",
"sha256": "2be6b137efaaf25a54aaedc841a14ff3089afdc8a01a04af6353634b8457393f"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_视频放大.json",
"sha256": "06c427c688c13b87ed5724ac6b1ed432c31f8ea6c44212b3e7596b94128619da"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_视频放大FOR循环长视频.json",
"sha256": "576a9516292ed3e63b50c2a03fbfc1a99f9d643f526dc7fa3b98f6cb9832c893"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/VOSR2_图像超分放大.json",
"sha256": "87484f700a9a18d1bffbc61834af2b489a58171dcb4a225e210e695a30c85dd5"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/VOSR2_视频放大_分批循环长视频.json",
"sha256": "0f55316d2961a293a7d9f77b7993fd6f01bd5a41a4dca58f69f4d0b35c0aa6ea"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/图像放大比较.json",
"sha256": "1ca5938a963921b16c96649a97d3b1a9f75d810d3aabcd7ce472a30e5805f3e4"
},
{
"path": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/视频模型放大插帧(简单快速版).json",
"sha256": "bf47ba2462a3f683fe4f1d742b7dcde81a7a3f95e7e63c021e942a6c4f9ef071"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-ASR-Subtitle语音转字幕.json",
"sha256": "47f9afa955a6a5dce37000cb6a15bac7516d26ff50b6398bda334c825552cfd8"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-ASR-语音转文字.json",
"sha256": "958a3b7cb7070f4207901c79f13863b44ffcd0ed5c2c7fb4cd779e7964da0d65"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-TTS_多角色对话.json",
"sha256": "549a6502b3e0d4386323e6e67d6a9b4943b7a01eb59bdbe7adc7a920cfe5b690"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/Qwen3-TTS_语音设计+语音克隆.json",
"sha256": "9c75272e418064f46da96f6167448216a9390566e4b5d5e168d8cc5955447ab1"
},
{
"path": "example_ComfyUI_workflows/1-语音生成/index-TTS2-情绪控制-音频参考-文本控制-克隆-多人对话.json",
"sha256": "d2c469a8a17c6d1fcffb9a96700c38290895873d99c40d13d669bd45f6ea79de"
},
{
"path": "example_ComfyUI_workflows/2-音乐生成/ace_step1_5_xl_turbo_8Step极速音乐生成.json",
"sha256": "668fae23de5f84cc530fa4cab7381299cbc787b30c4597345b47e7f5c17415ef"
},
{
"path": "example_ComfyUI_workflows/2-音乐生成/ace_step_1.5+Qwen3.5_自动歌词音乐生成.json",
"sha256": "518085b1e8d12257e68427dcc0f01e6cda5018ec353fd90fdf366afb4fc89b85"
},
{
"path": "example_ComfyUI_workflows/2-音乐生成/minimax_music_文生音乐.json",
"sha256": "0a655ead5a0da406159dceb46451439df0c02050becaaa25b3018abb41840284"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Anima/Anima_Klein放大_超强动漫模型.json",
"sha256": "000843bc0e46844e556b04fc820ae1b2f7fa9bba1dd0ec21805c0c7ab27a647c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/10_flux2_klein_文生图-角色三视图.json",
"sha256": "e04e5bd04f03ce32b5221d37c5f7cffb0405b1471cb7be90b47b407d900a49b7"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/1_flux2_klein_文生图.json",
"sha256": "523905ac41323c626d7a156c88d02156cfa4758a70175cd7a3fba2a8c4fd449b"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/2_flux2_klein_图生图.json",
"sha256": "c0472959097f4e785205f41109c941dab26d12a874311834a7dc02c4616bbe9b"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/3_flux2_klein_图生图一致性增强(大雄lora).json",
"sha256": "c6af28d5bd72df5577f1e4d336974397494dd500fff23efd4afe81037514be71"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/3_flux2_klein_图生图一致性增强(小志lora).json",
"sha256": "43995837f89e5112afa74a57180dc356f7b4d4ef9e3a325984a2fc5ca1b7c651"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/4_flux2_klein_图生图_局部重绘.json",
"sha256": "d1d57bd401959975cbe6fd70f97706cec21bbed0a5ec3747447b9f192631f414"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/5_flux2_klein_图生图_扩图.json",
"sha256": "ad8c09e81b07aa7809a7d42f633d0b9069f704187e7a983bc2ac12bc3cbb8507"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/6_flux2-klein+Qwen3.5_转线稿洗图.json",
"sha256": "40a9fee073066914ac610f74dc7f7a49022bda63f5b89560d4bd635094a5c757"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/7_flux2_klein_图生图-动漫转真人.json",
"sha256": "8cab62c6b7b2401bb6b51ff4426aaad2a644fc6cfe49d974769fadf19c16a0a1"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/8_flux2_klein_双图编辑.json",
"sha256": "9d00eb7af7e8d49c54396e6dc2afe7770f99cf75ae765dc1b906c8c9e6b69d83"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein-图生图_人物动作迁移.json",
"sha256": "fc6daf483ac05fdc904ca402271223d14cc217ea4c81a17ba2ef4cae993aefe7"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_图生图_人物迁移.json",
"sha256": "81409bdcd546102a7a6d5b7e32578912bf7ad4f89b35718de0401ceed624225e"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_图生图_印花提取.json",
"sha256": "8768dec340e35dbd70f928d8bbc34813b2bd45f5c270c405d4495b92da478337"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_图生图_老照片修复.json",
"sha256": "922c534d70b85beacc2cd51354552ed1d850dbb611b20f2d6981c4e524ce06c5"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Flux/flux2_klein_服装迁移.json",
"sha256": "e3f01ba44f3628297e714b4307ed959758f04e0415093dc5ec690857384a8386"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_Image2.1_图像编辑_VNCCS任意角度-任意姿势.json",
"sha256": "a5a675500a473214eaeb1d25dc1eda83b57bba3a17d18f1f0042bee62b474314"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_一键16张姿势图.json",
"sha256": "248b6c5ae28d5a44035c5ad91bcdfa458360a67598eaa4d195c3fb6853b18a49"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_动漫转真人.json",
"sha256": "1aa1d3641f82533f99d99567c2708919438b9efbfc6623d684a9a88b876b75cd"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_提示词增强.json",
"sha256": "ebf173eb9d871717534a379d451d4a08ca06c3b677b552de12a5d51dbe8febf2"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_深度-姿势-线稿-硬边缘-控图洗图.json",
"sha256": "b6e232082089dd9c4046e0dc5bd1d046907525b8cb01758fb804b5f4aa11275e"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_背景移除.json",
"sha256": "d225102993ad5aa08e619bd7f1e5abbfd54e2d5ac8d8be1eacf09722107c4c9e"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_角色BFS头部迁移.json",
"sha256": "6a9da127ee2bccafeff7499ab3d62f349aec1eff4265cb211bdec578dba1fe7b"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_图像编辑_角色表四视图.json",
"sha256": "0036c02e1ab22f44c94bd9f311d5254d7b3b0cea25211bc4ff1e92cd90e0acdf"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生_多图编辑_8步lora加速.json",
"sha256": "172b8fff0b531fbea367e79aa6b5ed1e6b59cab2ce6cb23d324092d5b55a3f97"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生_多图编辑_提示词增强(N版).json",
"sha256": "ae6521e5f42bef0b887f754c2fec5961d612afc464fbd98940a976a9795662c6"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生_多图编辑_透明背景.json",
"sha256": "5853f21657d56e97a6b625c4487e23473b846fa8c96dc292f3700b3075245a39"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生图_提示词增强.json",
"sha256": "dfe10917d101bf1a8a8c20750f4360690ecd478e9eb33d16a59ea0c6f12c086c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Qwen-Image-2.1/Qwen_image2.1_文生图_角色表四视图.json",
"sha256": "6fd307b02b7ba29858723e283580c1cf4ab1fce8804a3ced1f4fc37934965392"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/10_Z_Image双采样+Fluax2-klein修复-高清直出.json",
"sha256": "043cd2abe731996b80637d87b9a799e412e08b9a15e4b7c2f4440fbcff2487b9"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/11_Z_Image_Turbo+模型放大_图像4K高清放大.json",
"sha256": "baaa0cd969a28abe5e6ab19b3d7f6e161468cd15c970fe4bd9922afbe09ab4da"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/12_Z_Image_Tubro_文生图_SeedVR2高清放大8K.json",
"sha256": "8d79bcd44a7843ac5df9fbcd372a6327ba72274260ef463c46ec85709da7846a"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/1_Z-Image-Tubro_文生图.json",
"sha256": "36713b1a3f5c4f2992c7edef2e1e8c3246d44d28ecc750b87f4353a08c3b5ab0"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/2_Z-Image+Base+Turbo+双重采样工作流.json",
"sha256": "27108ae85715b147f63d8640ee032484c70a21633e2c6234eed346079b9aba2c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/3_Z-Image_文生图(摇光梦幻).app.json",
"sha256": "58e88cacc6e1375cad39023e39eb1728eb36e63acce3c46fca40898d706b1d42"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/4_Z-Image+Qwen3.5-文生图.json",
"sha256": "56bd28b5253fe734e851abd81c7851d00c62e4dbf37a22d97781d93ec367a35d"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/5_Z-Image+Qwen3.5提示词反推_文生图.json",
"sha256": "910317a123e658f26e48ad5cd144d28b7f31e0d43cbdb3ed567048c7917b5c73"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/6_Z-image_局部重绘.json",
"sha256": "f60e734b6ed9e678571ad7666411d6282065c38abe3e9c29ea4c5cc1c3455505"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/7_Z-image+Controlnet_图像扩展.json",
"sha256": "82cda5dca2e224a5b042daecba4c3c1405a825648a9e9ced29fe21e58f7e55f8"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/8_Z-image+Controlnet_姿势控制-洗图.json",
"sha256": "babc1dbeb3bb4981e338d8317ff9fb6fd8c28913bf47a2e2e3eb5409439447bf"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/9_Z-Image+Flux2-Klein_风格重新编辑.json",
"sha256": "3734f261691c3ad13d29b30d88e91f671d9c548f723e77d78651c7155b06c408"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_插图漫画.json",
"sha256": "02ea31b959de72f9b5c00a92f21b4e17bbc2bf5a54495093a204957771a88039"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_照片摄影.json",
"sha256": "740d7d41b3248978dca2046d9a2ea99d3a66ef081d45609782d2847f04f7e0c8"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_通用a_.json",
"sha256": "e58341a99587077a69baf3cec62d9ae7bb0ce02a87cb3973ce3134c04a119b23"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/Z-Image/Z_Image_turbo_十八种风格_通用b.json",
"sha256": "8d9e66744e0266c5f53a6396e030c38bb90053f2525ac9c3c6cc1b321006a976"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/Krea2_turbo_文生图_4_6_8宫格故事板.json",
"sha256": "776b2f92f8906232c2ffe1b25c8b9cfe3398bfe45a9f80715f6ce5acc03e96b4"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/Krea2_turbo_文生图_极致写实双采样2k版(N版).json",
"sha256": "50433cee0d5bab60a2cce44d73adbe5fe9b486c039bc89e1caef640fe6e0b28d"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/Krea2_turbo_文生图_角色三视图双采样2k版.json",
"sha256": "64bb5eb4e5399d307c12553717b8a1f0046f48b625b16e62d40e962b6bec1847"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2-Edit-Anything2Real_动漫转真人v3.json",
"sha256": "0d482e6c6fac70af6dd5549e8a464ee080a0ec135350d72d32a4ce4a8fd05bbe"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_identity_edit_图像编辑.json",
"sha256": "c208883f17eb873063a4febaef636f0fa065131fc82bc4b0b26eff41f442719a"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图 (N版).json",
"sha256": "935fc592ead1a89614470d41c512e2d7b4a41a6887f71a0a8d8f4c071a60e3c9"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图.json",
"sha256": "6b317af2bda225d9441074ef330669b4537e95c705987223efafd2705dbbc344"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_2万提示词随机模板+4千种风格选择.json",
"sha256": "599bb58d48d68de929e7ec476f77e9f7c736c00235b68570416d214d3b4e391c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_Qwen3.5自动提示词生成.json",
"sha256": "afafb0e0ebdc445a7534041589b7f6a580e0b15b8293c2fd26907474892f5957"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_动漫风格2.5D半写实.json",
"sha256": "3faf9b1f0a20c7d21367af1721583a7402f048e18991025f9afff192ff8fe077"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_动漫风格Image2风格.json",
"sha256": "bf65d0080ab80a5934855a0dbc7a5e167300bb54e24a18e05e4321a70ec838ea"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_动漫风格线条动漫.json",
"sha256": "9bab028943604b4b167a56dcc51475f67bac897c9eae3c7bf9d311b2c5cb7d91"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_图像风格参考.json",
"sha256": "8c248ccc44df79b475c81e0bb260596ece066d65f2a21c0b2a72dc6b2441b170"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_奇幻现实风格.json",
"sha256": "7a2af26c48114c7f1a7741a5cded07c0cceb68c4e69410de8af6429eb6b5041c"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_极致写实(N版).json",
"sha256": "ec98804940c28956af1719096751bba2d274eef8a251b97207ac655a05779384"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_细节增强.json",
"sha256": "faa28f85fbd80ec9c3aba76749d6447c1d3b4a8489c88853ebde665a4f78ef10"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_美学质量增强.json",
"sha256": "fbca5f24abf71f10ed5e2b90012aab1c25c6632a18541fbf0412b8845f603b85"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/krea2/krea2_turbo_文生图_赛博朋克现实风格.json",
"sha256": "a353acdb89b02462abed5f1513acfcb4f538c50ab5bc8ede8e8597f3ce8eea60"
},
{
"path": "example_ComfyUI_workflows/3-图像生成/肖像大师_美女提示词生成.json",
"sha256": "4ff20f7350813ec74fc054971b4532200d61661951c103c89f7729f89f7be2ff"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_FastH3_i2v_图生视频8步极速.json",
"sha256": "c5eff277eeeeefacb39c4af2e5ac41251785cc18ca90c1678a653367f4dd5942"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_FastH3_t2v_文生图8步极速.json",
"sha256": "ed4a30da03245f35ff9006ac64cd045c1b9c64eb8b585520dbbb418f6793fc78"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_多参考_双采样潜空间放大.json",
"sha256": "8b97388e142ddb67c84f2cbe0bb68c10f519e7615d75f1ea0005580fe4537ab2"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_孤海智能一体化(多合一简化版).json",
"sha256": "827f43d5d9bdb6f2d6f4d8b69e86708e6d08642ed0df04bee15087d10b9a0e35"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台MiniMaxH3_多合一多分段拼接.json",
"sha256": "34fde3a91f9ef932adc2837cc9d4254bf75a3251ad5c6474d90e4085690cbafc"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_双采样多段循环-PV动画尾帧衔接.json",
"sha256": "c8a442bd8cae8dcd75a6a01847ca99b75dcc37ef8ff0a855c82213ed25e943e0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_双采样潜空间放大.json",
"sha256": "2434bd48e3c29abf9e6ed0931f3c8825481772a134a065f6cfdd3c0b89ba81b7"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_文-图-参考-分段循环-双采放大_多合一.json",
"sha256": "698430e2b234a107b15f1bebf7704833afeea819bd21a3af56f7121daa1383e0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_文_图_首尾_参考多合一(单采样).json",
"sha256": "526986a02875bbefebeb8a81cce9b58a8e764ab0c0092b2d8e858ecfac771638"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_短剧创作-多宫格分镜参考.json",
"sha256": "d2850f5fb3e5b54e3e4ec9e17f34bdb11bf7009728b5e585c769fb2f11f80275"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_短剧创作-音频参考.json",
"sha256": "c188a7383a6c7a0dbd5d4d0717527b096ec73c1232373ee50c731bceefcfe7fb"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频人物替换.json",
"sha256": "dce57cfc239c9f90cda2107fff5614b2cb0944e0441d9d8137b3f1c325f41a7a"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频参考+多参图-SelfLift双采样潜放大.json",
"sha256": "97ec7f73f32126aa24798fc65736734dfa839b74d25c4b2a94021abe063f06d7"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台_视频参考+多参图.json",
"sha256": "40f92a22aa66c9d87b876784e33b02471339d64504e22e1672155608fbcbf079"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_导演台时间线素材_双采样潜空间放大_多分段拼接.json",
"sha256": "172eb8af3aca70082941427520fdcca06568957bab3d39101c5e9d6641b45e4a"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_音频MV_多参长视频分段_Selflift双采潜放大_Qwen3.8官方Skills自动提示词.json",
"sha256": "bdc93d36fb8a4728dfa8031d1f00782d68e8e6aedd718b166f57e54216f2882f"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/MiniMax_H3_音频数字人_SelfLift双采样潜放大分块_Qwen3.8官方Skills自动提示词.json",
"sha256": "903e32248fc0c53df36c5841f4f4ccdb5fb8190a39c6c9015d3e55a451aaf7eb"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双时钟采样_参考生视频-8步高质量极速版.json",
"sha256": "fae96106a128342a6903bd32680463d1be98c0d5ad738d2fff40fc0f52a35389"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双时钟采样_图生视频-8步高质量极速版.json",
"sha256": "97f188c9295af0dbe6358a4b23117ca1612e812d2fa3df67dd7b10ee68e96fb5"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双时钟采样_文生音视频-8步高质量极速版.json",
"sha256": "5b45b49ebe4402c207e7d894e03a1bb53482b24a0c09ce50d549be4a01f9c6d0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_T8双采样_潜空间放大_参考生视频.json",
"sha256": "fab48be409cf423aaed7be268c6655ae39ecd1733218413c51874c5ba2ad0bdf"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_r2v_参考生视频_双采样潜空间放大+Qwen3.8官方Skills自动提示词.json",
"sha256": "4c1305fdfe6d5643e64a7b6c99cc92e331ffc9475f30fef5e0119c887367aab0"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_视频动作参考_SelfLift双采样潜放大_Qwen3.8官方Skills自动提示词.json",
"sha256": "2be3981360fff849a53a928a6a2040c97bcf1944dce2df82d716a805c0ef2594"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/Minimax_H3_音频数字人_单采样.json",
"sha256": "77b665bf6bcd11195f424d42d88f5142b43b0c608af776eef5744aca896f4b56"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/minimax_h3_i2v_图生视频.json",
"sha256": "a071e6070ee933396f225b4447c363bbf6b0df059b3cd43da567e81bc7937e84"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/minimax_h3_r2v_多参生视频.json",
"sha256": "89166eb9cce4c9177a0f9a0a3a058e140429413e7beb3692e7ee5c30b76bc4fb"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/Minimax-h3/minimax_h3_t2v_文生视频.json",
"sha256": "039d46a5bbb809b84fab3b42c777118f91d0c06835555d54410631742584f1be"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/uncensored/minimax-h3多参生视频无审核版.json",
"sha256": "e501089f36c4c7f76a9e926e09ab9c467316d0778e62dff4c9e9faa6b155cb83"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/uncensored/minimax-h3文生视频无审核版.json",
"sha256": "07baed6dd4a259701f7e5563fa1f19799fbbb558668d09a74876db3729fff3a2"
},
{
"path": "example_ComfyUI_workflows/4-视频生成/uncensored/minimax-h3首尾帧生视频无审核版.json",
"sha256": "d47d3e995858a9c581863a593d89d4f6a24ea04014a1df3faeffa7e07cb19537"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_I2V_InfiniteTalk_rCM_数字人对口型多动态(KJ版).json",
"sha256": "90fb512939d5bbaebfd3462d8edd019ad388611951748e6df09993ddd7f3a36f"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_I2V_InfiniteTalk_提示词调度动作控制图生视频数字人(KJ版).json",
"sha256": "98b4c399948f99aeac9326b4de9638d9a7bc3d718edd2561ab745f6bec12478c"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_infinitetalk_音频驱动视频配音-单人for循环长视频(官流).json",
"sha256": "ebd0c2823b70e5121f9642f781f2d0fa32cda6abe7d4a68fb0eecacc30e92d06"
},
{
"path": "example_ComfyUI_workflows/5-数字人/Wan2.1_infinitetalk_音频驱动视频配音-双人for循环长视频(官流).json",
"sha256": "87412366e6bedd2a2f4490d1a945d0fc005251bb49a20e4ba1157cd6c4ddfbcd"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.1_SCAIL2_角色迁移_动作迁移_FOR循环长视频.json",
"sha256": "60d7a6c9b1b567d726ffd0981de3d8afb3675f88b320733d8442081d849b0ba8"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.1_Scail-2_动作迁移_WanAnimatePlus_v4.2.json",
"sha256": "f0da1e6c1eab5706d29d8d12897db0cea0d9d5f7a73b4882cf07ef2a626dda45"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.1_Scail-2_角色迁移_WanAnimatePlus_v4.2.json",
"sha256": "395dc48ad21d9da6a3a815654922193a9893696015154f53be0cc6f484882637"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.2_Animate_SAM3-人物迁移-动作迁移-长视频循环(KJ流).json",
"sha256": "3ea95e56f193c046937ad246087292865a809d2cc26571357c22fff415295f41"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan2.2_Animate_人物遮罩替换(官流整理).json",
"sha256": "394c3c31ad05255d3eb130f309d8445764f4d3772b40fa07fbf19708bfcc1002"
},
{
"path": "example_ComfyUI_workflows/6-动作迁移/Wan_Animate2_动作迁移_for循环长视频.json",
"sha256": "22b7853e22629822dd354b0b768e2961a53b4c2f480cfaceeaea9dc51c0f0d0b"
},
{
"path": "example_ComfyUI_workflows/Krea2_t2i_20260818_API.json",
"sha256": "dcf5fad9b464e4154d8ec7ba7af1c21987cb0153c7df747266a02de9f24e1313"
},
{
"path": "example_ComfyUI_workflows/MiniMax-H3-Turbo-R2V-Extend-2Refs1Vid_API.json",
"sha256": "080a17d7ae079f278518de1af15b880a4404105ec89edbac4fd82cf16097b757"
},
{
"path": "example_ComfyUI_workflows/krea2_T2I_CharSheetV1_API.json",
"sha256": "6a991229721d0a501846bf0bc55f793d1ab5225be28b2c9eea485fed56ed5b40"
},
{
"path": "example_ComfyUI_workflows/minimax_h3-Turbo_Image2Video_20260813_API.json",
"sha256": "3d895b01e72c10008c036a9c65fa281b3dfe0d0808417089960fd8f4b56c48ce"
},
{
"path": "example_ComfyUI_workflows/minimax_h3-Turbo_Text2Video_20260813_API.json",
"sha256": "55c6d0e7fb323e05c3d9373606607e0e8fefb3127cac356b03e29f19b7aaa4ed"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_2ref_API.json",
"sha256": "56ab7cbf2402f94000eb1df2b5415f90f36a2821e68f1c35af17a2d9498e7c49"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_3ref_API.json",
"sha256": "2a687133f175180584ebfc3b4318f29cfcac3a24a0f422e1b9c77e6b16c9862a"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_4ref_API.json",
"sha256": "0b00bfc29ad48f8af3c7b6ebc1dcaa03b809b33c24bc31dadc628289480b154a"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_5ref_API.json",
"sha256": "0b6c1bee6507c2485aa115d3b6c038c6c3dabf1ce8569205f8ece50e58f4e909"
},
{
"path": "example_ComfyUI_workflows/video_minimax_h3_r2v_API.json",
"sha256": "29f440f7123b9ce64e0fda01ee3cdafb7f87408c47c1fe46c2b73f88682eae0c"
}
],
"original_files": 156,
"all_unchanged": true
}
@@ -0,0 +1,69 @@
{
"base": "1d04c00c0cc75df1d782b39ca7b70bb37362517b",
"first": {
"imported": 155,
"user_excluded": 1
},
"upgrade": {
"skipped": 154,
"updated": 1,
"user_excluded": 1
},
"repeat": {
"skipped": 155,
"user_excluded": 1
},
"restored_rows": 1,
"untouched_whole_rows": 154,
"eligibility_unchanged": true,
"redo": {
"skipped": 154,
"updated": 1,
"user_excluded": 1
},
"user_protection": [
{
"phase": "user-before",
"counts": {
"skipped": 154,
"conflict": 1,
"user_excluded": 1
},
"whole_rows": 1,
"columns": 29
},
{
"phase": "user-after",
"counts": {
"skipped": 154,
"conflict": 1,
"user_excluded": 1
},
"whole_rows": 1,
"columns": 29
}
],
"fresh": {
"imported": 155,
"user_excluded": 1
},
"fresh_repeat": {
"skipped": 155,
"user_excluded": 1
},
"states": {
"pending_check": 16,
"needs_conversion": 139
},
"source_named_fields": 1217,
"positional_widgets": 3660,
"companion_values": 294,
"new_saved": 37,
"new_notes": 1,
"old_saved": 904,
"old_notes": 21,
"overviews": 31,
"all_disabled": true,
"doc_done": 0,
"executed": 0
}
@@ -0,0 +1,3 @@
All checks passed!
12 files already formatted
PASS 12 authored Python files and one JS syntax check
@@ -0,0 +1,125 @@
F841 Local variable `reg` is assigned to but never used
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:97:5
|
95 | "倍率按round计算宽高再common_upscale;无输入尺寸实测",
96 | )
97 | reg = ref("core", "nodes.py", 2048, 2140, "准确核心静态注册表,含SaveImage和采样/编解码/加载器")
| ^^^
98 | extra = ref(
99 | "core", "nodes.py", 2372, 2513, "准确核心内置extras模块调查集合,nodes_seed.py为必要候选"
|
help: Remove assignment to unused variable `reg`
F841 Local variable `mask` is assigned to but never used
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:108:5
|
106 | "准确nodes_seed.py全文调查;只对该集合下结论,不借新版或插件同名实现",
107 | )
108 | mask = ref(
| ^^^^
109 | "core",
110 | "comfy_extras/nodes_compositing.py",
|
help: Remove assignment to unused variable `mask`
E501 Line too long (107 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:204:101
|
202 | "准确提交许可原文;未推目标安装或许可适用性",
203 | )
204 | # default, unit, limits, effect, citations. Values are read independently from source, never generated.
| ^^^^^^^
205 | common = {
206 | "seed": (
|
E501 Line too long (105 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:227:74
|
225 | "无量纲",
226 | "0.0~100.0,step0.1/round0.01",
227 | "原JSON int1与FLOAT schema分开;宿主边53覆盖内部54.cfg。条件来自61正负出口,效果/兼容未知。",
| ^^^^
228 | [sampler],
229 | ),
|
E501 Line too long (153 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:275:73
|
273 | …
274 | …
275 | …ize先round宽高再插值,lanczos为插值算法,与后续模型超分分别说明;输入/输出尺寸和效果未知。",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
276 | …
277 | …
|
E501 Line too long (176 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:371:91
|
369 | …
370 | …
371 | …MAGE出口并result=(images,),与源边67兼容。条件PNG保存/UI文件描述符不是已保存证明,也不是再次加载文件。",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
372 | …
373 | …
|
E501 Line too long (282 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:379:76
|
377 | …
378 | …
379 | … 9.SaveImage出口,二者都是处理链结果,不标成原图/放大图对比。准确后端继承PreviewImage但compare_images只返回UI,未显式result;源声明images IMAGE出口未接,实际可消费性未知,保持转换关闭。",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
380 | …
381 | …
|
E501 Line too long (307 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:487:59
|
485 | …
486 | …
487 | … 。保存倍率4、lanczos插值;比较A来自子图,B来自保存节点,不能当成原图与放大图对比。准确core支持SaveImage图像出口,但三类SeedVR2实现尚未证实,模型路径也有差异;仅参考、转换关闭、未实跑,实际尺寸、显存和画质未知。"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
488 | …
489 | …
|
E501 Line too long (267 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:493:94
|
491 | …48.VAEEncodeTiled。52.UNETLoader→54.model及61.SeedVR2Conditioning.model;48.latent→61.vae_conditioning和54.latent_image;61正/负槽→54.positive/negative;54→55.VAEDecodeTiled→59.…
492 | …moted保存记录,不制造代理列表或seed控制。边50倍率→57.slot2;51seed→54.slot4;52steps→54.slot5;53cfg→54.slot6;54sampler_name→54.slot7;55scheduler→54.slot8;56denoise→54.slot9…
493 | …_convrot.safetensors;宿主VAE seedvr2_ema_vae_fp16.safetensors与内部ema_vae_fp16.safetensors不同。Note模型URL与目录仅推荐源文本,不执行链接/下载,不替换保存值或证明安装。",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
494 | …1非效果保证。temporal_size4096仅视频VAE窗口,实际单图批次、输入尺寸、内存与设备未知。54内部fixed前端控制与宿主seed分开,不求随机数/不构造prompt。",
495 | … 调查集合;tree无seedvr命名文件且这些文本未证实SeedVR2Preprocess/Conditioning/PostProcessing,不能证明全仓绝对不存在,更不借新版本/插件同名补缺。该实现身份、默认/单位/范围和模…
|
E501 Line too long (264 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:496:94
|
494 | …1非效果保证。temporal_size4096仅视频VAE窗口,实际单图批次、输入尺寸、内存与设备未知。54内部fixed前端控制与宿主seed分开,不求随机数/不构造prompt。",
495 | … 调查集合;tree无seedvr命名文件且这些文本未证实SeedVR2Preprocess/Conditioning/PostProcessing,不能证明全仓绝对不存在,更不借新版本/插件同名补缺。该实现身份、默认/单位/范围和…
496 | …t文本/许可。Comparer继承PreviewImage,父core SaveImage有IMAGE返回但override compare_images仅UI无显式result;前端Slide与rgthree_comparer恢复分层,保存[[]]不是缓存图片。",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
497 | …_added_by_ue空不证明无改写。guhaiImageValue、previewExposures源指54均仅属性,身份/恢复实现未知,不生成预览。准确宿主先属性/保存值再onConfigure,子图先定义槽再父configure、再…
498 | …1缺widgets_values,非[],不补值。旧30块904位置+21注释逐对象不变;现31块941位置+22注释仅参考。155完整定稿0/必要实跑0/新增转换0;145UI仍9参考候选136关闭。",
|
E501 Line too long (320 > 100)
--> docs/hel-892/seedvr2-document-evidence/build_definition.py:497:77
|
495 | … 调查集合;tree无seedvr命名文件且这些文本未证实SeedVR2Preprocess/Conditioning/PostProcessing,不能证明全仓绝对不存在,更不借新版本/插件同名补缺。该实现身份、默认/单位/范围和模型适配均未知。",
496 | …t文本/许可。Comparer继承PreviewImage,父core SaveImage有IMAGE返回但override compare_images仅UI无显式result;前端Slide与rgthree_comparer恢复分层,保存[[]]不是缓存图片。",
497 | …_added_by_ue空不证明无改写。guhaiImageValue、previewExposures源指54均仅属性,身份/恢复实现未知,不生成预览。准确宿主先属性/保存值再onConfigure,子图先定义槽再父configure、再代理恢复;不能推UE/guhai/preview扩展加载和最终值。",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
498 | …1缺widgets_values,非[],不补值。旧30块904位置+21注释逐对象不变;现31块941位置+22注释仅参考。155完整定稿0/必要实跑0/新增转换0;145UI仍9参考候选136关闭。",
499 | …
|
Found 14 errors (3 fixed, 11 remaining).
No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,7 @@
added 255 packages, and audited 256 packages in 1s
59 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
@@ -0,0 +1,23 @@
[
{
"file": "fixed_document.py",
"sha256": "2443993bec9f5456ee31312535d33e05653e0e7cd205f553cca19d8dd10cf7c8",
"wheel": true,
"sdist": true,
"definitions": 31
},
{
"file": "source_reviews.json",
"sha256": "5fee876e9ac3ba844b4004533add134461f1a64668a207a2f743db85f4b8868b",
"wheel": true,
"sdist": true,
"definitions": 31
},
{
"file": "library.py",
"sha256": "b9cbfce28267642e6db3ebe9d591cf8dd260c7772a5a21a8d36cb98915eca13c",
"wheel": true,
"sdist": true,
"definitions": 31
}
]
@@ -0,0 +1,3 @@
{
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json": "d623448c377ac5883c52bd3689aca85a9e4dafb2060f407f66e8d7bba83ed817"
}
@@ -0,0 +1,14 @@
{
"number": 25,
"state": "open",
"merged": false,
"html_url": "http://gitea.xbay.cc/leefer/aigc-home/pulls/25",
"head": {
"ref": "agent/agent/a64a969a6a44",
"sha": "1d04c00c0cc75df1d782b39ca7b70bb37362517b"
},
"base": {
"ref": "main",
"sha": "1fc8bdb8bb2a88ccace6f21a507fd77bcf22f532"
}
}
@@ -0,0 +1,14 @@
[
"calliope-backend/src/calliope/comfyui/fixed_document.py",
"calliope-backend/tests/test_seedvr2_fixed_document.py",
"e2e/run-seedvr2-document.py",
"docs/hel-892/seedvr2-document-evidence/build_definition.py",
"docs/hel-892/seedvr2-document-evidence/check_code.py",
"docs/hel-892/seedvr2-document-evidence/fetch_sources.py",
"docs/hel-892/seedvr2-document-evidence/rebuild.py",
"docs/hel-892/seedvr2-document-evidence/recompute.py",
"docs/hel-892/seedvr2-document-evidence/render_report.py",
"docs/hel-892/seedvr2-document-evidence/repeat.py",
"docs/hel-892/seedvr2-document-evidence/request_counts.py",
"docs/hel-892/seedvr2-document-evidence/verify_sources.py"
]
@@ -0,0 +1 @@
PASS one definition; other 155 reviews and old 30 blocks unchanged
@@ -0,0 +1,64 @@
"Add one reviewed definition; preserve every other review object exactly."
from __future__ import annotations
import hashlib
import json
import subprocess
from build_definition import OUT, PATHS, REPO, build, canonical
BASE = "1d04c00c0cc75df1d782b39ca7b70bb37362517b"
RESOURCE = "calliope-backend/src/calliope/comfyui/source_reviews.json"
def build_all():
previous = json.loads(subprocess.check_output(["git", "show", f"{BASE}:{RESOURCE}"], cwd=REPO))
reviews = json.loads(json.dumps(previous, ensure_ascii=False))
for i, path in enumerate(PATHS):
block = build(i)
assert reviews[path]["source_sha"] == block["source_sha1"]
assert "fixed_version_document" not in previous[path]
reviews[path]["fixed_version_document"] = block
return reviews, previous
def main():
current = json.loads((REPO / RESOURCE).read_bytes())
reviews, previous = build_all()
(REPO / RESOURCE).write_text(json.dumps(reviews, ensure_ascii=False, indent=2) + "\n")
pins = {}
for i, path in enumerate(PATHS):
block = reviews[path]["fixed_version_document"]
pins[path] = hashlib.sha256(canonical(block)).hexdigest()
(OUT / f"definition-{i}.json").write_text(
json.dumps(block, ensure_ascii=False, indent=2) + "\n"
)
# Explicit maintenance of the code-owned allowlist, never trust runtime caller digests.
module = REPO / ("calliope-backend/src/calliope/comfyui/fixed_document.py")
text = module.read_text()
for path, digest in pins.items():
old_block = current[path].get("fixed_version_document")
old_digest = hashlib.sha256(canonical(old_block)).hexdigest() if old_block else None
if old_digest and old_digest in text:
text = text.replace(old_digest, digest)
elif digest in text:
pass
else:
text = text.replace(
"DEFINITIONS = {",
"DEFINITIONS = {\n (\n"
+ "".join(
" " + repr(path[i : i + 40]) + "\n" for i in range(0, len(path), 40)
)
+ " ): "
+ repr(digest)
+ ",",
)
module.write_text(text)
(OUT / "pins.json").write_text(json.dumps(pins, ensure_ascii=False, indent=2) + "\n")
print(("PASS one definition; other 155 reviews and old 30 blocks unchanged"))
if __name__ == "__main__":
main()
@@ -0,0 +1,2 @@
PASS exact sources 32 citations 30
PASS actual 1d04c00 upgrade1/skip154, repeat155, rollback1, edits1/29cols, fresh155, 1217/3660/294, 31 definitions, frozen boundaries, wheel/sdist
@@ -0,0 +1,330 @@
"Actual 1d04c00 upgrade, one-row protection/rollback, frozen boundaries and packages."
from __future__ import annotations
import hashlib
import io
import json
import os
import sqlite3
import subprocess
import sys
import tarfile
import tempfile
import zipfile
from pathlib import Path
from build_definition import OUT, PATHS, REPO, canonical
from rebuild import BASE, RESOURCE, build_all
sys.path.insert(0, str(REPO / "calliope-backend"))
def write(name, value):
(OUT / name).write_text(json.dumps(value, ensure_ascii=False, indent=2) + "\n")
def require_packages():
dist = REPO / "calliope-backend/dist"
w = sorted(dist.glob("*.whl"))
s = sorted(dist.glob("*.tar.gz"))
if not w or not s:
raise SystemExit(
(
"缺少wheel/sdist包产物,请先在仓库根执行:"
"uv build --project calliop"
"e-backend --offline"
)
)
return w[-1], s[-1]
def main():
from calliope.comfyui.fixed_document import DEFINITIONS
from calliope.comfyui.library import rollback_batch
from scripts.audit_library_documents import audit
wheels, sdists = require_packages()
from verify_sources import main as verify_sources
verify_sources()
rebuilt, previous = build_all()
assert rebuilt == json.loads((REPO / RESOURCE).read_bytes())
old_blocks = {
p: r["fixed_version_document"] for p, r in previous.items() if "fixed_version_document" in r
}
assert len(old_blocks) == 30
assert all(rebuilt[p]["fixed_version_document"] == b for p, b in old_blocks.items())
assert sum(len(b["fields"]) for b in old_blocks.values()) == 904
for p, d in DEFINITIONS.items():
assert hashlib.sha256(canonical(rebuilt[p]["fixed_version_document"])).hexdigest() == d
write(
"review-delta.json",
dict(
base=BASE,
changed_paths=PATHS,
other_reviews_unchanged=155,
old_blocks_unchanged=30,
old_saved=904,
old_notes=21,
new_saved=37,
new_notes=1,
total_documents=31,
total_saved=941,
total_notes=22,
),
)
with tempfile.TemporaryDirectory() as directory:
work = Path(directory)
old = work / "old"
old.mkdir()
data = subprocess.check_output(["git", "archive", BASE, "calliope-backend/src"], cwd=REPO)
with tarfile.open(fileobj=io.BytesIO(data)) as a:
a.extractall(old, filter="data")
db = work / "library.db"
def run(name, historical=False):
out = work / name
env = {
**os.environ,
"PYTHONPATH": str((old if historical else REPO) / "calliope-backend/src"),
}
subprocess.run(
[
sys.executable,
"-m",
"calliope.comfyui.library_cli",
"import",
"--root",
str(REPO / "example_ComfyUI_workflows"),
"--db",
str(db),
"--source-commit",
BASE,
"--companions",
str(REPO / "docs/hel-892/supplied-api/manifest.json"),
"--output-dir",
str(out),
],
cwd=REPO,
env=env,
check=True,
stdout=subprocess.DEVNULL,
)
return json.loads((out / "import_report.json").read_bytes()), out
def rows():
with sqlite3.connect(db) as c:
c.row_factory = sqlite3.Row
return {
r["source_repo_path"]: dict(r) for r in c.execute("SELECT * FROM workflows")
}
first, _ = run("historical", True)
before = rows()
assert first["counts"] == {"imported": 155, "user_excluded": 1}
assert all("fixed_version" not in json.loads(before[p]["doc_json"]) for p in PATHS)
assert all(
json.loads(before[p]["doc_json"])["fixed_version"]["matched"]
for p in DEFINITIONS
if p not in PATHS
)
original = db
protected = []
def protect(name):
nonlocal db
db = work / (name + ".db")
with sqlite3.connect(original) as src, sqlite3.connect(db) as dst:
src.backup(dst)
for p in PATHS:
dst.execute(
("UPDATE workflows SET description=? WHERE source_repo_path=?"),
(name, p),
)
snapshot = rows()
r, _ = run(name)
assert r["counts"] == {"conflict": 1, "skipped": 154, "user_excluded": 1}
assert rows() == snapshot and all(len(snapshot[p]) == 29 for p in PATHS)
protected.append(dict(phase=name, counts=r["counts"], whole_rows=1, columns=29))
db = original
protect("user-before")
upgrade, exported = run("upgrade")
after = rows()
assert upgrade["counts"] == {"updated": 1, "skipped": 154, "user_excluded": 1}
for p, row in after.items():
if p not in PATHS:
assert row == before[p]
continue
assert len(row) == 29
assert all(
row[k] == before[p][k]
for k in row.keys() - {"doc_json", "batch_id", "imported_at", "library_fingerprint"}
)
d = json.loads(row["doc_json"])
assert d["fixed_version"]["matched"]
old_doc = json.loads(before[p]["doc_json"])
without = dict(d)
fixed = without.pop("fixed_version")
assert without["steps"] == old_doc["steps"][:-3] + fixed["steps"]
without["steps"] = old_doc["steps"]
assert without.pop("source_review_sha") != old_doc.pop("source_review_sha")
assert without == old_doc
write("actual-" + Path(p).stem + ".json", d)
repeat, _ = run("repeat")
assert repeat["counts"] == {"skipped": 155, "user_excluded": 1}
with sqlite3.connect(db) as c:
c.row_factory = sqlite3.Row
r = rollback_batch(c, upgrade["batch_id"])
assert len(r["files"]) == 1 and all(f["result"] == "restored" for f in r["files"])
assert rows() == before
redo, _ = run("redo")
assert redo["counts"] == upgrade["counts"]
protect("user-after")
db = work / "fresh.db"
fresh, exported = run("fresh")
fresh_repeat, _ = run("fresh-repeat")
assert fresh["counts"] == first["counts"] and fresh_repeat["counts"] == repeat["counts"]
assert fresh["states"] == {"pending_check": 16, "needs_conversion": 139}
companion = 0
for row in rows().values():
d = json.loads(row["doc_json"])
companion += sum(p.get("value_origin") == "supplied_api_companion" for p in d["params"])
assert (
not row["is_enabled"]
and row["doc_completed_at"] is None
and row["exec_verified_at"] is None
)
assert not d["status"]["doc_done"] and not d["status"]["exec_verified"]
assert d["dependencies"]["check_state"] == "unchecked"
report = audit(REPO, exported)
assert (
report["named_values_preserved"] == 1217
and report["unnamed_widget_nodes"] == 3660
and companion == 294
)
assert report["full_documents_completed"] == report["real_executions"] == 0
write("audit-summary.json", {k: v for k, v in report.items() if k != "files"})
write(
"import-protection.json",
dict(
base=BASE,
first=first["counts"],
upgrade=upgrade["counts"],
repeat=repeat["counts"],
restored_rows=1,
untouched_whole_rows=154,
eligibility_unchanged=True,
redo=redo["counts"],
user_protection=protected,
fresh=fresh["counts"],
fresh_repeat=fresh_repeat["counts"],
states=fresh["states"],
source_named_fields=1217,
positional_widgets=3660,
companion_values=companion,
new_saved=37,
new_notes=1,
old_saved=904,
old_notes=21,
overviews=31,
all_disabled=True,
doc_done=0,
executed=0,
),
)
old_reviews = json.loads(
subprocess.check_output(["git", "show", f"{BASE}:{RESOURCE}"], cwd=REPO)
)
current = json.loads((REPO / RESOURCE).read_bytes())
for p in PATHS:
current[p].pop("fixed_version_document")
assert current == old_reviews
boundaries = json.loads(
(REPO / ("docs/hel-892/h3-document-evidence/unchanged-boundaries.json")).read_bytes()
)
paths = (
[f["path"] for f in boundaries["files"]]
+ boundaries["frozen_conversion_and_audits"]
+ ["calliope-backend/src/calliope/comfyui/library.py"]
)
kept = []
for p in paths:
raw = (REPO / p).read_bytes()
assert raw == subprocess.check_output(["git", "show", f"{BASE}:{p}"], cwd=REPO)
kept.append(dict(path=p, sha256=hashlib.sha256(raw).hexdigest()))
ui = "calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte"
drawer_bytes = (REPO / ui).read_bytes()
assert drawer_bytes == subprocess.check_output(["git", "show", f"{BASE}:{ui}"], cwd=REPO)
write(
"boundaries.json",
dict(
base=BASE,
files=kept,
originals=163,
old_thirty_blocks_unchanged=True,
drawer_css_unchanged=True,
drawer_whole_file_unchanged=True,
drawer_sha256=hashlib.sha256(drawer_bytes).hexdigest(),
conversion_rerun=False,
profiles_28_candidates_9_diffs_6="unchanged",
),
)
tracked = (
subprocess.check_output(["git", "ls-tree", "-rz", "--name-only", BASE], cwd=REPO)
.decode()
.rstrip("\0")
.split("\0")
)
frozen = [
p
for p in tracked
if p.startswith(("example_ComfyUI_workflows/", "docs/hel-892/supplied-api/"))
or p.startswith("calliope-backend/src/calliope/comfyui/")
and p not in [RESOURCE, ("calliope-backend/src/calliope/comfyui/fixed_document.py")]
]
for p in frozen:
assert (REPO / p).read_bytes() == subprocess.check_output(
["git", "show", f"{BASE}:{p}"], cwd=REPO
)
write(
"frozen-resource-check.json",
dict(
base=BASE,
files=[
dict(path=p, sha256=hashlib.sha256((REPO / p).read_bytes()).hexdigest())
for p in frozen
],
original_files=sum(p.startswith("example_ComfyUI_workflows/") for p in frozen),
all_unchanged=True,
),
)
packages = []
with zipfile.ZipFile(wheels) as w, tarfile.open(sdists) as s:
for name in ["fixed_document.py", "source_reviews.json", "library.py"]:
raw = (REPO / "calliope-backend/src/calliope/comfyui" / name).read_bytes()
assert w.read("calliope/comfyui/" + name) == raw
member = next(n for n in s.getnames() if n.endswith("/src/calliope/comfyui/" + name))
assert s.extractfile(member).read() == raw
packages.append(
dict(
file=name,
sha256=hashlib.sha256(raw).hexdigest(),
wheel=True,
sdist=True,
definitions=31,
)
)
write("package-check.json", packages)
print(
"PASS actual 1d04c00 upgrade1/skip154, repe"
"at155, rollback1, edits1/29cols, fresh155,"
" 1217/3660/294, 31 definitions, frozen bou"
"ndaries, wheel/sdist"
)
if __name__ == "__main__":
main()
@@ -0,0 +1,112 @@
"Readable complete Chinese definitions and fixed source index from delivered data."
from __future__ import annotations
import hashlib
import json
from pathlib import Path
OUT = Path(__file__).resolve().parent
def main():
lines = [
"# SeedVR2单图放大固定参考中文说明",
"",
"新增37保存位置+1完整Note;旧30图904位置+21注释逐对象不变,现31图941+22仅参考。155定稿0/实跑0/新增转换0。",
"",
(
"来源local_file以docs/hel-892/seedvr2-document"
"-evidence为基准;源SHA/全图摘要/定义摘要绑定;不加载上游代码、媒体或链接。"
),
"",
]
index = []
for i in range(1):
b = json.loads((OUT / f"definition-{i}.json").read_bytes())
lines += [
"## " + Path(b["source_path"]).stem,
"",
b["user_overview"],
"",
b["notice"],
"",
"源路径:`" + b["source_path"] + "`",
"",
"SHA1:" + b["source_sha1"],
"",
"原字节SHA256:" + b["source_sha256"],
"",
"规范全图SHA256:" + b["canonical_sha256"],
"",
*[v + "\n" for v in b["versions"]],
"### 具体连线与处理条件",
"",
*[v + "\n" for v in b["flow"]],
"### 使用与核对",
"",
*[v + "\n" for v in b["steps"]],
"### 逐保存位置说明",
"",
]
for j, f in enumerate(b["fields"], 1):
lines += [
f"#### {j}. 节点{f['node_id']} · {f['label']}({f['field']})",
"",
f["effect"],
"",
"```json",
json.dumps(f["value"], ensure_ascii=False, indent=2),
"```",
"",
f"类:{f['class_type']};JSON类型:{f['json_type']};角色:{f['role']}。",
"",
"源保存位置:`" + f["pointer"] + "`;源输入口:`" + f["input_pointer"] + "`",
"",
"定义默认:" + f["schema_default"] + ";单位:" + f["unit"],
"",
"范围/条件:" + f["limits"],
"",
f["execution_note"],
"",
"依据:",
]
for k in f["evidence"]:
e = b["sources"][k]
lines += [
f"- [{k}] {e['claim']};{e['file']} {e['lines'][0]}~{e['lines'][1]}行;"
f"commit {e['commit']};SHA256 {e['sha256']};{e['url']}"
]
lines += [""]
lines += ["### 零保存节点与源注释", ""]
for z in b["zero_saved_nodes"]:
lines += [z["node_id"] + " " + z["class_type"] + ":" + z["effect"], ""]
for n in b["comments"]:
lines += [
"节点" + n["node_id"] + ",位置`" + n["pointer"] + "`",
"",
n["meaning"],
"",
"```text",
n["text"],
"```",
"",
]
lines += ["### 固定原件索引", ""]
for k, e in enumerate(b["sources"]):
data = (OUT / e["local_file"]).read_bytes()
assert hashlib.sha256(data).hexdigest() == e["sha256"]
lines += [
f"{k}. {e['claim']};{e['file']} 第{e['lines'][0]}~{e['lines'][1]}行;"
f"提交{e['commit']};SHA256 {e['sha256']};{e['url']}",
"",
]
index.append(dict(document=b["source_path"], **e))
(OUT.parent / "SeedVR2单图放大固定参考中文说明.md").write_text("\n".join(lines).rstrip() + "\n")
(OUT / "fixed-source-index.json").write_text(
json.dumps(index, ensure_ascii=False, indent=2) + "\n"
)
if __name__ == "__main__":
main()
@@ -0,0 +1 @@
PASS deterministic definitions and rendered artifacts: zero difference
@@ -0,0 +1,42 @@
"Compare deterministic definitions and rendered artifacts without repeating unrelated tests."
import hashlib
import json
from build_definition import OUT, REPO, canonical
from rebuild import RESOURCE, build_all
from render_report import main as render
def main():
a, old = build_all()
b, previous = build_all()
assert a == b and old == previous
assert a == json.loads((REPO / RESOURCE).read_bytes())
render()
paths = [
OUT / "fixed-source-index.json",
OUT.parent / "SeedVR2单图放大固定参考中文说明.md",
]
before = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
render()
assert before == {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
(OUT / "repeatability.json").write_text(
json.dumps(
dict(
definitions=31,
repeated_build_equal=True,
repeated_render_equal=True,
resource_sha256=hashlib.sha256(canonical(a)).hexdigest(),
artifacts=before,
),
ensure_ascii=False,
indent=2,
)
+ "\n"
)
print(("PASS deterministic definitions and rendered artifacts: zero difference"))
if __name__ == "__main__":
main()
@@ -0,0 +1,10 @@
{
"definitions": 31,
"repeated_build_equal": true,
"repeated_render_equal": true,
"resource_sha256": "5e7438baedf59e75c328bc57fe67b45a42634dd50214cd5204ad36d0fb0dc339",
"artifacts": {
"fixed-source-index.json": "3da4689055cf8d78156f276e8080ef4c6e2e25514d50b02e5aa9142ca1892a0b",
"SeedVR2单图放大固定参考中文说明.md": "b93da0f4269df2df5625be90e416ea5c900ede5279eb036971b51a72ff347a83"
}
}
@@ -0,0 +1 @@
{"total": 111, "fixed_count": 101, "polling_count": 10, "paths": {"/api/workflows": 3, "/api/workflows/28": 4, "/api/workflows/27": 4, "/api/workflows/26": 3, "/api/workflows/17": 3, "/api/workflows/4": 3, "/api/workflows/15": 3, "/api/workflows/11": 3, "/api/workflows/3": 3, "/api/workflows/9": 3, "/api/workflows/16": 3, "/api/workflows/10": 3, "/api/workflows/23": 3, "/api/workflows/8": 3, "/api/workflows/22": 3, "/api/workflows/5": 3, "/api/workflows/6": 3, "/api/workflows/7": 3, "/api/workflows/19": 3, "/api/workflows/13": 3, "/api/workflows/12": 3, "/api/workflows/64": 3, "/api/workflows/62": 3, "/api/workflows/70": 3, "/api/workflows/1": 3, "/api/workflows/36": 3, "/api/workflows/35": 3, "/api/workflows/2": 3, "/api/workflows/25": 3, "/api/workflows/24": 3, "/api/workflows/21": 3, "/api/workflows/14": 3, "/api/jobs": 10, "/api/settings": 1, "/api/workflows/156": 1, "/api/workflows/157": 1}, "readiness_included": 1, "reason": "就绪GET单列1;浏览记录含Node直连及Playwright本地拦截的GET,服务日志只含真正到后端者,不机械等同。轮询可随计时边界±1,禁止请求始终零容忍。"}
@@ -0,0 +1,39 @@
"Count actual local server GETs separately from browser intercepted requests."
import collections
import json
import re
from pathlib import Path
OUT = Path(__file__).resolve().parent
def main():
text = (OUT / "service-0.txt").read_text()
gets = re.findall(r'"GET ([^ ]+) HTTP/', text)
polling = [p for p in gets if p in ["/api/jobs", "/api/events"]]
result = dict(
total=len(gets),
fixed_count=len(gets) - len(polling),
polling_count=len(polling),
paths=dict(collections.Counter(gets)),
readiness_included=1,
reason=(
"就绪GET单列1;浏览记录含Node直连及Playwright本地拦截的GET,"
"服务日志只含真正到后端者,不机械等同。"
"轮询可随计时边界±1,禁止请求始终零容忍。"
),
)
browser = json.loads((OUT / "browser-results.json").read_bytes())
assert browser["errors"] == []
assert all(r["method"] == "GET" for r in browser["requests"])
assert all(not p.startswith("/api/view") for p in gets)
assert abs(result["polling_count"] - browser["request_accounting"]["polling_count"]) <= 1
(OUT / "server-request-accounting.json").write_text(
json.dumps(result, ensure_ascii=False, indent=2) + "\n"
)
print(json.dumps(result, ensure_ascii=False))
if __name__ == "__main__":
main()
@@ -0,0 +1,15 @@
{
"base": "1d04c00c0cc75df1d782b39ca7b70bb37362517b",
"changed_paths": [
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/高清放大/Seedvr2_3b_int8_图像放大.json"
],
"other_reviews_unchanged": 155,
"old_blocks_unchanged": 30,
"old_saved": 904,
"old_notes": 21,
"new_saved": 37,
"new_notes": 1,
"total_documents": 31,
"total_saved": 941,
"total_notes": 22
}
@@ -0,0 +1,45 @@
{
"total": 111,
"fixed_count": 101,
"polling_count": 10,
"paths": {
"/api/workflows": 3,
"/api/workflows/28": 4,
"/api/workflows/27": 4,
"/api/workflows/26": 3,
"/api/workflows/17": 3,
"/api/workflows/4": 3,
"/api/workflows/15": 3,
"/api/workflows/11": 3,
"/api/workflows/3": 3,
"/api/workflows/9": 3,
"/api/workflows/16": 3,
"/api/workflows/10": 3,
"/api/workflows/23": 3,
"/api/workflows/8": 3,
"/api/workflows/22": 3,
"/api/workflows/5": 3,
"/api/workflows/6": 3,
"/api/workflows/7": 3,
"/api/workflows/19": 3,
"/api/workflows/13": 3,
"/api/workflows/12": 3,
"/api/workflows/64": 3,
"/api/workflows/62": 3,
"/api/workflows/70": 3,
"/api/workflows/1": 3,
"/api/workflows/36": 3,
"/api/workflows/35": 3,
"/api/workflows/2": 3,
"/api/workflows/25": 3,
"/api/workflows/24": 3,
"/api/workflows/21": 3,
"/api/workflows/14": 3,
"/api/jobs": 10,
"/api/settings": 1,
"/api/workflows/156": 1,
"/api/workflows/157": 1
},
"readiness_included": 1,
"reason": "就绪GET单列1;浏览记录含Node直连及Playwright本地拦截的GET,服务日志只含真正到后端者,不机械等同。轮询可随计时边界±1,禁止请求始终零容忍。"
}
@@ -0,0 +1,120 @@
INFO: Started server process [731161]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8247 (Press CTRL+C to quit)
{'counts': {'skipped': 154, 'updated': 1, 'user_excluded': 1}, 'states': {'pending_check': 16, 'needs_conversion': 139}}
INFO: 127.0.0.1:59666 - "GET /api/workflows HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/28 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/27 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/26 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/17 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/4 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/15 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/11 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/3 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/9 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/16 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/10 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/23 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/8 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/22 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/5 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/6 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/7 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/19 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/13 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/12 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/64 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/62 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/70 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/1 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/36 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/35 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/2 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/25 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/24 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59668 - "GET /api/workflows/21 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59674 - "GET /api/workflows/14 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59686 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:59684 - "GET /api/settings HTTP/1.1" 200 OK
INFO: 127.0.0.1:59700 - "GET /api/workflows HTTP/1.1" 200 OK
INFO: 127.0.0.1:59710 - "GET /api/workflows/28 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59718 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:42166 - "GET /api/workflows/27 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42180 - "GET /api/workflows/26 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42192 - "GET /api/workflows/17 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42196 - "GET /api/workflows/4 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42210 - "GET /api/workflows/15 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42226 - "GET /api/workflows/11 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42232 - "GET /api/workflows/3 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42248 - "GET /api/workflows/9 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42254 - "GET /api/workflows/16 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42256 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:42260 - "GET /api/workflows/10 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42276 - "GET /api/workflows/23 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42284 - "GET /api/workflows/8 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42292 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:42302 - "GET /api/workflows/22 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42312 - "GET /api/workflows/5 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42314 - "GET /api/workflows/6 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42322 - "GET /api/workflows/7 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54684 - "GET /api/workflows/19 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54694 - "GET /api/workflows/13 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54704 - "GET /api/workflows/12 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54720 - "GET /api/workflows/64 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54724 - "GET /api/workflows/62 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54736 - "GET /api/workflows/70 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54742 - "GET /api/workflows/1 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54758 - "GET /api/workflows/36 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54766 - "GET /api/workflows/35 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54774 - "GET /api/workflows/2 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54786 - "GET /api/workflows/25 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54792 - "GET /api/workflows/24 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54808 - "GET /api/workflows/21 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54816 - "GET /api/workflows/14 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54824 - "GET /api/workflows/28 HTTP/1.1" 200 OK
INFO: 127.0.0.1:54830 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:54838 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:42748 - "GET /api/workflows/27 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42764 - "GET /api/workflows/26 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42770 - "GET /api/workflows/17 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42782 - "GET /api/workflows/4 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42790 - "GET /api/workflows/15 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42804 - "GET /api/workflows/11 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42812 - "GET /api/workflows/3 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42814 - "GET /api/workflows/9 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42830 - "GET /api/workflows/16 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42842 - "GET /api/workflows/10 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42856 - "GET /api/workflows/23 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42866 - "GET /api/workflows/8 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42876 - "GET /api/workflows/22 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42880 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:42888 - "GET /api/workflows/5 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42904 - "GET /api/workflows/6 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42908 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:42910 - "GET /api/workflows/7 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42920 - "GET /api/workflows/19 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42922 - "GET /api/workflows/13 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42934 - "GET /api/workflows/12 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42948 - "GET /api/workflows/64 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42958 - "GET /api/workflows/62 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42960 - "GET /api/workflows/70 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42964 - "GET /api/workflows/1 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42968 - "GET /api/workflows/36 HTTP/1.1" 200 OK
INFO: 127.0.0.1:42978 - "GET /api/workflows/35 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34236 - "GET /api/workflows/2 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34240 - "GET /api/workflows/25 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34254 - "GET /api/workflows/24 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34270 - "GET /api/workflows/21 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34274 - "GET /api/workflows/14 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34280 - "GET /api/workflows/156 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34290 - "GET /api/workflows/157 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34294 - "GET /api/workflows/27 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34296 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:34310 - "GET /api/workflows/28 HTTP/1.1" 200 OK
INFO: 127.0.0.1:34320 - "GET /api/jobs HTTP/1.1" 404 Not Found
INFO: Shutting down
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
INFO: Finished server process [731161]
@@ -0,0 +1,4 @@
VITE v6.4.3 ready in 278 ms
➜ Local: http://127.0.0.1:5173/
@@ -0,0 +1 @@
{"ports_released": [8247, 5173], "child_exit_codes": [-15, 143]}
@@ -0,0 +1,22 @@
{
"all_pass": true,
"git_texts": 32,
"citations": 30,
"tags": {
"core": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"frontend": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff"
},
"rgthree": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"local_file_base": "docs/hel-892/seedvr2-document-evidence",
"investigation": [
"nodes.py",
"comfy_extras/nodes_seed.py",
"comfy_extras/nodes_compositing.py",
"comfy_extras/nodes_post_processing.py",
"comfy_extras/nodes_images.py",
"comfy_extras/nodes_mask.py",
"comfy_extras/nodes_sd3.py"
],
"seedvr_classes": "not established in bounded investigation; no global absence claim",
"source_links_executed": false
}
@@ -0,0 +1,361 @@
{
"base": "1d04c00c0cc75df1d782b39ca7b70bb37362517b",
"files": [
{
"path": "calliope-backend/pyproject.toml",
"sha256": "09d829a2c42a4819e13d9584a4ba532ede873a582590cdc3e655028e1f3fe4a0"
},
{
"path": "calliope-backend/scripts/audit_library_documents.py",
"sha256": "69186ebd375aa149d6b2cf9978b952b3dff3d682aaf9ad7527bd4a489ef2dcf7"
},
{
"path": "calliope-backend/src/calliope/comfyui/__init__.py",
"sha256": "1d3488bcc2eadcd8a8f2e84ab4f6e9bdf52096b8af637c4da399db041d5a0543"
},
{
"path": "calliope-backend/src/calliope/comfyui/client.py",
"sha256": "ce30b3b3587d8f0dac86d534b99f31b95f1f4d0acb361babb45fd2be9513fe72"
},
{
"path": "calliope-backend/src/calliope/comfyui/companions.py",
"sha256": "7dde205059bf489e3d39539a8b42333b3947c3989d890441f70a45cf67d9ab04"
},
{
"path": "calliope-backend/src/calliope/comfyui/delivery_scope.json",
"sha256": "3a85718f877a63be54c843e2610b24dcc3013a6011f705d6348c91e2c7f78fd6"
},
{
"path": "calliope-backend/src/calliope/comfyui/delivery_scope.py",
"sha256": "0b849256dbb06f709c1ba856c34b3df04d2fccf09984a6e1fe1284b792eaf867"
},
{
"path": "calliope-backend/src/calliope/comfyui/dry_run.py",
"sha256": "f8bf4d1b91d959044de1dbc4aeb11bf0bb521f51f1928d36a46c670381a08ed7"
},
{
"path": "calliope-backend/src/calliope/comfyui/endpoints.py",
"sha256": "fc99a623850b581ae38843bbc3baf1b71ca9fd633e6103a34cb809a345e5a647"
},
{
"path": "calliope-backend/src/calliope/comfyui/fixed_document.py",
"sha256": "2443993bec9f5456ee31312535d33e05653e0e7cd205f553cca19d8dd10cf7c8"
},
{
"path": "calliope-backend/src/calliope/comfyui/h3_chain_reference.py",
"sha256": "a5c0ab92d99757c168648ddbc0418b23d2b871f674b153e9a240b75409cf5741"
},
{
"path": "calliope-backend/src/calliope/comfyui/h3_core_reference.py",
"sha256": "2913654b6ec3dabac1d36b1894064b8e077dd1d743d546e81667b317339f8a5f"
},
{
"path": "calliope-backend/src/calliope/comfyui/library.py",
"sha256": "b9cbfce28267642e6db3ebe9d591cf8dd260c7772a5a21a8d36cb98915eca13c"
},
{
"path": "calliope-backend/src/calliope/comfyui/library_cli.py",
"sha256": "04bfa8cfbe3f9378e78594958973118ec95aa1ff0bcdbdf4da0311abbdbcd380"
},
{
"path": "calliope-backend/src/calliope/comfyui/lint.py",
"sha256": "9b79bf162e13fb68321727fb17f96d6fc0c217d60db85de38235c4270bf9b4e3"
},
{
"path": "calliope-backend/src/calliope/comfyui/output_map.py",
"sha256": "36ed4ced825e4f7e1d389602085451b5cb9336b319d220f423f59f83fed6a70e"
},
{
"path": "calliope-backend/src/calliope/comfyui/parser.py",
"sha256": "a02d583c6a1cf7f85e77341a20308823771c233fb95241118a264e202a5230a0"
},
{
"path": "calliope-backend/src/calliope/comfyui/patcher.py",
"sha256": "8ac1417f0f78d952cdb219b10811a6ed7d4ce3bb0d561708858c4a8f5d15b45d"
},
{
"path": "calliope-backend/src/calliope/comfyui/preflight.py",
"sha256": "6629961d33204cbe5b3fc3d8a5a0a4de0c86d235e73f542d191429cf7f4bd2ec"
},
{
"path": "calliope-backend/src/calliope/comfyui/profiles.py",
"sha256": "4ca33343fc3f20e0fb82558cb428548f6415af04fb90213a694fb759515732f2"
},
{
"path": "calliope-backend/src/calliope/comfyui/protocol_references.json",
"sha256": "a10aaf98db9bb3b5ac6d1fc30b18c40cf315b34eee57ebb19470a6664e9221a4"
},
{
"path": "calliope-backend/src/calliope/comfyui/protocol_references.py",
"sha256": "ab9d948dd1bbf83dfce27186d6e48d9c3d5dff129305afd760fb3e77570b2916"
},
{
"path": "calliope-backend/src/calliope/comfyui/registry.py",
"sha256": "0382eda52a31f23c1c29dd7a62d0ffc93e10fcbb88872a5893b8fc93a2b2734d"
},
{
"path": "calliope-backend/src/calliope/comfyui/roles.py",
"sha256": "cc0b45eac2d881a6f7cc5ea88ceadb03f71715240a45257fef3a76bfc53d56c4"
},
{
"path": "calliope-backend/src/calliope/comfyui/serialization_reference.py",
"sha256": "67724fac65acbd397198271e1ed17b91f592f52da7ce8299e575d4c597d57fa1"
},
{
"path": "calliope-backend/src/calliope/comfyui/smart_fill.py",
"sha256": "adc34e80cca7a2b38cc834a713c9e64001caac84413af288389e5554e304bab6"
},
{
"path": "calliope-backend/src/calliope/comfyui/source_reviews.json",
"sha256": "5fee876e9ac3ba844b4004533add134461f1a64668a207a2f743db85f4b8868b"
},
{
"path": "calliope-backend/src/calliope/comfyui/source_reviews.py",
"sha256": "b85e26f1e4fce77f75429b7bc0653401065b2cd28151bdf5d9edc87c096e9419"
},
{
"path": "calliope-backend/src/calliope/comfyui/structure_reference.py",
"sha256": "a9f3a8ed314a0c0a424c6781db4e83af3a85cb8b66b16b01380b5fecc3e1f0bb"
},
{
"path": "calliope-backend/src/calliope/comfyui/ui2api.py",
"sha256": "86a9c98ad72afa15aaf706bab8b39589a1cbca2e93da40d0aed9f963c14c0d1f"
},
{
"path": "calliope-backend/src/calliope/comfyui/validate.py",
"sha256": "c27fca69a604705b06809fdd692975ca0e7a08d05d558172962f8910a6a0491d"
},
{
"path": "calliope-backend/src/calliope/config.py",
"sha256": "94cda57274c512feac82ab3c97d9c680abf6706009727d6a6791cef690994001"
},
{
"path": "calliope-backend/src/calliope/db.py",
"sha256": "247d92b6cffdda8e34a83b0a3d26c47a17d2d136b897aa02294c7acb818c762c"
},
{
"path": "calliope-backend/src/calliope/routers/workflows.py",
"sha256": "3f1d5fdacc841080973dcafb9cd87a42433ec19080a3ff14a29561f13d512c97"
},
{
"path": "calliope-backend/tests/test_seedvr2_fixed_document.py",
"sha256": "088ba744f1a05eb7619409f321f95874b475de3a66ca9fbbef7725c1dc15c299"
},
{
"path": "calliope-backend/tests/test_workflow_library.py",
"sha256": "e8dc9acd466cad8f057770962e7830cb2b56a4a6bc534bd581f1e19f514dc057"
},
{
"path": "calliope-backend/uv.lock",
"sha256": "04950ca1719bb95d0c9ee94456a508a4a197af58db2e0a78bdcfe5a633345ad2"
},
{
"path": "calliope-web/package-lock.json",
"sha256": "e91b2f5e18f8cbc7edc31d17e316be3035a307d94d7e765f33ac1c13f6ef256f"
},
{
"path": "calliope-web/src/lib/components/WorkflowDocumentDrawer.svelte",
"sha256": "3e3c7602bae3a031e7fb1c38792f8ba5a1f37172e7b8850d304502ea1be010c1"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/build_definition.py",
"sha256": "a6afd8cd4e6abda6115781f9cff629f0d14202fea6b39b91dbd16ad916f3d47b"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/check_code.py",
"sha256": "8a39231bdede5c31b8f4c80ea80216f2de7a69a853280b9aac12ccb3f895840e"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/fetch_sources.py",
"sha256": "4104ecf28e9bd8c782d97d863f9127b4c2443166af40ae7177108e2183b53011"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/rebuild.py",
"sha256": "e334a2984afe1e0d1238716bbf44a8ea3e89633048f7223ebf874993199a646d"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/recompute.py",
"sha256": "17a3cfef8839f8c453a9ea8f0bb9d563584c620787a22e77102d42c915da0d3b"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/render_report.py",
"sha256": "63adb886cdd2cb62d41000bbfa794929949d3e513900327bd34810aa3260c2b0"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/repeat.py",
"sha256": "fbaccfa4d7d36ce7659be7753acf6e0dfa148e00bc8f0d6ad705a3e6a0c774c5"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/request_counts.py",
"sha256": "982d4859e01e9a3e3ef9746fc8b7f447b4ea63fbdf414f13de3bbaaaedd2d58f"
},
{
"path": "docs/hel-892/seedvr2-document-evidence/verify_sources.py",
"sha256": "3eccf0b4ed61048dec18a6bee95f21233fb7f8a4ce904d50a565e2d0c2e47d58"
},
{
"path": "docs/hel-892/seedvr2-reference/core-tag.json",
"sha256": "c3bf0d1f3f6fcea0b54d87d369f979b17141ccbbbb4d14f5fbfa9dac5a8888eb"
},
{
"path": "docs/hel-892/seedvr2-reference/core-tree.json",
"sha256": "0dc2446485c88dacb3570811cd980afbe221a2195a47dcff6f2d99a61f1964a1"
},
{
"path": "docs/hel-892/seedvr2-reference/core__LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy__samplers.py",
"sha256": "d882256ae9baa1d23f1367ab2ec3b021fdc15fe39ce4cb49ea2c1ee10026a649"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy__utils.py",
"sha256": "8b8805ca837e20c922a846854156d10e214654f69df96be90969522f9def2bdb"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_api__latest___io.py",
"sha256": "ac986092cace7600461b8547e21f770126958d8c15eef59d79d6709cca4b7717"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_api__latest___ui.py",
"sha256": "842ac7eeb8484fbd1746436daf4368b002e2268ff4aafd4d4682a5b24c6ba794"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_compositing.py",
"sha256": "e001e2963baaa5ea9f031e6b7920e4d70dae248588a70ed31ab595706a29efae"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_images.py",
"sha256": "a57638bf58f93698b8b5ed44e53d31ac3d4ac608cc5c49d38c3768fdf722e448"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_mask.py",
"sha256": "9ff6c44f6114e36cfd17886a92b6cfb1d824013b43242ea1ee6b86c93a71b7dc"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_post_processing.py",
"sha256": "96ec39e8d0e9fe9a70b332f97f994d507e1fa223a26699a3c9c9fbeedacf6575"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_sd3.py",
"sha256": "90a79847332fed7cc97379abbc7092116e6b1b883a7c9e933ac88167a521f693"
},
{
"path": "docs/hel-892/seedvr2-reference/core__comfy_extras__nodes_seed.py",
"sha256": "f1566b448ca9e4b4a1cbd15767301635905cf36a44a17f586c18b848e23e5932"
},
{
"path": "docs/hel-892/seedvr2-reference/core__folder_paths.py",
"sha256": "380961714742085363301f980a6c9458f36aca05b1e36ed9b8afa3fb64ccdb50"
},
{
"path": "docs/hel-892/seedvr2-reference/core__nodes.py",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend-tag.json",
"sha256": "19e013a55c5289946fd8f5387b48ae1c8e858082717b94258d1273b725e7aeef"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend-tree.json",
"sha256": "55db75185a80084619cd6577d99f866fd8d8f1a623cc50d26bfcd7d0d3dbfbc2"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__core__graph__subgraph__promotedWidgetView.ts",
"sha256": "21b0068dc03cf45bc5100a1741484bd04ff09c51b96c4ff2293f758034ba83e3"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__core__graph__subgraph__resolveSubgraphInputTarget.ts",
"sha256": "cbd6d3d16cf94acc0ca3d333028a0b6b91f4c1a011fe5947345c4a31048ba6ed"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__core__graph__widgets__dynamicWidgets.ts",
"sha256": "cbc7d1a9eccb1c64f90cf2f87db9ad3ba9a301d81ec3f8daea2af48e2ccb8e32"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__extensions__core__dynamicPrompts.ts",
"sha256": "31004dc7ba9b8ea5c8caa92ab3a15a0e63af8a822f57cb487079aad84d06f4bd"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__extensions__core__noteNode.ts",
"sha256": "1014f719e3d67d9c5183a5e8631d4c2d6581dfe67083f32eb23774ec3074bef2"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__extensions__core__uploadImage.ts",
"sha256": "48d062c2ee95bd77c537c539e6c8f8bc03bd71dcec94c5b82487c014ea3e9c06"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__lib__litegraph__src__LGraphNode.ts",
"sha256": "d7c22582f6a0a5c05521d8b848a04a21e0d6df3339401be746b252b8d0ac5588"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__lib__litegraph__src__subgraph__Subgraph.ts",
"sha256": "321403ca3ba2faa0b448dec6e8bf379e49ddea4bfbe8619547d29926e30d62d2"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__lib__litegraph__src__subgraph__SubgraphNode.ts",
"sha256": "bc0436dc3e21ccfa6f1dccf40935c0d0b97b607932f7025b975a4138efe1e24e"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__scripts__app.ts",
"sha256": "6a0fd5cc4da6aad850ac05d312a22fd2f545fd296735ed7b927b62d7a564c08e"
},
{
"path": "docs/hel-892/seedvr2-reference/frontend__src__scripts__widgets.ts",
"sha256": "2afe2e069a0e163d36b892a7d46e3074d087f48faeef240610b6e4d55c6fba5c"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree-tree.json",
"sha256": "fee075750e09eed5ea8498c4baf8dd58242a035d977bdd1550726bd86808e647"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__LICENSE",
"sha256": "b34faf7c3e2975fe08d0169958e2b39f076d4d4289cbe2560dd7dd5b1a613ed1"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree____init__.py",
"sha256": "06174f22e7246b2b0771961cc0681846f452b853ccb927ca507e074f340abc61"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__py__constants.py",
"sha256": "50dee946013b1d88d01fe9d63c2a7ab4d4c59be218cf80171f3542b43f0d8558"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__py__image_comparer.py",
"sha256": "43ccce9b6f9413d5196ce4a7a3ef544969ae1ce2b52c44345f6cc8fb28c596fc"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__src_web__comfyui__base_node.ts",
"sha256": "5aa0ec6dc78ad00ecf46ef05922fa53c09526152f07eb3762a1e2c052b040623"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__src_web__comfyui__base_node_mode_changer.ts",
"sha256": "ecd92d0b5275dace15e65a33c2bfd3aab49b4604f47cc0ce2e793c486e36921d"
},
{
"path": "docs/hel-892/seedvr2-reference/rgthree__src_web__comfyui__image_comparer.ts",
"sha256": "cb15118af030e39aaecdde072a79a7edd501344d2742dd6e296db55e12c14d34"
},
{
"path": "docs/hel-892/seedvr2-reference/sources.json",
"sha256": "8b30c5e127ad164e8eb521e8893eb75c2b67f886acfbb8da8887345eb2cbec2b"
},
{
"path": "e2e/run-seedvr2-document.py",
"sha256": "db34660e0834d134da7d683a5d99a2fee8c768c4f796fc76bca1747738604630"
},
{
"path": "e2e/seedvr2-document.mjs",
"sha256": "f1956117ad225fd2ab4ae3cfd93f9d9fe73b2f328411acc86130256c75d9fdce"
},
{
"path": "e2e/workflow-document-server.py",
"sha256": "539c54c1eafe6644cba117cf5550af918c97b48aef4b29d2c6378881204742e2"
}
]
}
@@ -0,0 +1,17 @@
# Run from repo root. Existing locked dependencies only; no upstream code execution, GPU/media/target requests.
PYTHONDONTWRITEBYTECODE=1 uv sync --project calliope-backend --frozen --extra dev --python 3.11 --offline
npm ci --prefix calliope-web --ignore-scripts --offline
PYTHONDONTWRITEBYTECODE=1 python3 docs/hel-892/seedvr2-document-evidence/verify_sources.py
PYTHONDONTWRITEBYTECODE=1 python3 docs/hel-892/seedvr2-document-evidence/rebuild.py
PYTHONDONTWRITEBYTECODE=1 uv run --project calliope-backend --offline pytest calliope-backend/tests/test_seedvr2_fixed_document.py calliope-backend/tests/test_workflow_library.py -q
PYTHONDONTWRITEBYTECODE=1 python3 docs/hel-892/seedvr2-document-evidence/check_code.py
PYTHONDONTWRITEBYTECODE=1 uv build --project calliope-backend --offline
PYTHONDONTWRITEBYTECODE=1 uv run --project calliope-backend --offline python docs/hel-892/seedvr2-document-evidence/recompute.py
PYTHONDONTWRITEBYTECODE=1 python3 docs/hel-892/seedvr2-document-evidence/repeat.py
PYTHONDONTWRITEBYTECODE=1 LD_LIBRARY_PATH=/home/xiaomo/chromium-libs/root/usr/lib/x86_64-linux-gnu:/home/xiaomo/browserlibs/root/usr/lib/x86_64-linux-gnu PLAYWRIGHT_MODULE=/home/xiaomo/.npm-global/lib/node_modules/playwright/index.mjs BROWSER_EXECUTABLE=/home/xiaomo/.cache/ms-playwright/chromium-1248/chrome-linux64/chrome uv run --project calliope-backend --offline python e2e/run-seedvr2-document.py
# Browser foreground completes, finally stops both owned services and verifies 8247/5173 are released.
# Copy browser-results.json/service-stop.json/service-0.log (rename .txt) from .local-evidence/seedvr2-document/browser to this evidence dir.
PYTHONDONTWRITEBYTECODE=1 python3 docs/hel-892/seedvr2-document-evidence/request_counts.py
# Optional exact static text refetch: fetch_sources.py (Git metadata + bounded text only). No URL in source Note is executed.
# Source local_file base: docs/hel-892/seedvr2-document-evidence.
# Old code baseline: 1d04c00c0cc75df1d782b39ca7b70bb37362517b. Examples: source-check.json, review-delta.json, import-protection.json, package-check.json, repeatability.json, actual-Seedvr2_3b_int8_图像放大.json.
@@ -0,0 +1,67 @@
"""Verify exact tags, trees, blobs, citation lines and bounded absence claims offline."""
import hashlib
import json
from build_definition import OUT, REF, build
def main():
entries = json.loads((REF / "sources.json").read_bytes())["sources"]
for e in entries:
raw = (REF / e["local_file"]).read_bytes()
assert hashlib.sha256(raw).hexdigest() == e["sha256"]
tree = json.loads((REF / (e["id"] + "-tree.json")).read_bytes())
assert not tree["truncated"] and tree["sha"] == e["commit"]
assert (
hashlib.sha1(b"blob " + str(len(raw)).encode() + b"\0" + raw).hexdigest()
== e["git_blob_sha1"]
== next(x["sha"] for x in tree["tree"] if x["path"] == e["file"])
)
tags = {}
for key in ["core", "frontend"]:
tag = json.loads((REF / (key + "-tag.json")).read_bytes())
tree = json.loads((REF / (key + "-tree.json")).read_bytes())
assert tag["object"] == dict(sha=tree["sha"], type="commit", url=tag["object"]["url"])
tags[key] = tree["sha"]
block = build()
for e in block["sources"]:
raw = (OUT / e["local_file"]).read_bytes()
assert hashlib.sha256(raw).hexdigest() == e["sha256"]
assert 1 <= e["lines"][0] <= e["lines"][1] <= len(raw.decode().splitlines())
trees = json.loads((REF / "core-tree.json").read_bytes())["tree"]
assert not [e for e in trees if "seedvr" in e["path"].lower()]
investigation = [
"nodes.py",
"comfy_extras/nodes_seed.py",
"comfy_extras/nodes_compositing.py",
"comfy_extras/nodes_post_processing.py",
"comfy_extras/nodes_images.py",
"comfy_extras/nodes_mask.py",
"comfy_extras/nodes_sd3.py",
]
for p in investigation:
text = (
REF / next(e["local_file"] for e in entries if e["id"] == "core" and e["file"] == p)
).read_text()
assert all(
name not in text
for name in ["SeedVR2Preprocess", "SeedVR2Conditioning", "SeedVR2PostProcessing"]
)
report = dict(
all_pass=True,
git_texts=len(entries),
citations=len(block["sources"]),
tags=tags,
rgthree="27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
local_file_base="docs/hel-892/seedvr2-document-evidence",
investigation=investigation,
seedvr_classes="not established in bounded investigation; no global absence claim",
source_links_executed=False,
)
(OUT / "source-check.json").write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n")
print("PASS exact sources", len(entries), "citations", len(block["sources"]))
if __name__ == "__main__":
main()
@@ -0,0 +1,5 @@
Actual final screenshot inspection: 1440-28-default.png and390-28-default.png show the saved image/subgraph/save/comparison purpose first in natural Chinese, explicit unknown SeedVR2 implementations/model paths/size/VRAM/quality and disabled/unfinalized/unexecuted states. Technical source/range sections default collapsed. No horizontal overflow observed.
1440-28-66-vae_name.png: saved host seedvr2_ema_vae_fp16 value, internal ema_vae_fp16 mismatch, linked override, dynamic schema and exact core commit/SHA/lines render legibly in existing drawer.
1440-28-branch-flow.png: existing technical section shows root A/B origins, SaveImage IMAGE compatibility, Comparer inherited/override distinction and13 boundary mappings without horizontal overflow.
390-28-note.png: complete source Note remains raw JSON text (literal URLs, not linked/loaded); line wrapping preserves all content. Existing local fallback font lacks a few decorative tree/emoji glyphs; codepoints are preserved. No font download or Drawer/style change was made.
All screenshots remain local evidence and issue attachments only; no screenshot is added to Git. Automated final browser:1334 assertions (598 new/720 old30/2 aggregate/14 shared). Both widths tested each37 field and1 Note, source expansion, folding, keyboard/focus, late response/retry/old-empty/mismatched binding fallback. Forbidden requests0, both service ports released.
@@ -0,0 +1 @@
{"ref":"refs/tags/v0.27.0","node_id":"REF_kwDOIygeJrFyZWZzL3RhZ3MvdjAuMjcuMA","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/refs/tags/v0.27.0","object":{"sha":"bb131be9e83d2f773c90f1d6f1e4b248a498c8c5","type":"commit","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5"}}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,486 @@
from __future__ import annotations
import json
import os
import random
import uuid
from io import BytesIO
import av
import numpy as np
import torch
try:
import torchaudio
TORCH_AUDIO_AVAILABLE = True
except:
TORCH_AUDIO_AVAILABLE = False
from PIL import Image as PILImage
from PIL.PngImagePlugin import PngInfo
import folder_paths
# used for image preview
from comfy.cli_args import args
from ._io import ComfyNode, FolderType, Image, _UIOutput
class SavedResult(dict):
def __init__(self, filename: str, subfolder: str, type: FolderType):
super().__init__(filename=filename, subfolder=subfolder,type=type.value)
@property
def filename(self) -> str:
return self["filename"]
@property
def subfolder(self) -> str:
return self["subfolder"]
@property
def type(self) -> FolderType:
return FolderType(self["type"])
class SavedImages(_UIOutput):
"""A UI output class to represent one or more saved images, potentially animated."""
def __init__(self, results: list[SavedResult], is_animated: bool = False):
super().__init__()
self.results = results
self.is_animated = is_animated
def as_dict(self) -> dict:
data = {"images": self.results}
if self.is_animated:
data["animated"] = (True,)
return data
class SavedAudios(_UIOutput):
"""UI wrapper around one or more audio files on disk (FLAC / MP3 / Opus)."""
def __init__(self, results: list[SavedResult]):
super().__init__()
self.results = results
def as_dict(self) -> dict:
return {"audio": self.results}
def _get_directory_by_folder_type(folder_type: FolderType) -> str:
if folder_type == FolderType.input:
return folder_paths.get_input_directory()
if folder_type == FolderType.output:
return folder_paths.get_output_directory()
return folder_paths.get_temp_directory()
class ImageSaveHelper:
"""A helper class with static methods to handle image saving and metadata."""
@staticmethod
def _convert_tensor_to_pil(image_tensor: torch.Tensor) -> PILImage.Image:
"""Converts a single torch tensor to a PIL Image."""
return PILImage.fromarray(np.clip(255.0 * image_tensor.cpu().numpy(), 0, 255).astype(np.uint8))
@staticmethod
def _create_png_metadata(cls: type[ComfyNode] | None) -> PngInfo | None:
"""Creates a PngInfo object with prompt and extra_pnginfo."""
if args.disable_metadata or cls is None or not cls.hidden:
return None
metadata = PngInfo()
if cls.hidden.prompt:
metadata.add_text("prompt", json.dumps(cls.hidden.prompt))
if cls.hidden.extra_pnginfo:
for x in cls.hidden.extra_pnginfo:
metadata.add_text(x, json.dumps(cls.hidden.extra_pnginfo[x]))
return metadata
@staticmethod
def _create_animated_png_metadata(cls: type[ComfyNode] | None) -> PngInfo | None:
"""Creates a PngInfo object with prompt and extra_pnginfo for animated PNGs (APNG)."""
if args.disable_metadata or cls is None or not cls.hidden:
return None
metadata = PngInfo()
if cls.hidden.prompt:
metadata.add(
b"comf",
"prompt".encode("latin-1", "strict")
+ b"\0"
+ json.dumps(cls.hidden.prompt).encode("latin-1", "strict"),
after_idat=True,
)
if cls.hidden.extra_pnginfo:
for x in cls.hidden.extra_pnginfo:
metadata.add(
b"comf",
x.encode("latin-1", "strict")
+ b"\0"
+ json.dumps(cls.hidden.extra_pnginfo[x]).encode("latin-1", "strict"),
after_idat=True,
)
return metadata
@staticmethod
def _create_webp_metadata(pil_image: PILImage.Image, cls: type[ComfyNode] | None) -> PILImage.Exif:
"""Creates EXIF metadata bytes for WebP images."""
exif_data = pil_image.getexif()
if args.disable_metadata or cls is None or cls.hidden is None:
return exif_data
if cls.hidden.prompt is not None:
exif_data[0x0110] = "prompt:{}".format(json.dumps(cls.hidden.prompt)) # EXIF 0x0110 = Model
if cls.hidden.extra_pnginfo is not None:
inital_exif_tag = 0x010F # EXIF 0x010f = Make
for key, value in cls.hidden.extra_pnginfo.items():
exif_data[inital_exif_tag] = "{}:{}".format(key, json.dumps(value))
inital_exif_tag -= 1
return exif_data
@staticmethod
def save_images(
images, filename_prefix: str, folder_type: FolderType, cls: type[ComfyNode] | None, compress_level = 4,
) -> list[SavedResult]:
"""Saves a batch of images as individual PNG files."""
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
)
results = []
metadata = ImageSaveHelper._create_png_metadata(cls)
for batch_number, image_tensor in enumerate(images):
img = ImageSaveHelper._convert_tensor_to_pil(image_tensor)
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
file = f"{filename_with_batch_num}_{counter:05}_.png"
img.save(os.path.join(full_output_folder, file), pnginfo=metadata, compress_level=compress_level)
results.append(SavedResult(file, subfolder, folder_type))
counter += 1
return results
@staticmethod
def get_save_images_ui(images, filename_prefix: str, cls: type[ComfyNode] | None, compress_level=4) -> SavedImages:
"""Saves a batch of images and returns a UI object for the node output."""
return SavedImages(
ImageSaveHelper.save_images(
images,
filename_prefix=filename_prefix,
folder_type=FolderType.output,
cls=cls,
compress_level=compress_level,
)
)
@staticmethod
def save_animated_png(
images, filename_prefix: str, folder_type: FolderType, cls: type[ComfyNode] | None, fps: float, compress_level: int
) -> SavedResult:
"""Saves a batch of images as a single animated PNG."""
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
)
pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
metadata = ImageSaveHelper._create_animated_png_metadata(cls)
file = f"{filename}_{counter:05}_.png"
save_path = os.path.join(full_output_folder, file)
pil_images[0].save(
save_path,
pnginfo=metadata,
compress_level=compress_level,
save_all=True,
duration=int(1000.0 / fps),
append_images=pil_images[1:],
)
return SavedResult(file, subfolder, folder_type)
@staticmethod
def get_save_animated_png_ui(
images, filename_prefix: str, cls: type[ComfyNode] | None, fps: float, compress_level: int
) -> SavedImages:
"""Saves an animated PNG and returns a UI object for the node output."""
result = ImageSaveHelper.save_animated_png(
images,
filename_prefix=filename_prefix,
folder_type=FolderType.output,
cls=cls,
fps=fps,
compress_level=compress_level,
)
return SavedImages([result], is_animated=len(images) > 1)
@staticmethod
def save_animated_webp(
images,
filename_prefix: str,
folder_type: FolderType,
cls: type[ComfyNode] | None,
fps: float,
lossless: bool,
quality: int,
method: int,
) -> SavedResult:
"""Saves a batch of images as a single animated WebP."""
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
filename_prefix, _get_directory_by_folder_type(folder_type), images[0].shape[1], images[0].shape[0]
)
pil_images = [ImageSaveHelper._convert_tensor_to_pil(img) for img in images]
pil_exif = ImageSaveHelper._create_webp_metadata(pil_images[0], cls)
file = f"{filename}_{counter:05}_.webp"
pil_images[0].save(
os.path.join(full_output_folder, file),
save_all=True,
duration=int(1000.0 / fps),
append_images=pil_images[1:],
exif=pil_exif,
lossless=lossless,
quality=quality,
method=method,
)
return SavedResult(file, subfolder, folder_type)
@staticmethod
def get_save_animated_webp_ui(
images,
filename_prefix: str,
cls: type[ComfyNode] | None,
fps: float,
lossless: bool,
quality: int,
method: int,
) -> SavedImages:
"""Saves an animated WebP and returns a UI object for the node output."""
result = ImageSaveHelper.save_animated_webp(
images,
filename_prefix=filename_prefix,
folder_type=FolderType.output,
cls=cls,
fps=fps,
lossless=lossless,
quality=quality,
method=method,
)
return SavedImages([result], is_animated=len(images) > 1)
class AudioSaveHelper:
"""A helper class with static methods to handle audio saving and metadata."""
_OPUS_RATES = [8000, 12000, 16000, 24000, 48000]
@staticmethod
def save_audio(
audio: dict,
filename_prefix: str,
folder_type: FolderType,
cls: type[ComfyNode] | None,
format: str = "flac",
quality: str = "128k",
) -> list[SavedResult]:
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
filename_prefix, _get_directory_by_folder_type(folder_type)
)
metadata = {}
if not args.disable_metadata and cls is not None:
if cls.hidden.prompt is not None:
metadata["prompt"] = json.dumps(cls.hidden.prompt)
if cls.hidden.extra_pnginfo is not None:
for x in cls.hidden.extra_pnginfo:
metadata[x] = json.dumps(cls.hidden.extra_pnginfo[x])
results = []
for batch_number, waveform in enumerate(audio["waveform"].cpu()):
filename_with_batch_num = filename.replace("%batch_num%", str(batch_number))
file = f"{filename_with_batch_num}_{counter:05}.{format}"
output_path = os.path.join(full_output_folder, file)
# Use original sample rate initially
sample_rate = audio["sample_rate"]
# Handle Opus sample rate requirements
if format == "opus":
if sample_rate > 48000:
sample_rate = 48000
elif sample_rate not in AudioSaveHelper._OPUS_RATES:
# Find the next highest supported rate
for rate in sorted(AudioSaveHelper._OPUS_RATES):
if rate > sample_rate:
sample_rate = rate
break
if sample_rate not in AudioSaveHelper._OPUS_RATES: # Fallback if still not supported
sample_rate = 48000
# Resample if necessary
if sample_rate != audio["sample_rate"]:
if not TORCH_AUDIO_AVAILABLE:
raise Exception("torchaudio is not available; cannot resample audio.")
waveform = torchaudio.functional.resample(waveform, audio["sample_rate"], sample_rate)
# Create output with specified format
output_buffer = BytesIO()
output_container = av.open(output_buffer, mode="w", format=format)
# Set metadata on the container
for key, value in metadata.items():
output_container.metadata[key] = value
layout = "mono" if waveform.shape[0] == 1 else "stereo"
# Set up the output stream with appropriate properties
if format == "opus":
out_stream = output_container.add_stream("libopus", rate=sample_rate, layout=layout)
if quality == "64k":
out_stream.bit_rate = 64000
elif quality == "96k":
out_stream.bit_rate = 96000
elif quality == "128k":
out_stream.bit_rate = 128000
elif quality == "192k":
out_stream.bit_rate = 192000
elif quality == "320k":
out_stream.bit_rate = 320000
elif format == "mp3":
out_stream = output_container.add_stream("libmp3lame", rate=sample_rate, layout=layout)
if quality == "V0":
# TODO i would really love to support V3 and V5 but there doesn't seem to be a way to set the qscale level, the property below is a bool
out_stream.codec_context.qscale = 1
elif quality == "128k":
out_stream.bit_rate = 128000
elif quality == "320k":
out_stream.bit_rate = 320000
else: # format == "flac":
out_stream = output_container.add_stream("flac", rate=sample_rate, layout=layout)
frame = av.AudioFrame.from_ndarray(
waveform.movedim(0, 1).reshape(1, -1).float().numpy(),
format="flt",
layout=layout,
)
frame.sample_rate = sample_rate
frame.pts = 0
output_container.mux(out_stream.encode(frame))
# Flush encoder
output_container.mux(out_stream.encode(None))
# Close containers
output_container.close()
# Write the output to file
output_buffer.seek(0)
with open(output_path, "wb") as f:
f.write(output_buffer.getbuffer())
results.append(SavedResult(file, subfolder, folder_type))
counter += 1
return results
@staticmethod
def get_save_audio_ui(
audio, filename_prefix: str, cls: type[ComfyNode] | None, format: str = "flac", quality: str = "128k",
) -> SavedAudios:
"""Save and instantly wrap for UI."""
return SavedAudios(
AudioSaveHelper.save_audio(
audio,
filename_prefix=filename_prefix,
folder_type=FolderType.output,
cls=cls,
format=format,
quality=quality,
)
)
class PreviewImage(_UIOutput):
def __init__(self, image: Image.Type, animated: bool = False, cls: type[ComfyNode] = None, **kwargs):
self.values = ImageSaveHelper.save_images(
image,
filename_prefix="ComfyUI_temp_" + ''.join(random.choice("abcdefghijklmnopqrstupvxyz") for _ in range(5)),
folder_type=FolderType.temp,
cls=cls,
compress_level=1,
)
self.animated = animated
def as_dict(self):
return {
"images": self.values,
"animated": (self.animated,)
}
class PreviewMask(PreviewImage):
def __init__(self, mask: PreviewMask.Type, animated: bool=False, cls: ComfyNode=None, **kwargs):
preview = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
super().__init__(preview, animated, cls, **kwargs)
class PreviewAudio(_UIOutput):
def __init__(self, audio: dict, cls: type[ComfyNode] = None, **kwargs):
self.values = AudioSaveHelper.save_audio(
audio,
filename_prefix="ComfyUI_temp_" + "".join(random.choice("abcdefghijklmnopqrstuvwxyz") for _ in range(5)),
folder_type=FolderType.temp,
cls=cls,
format="flac",
quality="128k",
)
def as_dict(self) -> dict:
return {"audio": self.values}
class PreviewVideo(_UIOutput):
def __init__(self, values: list[SavedResult | dict], **kwargs):
self.values = values
def as_dict(self):
return {"images": self.values, "animated": (True,)}
class PreviewUI3D(_UIOutput):
def __init__(self, model_file, camera_info, **kwargs):
self.model_file = model_file
self.camera_info = camera_info
self.bg_image_path = None
bg_image = kwargs.get("bg_image", None)
if bg_image is not None:
img_array = (bg_image[0].cpu().numpy() * 255).astype(np.uint8)
img = PILImage.fromarray(img_array)
temp_dir = folder_paths.get_temp_directory()
filename = f"bg_{uuid.uuid4().hex}.png"
bg_image_path = os.path.join(temp_dir, filename)
img.save(bg_image_path, compress_level=1)
self.bg_image_path = f"temp/{filename}"
def as_dict(self):
return {"result": [self.model_file, self.camera_info, self.bg_image_path]}
class PreviewUI3DAdvanced(_UIOutput):
def __init__(self, model_file, camera_info, model_3d_info):
self.model_file = model_file
self.camera_info = camera_info
self.model_3d_info = model_3d_info
def as_dict(self):
return {"result": [self.model_file, self.camera_info, self.model_3d_info]}
class PreviewText(_UIOutput):
def __init__(self, value: str, **kwargs):
self.value = value
def as_dict(self):
return {"text": (self.value,)}
__all__ = [
"SavedResult",
"SavedImages",
"SavedAudios",
"ImageSaveHelper",
"AudioSaveHelper",
"PreviewImage",
"PreviewMask",
"PreviewAudio",
"PreviewVideo",
"PreviewUI3D",
"PreviewUI3DAdvanced",
"PreviewText",
]
@@ -0,0 +1,223 @@
import torch
import comfy.utils
from enum import Enum
from typing_extensions import override
from comfy_api.latest import ComfyExtension, io
def resize_mask(mask, shape):
return torch.nn.functional.interpolate(mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])), size=(shape[0], shape[1]), mode="bilinear").squeeze(1)
class PorterDuffMode(Enum):
ADD = 0
CLEAR = 1
DARKEN = 2
DST = 3
DST_ATOP = 4
DST_IN = 5
DST_OUT = 6
DST_OVER = 7
LIGHTEN = 8
MULTIPLY = 9
OVERLAY = 10
SCREEN = 11
SRC = 12
SRC_ATOP = 13
SRC_IN = 14
SRC_OUT = 15
SRC_OVER = 16
XOR = 17
def porter_duff_composite(src_image: torch.Tensor, src_alpha: torch.Tensor, dst_image: torch.Tensor, dst_alpha: torch.Tensor, mode: PorterDuffMode):
# convert mask to alpha
src_alpha = 1 - src_alpha
dst_alpha = 1 - dst_alpha
# premultiply alpha
src_image = src_image * src_alpha
dst_image = dst_image * dst_alpha
# composite ops below assume alpha-premultiplied images
if mode == PorterDuffMode.ADD:
out_alpha = torch.clamp(src_alpha + dst_alpha, 0, 1)
out_image = torch.clamp(src_image + dst_image, 0, 1)
elif mode == PorterDuffMode.CLEAR:
out_alpha = torch.zeros_like(dst_alpha)
out_image = torch.zeros_like(dst_image)
elif mode == PorterDuffMode.DARKEN:
out_alpha = src_alpha + dst_alpha - src_alpha * dst_alpha
out_image = (1 - dst_alpha) * src_image + (1 - src_alpha) * dst_image + torch.min(src_image, dst_image)
elif mode == PorterDuffMode.DST:
out_alpha = dst_alpha
out_image = dst_image
elif mode == PorterDuffMode.DST_ATOP:
out_alpha = src_alpha
out_image = src_alpha * dst_image + (1 - dst_alpha) * src_image
elif mode == PorterDuffMode.DST_IN:
out_alpha = src_alpha * dst_alpha
out_image = dst_image * src_alpha
elif mode == PorterDuffMode.DST_OUT:
out_alpha = (1 - src_alpha) * dst_alpha
out_image = (1 - src_alpha) * dst_image
elif mode == PorterDuffMode.DST_OVER:
out_alpha = dst_alpha + (1 - dst_alpha) * src_alpha
out_image = dst_image + (1 - dst_alpha) * src_image
elif mode == PorterDuffMode.LIGHTEN:
out_alpha = src_alpha + dst_alpha - src_alpha * dst_alpha
out_image = (1 - dst_alpha) * src_image + (1 - src_alpha) * dst_image + torch.max(src_image, dst_image)
elif mode == PorterDuffMode.MULTIPLY:
out_alpha = src_alpha * dst_alpha
out_image = src_image * dst_image
elif mode == PorterDuffMode.OVERLAY:
out_alpha = src_alpha + dst_alpha - src_alpha * dst_alpha
out_image = torch.where(2 * dst_image < dst_alpha, 2 * src_image * dst_image,
src_alpha * dst_alpha - 2 * (dst_alpha - src_image) * (src_alpha - dst_image))
elif mode == PorterDuffMode.SCREEN:
out_alpha = src_alpha + dst_alpha - src_alpha * dst_alpha
out_image = src_image + dst_image - src_image * dst_image
elif mode == PorterDuffMode.SRC:
out_alpha = src_alpha
out_image = src_image
elif mode == PorterDuffMode.SRC_ATOP:
out_alpha = dst_alpha
out_image = dst_alpha * src_image + (1 - src_alpha) * dst_image
elif mode == PorterDuffMode.SRC_IN:
out_alpha = src_alpha * dst_alpha
out_image = src_image * dst_alpha
elif mode == PorterDuffMode.SRC_OUT:
out_alpha = (1 - dst_alpha) * src_alpha
out_image = (1 - dst_alpha) * src_image
elif mode == PorterDuffMode.SRC_OVER:
out_alpha = src_alpha + (1 - src_alpha) * dst_alpha
out_image = src_image + (1 - src_alpha) * dst_image
elif mode == PorterDuffMode.XOR:
out_alpha = (1 - dst_alpha) * src_alpha + (1 - src_alpha) * dst_alpha
out_image = (1 - dst_alpha) * src_image + (1 - src_alpha) * dst_image
else:
return None, None
# back to non-premultiplied alpha
out_image = torch.where(out_alpha > 1e-5, out_image / out_alpha, torch.zeros_like(out_image))
out_image = torch.clamp(out_image, 0, 1)
# convert alpha to mask
out_alpha = 1 - out_alpha
return out_image, out_alpha
class PorterDuffImageComposite(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="PorterDuffImageComposite",
search_aliases=["alpha composite", "blend modes", "layer blend", "transparency blend"],
display_name="Porter-Duff Image Composite",
category="image/compositing",
inputs=[
io.Image.Input("source"),
io.Mask.Input("source_alpha"),
io.Image.Input("destination"),
io.Mask.Input("destination_alpha"),
io.Combo.Input("mode", options=[mode.name for mode in PorterDuffMode], default=PorterDuffMode.DST.name),
],
outputs=[
io.Image.Output(),
io.Mask.Output(),
],
)
@classmethod
def execute(cls, source: torch.Tensor, source_alpha: torch.Tensor, destination: torch.Tensor, destination_alpha: torch.Tensor, mode) -> io.NodeOutput:
batch_size = min(len(source), len(source_alpha), len(destination), len(destination_alpha))
out_images = []
out_alphas = []
for i in range(batch_size):
src_image = source[i]
dst_image = destination[i]
assert src_image.shape[2] == dst_image.shape[2] # inputs need to have same number of channels
src_alpha = source_alpha[i].unsqueeze(2)
dst_alpha = destination_alpha[i].unsqueeze(2)
if dst_alpha.shape[:2] != dst_image.shape[:2]:
upscale_input = dst_alpha.unsqueeze(0).permute(0, 3, 1, 2)
upscale_output = comfy.utils.common_upscale(upscale_input, dst_image.shape[1], dst_image.shape[0], upscale_method='bicubic', crop='center')
dst_alpha = upscale_output.permute(0, 2, 3, 1).squeeze(0)
if src_image.shape != dst_image.shape:
upscale_input = src_image.unsqueeze(0).permute(0, 3, 1, 2)
upscale_output = comfy.utils.common_upscale(upscale_input, dst_image.shape[1], dst_image.shape[0], upscale_method='bicubic', crop='center')
src_image = upscale_output.permute(0, 2, 3, 1).squeeze(0)
if src_alpha.shape != dst_alpha.shape:
upscale_input = src_alpha.unsqueeze(0).permute(0, 3, 1, 2)
upscale_output = comfy.utils.common_upscale(upscale_input, dst_alpha.shape[1], dst_alpha.shape[0], upscale_method='bicubic', crop='center')
src_alpha = upscale_output.permute(0, 2, 3, 1).squeeze(0)
out_image, out_alpha = porter_duff_composite(src_image, src_alpha, dst_image, dst_alpha, PorterDuffMode[mode])
out_images.append(out_image)
out_alphas.append(out_alpha.squeeze(2))
return io.NodeOutput(torch.stack(out_images), torch.stack(out_alphas))
class SplitImageWithAlpha(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="SplitImageWithAlpha",
search_aliases=["extract alpha", "separate transparency", "remove alpha"],
display_name="Split Image with Alpha",
category="image/compositing",
inputs=[
io.Image.Input("image"),
],
outputs=[
io.Image.Output(),
io.Mask.Output(),
],
)
@classmethod
def execute(cls, image: torch.Tensor) -> io.NodeOutput:
out_images = [i[:,:,:3] for i in image]
out_alphas = [i[:,:,3] if i.shape[2] > 3 else torch.ones_like(i[:,:,0]) for i in image]
return io.NodeOutput(torch.stack(out_images), 1.0 - torch.stack(out_alphas))
class JoinImageWithAlpha(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="JoinImageWithAlpha",
search_aliases=["add transparency", "apply alpha", "composite alpha", "RGBA"],
display_name="Join Image with Alpha",
category="image/compositing",
inputs=[
io.Image.Input("image"),
io.Mask.Input("alpha"),
],
outputs=[io.Image.Output()],
)
@classmethod
def execute(cls, image: torch.Tensor, alpha: torch.Tensor) -> io.NodeOutput:
batch_size = max(len(image), len(alpha))
alpha = 1.0 - resize_mask(alpha.to(image), image.shape[1:])
alpha = comfy.utils.repeat_to_batch_size(alpha, batch_size)
image = comfy.utils.repeat_to_batch_size(image, batch_size)
return io.NodeOutput(torch.cat((image[..., :3], alpha.unsqueeze(-1)), dim=-1))
class CompositingExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
PorterDuffImageComposite,
SplitImageWithAlpha,
JoinImageWithAlpha,
]
async def comfy_entrypoint() -> CompositingExtension:
return CompositingExtension()
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,456 @@
import numpy as np
import scipy.ndimage
import torch
import comfy.utils
import comfy.model_management
import node_helpers
from typing_extensions import override
from comfy_api.latest import ComfyExtension, IO, UI
import nodes
def composite(destination, source, x, y, mask = None, multiplier = 8, resize_source = False):
source = source.to(destination.device)
if resize_source:
source = torch.nn.functional.interpolate(source, size=(destination.shape[-2], destination.shape[-1]), mode="bilinear")
source = comfy.utils.repeat_to_batch_size(source, destination.shape[0])
x = max(-source.shape[-1] * multiplier, min(x, destination.shape[-1] * multiplier))
y = max(-source.shape[-2] * multiplier, min(y, destination.shape[-2] * multiplier))
left, top = (x // multiplier, y // multiplier)
right, bottom = (left + source.shape[-1], top + source.shape[-2],)
if mask is None:
mask = torch.ones_like(source)
else:
mask = mask.to(destination.device, copy=True)
mask = torch.nn.functional.interpolate(mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])), size=(source.shape[-2], source.shape[-1]), mode="bilinear")
mask = comfy.utils.repeat_to_batch_size(mask, source.shape[0])
# calculate the bounds of the source that will be overlapping the destination
# this prevents the source trying to overwrite latent pixels that are out of bounds
# of the destination
visible_width, visible_height = (destination.shape[-1] - left + min(0, x), destination.shape[-2] - top + min(0, y),)
mask = mask[:, :, :visible_height, :visible_width]
if mask.ndim < source.ndim:
mask = mask.unsqueeze(1)
inverse_mask = torch.ones_like(mask) - mask
source_portion = mask * source[..., :visible_height, :visible_width]
destination_portion = inverse_mask * destination[..., top:bottom, left:right]
destination[..., top:bottom, left:right] = source_portion + destination_portion
return destination
class LatentCompositeMasked(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="LatentCompositeMasked",
search_aliases=["overlay latent", "layer latent", "paste latent", "inpaint latent"],
display_name="Latent Composite Masked",
category="model/latent",
inputs=[
IO.Latent.Input("destination"),
IO.Latent.Input("source"),
IO.Int.Input("x", default=0, min=0, max=nodes.MAX_RESOLUTION, step=8),
IO.Int.Input("y", default=0, min=0, max=nodes.MAX_RESOLUTION, step=8),
IO.Boolean.Input("resize_source", default=False),
IO.Mask.Input("mask", optional=True),
],
outputs=[IO.Latent.Output()],
)
@classmethod
def execute(cls, destination, source, x, y, resize_source, mask = None) -> IO.NodeOutput:
output = destination.copy()
destination = destination["samples"].clone()
source = source["samples"]
output["samples"] = composite(destination, source, x, y, mask, 8, resize_source)
return IO.NodeOutput(output)
composite = execute # TODO: remove
class ImageCompositeMasked(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="ImageCompositeMasked",
search_aliases=["overlay", "layer", "paste image", "images composition"],
display_name="Image Composite Masked",
category="image/compositing",
inputs=[
IO.Image.Input("destination"),
IO.Image.Input("source"),
IO.Int.Input("x", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("y", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Boolean.Input("resize_source", default=False),
IO.Mask.Input("mask", optional=True),
],
outputs=[IO.Image.Output()],
)
@classmethod
def execute(cls, destination, source, x, y, resize_source, mask = None) -> IO.NodeOutput:
destination, source = node_helpers.image_alpha_fix(destination, source)
destination = destination.clone().movedim(-1, 1)
output = composite(destination, source.movedim(-1, 1), x, y, mask, 1, resize_source).movedim(1, -1)
return IO.NodeOutput(output)
composite = execute # TODO: remove
class MaskToImage(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="MaskToImage",
search_aliases=["convert mask"],
display_name="Convert Mask to Image",
category="image/mask",
inputs=[
IO.Mask.Input("mask"),
],
outputs=[IO.Image.Output()],
)
@classmethod
def execute(cls, mask) -> IO.NodeOutput:
result = mask.reshape((-1, 1, mask.shape[-2], mask.shape[-1])).movedim(1, -1).expand(-1, -1, -1, 3)
return IO.NodeOutput(result)
mask_to_image = execute # TODO: remove
class ImageToMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="ImageToMask",
search_aliases=["extract channel", "channel to mask"],
display_name="Convert Image to Mask",
category="image/mask",
inputs=[
IO.Image.Input("image"),
IO.Combo.Input("channel", options=["red", "green", "blue", "alpha"]),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, image, channel) -> IO.NodeOutput:
channels = ["red", "green", "blue", "alpha"]
mask = image[:, :, :, channels.index(channel)]
return IO.NodeOutput(mask)
image_to_mask = execute # TODO: remove
class ImageColorToMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="ImageColorToMask",
search_aliases=["color keying", "chroma key"],
display_name="Convert Image Color to Mask",
category="image/mask",
inputs=[
IO.Image.Input("image"),
IO.Int.Input("color", default=0, min=0, max=0xFFFFFF, step=1, display_mode=IO.NumberDisplay.number),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, image, color) -> IO.NodeOutput:
temp = (torch.clamp(image, 0, 1.0) * 255.0).round().to(torch.int)
temp = torch.bitwise_left_shift(temp[:,:,:,0], 16) + torch.bitwise_left_shift(temp[:,:,:,1], 8) + temp[:,:,:,2]
mask = torch.where(temp == color, 1.0, 0).float()
return IO.NodeOutput(mask)
image_to_mask = execute # TODO: remove
class SolidMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="SolidMask",
display_name="Create Solid Mask",
category="image/mask",
inputs=[
IO.Float.Input("value", default=1.0, min=0.0, max=1.0, step=0.01),
IO.Int.Input("width", default=512, min=1, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("height", default=512, min=1, max=nodes.MAX_RESOLUTION, step=1),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, value, width, height) -> IO.NodeOutput:
out = torch.full((1, height, width), value, dtype=torch.float32, device=comfy.model_management.intermediate_device())
return IO.NodeOutput(out)
solid = execute # TODO: remove
class InvertMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="InvertMask",
search_aliases=["reverse mask", "flip mask"],
display_name="Invert Mask",
category="image/mask",
inputs=[
IO.Mask.Input("mask"),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, mask) -> IO.NodeOutput:
out = 1.0 - mask
return IO.NodeOutput(out)
invert = execute # TODO: remove
class CropMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="CropMask",
search_aliases=["cut mask", "extract mask region", "mask slice"],
display_name="Crop Mask",
category="image/mask",
inputs=[
IO.Mask.Input("mask"),
IO.Int.Input("x", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("y", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("width", default=512, min=1, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("height", default=512, min=1, max=nodes.MAX_RESOLUTION, step=1),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, mask, x, y, width, height) -> IO.NodeOutput:
mask = mask.reshape((-1, mask.shape[-2], mask.shape[-1]))
out = mask[:, y:y + height, x:x + width]
return IO.NodeOutput(out)
crop = execute # TODO: remove
class MaskComposite(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="MaskComposite",
search_aliases=["combine masks", "blend masks", "layer masks", "masks composition"],
display_name="Combine Masks",
category="image/mask",
inputs=[
IO.Mask.Input("destination"),
IO.Mask.Input("source"),
IO.Int.Input("x", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("y", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Combo.Input("operation", options=["multiply", "add", "subtract", "and", "or", "xor"]),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, destination, source, x, y, operation) -> IO.NodeOutput:
output = destination.reshape((-1, destination.shape[-2], destination.shape[-1])).clone()
source = source.reshape((-1, source.shape[-2], source.shape[-1]))
source = source.to(output.device)
left, top = (x, y,)
right, bottom = (min(left + source.shape[-1], destination.shape[-1]), min(top + source.shape[-2], destination.shape[-2]))
visible_width, visible_height = (right - left, bottom - top,)
source_portion = source[:, :visible_height, :visible_width]
destination_portion = output[:, top:bottom, left:right]
if operation == "multiply":
output[:, top:bottom, left:right] = destination_portion * source_portion
elif operation == "add":
output[:, top:bottom, left:right] = destination_portion + source_portion
elif operation == "subtract":
output[:, top:bottom, left:right] = destination_portion - source_portion
elif operation == "and":
output[:, top:bottom, left:right] = torch.bitwise_and(destination_portion.round().bool(), source_portion.round().bool()).float()
elif operation == "or":
output[:, top:bottom, left:right] = torch.bitwise_or(destination_portion.round().bool(), source_portion.round().bool()).float()
elif operation == "xor":
output[:, top:bottom, left:right] = torch.bitwise_xor(destination_portion.round().bool(), source_portion.round().bool()).float()
output = torch.clamp(output, 0.0, 1.0)
return IO.NodeOutput(output)
combine = execute # TODO: remove
class FeatherMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="FeatherMask",
search_aliases=["soft edge mask", "blur mask edges", "gradient mask edge"],
display_name="Feather Mask",
category="image/mask",
inputs=[
IO.Mask.Input("mask"),
IO.Int.Input("left", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("top", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("right", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
IO.Int.Input("bottom", default=0, min=0, max=nodes.MAX_RESOLUTION, step=1),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, mask, left, top, right, bottom) -> IO.NodeOutput:
output = mask.reshape((-1, mask.shape[-2], mask.shape[-1])).clone()
left = min(left, output.shape[-1])
right = min(right, output.shape[-1])
top = min(top, output.shape[-2])
bottom = min(bottom, output.shape[-2])
for x in range(left):
feather_rate = (x + 1.0) / left
output[:, :, x] *= feather_rate
for x in range(right):
feather_rate = (x + 1) / right
output[:, :, -(x + 1)] *= feather_rate
for y in range(top):
feather_rate = (y + 1) / top
output[:, y, :] *= feather_rate
for y in range(bottom):
feather_rate = (y + 1) / bottom
output[:, -(y + 1), :] *= feather_rate
return IO.NodeOutput(output)
feather = execute # TODO: remove
class GrowMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="GrowMask",
search_aliases=["expand mask", "shrink mask"],
display_name="Grow Mask",
category="image/mask",
inputs=[
IO.Mask.Input("mask"),
IO.Int.Input("expand", default=0, min=-nodes.MAX_RESOLUTION, max=nodes.MAX_RESOLUTION, step=1),
IO.Boolean.Input("tapered_corners", default=True, advanced=True),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, mask, expand, tapered_corners) -> IO.NodeOutput:
c = 0 if tapered_corners else 1
kernel = np.array([[c, 1, c],
[1, 1, 1],
[c, 1, c]])
mask = mask.reshape((-1, mask.shape[-2], mask.shape[-1]))
out = []
for m in mask:
output = m.numpy()
for _ in range(abs(expand)):
if expand < 0:
output = scipy.ndimage.grey_erosion(output, footprint=kernel)
else:
output = scipy.ndimage.grey_dilation(output, footprint=kernel)
output = torch.from_numpy(output)
out.append(output)
return IO.NodeOutput(torch.stack(out, dim=0))
expand_mask = execute # TODO: remove
class ThresholdMask(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="ThresholdMask",
search_aliases=["binary mask"],
display_name="Threshold Mask",
category="image/mask",
inputs=[
IO.Mask.Input("mask"),
IO.Float.Input("value", default=0.5, min=0.0, max=1.0, step=0.01),
],
outputs=[IO.Mask.Output()],
)
@classmethod
def execute(cls, mask, value) -> IO.NodeOutput:
mask = (mask > value).float()
return IO.NodeOutput(mask)
image_to_mask = execute # TODO: remove
# Mask Preview - original implement from
# https://github.com/cubiq/ComfyUI_essentials/blob/9d9f4bedfc9f0321c19faf71855e228c93bd0dc9/mask.py#L81
# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes
class MaskPreview(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="MaskPreview",
search_aliases=["show mask", "view mask", "inspect mask", "debug mask"],
display_name="Preview Mask",
category="image/mask",
description="Saves the input images to your ComfyUI output directory.",
inputs=[
IO.Mask.Input("mask"),
],
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, mask, filename_prefix="ComfyUI") -> IO.NodeOutput:
return IO.NodeOutput(ui=UI.PreviewMask(mask))
class MaskExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[IO.ComfyNode]]:
return [
LatentCompositeMasked,
ImageCompositeMasked,
MaskToImage,
ImageToMask,
ImageColorToMask,
SolidMask,
InvertMask,
CropMask,
MaskComposite,
FeatherMask,
GrowMask,
ThresholdMask,
MaskPreview,
]
async def comfy_entrypoint() -> MaskExtension:
return MaskExtension()
@@ -0,0 +1,909 @@
from typing_extensions import override
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
import math
from enum import Enum
from typing import TypedDict, Literal
import kornia
import comfy.utils
import comfy.model_management
from comfy_extras.nodes_latent import reshape_latent_to
import node_helpers
from comfy_api.latest import ComfyExtension, io
from nodes import MAX_RESOLUTION
class Blend(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ImageBlend",
search_aliases=["mix images"],
display_name="Blend Images",
category="image/filters",
essentials_category="Image Tools",
inputs=[
io.Image.Input("image1"),
io.Image.Input("image2"),
io.Float.Input("blend_factor", default=0.5, min=0.0, max=1.0, step=0.01),
io.Combo.Input("blend_mode", options=["normal", "multiply", "screen", "overlay", "soft_light", "difference"]),
],
outputs=[
io.Image.Output(),
],
)
@classmethod
def execute(cls, image1: torch.Tensor, image2: torch.Tensor, blend_factor: float, blend_mode: str) -> io.NodeOutput:
image1, image2 = node_helpers.image_alpha_fix(image1, image2)
image2 = image2.to(image1.device)
if image1.shape != image2.shape:
image2 = image2.permute(0, 3, 1, 2)
image2 = comfy.utils.common_upscale(image2, image1.shape[2], image1.shape[1], upscale_method='bicubic', crop='center')
image2 = image2.permute(0, 2, 3, 1)
blended_image = cls.blend_mode(image1, image2, blend_mode)
blended_image = image1 * (1 - blend_factor) + blended_image * blend_factor
blended_image = torch.clamp(blended_image, 0, 1)
return io.NodeOutput(blended_image)
@classmethod
def blend_mode(cls, img1, img2, mode):
if mode == "normal":
return img2
elif mode == "multiply":
return img1 * img2
elif mode == "screen":
return 1 - (1 - img1) * (1 - img2)
elif mode == "overlay":
return torch.where(img1 <= 0.5, 2 * img1 * img2, 1 - 2 * (1 - img1) * (1 - img2))
elif mode == "soft_light":
return torch.where(img2 <= 0.5, img1 - (1 - 2 * img2) * img1 * (1 - img1), img1 + (2 * img2 - 1) * (cls.g(img1) - img1))
elif mode == "difference":
return img1 - img2
raise ValueError(f"Unsupported blend mode: {mode}")
@classmethod
def g(cls, x):
return torch.where(x <= 0.25, ((16 * x - 12) * x + 4) * x, torch.sqrt(x))
def gaussian_kernel(kernel_size: int, sigma: float, device=None, dtype=torch.float32):
x, y = torch.meshgrid(torch.linspace(-1, 1, kernel_size, device=device), torch.linspace(-1, 1, kernel_size, device=device), indexing="ij")
d = torch.sqrt(x * x + y * y)
g = torch.exp(-(d * d) / (2.0 * sigma * sigma))
return (g / g.sum()).to(dtype)
class Blur(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ImageBlur",
display_name="Blur Image",
category="image/filters",
inputs=[
io.Image.Input("image"),
io.Int.Input("blur_radius", default=1, min=1, max=31, step=1),
io.Float.Input("sigma", default=1.0, min=0.1, max=10.0, step=0.1),
],
outputs=[
io.Image.Output(),
],
)
@classmethod
def execute(cls, image: torch.Tensor, blur_radius: int, sigma: float) -> io.NodeOutput:
if blur_radius == 0:
return io.NodeOutput(image)
image = image.to(comfy.model_management.get_torch_device())
batch_size, height, width, channels = image.shape
kernel_size = blur_radius * 2 + 1
kernel = gaussian_kernel(kernel_size, sigma, device=image.device, dtype=image.dtype).repeat(channels, 1, 1).unsqueeze(1)
image = image.permute(0, 3, 1, 2) # Torch wants (B, C, H, W) we use (B, H, W, C)
padded_image = F.pad(image, (blur_radius,blur_radius,blur_radius,blur_radius), 'reflect')
blurred = F.conv2d(padded_image, kernel, padding=kernel_size // 2, groups=channels)[:,:,blur_radius:-blur_radius, blur_radius:-blur_radius]
blurred = blurred.permute(0, 2, 3, 1)
return io.NodeOutput(blurred.to(comfy.model_management.intermediate_device()))
class Quantize(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ImageQuantize",
display_name="Quantize Image",
category="image/filters",
inputs=[
io.Image.Input("image"),
io.Int.Input("colors", default=256, min=1, max=256, step=1),
io.Combo.Input("dither", options=["none", "floyd-steinberg", "bayer-2", "bayer-4", "bayer-8", "bayer-16"]),
],
outputs=[
io.Image.Output(),
],
)
@staticmethod
def bayer(im, pal_im, order):
def normalized_bayer_matrix(n):
if n == 0:
return np.zeros((1,1), "float32")
else:
q = 4 ** n
m = q * normalized_bayer_matrix(n - 1)
return np.bmat(((m-1.5, m+0.5), (m+1.5, m-0.5))) / q
num_colors = len(pal_im.getpalette()) // 3
spread = 2 * 256 / num_colors
bayer_n = int(math.log2(order))
bayer_matrix = torch.from_numpy(spread * normalized_bayer_matrix(bayer_n) + 0.5)
result = torch.from_numpy(np.array(im).astype(np.float32))
tw = math.ceil(result.shape[0] / bayer_matrix.shape[0])
th = math.ceil(result.shape[1] / bayer_matrix.shape[1])
tiled_matrix = bayer_matrix.tile(tw, th).unsqueeze(-1)
result.add_(tiled_matrix[:result.shape[0],:result.shape[1]]).clamp_(0, 255)
result = result.to(dtype=torch.uint8)
im = Image.fromarray(result.cpu().numpy())
im = im.quantize(palette=pal_im, dither=Image.Dither.NONE)
return im
@classmethod
def execute(cls, image: torch.Tensor, colors: int, dither: str) -> io.NodeOutput:
batch_size, height, width, _ = image.shape
result = torch.zeros_like(image)
for b in range(batch_size):
im = Image.fromarray((image[b] * 255).to(torch.uint8).numpy(), mode='RGB')
pal_im = im.quantize(colors=colors) # Required as described in https://github.com/python-pillow/Pillow/issues/5836
if dither == "none":
quantized_image = im.quantize(palette=pal_im, dither=Image.Dither.NONE)
elif dither == "floyd-steinberg":
quantized_image = im.quantize(palette=pal_im, dither=Image.Dither.FLOYDSTEINBERG)
elif dither.startswith("bayer"):
order = int(dither.split('-')[-1])
quantized_image = Quantize.bayer(im, pal_im, order)
quantized_array = torch.tensor(np.array(quantized_image.convert("RGB"))).float() / 255
result[b] = quantized_array
return io.NodeOutput(result)
class Sharpen(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ImageSharpen",
display_name="Sharpen Image",
category="image/filters",
inputs=[
io.Image.Input("image"),
io.Int.Input("sharpen_radius", default=1, min=1, max=31, step=1, advanced=True),
io.Float.Input("sigma", default=1.0, min=0.1, max=10.0, step=0.01, advanced=True),
io.Float.Input("alpha", default=1.0, min=0.0, max=5.0, step=0.01, advanced=True),
],
outputs=[
io.Image.Output(),
],
)
@classmethod
def execute(cls, image: torch.Tensor, sharpen_radius: int, sigma:float, alpha: float) -> io.NodeOutput:
if sharpen_radius == 0:
return io.NodeOutput(image)
batch_size, height, width, channels = image.shape
image = image.to(comfy.model_management.get_torch_device())
kernel_size = sharpen_radius * 2 + 1
kernel = gaussian_kernel(kernel_size, sigma, device=image.device, dtype=image.dtype) * -(alpha*10)
kernel = kernel.to(dtype=image.dtype)
center = kernel_size // 2
kernel[center, center] = kernel[center, center] - kernel.sum() + 1.0
kernel = kernel.repeat(channels, 1, 1).unsqueeze(1)
tensor_image = image.permute(0, 3, 1, 2) # Torch wants (B, C, H, W) we use (B, H, W, C)
tensor_image = F.pad(tensor_image, (sharpen_radius,sharpen_radius,sharpen_radius,sharpen_radius), 'reflect')
sharpened = F.conv2d(tensor_image, kernel, padding=center, groups=channels)[:,:,sharpen_radius:-sharpen_radius, sharpen_radius:-sharpen_radius]
sharpened = sharpened.permute(0, 2, 3, 1)
result = torch.clamp(sharpened, 0, 1)
return io.NodeOutput(result.to(comfy.model_management.intermediate_device()))
class ImageScaleToTotalPixels(io.ComfyNode):
upscale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"]
crop_methods = ["disabled", "center"]
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ImageScaleToTotalPixels",
display_name="Scale Image to Total Pixels",
category="image/upscaling",
inputs=[
io.Image.Input("image"),
io.Combo.Input("upscale_method", options=cls.upscale_methods),
io.Float.Input("megapixels", default=1.0, min=0.01, max=16.0, step=0.01),
io.Int.Input("resolution_steps", default=1, min=1, max=256, advanced=True),
],
outputs=[
io.Image.Output(),
],
)
@classmethod
def execute(cls, image, upscale_method, megapixels, resolution_steps) -> io.NodeOutput:
samples = image.movedim(-1,1)
total = megapixels * 1024 * 1024
scale_by = math.sqrt(total / (samples.shape[3] * samples.shape[2]))
width = round(samples.shape[3] * scale_by / resolution_steps) * resolution_steps
height = round(samples.shape[2] * scale_by / resolution_steps) * resolution_steps
s = comfy.utils.common_upscale(samples, int(width), int(height), upscale_method, "disabled")
s = s.movedim(1,-1)
return io.NodeOutput(s)
class ResizeType(str, Enum):
SCALE_BY = "scale by multiplier"
SCALE_DIMENSIONS = "scale dimensions"
SCALE_LONGER_DIMENSION = "scale longer dimension"
SCALE_SHORTER_DIMENSION = "scale shorter dimension"
SCALE_WIDTH = "scale width"
SCALE_HEIGHT = "scale height"
SCALE_TOTAL_PIXELS = "scale total pixels"
MATCH_SIZE = "match size"
SCALE_TO_MULTIPLE = "scale to multiple"
def is_image(input: torch.Tensor) -> bool:
# images have 4 dimensions: [batch, height, width, channels]
# masks have 3 dimensions: [batch, height, width]
return len(input.shape) == 4
def init_image_mask_input(input: torch.Tensor, is_type_image: bool) -> torch.Tensor:
if is_type_image:
input = input.movedim(-1, 1)
else:
input = input.unsqueeze(1)
return input
def finalize_image_mask_input(input: torch.Tensor, is_type_image: bool) -> torch.Tensor:
if is_type_image:
input = input.movedim(1, -1)
else:
input = input.squeeze(1)
return input
def scale_by(input: torch.Tensor, multiplier: float, scale_method: str) -> torch.Tensor:
is_type_image = is_image(input)
input = init_image_mask_input(input, is_type_image)
width = round(input.shape[-1] * multiplier)
height = round(input.shape[-2] * multiplier)
input = comfy.utils.common_upscale(input, width, height, scale_method, "disabled")
input = finalize_image_mask_input(input, is_type_image)
return input
def scale_dimensions(input: torch.Tensor, width: int, height: int, scale_method: str, crop: str="disabled") -> torch.Tensor:
if width == 0 and height == 0:
return input
is_type_image = is_image(input)
input = init_image_mask_input(input, is_type_image)
if width == 0:
width = max(1, round(input.shape[-1] * height / input.shape[-2]))
elif height == 0:
height = max(1, round(input.shape[-2] * width / input.shape[-1]))
input = comfy.utils.common_upscale(input, width, height, scale_method, crop)
input = finalize_image_mask_input(input, is_type_image)
return input
def scale_longer_dimension(input: torch.Tensor, longer_size: int, scale_method: str) -> torch.Tensor:
is_type_image = is_image(input)
input = init_image_mask_input(input, is_type_image)
width = input.shape[-1]
height = input.shape[-2]
if height > width:
width = round((width / height) * longer_size)
height = longer_size
elif width > height:
height = round((height / width) * longer_size)
width = longer_size
else:
height = longer_size
width = longer_size
input = comfy.utils.common_upscale(input, width, height, scale_method, "disabled")
input = finalize_image_mask_input(input, is_type_image)
return input
def scale_shorter_dimension(input: torch.Tensor, shorter_size: int, scale_method: str) -> torch.Tensor:
is_type_image = is_image(input)
input = init_image_mask_input(input, is_type_image)
width = input.shape[-1]
height = input.shape[-2]
if height < width:
width = round((width / height) * shorter_size)
height = shorter_size
elif width < height:
height = round((height / width) * shorter_size)
width = shorter_size
else:
height = shorter_size
width = shorter_size
input = comfy.utils.common_upscale(input, width, height, scale_method, "disabled")
input = finalize_image_mask_input(input, is_type_image)
return input
def scale_total_pixels(input: torch.Tensor, megapixels: float, scale_method: str) -> torch.Tensor:
is_type_image = is_image(input)
input = init_image_mask_input(input, is_type_image)
total = int(megapixels * 1024 * 1024)
scale_by = math.sqrt(total / (input.shape[-1] * input.shape[-2]))
width = round(input.shape[-1] * scale_by)
height = round(input.shape[-2] * scale_by)
input = comfy.utils.common_upscale(input, width, height, scale_method, "disabled")
input = finalize_image_mask_input(input, is_type_image)
return input
def scale_match_size(input: torch.Tensor, match: torch.Tensor, scale_method: str, crop: str) -> torch.Tensor:
is_type_image = is_image(input)
input = init_image_mask_input(input, is_type_image)
match = init_image_mask_input(match, is_image(match))
width = match.shape[-1]
height = match.shape[-2]
input = comfy.utils.common_upscale(input, width, height, scale_method, crop)
input = finalize_image_mask_input(input, is_type_image)
return input
def scale_to_multiple_cover(input: torch.Tensor, multiple: int, scale_method: str) -> torch.Tensor:
if multiple <= 1:
return input
is_type_image = is_image(input)
if is_type_image:
_, height, width, _ = input.shape
else:
_, height, width = input.shape
target_w = (width // multiple) * multiple
target_h = (height // multiple) * multiple
if target_w == 0 or target_h == 0:
return input
if target_w == width and target_h == height:
return input
s_w = target_w / width
s_h = target_h / height
if s_w >= s_h:
scaled_w = target_w
scaled_h = int(math.ceil(height * s_w))
if scaled_h < target_h:
scaled_h = target_h
else:
scaled_h = target_h
scaled_w = int(math.ceil(width * s_h))
if scaled_w < target_w:
scaled_w = target_w
input = init_image_mask_input(input, is_type_image)
input = comfy.utils.common_upscale(input, scaled_w, scaled_h, scale_method, "disabled")
input = finalize_image_mask_input(input, is_type_image)
x0 = (scaled_w - target_w) // 2
y0 = (scaled_h - target_h) // 2
x1 = x0 + target_w
y1 = y0 + target_h
if is_type_image:
return input[:, y0:y1, x0:x1, :]
return input[:, y0:y1, x0:x1]
class ResizeImageMaskNode(io.ComfyNode):
scale_methods = ["nearest-exact", "bilinear", "area", "bicubic", "lanczos"]
crop_methods = ["disabled", "center"]
class ResizeTypedDict(TypedDict):
resize_type: ResizeType
scale_method: Literal["nearest-exact", "bilinear", "area", "bicubic", "lanczos"]
crop: Literal["disabled", "center"]
multiplier: float
width: int
height: int
longer_size: int
shorter_size: int
megapixels: float
multiple: int
@classmethod
def define_schema(cls):
template = io.MatchType.Template("input_type", [io.Image, io.Mask])
crop_combo = io.Combo.Input(
"crop",
options=cls.crop_methods,
default="center",
tooltip="How to handle aspect ratio mismatch: 'disabled' stretches to fit, 'center' crops to maintain aspect ratio.",
)
return io.Schema(
node_id="ResizeImageMaskNode",
display_name="Resize Image/Mask",
description="Resize an image or mask using various scaling methods.",
category="image/transform",
search_aliases=["resize", "resize image", "resize mask", "scale", "scale image", "scale mask", "image resize", "change size", "dimensions", "shrink", "enlarge"],
inputs=[
io.MatchType.Input("input", template=template),
io.DynamicCombo.Input(
"resize_type",
tooltip="Select how to resize: by exact dimensions, scale factor, matching another image, etc.",
options=[
io.DynamicCombo.Option(ResizeType.SCALE_DIMENSIONS, [
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target width in pixels. Set to 0 to auto-calculate from height while preserving aspect ratio."),
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target height in pixels. Set to 0 to auto-calculate from width while preserving aspect ratio."),
crop_combo,
]),
io.DynamicCombo.Option(ResizeType.SCALE_BY, [
io.Float.Input("multiplier", default=1.00, min=0.01, max=8.0, step=0.01, tooltip="Scale factor (e.g., 2.0 doubles size, 0.5 halves size)."),
]),
io.DynamicCombo.Option(ResizeType.SCALE_LONGER_DIMENSION, [
io.Int.Input("longer_size", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="The longer edge will be resized to this value. Aspect ratio is preserved."),
]),
io.DynamicCombo.Option(ResizeType.SCALE_SHORTER_DIMENSION, [
io.Int.Input("shorter_size", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="The shorter edge will be resized to this value. Aspect ratio is preserved."),
]),
io.DynamicCombo.Option(ResizeType.SCALE_WIDTH, [
io.Int.Input("width", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target width in pixels. Height auto-adjusts to preserve aspect ratio."),
]),
io.DynamicCombo.Option(ResizeType.SCALE_HEIGHT, [
io.Int.Input("height", default=512, min=0, max=MAX_RESOLUTION, step=1, tooltip="Target height in pixels. Width auto-adjusts to preserve aspect ratio."),
]),
io.DynamicCombo.Option(ResizeType.SCALE_TOTAL_PIXELS, [
io.Float.Input("megapixels", default=1.0, min=0.01, max=16.0, step=0.01, tooltip="Target total megapixels (e.g., 1.0 ≈ 1024×1024). Aspect ratio is preserved."),
]),
io.DynamicCombo.Option(ResizeType.MATCH_SIZE, [
io.MultiType.Input("match", [io.Image, io.Mask], tooltip="Resize input to match the dimensions of this reference image or mask."),
crop_combo,
]),
io.DynamicCombo.Option(ResizeType.SCALE_TO_MULTIPLE, [
io.Int.Input("multiple", default=8, min=1, max=MAX_RESOLUTION, step=1, tooltip="Resize so width and height are divisible by this number. Useful for latent alignment (e.g., 8 or 64)."),
]),
],
),
io.Combo.Input(
"scale_method",
options=cls.scale_methods,
default="area",
tooltip="Interpolation algorithm. 'area' is best for downscaling, 'lanczos' for upscaling, 'nearest-exact' for pixel art.",
),
],
outputs=[io.MatchType.Output(template=template, display_name="resized")]
)
@classmethod
def execute(cls, input: io.Image.Type | io.Mask.Type, scale_method: io.Combo.Type, resize_type: ResizeTypedDict) -> io.NodeOutput:
selected_type = resize_type["resize_type"]
if selected_type == ResizeType.SCALE_BY:
return io.NodeOutput(scale_by(input, resize_type["multiplier"], scale_method))
elif selected_type == ResizeType.SCALE_DIMENSIONS:
return io.NodeOutput(scale_dimensions(input, resize_type["width"], resize_type["height"], scale_method, resize_type["crop"]))
elif selected_type == ResizeType.SCALE_LONGER_DIMENSION:
return io.NodeOutput(scale_longer_dimension(input, resize_type["longer_size"], scale_method))
elif selected_type == ResizeType.SCALE_SHORTER_DIMENSION:
return io.NodeOutput(scale_shorter_dimension(input, resize_type["shorter_size"], scale_method))
elif selected_type == ResizeType.SCALE_WIDTH:
return io.NodeOutput(scale_dimensions(input, resize_type["width"], 0, scale_method))
elif selected_type == ResizeType.SCALE_HEIGHT:
return io.NodeOutput(scale_dimensions(input, 0, resize_type["height"], scale_method))
elif selected_type == ResizeType.SCALE_TOTAL_PIXELS:
return io.NodeOutput(scale_total_pixels(input, resize_type["megapixels"], scale_method))
elif selected_type == ResizeType.MATCH_SIZE:
return io.NodeOutput(scale_match_size(input, resize_type["match"], scale_method, resize_type["crop"]))
elif selected_type == ResizeType.SCALE_TO_MULTIPLE:
return io.NodeOutput(scale_to_multiple_cover(input, resize_type["multiple"], scale_method))
raise ValueError(f"Unsupported resize type: {selected_type}")
def batch_images(images: list[torch.Tensor]) -> torch.Tensor | None:
if len(images) == 0:
return None
# first, get the max channels count
max_channels = max(image.shape[-1] for image in images)
# then, pad all images to have the same channels count
padded_images: list[torch.Tensor] = []
for image in images:
if image.shape[-1] < max_channels:
padded_images.append(torch.nn.functional.pad(image, (0,1), mode='constant', value=1.0))
else:
padded_images.append(image)
# resize all images to be the same size as the first image
resized_images: list[torch.Tensor] = []
first_image_shape = padded_images[0].shape
for image in padded_images:
if image.shape[1:] != first_image_shape[1:]:
resized_images.append(comfy.utils.common_upscale(image.movedim(-1,1), first_image_shape[2], first_image_shape[1], "bilinear", "center").movedim(1,-1))
else:
resized_images.append(image)
# batch the images in the format [b, h, w, c]
return torch.cat(resized_images, dim=0)
def batch_masks(masks: list[torch.Tensor]) -> torch.Tensor | None:
if len(masks) == 0:
return None
# resize all masks to be the same size as the first mask
resized_masks: list[torch.Tensor] = []
first_mask_shape = masks[0].shape
for mask in masks:
if mask.shape[1:] != first_mask_shape[1:]:
mask = init_image_mask_input(mask, is_type_image=False)
mask = comfy.utils.common_upscale(mask, first_mask_shape[2], first_mask_shape[1], "bilinear", "center")
resized_masks.append(finalize_image_mask_input(mask, is_type_image=False))
else:
resized_masks.append(mask)
# batch the masks in the format [b, h, w]
return torch.cat(resized_masks, dim=0)
def batch_latents(latents: list[dict[str, torch.Tensor]]) -> dict[str, torch.Tensor] | None:
if len(latents) == 0:
return None
samples_out = latents[0].copy()
samples_out["batch_index"] = []
first_samples = latents[0]["samples"]
tensors: list[torch.Tensor] = []
for latent in latents:
# first, deal with latent tensors
tensors.append(reshape_latent_to(first_samples.shape, latent["samples"], repeat_batch=False))
# next, deal with batch_index
samples_out["batch_index"].extend(latent.get("batch_index", [x for x in range(0, latent["samples"].shape[0])]))
samples_out["samples"] = torch.cat(tensors, dim=0)
return samples_out
class BatchImagesNode(io.ComfyNode):
@classmethod
def define_schema(cls):
autogrow_template = io.Autogrow.TemplatePrefix(io.Image.Input("image"), prefix="image", min=1, max=50)
return io.Schema(
node_id="BatchImagesNode",
display_name="Batch Images",
category="image/batch",
essentials_category="Image Tools",
search_aliases=["batch", "image batch", "batch images", "combine images", "merge images", "stack images"],
inputs=[
io.Autogrow.Input("images", template=autogrow_template)
],
outputs=[
io.Image.Output()
]
)
@classmethod
def execute(cls, images: io.Autogrow.Type) -> io.NodeOutput:
return io.NodeOutput(batch_images(list(images.values())))
class BatchMasksNode(io.ComfyNode):
@classmethod
def define_schema(cls):
autogrow_template = io.Autogrow.TemplatePrefix(io.Mask.Input("mask"), prefix="mask", min=1, max=50)
return io.Schema(
node_id="BatchMasksNode",
search_aliases=["combine masks", "stack masks", "merge masks"],
display_name="Batch Masks",
category="image/mask",
inputs=[
io.Autogrow.Input("masks", template=autogrow_template)
],
outputs=[
io.Mask.Output()
]
)
@classmethod
def execute(cls, masks: io.Autogrow.Type) -> io.NodeOutput:
return io.NodeOutput(batch_masks(list(masks.values())))
class BatchLatentsNode(io.ComfyNode):
@classmethod
def define_schema(cls):
autogrow_template = io.Autogrow.TemplatePrefix(io.Latent.Input("latent"), prefix="latent", min=1, max=50)
return io.Schema(
node_id="BatchLatentsNode",
search_aliases=["combine latents", "stack latents", "merge latents"],
display_name="Batch Latents",
category="model/latent/batch",
inputs=[
io.Autogrow.Input("latents", template=autogrow_template)
],
outputs=[
io.Latent.Output()
]
)
@classmethod
def execute(cls, latents: io.Autogrow.Type) -> io.NodeOutput:
return io.NodeOutput(batch_latents(list(latents.values())))
class BatchImagesMasksLatentsNode(io.ComfyNode):
@classmethod
def define_schema(cls):
matchtype_template = io.MatchType.Template("input", allowed_types=[io.Image, io.Mask, io.Latent])
autogrow_template = io.Autogrow.TemplatePrefix(
io.MatchType.Input("input", matchtype_template),
prefix="input", min=1, max=50)
return io.Schema(
node_id="BatchImagesMasksLatentsNode",
search_aliases=["combine batch", "merge batch", "stack inputs"],
display_name="Batch Images/Masks/Latents",
category="util",
inputs=[
io.Autogrow.Input("inputs", template=autogrow_template)
],
outputs=[
io.MatchType.Output(id=None, template=matchtype_template)
]
)
@classmethod
def execute(cls, inputs: io.Autogrow.Type) -> io.NodeOutput:
batched = None
values = list(inputs.values())
# latents
if isinstance(values[0], dict):
batched = batch_latents(values)
# images
elif is_image(values[0]):
batched = batch_images(values)
# masks
else:
batched = batch_masks(values)
return io.NodeOutput(batched)
class ColorTransfer(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ColorTransfer",
display_name="Transfer Color",
category="image/filters",
description="Match the colors of one image to another using various algorithms.",
search_aliases=["color match", "color grading", "color correction", "match colors", "color transform", "mkl", "reinhard", "histogram"],
inputs=[
io.Image.Input("image_target", tooltip="Image(s) to apply the color transform to."),
io.Image.Input("image_ref", tooltip="Reference image(s) to match colors to."),
io.Combo.Input("method", options=['reinhard_lab', 'mkl_lab', 'histogram'],),
io.DynamicCombo.Input("source_stats",
tooltip="per_frame: each frame matched to image_ref individually. uniform: pool stats across all source frames as baseline, match to image_ref. target_frame: use one chosen frame as the baseline for the transform to image_ref, applied uniformly to all frames (preserves relative differences)",
options=[
io.DynamicCombo.Option("per_frame", []),
io.DynamicCombo.Option("uniform", []),
io.DynamicCombo.Option("target_frame", [
io.Int.Input("target_index", default=0, min=0, max=10000,
tooltip="Frame index used as the source baseline for computing the transform to image_ref"),
]),
]),
io.Float.Input("strength", default=1.0, min=0.0, max=10.0, step=0.01),
],
outputs=[
io.Image.Output(display_name="image"),
],
)
@staticmethod
def _to_lab(images, i, device):
return kornia.color.rgb_to_lab(
images[i:i+1].to(device, dtype=torch.float32).permute(0, 3, 1, 2))
@staticmethod
def _pool_stats(images, device, is_reinhard, eps):
"""Two-pass pooled mean + std/cov across all frames."""
N, C = images.shape[0], images.shape[3]
HW = images.shape[1] * images.shape[2]
mean = torch.zeros(C, 1, device=device, dtype=torch.float32)
for i in range(N):
mean += ColorTransfer._to_lab(images, i, device).view(C, -1).mean(dim=-1, keepdim=True)
mean /= N
acc = torch.zeros(C, 1 if is_reinhard else C, device=device, dtype=torch.float32)
for i in range(N):
centered = ColorTransfer._to_lab(images, i, device).view(C, -1) - mean
if is_reinhard:
acc += (centered * centered).mean(dim=-1, keepdim=True)
else:
acc += centered @ centered.T / HW
if is_reinhard:
return mean, torch.sqrt(acc / N).clamp_min_(eps)
return mean, acc / N
@staticmethod
def _frame_stats(lab_flat, hw, is_reinhard, eps):
"""Per-frame mean + std/cov."""
mean = lab_flat.mean(dim=-1, keepdim=True)
if is_reinhard:
return mean, lab_flat.std(dim=-1, keepdim=True, unbiased=False).clamp_min_(eps)
centered = lab_flat - mean
return mean, centered @ centered.T / hw
@staticmethod
def _mkl_matrix(cov_s, cov_r, eps):
"""Compute MKL 3x3 transform matrix from source and ref covariances."""
eig_val_s, eig_vec_s = torch.linalg.eigh(cov_s)
sqrt_val_s = torch.sqrt(eig_val_s.clamp_min(0)).clamp_min_(eps)
scaled_V = eig_vec_s * sqrt_val_s.unsqueeze(0)
mid = scaled_V.T @ cov_r @ scaled_V
eig_val_m, eig_vec_m = torch.linalg.eigh(mid)
sqrt_m = torch.sqrt(eig_val_m.clamp_min(0))
inv_sqrt_s = 1.0 / sqrt_val_s
inv_scaled_V = eig_vec_s * inv_sqrt_s.unsqueeze(0)
M_half = (eig_vec_m * sqrt_m.unsqueeze(0)) @ eig_vec_m.T
return inv_scaled_V @ M_half @ inv_scaled_V.T
@staticmethod
def _histogram_lut(src, ref, bins=256):
"""Build per-channel LUT from source and ref histograms. src/ref: (C, HW) in [0,1]."""
s_bins = (src * (bins - 1)).long().clamp(0, bins - 1)
r_bins = (ref * (bins - 1)).long().clamp(0, bins - 1)
s_hist = torch.zeros(src.shape[0], bins, device=src.device, dtype=src.dtype)
r_hist = torch.zeros(src.shape[0], bins, device=src.device, dtype=src.dtype)
ones_s = torch.ones_like(src)
ones_r = torch.ones_like(ref)
s_hist.scatter_add_(1, s_bins, ones_s)
r_hist.scatter_add_(1, r_bins, ones_r)
s_cdf = s_hist.cumsum(1)
s_cdf = s_cdf / s_cdf[:, -1:]
r_cdf = r_hist.cumsum(1)
r_cdf = r_cdf / r_cdf[:, -1:]
return torch.searchsorted(r_cdf, s_cdf).clamp_max_(bins - 1).float() / (bins - 1)
@classmethod
def _pooled_cdf(cls, images, device, num_bins=256):
"""Build pooled CDF across all frames, one frame at a time."""
C = images.shape[3]
hist = torch.zeros(C, num_bins, device=device, dtype=torch.float32)
for i in range(images.shape[0]):
frame = images[i].to(device, dtype=torch.float32).permute(2, 0, 1).reshape(C, -1)
bins = (frame * (num_bins - 1)).long().clamp(0, num_bins - 1)
hist.scatter_add_(1, bins, torch.ones_like(frame))
cdf = hist.cumsum(1)
return cdf / cdf[:, -1:]
@classmethod
def _build_histogram_transform(cls, image_target, image_ref, device, stats_mode, target_index, B):
"""Build per-frame or uniform LUT transform for histogram mode."""
if stats_mode == 'per_frame':
return None # LUT computed per-frame in the apply loop
r_cdf = cls._pooled_cdf(image_ref, device)
if stats_mode == 'target_frame':
ti = min(target_index, B - 1)
s_cdf = cls._pooled_cdf(image_target[ti:ti+1], device)
else:
s_cdf = cls._pooled_cdf(image_target, device)
return torch.searchsorted(r_cdf, s_cdf).clamp_max_(255).float() / 255.0
@classmethod
def _build_lab_transform(cls, image_target, image_ref, device, stats_mode, target_index, is_reinhard):
"""Build transform parameters for Lab-based methods. Returns a transform function."""
eps = 1e-6
B, H, W, C = image_target.shape
B_ref = image_ref.shape[0]
single_ref = B_ref == 1
HW = H * W
HW_ref = image_ref.shape[1] * image_ref.shape[2]
# Precompute ref stats
if single_ref or stats_mode in ('uniform', 'target_frame'):
ref_mean, ref_sc = cls._pool_stats(image_ref, device, is_reinhard, eps)
# Uniform/target_frame: precompute single affine transform
if stats_mode in ('uniform', 'target_frame'):
if stats_mode == 'target_frame':
ti = min(target_index, B - 1)
s_lab = cls._to_lab(image_target, ti, device).view(C, -1)
s_mean, s_sc = cls._frame_stats(s_lab, HW, is_reinhard, eps)
else:
s_mean, s_sc = cls._pool_stats(image_target, device, is_reinhard, eps)
if is_reinhard:
scale = ref_sc / s_sc
offset = ref_mean - scale * s_mean
return lambda src_flat, **_: src_flat * scale + offset
T = cls._mkl_matrix(s_sc, ref_sc, eps)
offset = ref_mean - T @ s_mean
return lambda src_flat, **_: T @ src_flat + offset
# per_frame
def per_frame_transform(src_flat, frame_idx):
s_mean, s_sc = cls._frame_stats(src_flat, HW, is_reinhard, eps)
if single_ref:
r_mean, r_sc = ref_mean, ref_sc
else:
ri = min(frame_idx, B_ref - 1)
r_mean, r_sc = cls._frame_stats(cls._to_lab(image_ref, ri, device).view(C, -1), HW_ref, is_reinhard, eps)
centered = src_flat - s_mean
if is_reinhard:
return centered * (r_sc / s_sc) + r_mean
T = cls._mkl_matrix(centered @ centered.T / HW, r_sc, eps)
return T @ centered + r_mean
return per_frame_transform
@classmethod
def execute(cls, image_target, image_ref, method, source_stats, strength=1.0) -> io.NodeOutput:
stats_mode = source_stats["source_stats"]
target_index = source_stats.get("target_index", 0)
if strength == 0 or image_ref is None:
return io.NodeOutput(image_target)
device = comfy.model_management.get_torch_device()
intermediate_device = comfy.model_management.intermediate_device()
intermediate_dtype = comfy.model_management.intermediate_dtype()
B, H, W, C = image_target.shape
B_ref = image_ref.shape[0]
pbar = comfy.utils.ProgressBar(B)
out = torch.empty(B, H, W, C, device=intermediate_device, dtype=intermediate_dtype)
if method == 'histogram':
uniform_lut = cls._build_histogram_transform(
image_target, image_ref, device, stats_mode, target_index, B)
for i in range(B):
src = image_target[i].to(device, dtype=torch.float32).permute(2, 0, 1)
src_flat = src.reshape(C, -1)
if uniform_lut is not None:
lut = uniform_lut
else:
ri = min(i, B_ref - 1)
ref = image_ref[ri].to(device, dtype=torch.float32).permute(2, 0, 1).reshape(C, -1)
lut = cls._histogram_lut(src_flat, ref)
bin_idx = (src_flat * 255).long().clamp(0, 255)
matched = lut.gather(1, bin_idx).view(C, H, W)
result = matched if strength == 1.0 else torch.lerp(src, matched, strength)
out[i] = result.permute(1, 2, 0).clamp_(0, 1).to(device=intermediate_device, dtype=intermediate_dtype)
pbar.update(1)
else:
transform = cls._build_lab_transform(image_target, image_ref, device, stats_mode, target_index, is_reinhard=method == "reinhard_lab")
for i in range(B):
src_frame = cls._to_lab(image_target, i, device)
corrected = transform(src_frame.view(C, -1), frame_idx=i)
if strength == 1.0:
result = kornia.color.lab_to_rgb(corrected.view(1, C, H, W))
else:
result = kornia.color.lab_to_rgb(torch.lerp(src_frame, corrected.view(1, C, H, W), strength))
out[i] = result.squeeze(0).permute(1, 2, 0).clamp_(0, 1).to(device=intermediate_device, dtype=intermediate_dtype)
pbar.update(1)
return io.NodeOutput(out)
class PostProcessingExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
Blend,
Blur,
Quantize,
Sharpen,
ImageScaleToTotalPixels,
ResizeImageMaskNode,
BatchImagesNode,
BatchMasksNode,
BatchLatentsNode,
ColorTransfer,
# BatchImagesMasksLatentsNode,
]
async def comfy_entrypoint() -> PostProcessingExtension:
return PostProcessingExtension()
@@ -0,0 +1,215 @@
import folder_paths
import comfy.sd
import comfy.model_management
import nodes
import torch
from typing_extensions import override
from comfy_api.latest import ComfyExtension, io
from comfy_extras.nodes_slg import SkipLayerGuidanceDiT
class TripleCLIPLoader(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="TripleCLIPLoader",
display_name="Load CLIP (Triple)",
category="model/loaders",
description="Recipes:\nsd3: clip-l, clip-g, t5",
inputs=[
io.Combo.Input("clip_name1", options=folder_paths.get_filename_list("text_encoders")),
io.Combo.Input("clip_name2", options=folder_paths.get_filename_list("text_encoders")),
io.Combo.Input("clip_name3", options=folder_paths.get_filename_list("text_encoders")),
],
outputs=[
io.Clip.Output(),
],
)
@classmethod
def execute(cls, clip_name1, clip_name2, clip_name3) -> io.NodeOutput:
clip_path1 = folder_paths.get_full_path_or_raise("text_encoders", clip_name1)
clip_path2 = folder_paths.get_full_path_or_raise("text_encoders", clip_name2)
clip_path3 = folder_paths.get_full_path_or_raise("text_encoders", clip_name3)
clip = comfy.sd.load_clip(ckpt_paths=[clip_path1, clip_path2, clip_path3], embedding_directory=folder_paths.get_folder_paths("embeddings"))
return io.NodeOutput(clip)
load_clip = execute # TODO: remove
class EmptySD3LatentImage(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="EmptySD3LatentImage",
category="model/latent/stable diffusion",
inputs=[
io.Int.Input("width", default=1024, min=16, max=nodes.MAX_RESOLUTION, step=16),
io.Int.Input("height", default=1024, min=16, max=nodes.MAX_RESOLUTION, step=16),
io.Int.Input("batch_size", default=1, min=1, max=4096),
],
outputs=[
io.Latent.Output(),
],
)
@classmethod
def execute(cls, width, height, batch_size=1) -> io.NodeOutput:
latent = torch.zeros([batch_size, 16, height // 8, width // 8], device=comfy.model_management.intermediate_device(), dtype=comfy.model_management.intermediate_dtype())
return io.NodeOutput({"samples": latent, "downscale_ratio_spacial": 8})
generate = execute # TODO: remove
class CLIPTextEncodeSD3(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="CLIPTextEncodeSD3",
search_aliases=["sd3 prompt"],
display_name="CLIP Text Encode (SD3)",
category="model/conditioning/stable diffusion",
inputs=[
io.Clip.Input("clip"),
io.String.Input("clip_l", multiline=True, dynamic_prompts=True),
io.String.Input("clip_g", multiline=True, dynamic_prompts=True),
io.String.Input("t5xxl", multiline=True, dynamic_prompts=True),
io.Combo.Input("empty_padding", options=["none", "empty_prompt"], advanced=True),
],
outputs=[
io.Conditioning.Output(),
],
)
@classmethod
def execute(cls, clip, clip_l, clip_g, t5xxl, empty_padding) -> io.NodeOutput:
no_padding = empty_padding == "none"
tokens = clip.tokenize(clip_g)
if len(clip_g) == 0 and no_padding:
tokens["g"] = []
if len(clip_l) == 0 and no_padding:
tokens["l"] = []
else:
tokens["l"] = clip.tokenize(clip_l)["l"]
if len(t5xxl) == 0 and no_padding:
tokens["t5xxl"] = []
else:
tokens["t5xxl"] = clip.tokenize(t5xxl)["t5xxl"]
if len(tokens["l"]) != len(tokens["g"]):
empty = clip.tokenize("")
while len(tokens["l"]) < len(tokens["g"]):
tokens["l"] += empty["l"]
while len(tokens["l"]) > len(tokens["g"]):
tokens["g"] += empty["g"]
return io.NodeOutput(clip.encode_from_tokens_scheduled(tokens))
encode = execute # TODO: remove
class ControlNetApplySD3(io.ComfyNode):
@classmethod
def define_schema(cls) -> io.Schema:
return io.Schema(
node_id="ControlNetApplySD3",
display_name="Apply Controlnet with VAE",
category="model/conditioning/controlnet",
inputs=[
io.Conditioning.Input("positive"),
io.Conditioning.Input("negative"),
io.ControlNet.Input("control_net"),
io.Vae.Input("vae"),
io.Image.Input("image"),
io.Float.Input("strength", default=1.0, min=0.0, max=10.0, step=0.01),
io.Float.Input("start_percent", default=0.0, min=0.0, max=1.0, step=0.001),
io.Float.Input("end_percent", default=1.0, min=0.0, max=1.0, step=0.001),
],
outputs=[
io.Conditioning.Output(display_name="positive"),
io.Conditioning.Output(display_name="negative"),
],
is_deprecated=True,
)
@classmethod
def execute(cls, positive, negative, control_net, image, strength, start_percent, end_percent, vae=None) -> io.NodeOutput:
if strength == 0:
return io.NodeOutput(positive, negative)
control_hint = image.movedim(-1, 1)
cnets = {}
out = []
for conditioning in [positive, negative]:
c = []
for t in conditioning:
d = t[1].copy()
prev_cnet = d.get('control', None)
if prev_cnet in cnets:
c_net = cnets[prev_cnet]
else:
c_net = control_net.copy().set_cond_hint(control_hint, strength, (start_percent, end_percent),
vae=vae, extra_concat=[])
c_net.set_previous_controlnet(prev_cnet)
cnets[prev_cnet] = c_net
d['control'] = c_net
d['control_apply_to_uncond'] = False
n = [t[0], d]
c.append(n)
out.append(c)
return io.NodeOutput(out[0], out[1])
apply_controlnet = execute # TODO: remove
class SkipLayerGuidanceSD3(io.ComfyNode):
'''
Enhance guidance towards detailed dtructure by having another set of CFG negative with skipped layers.
Inspired by Perturbed Attention Guidance (https://arxiv.org/abs/2403.17377)
Experimental implementation by Dango233@StabilityAI.
'''
@classmethod
def define_schema(cls):
return io.Schema(
node_id="SkipLayerGuidanceSD3",
category="advanced/guidance",
description="Generic version of SkipLayerGuidance node that can be used on every DiT model.",
inputs=[
io.Model.Input("model"),
io.String.Input("layers", default="7, 8, 9", multiline=False, advanced=True),
io.Float.Input("scale", default=3.0, min=0.0, max=10.0, step=0.1),
io.Float.Input("start_percent", default=0.01, min=0.0, max=1.0, step=0.001, advanced=True),
io.Float.Input("end_percent", default=0.15, min=0.0, max=1.0, step=0.001, advanced=True),
],
outputs=[
io.Model.Output(),
],
is_experimental=True,
)
@classmethod
def execute(cls, model, layers, scale, start_percent, end_percent) -> io.NodeOutput:
return SkipLayerGuidanceDiT().execute(model=model, scale=scale, start_percent=start_percent, end_percent=end_percent, double_layers=layers)
skip_guidance_sd3 = execute # TODO: remove
class SD3Extension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
TripleCLIPLoader,
EmptySD3LatentImage,
CLIPTextEncodeSD3,
ControlNetApplySD3,
SkipLayerGuidanceSD3,
]
async def comfy_entrypoint() -> SD3Extension:
return SD3Extension()
@@ -0,0 +1,33 @@
import sys
from typing_extensions import override
from comfy_api.latest import ComfyExtension, io
class SeedNode(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="SeedNode",
display_name="Seed",
search_aliases=["seed", "random"],
category="utilities",
inputs=[
io.Int.Input("seed", min=0, max=sys.maxsize, control_after_generate=io.ControlAfterGenerate.fixed),
],
outputs=[io.Int.Output(display_name="seed")],
)
@classmethod
def execute(cls, seed: int) -> io.NodeOutput:
return io.NodeOutput(seed)
class SeedExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [SeedNode]
async def comfy_entrypoint() -> SeedExtension:
return SeedExtension()
@@ -0,0 +1,506 @@
import os
import time
import mimetypes
import logging
from typing import Literal, List
from collections.abc import Collection
from comfy.cli_args import args
supported_pt_extensions: set[str] = {'.ckpt', '.pt', '.pt2', '.bin', '.pth', '.safetensors', '.pkl', '.sft'}
folder_names_and_paths: dict[str, tuple[list[str], set[str]]] = {}
# --base-directory - Resets all default paths configured in folder_paths with a new base path
if args.base_directory:
base_path = os.path.abspath(args.base_directory)
else:
base_path = os.path.dirname(os.path.realpath(__file__))
models_dir = os.path.join(base_path, "models")
folder_names_and_paths["checkpoints"] = ([os.path.join(models_dir, "checkpoints")], supported_pt_extensions)
folder_names_and_paths["configs"] = ([os.path.join(models_dir, "configs")], [".yaml"])
folder_names_and_paths["loras"] = ([os.path.join(models_dir, "loras")], supported_pt_extensions)
folder_names_and_paths["vae"] = ([os.path.join(models_dir, "vae")], supported_pt_extensions)
folder_names_and_paths["text_encoders"] = ([os.path.join(models_dir, "text_encoders"), os.path.join(models_dir, "clip")], supported_pt_extensions)
folder_names_and_paths["diffusion_models"] = ([os.path.join(models_dir, "unet"), os.path.join(models_dir, "diffusion_models")], supported_pt_extensions)
folder_names_and_paths["clip_vision"] = ([os.path.join(models_dir, "clip_vision")], supported_pt_extensions)
folder_names_and_paths["style_models"] = ([os.path.join(models_dir, "style_models")], supported_pt_extensions)
folder_names_and_paths["embeddings"] = ([os.path.join(models_dir, "embeddings")], supported_pt_extensions)
folder_names_and_paths["diffusers"] = ([os.path.join(models_dir, "diffusers")], ["folder"])
folder_names_and_paths["vae_approx"] = ([os.path.join(models_dir, "vae_approx")], supported_pt_extensions)
folder_names_and_paths["controlnet"] = ([os.path.join(models_dir, "controlnet"), os.path.join(models_dir, "t2i_adapter")], supported_pt_extensions)
folder_names_and_paths["gligen"] = ([os.path.join(models_dir, "gligen")], supported_pt_extensions)
folder_names_and_paths["upscale_models"] = ([os.path.join(models_dir, "upscale_models")], supported_pt_extensions)
folder_names_and_paths["latent_upscale_models"] = ([os.path.join(models_dir, "latent_upscale_models")], supported_pt_extensions)
folder_names_and_paths["custom_nodes"] = ([os.path.join(base_path, "custom_nodes")], set())
folder_names_and_paths["hypernetworks"] = ([os.path.join(models_dir, "hypernetworks")], supported_pt_extensions)
folder_names_and_paths["photomaker"] = ([os.path.join(models_dir, "photomaker")], supported_pt_extensions)
folder_names_and_paths["classifiers"] = ([os.path.join(models_dir, "classifiers")], {""})
folder_names_and_paths["model_patches"] = ([os.path.join(models_dir, "model_patches")], supported_pt_extensions)
folder_names_and_paths["audio_encoders"] = ([os.path.join(models_dir, "audio_encoders")], supported_pt_extensions)
folder_names_and_paths["background_removal"] = ([os.path.join(models_dir, "background_removal")], supported_pt_extensions)
folder_names_and_paths["frame_interpolation"] = ([os.path.join(models_dir, "frame_interpolation")], supported_pt_extensions)
folder_names_and_paths["geometry_estimation"] = ([os.path.join(models_dir, "geometry_estimation")], supported_pt_extensions)
folder_names_and_paths["optical_flow"] = ([os.path.join(models_dir, "optical_flow")], supported_pt_extensions)
folder_names_and_paths["detection"] = ([os.path.join(models_dir, "detection")], supported_pt_extensions)
output_directory = os.path.join(base_path, "output")
temp_directory = os.path.join(base_path, "temp")
input_directory = os.path.join(base_path, "input")
user_directory = os.path.join(base_path, "user")
filename_list_cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
class CacheHelper:
"""
Helper class for managing file list cache data.
"""
def __init__(self):
self.cache: dict[str, tuple[list[str], dict[str, float], float]] = {}
self.active = False
def get(self, key: str, default=None) -> tuple[list[str], dict[str, float], float]:
if not self.active:
return default
return self.cache.get(key, default)
def set(self, key: str, value: tuple[list[str], dict[str, float], float]) -> None:
if self.active:
self.cache[key] = value
def clear(self):
self.cache.clear()
def __enter__(self):
self.active = True
return self
def __exit__(self, exc_type, exc_value, traceback):
self.active = False
self.clear()
cache_helper = CacheHelper()
extension_mimetypes_cache = {
"webp" : "image",
"fbx" : "model",
}
def map_legacy(folder_name: str) -> str:
legacy = {"unet": "diffusion_models",
"clip": "text_encoders"}
return legacy.get(folder_name, folder_name)
if not os.path.exists(input_directory):
try:
os.makedirs(input_directory)
except:
logging.error("Failed to create input directory")
def set_output_directory(output_dir: str) -> None:
global output_directory
output_directory = output_dir
def set_temp_directory(temp_dir: str) -> None:
global temp_directory
temp_directory = temp_dir
def set_input_directory(input_dir: str) -> None:
global input_directory
input_directory = input_dir
def get_output_directory() -> str:
global output_directory
return output_directory
def get_temp_directory() -> str:
global temp_directory
return temp_directory
def get_input_directory() -> str:
global input_directory
return input_directory
def get_user_directory() -> str:
return user_directory
def set_user_directory(user_dir: str) -> None:
global user_directory
user_directory = user_dir
# System User Protection - Protects system directories from HTTP endpoint access
# System Users are internal-only users that cannot be accessed via HTTP endpoints.
# They use the '__' prefix convention (similar to Python's private member convention).
SYSTEM_USER_PREFIX = "__"
def get_system_user_directory(name: str = "system") -> str:
"""
Get the path to a System User directory.
System User directories (prefixed with '__') are only accessible via internal API,
not through HTTP endpoints. Use this for storing system-internal data that
should not be exposed to users.
Args:
name: System user name (e.g., "system", "cache"). Must be alphanumeric
with underscores allowed, but cannot start with underscore.
Returns:
Absolute path to the system user directory.
Raises:
ValueError: If name is empty, invalid, or starts with underscore.
Example:
>>> get_system_user_directory("cache")
'/path/to/user/__cache'
"""
if not name or not isinstance(name, str):
raise ValueError("System user name cannot be empty")
if not name.replace("_", "").isalnum():
raise ValueError(f"Invalid system user name: '{name}'")
if name.startswith("_"):
raise ValueError("System user name should not start with underscore")
return os.path.join(get_user_directory(), f"{SYSTEM_USER_PREFIX}{name}")
def get_public_user_directory(user_id: str) -> str | None:
"""
Get the path to a Public User directory for HTTP endpoint access.
This function provides structural security by returning None for any
System User (prefixed with '__'). All HTTP endpoints should use this
function instead of directly constructing user paths.
Args:
user_id: User identifier from HTTP request.
Returns:
Absolute path to the user directory, or None if user_id is invalid
or refers to a System User.
Example:
>>> get_public_user_directory("default")
'/path/to/user/default'
>>> get_public_user_directory("__system")
None
"""
if not user_id or not isinstance(user_id, str):
return None
if user_id.startswith(SYSTEM_USER_PREFIX):
return None
return os.path.join(get_user_directory(), user_id)
#NOTE: used in http server so don't put folders that should not be accessed remotely
def get_directory_by_type(type_name: str) -> str | None:
if type_name == "output":
return get_output_directory()
if type_name == "temp":
return get_temp_directory()
if type_name == "input":
return get_input_directory()
return None
def filter_files_content_types(files: list[str], content_types: List[Literal["image", "video", "audio", "model"]]) -> list[str]:
"""
Example:
files = os.listdir(folder_paths.get_input_directory())
videos = filter_files_content_types(files, ["video"])
Note:
- 'model' in MIME context refers to 3D models, not files containing trained weights and parameters
"""
global extension_mimetypes_cache
result = []
for file in files:
extension = file.split('.')[-1]
if extension not in extension_mimetypes_cache:
mime_type, _ = mimetypes.guess_type(file, strict=False)
if not mime_type:
continue
content_type = mime_type.split('/')[0]
extension_mimetypes_cache[extension] = content_type
else:
content_type = extension_mimetypes_cache[extension]
if content_type in content_types:
result.append(file)
return result
# determine base_dir rely on annotation if name is 'filename.ext [annotation]' format
# otherwise use default_path as base_dir
def annotated_filepath(name: str) -> tuple[str, str | None]:
if name.endswith("[output]"):
base_dir = get_output_directory()
name = name[:-9]
elif name.endswith("[input]"):
base_dir = get_input_directory()
name = name[:-8]
elif name.endswith("[temp]"):
base_dir = get_temp_directory()
name = name[:-7]
else:
return name, None
return name, base_dir
def get_annotated_filepath(name: str, default_dir: str | None=None) -> str:
name, base_dir = annotated_filepath(name)
if base_dir is None:
if default_dir is not None:
base_dir = default_dir
else:
base_dir = get_input_directory() # fallback path
return os.path.join(base_dir, name)
def exists_annotated_filepath(name) -> bool:
name, base_dir = annotated_filepath(name)
if base_dir is None:
base_dir = get_input_directory() # fallback path
filepath = os.path.join(base_dir, name)
return os.path.exists(filepath)
def add_model_folder_path(folder_name: str, full_folder_path: str, is_default: bool = False) -> None:
global folder_names_and_paths
folder_name = map_legacy(folder_name)
if folder_name in folder_names_and_paths:
paths, _exts = folder_names_and_paths[folder_name]
if full_folder_path in paths:
if is_default and paths[0] != full_folder_path:
# If the path to the folder is not the first in the list, move it to the beginning.
paths.remove(full_folder_path)
paths.insert(0, full_folder_path)
else:
if is_default:
paths.insert(0, full_folder_path)
else:
paths.append(full_folder_path)
else:
folder_names_and_paths[folder_name] = ([full_folder_path], set())
def get_folder_paths(folder_name: str) -> list[str]:
folder_name = map_legacy(folder_name)
return folder_names_and_paths[folder_name][0][:]
def recursive_search(directory: str, excluded_dir_names: list[str] | None=None) -> tuple[list[str], dict[str, float]]:
if not os.path.isdir(directory):
return [], {}
if excluded_dir_names is None:
excluded_dir_names = []
result = []
dirs = {}
# Attempt to add the initial directory to dirs with error handling
try:
dirs[directory] = os.path.getmtime(directory)
except FileNotFoundError:
logging.warning(f"Warning: Unable to access {directory}. Skipping this path.")
logging.debug("recursive file list on directory {}".format(directory))
dirpath: str
subdirs: list[str]
filenames: list[str]
for dirpath, subdirs, filenames in os.walk(directory, followlinks=True, topdown=True):
subdirs[:] = [d for d in subdirs if d not in excluded_dir_names]
for file_name in filenames:
try:
relative_path = os.path.relpath(os.path.join(dirpath, file_name), directory)
result.append(relative_path)
except:
logging.warning(f"Warning: Unable to access {file_name}. Skipping this file.")
continue
for d in subdirs:
path: str = os.path.join(dirpath, d)
try:
dirs[path] = os.path.getmtime(path)
except FileNotFoundError:
logging.warning(f"Warning: Unable to access {path}. Skipping this path.")
continue
logging.debug("found {} files".format(len(result)))
return result, dirs
def filter_files_extensions(files: Collection[str], extensions: Collection[str]) -> list[str]:
return sorted(list(filter(lambda a: os.path.splitext(a)[-1].lower() in extensions or len(extensions) == 0, files)))
def get_full_path(folder_name: str, filename: str) -> str | None:
"""
Get the full path of a file in a folder, has to be a file
"""
global folder_names_and_paths
folder_name = map_legacy(folder_name)
if folder_name not in folder_names_and_paths:
return None
folders = folder_names_and_paths[folder_name]
filename = os.path.relpath(os.path.join("/", filename), "/")
for x in folders[0]:
full_path = os.path.join(x, filename)
if os.path.isfile(full_path):
return full_path
elif os.path.islink(full_path):
logging.warning("WARNING path {} exists but doesn't link anywhere, skipping.".format(full_path))
return None
def get_full_path_or_raise(folder_name: str, filename: str) -> str:
"""
Get the full path of a file in a folder, has to be a file
"""
full_path = get_full_path(folder_name, filename)
if full_path is None:
raise FileNotFoundError(f"Model in folder '{folder_name}' with filename '{filename}' not found.")
return full_path
def get_filename_list_(folder_name: str) -> tuple[list[str], dict[str, float], float]:
folder_name = map_legacy(folder_name)
global folder_names_and_paths
output_list = set()
folders = folder_names_and_paths[folder_name]
output_folders = {}
for x in folders[0]:
files, folders_all = recursive_search(x, excluded_dir_names=[".git"])
output_list.update(filter_files_extensions(files, folders[1]))
output_folders = {**output_folders, **folders_all}
return sorted(list(output_list)), output_folders, time.perf_counter()
def cached_filename_list_(folder_name: str) -> tuple[list[str], dict[str, float], float] | None:
strong_cache = cache_helper.get(folder_name)
if strong_cache is not None:
return strong_cache
global filename_list_cache
global folder_names_and_paths
folder_name = map_legacy(folder_name)
if folder_name not in filename_list_cache:
return None
out = filename_list_cache[folder_name]
for x in out[1]:
time_modified = out[1][x]
folder = x
if os.path.getmtime(folder) != time_modified:
return None
folders = folder_names_and_paths[folder_name]
for x in folders[0]:
if os.path.isdir(x):
if x not in out[1]:
return None
return out
def get_filename_list(folder_name: str) -> list[str]:
folder_name = map_legacy(folder_name)
out = cached_filename_list_(folder_name)
if out is None:
out = get_filename_list_(folder_name)
global filename_list_cache
filename_list_cache[folder_name] = out
cache_helper.set(folder_name, out)
return list(out[0])
def get_save_image_path(filename_prefix: str, output_dir: str, image_width=0, image_height=0) -> tuple[str, str, int, str, str]:
def map_filename(filename: str) -> tuple[int, str]:
prefix_len = len(os.path.basename(filename_prefix))
prefix = filename[:prefix_len + 1]
try:
remainder = filename[prefix_len + 1:]
base_remainder = remainder.split('.')[0]
digits = int(base_remainder.split('_')[0])
except:
digits = 0
return digits, prefix
def compute_vars(input: str, image_width: int, image_height: int) -> str:
input = input.replace("%width%", str(image_width))
input = input.replace("%height%", str(image_height))
now = time.localtime()
input = input.replace("%year%", str(now.tm_year))
input = input.replace("%month%", str(now.tm_mon).zfill(2))
input = input.replace("%day%", str(now.tm_mday).zfill(2))
input = input.replace("%hour%", str(now.tm_hour).zfill(2))
input = input.replace("%minute%", str(now.tm_min).zfill(2))
input = input.replace("%second%", str(now.tm_sec).zfill(2))
return input
if "%" in filename_prefix:
filename_prefix = compute_vars(filename_prefix, image_width, image_height)
subfolder = os.path.dirname(os.path.normpath(filename_prefix))
filename = os.path.basename(os.path.normpath(filename_prefix))
full_output_folder = os.path.join(output_dir, subfolder)
if os.path.commonpath((output_dir, os.path.abspath(full_output_folder))) != output_dir:
err = "**** ERROR: Saving image outside the output folder is not allowed." + \
"\n full_output_folder: " + os.path.abspath(full_output_folder) + \
"\n output_dir: " + output_dir + \
"\n commonpath: " + os.path.commonpath((output_dir, os.path.abspath(full_output_folder)))
logging.error(err)
raise Exception(err)
try:
counter = max(filter(lambda a: os.path.normcase(a[1][:-1]) == os.path.normcase(filename) and a[1][-1] == "_", map(map_filename, os.listdir(full_output_folder))))[0] + 1
except ValueError:
counter = 1
except FileNotFoundError:
os.makedirs(full_output_folder, exist_ok=True)
counter = 1
return full_output_folder, filename, counter, subfolder, filename_prefix
def get_input_subfolders() -> list[str]:
"""Returns a list of all subfolder paths in the input directory, recursively.
Returns:
List of folder paths relative to the input directory, excluding the root directory
"""
input_dir = get_input_directory()
folders = []
try:
if not os.path.exists(input_dir):
return []
for root, dirs, _ in os.walk(input_dir):
rel_path = os.path.relpath(root, input_dir)
if rel_path != ".": # Only include non-root directories
# Normalize path separators to forward slashes
folders.append(rel_path.replace(os.sep, '/'))
return sorted(folders)
except FileNotFoundError:
return []
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
{"ref":"refs/tags/v1.45.20","node_id":"REF_kwDOMIrOxrJyZWZzL3RhZ3MvdjEuNDUuMjA","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/refs/tags/v1.45.20","object":{"sha":"7bd9f8b0d0b854ccb5a947623468f36a392ea0ff","type":"commit","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/commits/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff"}}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
@@ -0,0 +1,589 @@
import type { LGraphNode, NodeId } from '@/lib/litegraph/src/LGraphNode'
import type { LGraphCanvas } from '@/lib/litegraph/src/LGraphCanvas'
import type { CanvasPointer } from '@/lib/litegraph/src/CanvasPointer'
import type { Point } from '@/lib/litegraph/src/interfaces'
import type { CanvasPointerEvent } from '@/lib/litegraph/src/types/events'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import type { SubgraphNode } from '@/lib/litegraph/src/subgraph/SubgraphNode'
import type { BaseWidget } from '@/lib/litegraph/src/widgets/BaseWidget'
import { toConcreteWidget } from '@/lib/litegraph/src/widgets/widgetMap'
import { t } from '@/i18n'
import { useDomWidgetStore } from '@/stores/domWidgetStore'
import {
stripGraphPrefix,
useWidgetValueStore
} from '@/stores/widgetValueStore'
import type { WidgetState } from '@/stores/widgetValueStore'
import {
resolveConcretePromotedWidget,
resolvePromotedWidgetAtHost
} from '@/core/graph/subgraph/resolveConcretePromotedWidget'
import { matchPromotedInput } from '@/core/graph/subgraph/matchPromotedInput'
import { hasWidgetNode } from '@/core/graph/subgraph/widgetNodeTypeGuard'
import { isPromotedWidgetView } from './promotedWidgetTypes'
import type { PromotedWidgetView as IPromotedWidgetView } from './promotedWidgetTypes'
export type { PromotedWidgetView } from './promotedWidgetTypes'
export { isPromotedWidgetView } from './promotedWidgetTypes'
interface SubgraphSlotRef {
name: string
label?: string
displayName?: string
}
function isWidgetValue(value: unknown): value is IBaseWidget['value'] {
if (value === undefined) return true
if (typeof value === 'string') return true
if (typeof value === 'number') return true
if (typeof value === 'boolean') return true
return value !== null && typeof value === 'object'
}
type LegacyMouseWidget = IBaseWidget & {
mouse: (e: CanvasPointerEvent, pos: Point, node: LGraphNode) => unknown
}
function hasLegacyMouse(widget: IBaseWidget): widget is LegacyMouseWidget {
return 'mouse' in widget && typeof widget.mouse === 'function'
}
const designTokenCache = new Map<string, string>()
export function createPromotedWidgetView(
subgraphNode: SubgraphNode,
nodeId: string,
widgetName: string,
displayName?: string,
disambiguatingSourceNodeId?: string,
identityName?: string
): IPromotedWidgetView {
return new PromotedWidgetView(
subgraphNode,
nodeId,
widgetName,
displayName,
disambiguatingSourceNodeId,
identityName
)
}
class PromotedWidgetView implements IPromotedWidgetView {
[symbol: symbol]: boolean
readonly sourceNodeId: string
readonly sourceWidgetName: string
readonly serialize = false
last_y?: number
computedHeight?: number
private readonly graphId: string
private yValue = 0
private _computedDisabled = false
private projectedSourceNode?: LGraphNode
private projectedSourceWidget?: IBaseWidget
private projectedSourceWidgetType?: IBaseWidget['type']
private projectedWidget?: BaseWidget
private cachedDeepestByFrame?: { node: LGraphNode; widget: IBaseWidget }
private cachedDeepestFrame = -1
/** Cached reference to the bound subgraph slot, set at construction. */
private _boundSlot?: SubgraphSlotRef
private _boundSlotVersion = -1
constructor(
private readonly subgraphNode: SubgraphNode,
nodeId: string,
widgetName: string,
private readonly displayName?: string,
readonly disambiguatingSourceNodeId?: string,
private readonly identityName?: string
) {
this.sourceNodeId = nodeId
this.sourceWidgetName = widgetName
this.graphId = subgraphNode.rootGraph.id
}
get node(): SubgraphNode {
return this.subgraphNode
}
get name(): string {
return this.identityName ?? this.sourceWidgetName
}
get y(): number {
return this.yValue
}
set y(value: number) {
this.yValue = value
this.syncDomOverride()
}
get computedDisabled(): boolean {
return this._computedDisabled
}
set computedDisabled(value: boolean | undefined) {
this._computedDisabled = value ?? false
}
get type(): IBaseWidget['type'] {
return this.resolveDeepest()?.widget.type ?? 'button'
}
get options(): IBaseWidget['options'] {
return this.resolveDeepest()?.widget.options ?? {}
}
get tooltip(): string | undefined {
return this.resolveDeepest()?.widget.tooltip
}
get linkedWidgets(): IBaseWidget[] | undefined {
return this.resolveDeepest()?.widget.linkedWidgets
}
get value(): IBaseWidget['value'] {
const state = this.getWidgetState()
if (state && isWidgetValue(state.value)) return state.value
return this.resolveAtHost()?.widget.value
}
set value(value: IBaseWidget['value']) {
const linkedWidgets = this.getLinkedInputWidgets()
if (linkedWidgets.length > 0) {
const widgetStore = useWidgetValueStore()
let didUpdateState = false
for (const linkedWidget of linkedWidgets) {
const state = widgetStore.getWidget(
this.graphId,
linkedWidget.nodeId,
linkedWidget.widgetName
)
if (state) {
state.value = value
didUpdateState = true
}
}
const resolved = this.resolveDeepest()
if (resolved) {
const resolvedState = widgetStore.getWidget(
this.graphId,
stripGraphPrefix(String(resolved.node.id)),
resolved.widget.name
)
if (resolvedState) {
resolvedState.value = value
didUpdateState = true
}
}
if (didUpdateState) return
}
const state = this.getWidgetState()
if (state) {
state.value = value
return
}
const resolved = this.resolveAtHost()
if (resolved && isWidgetValue(value)) {
resolved.widget.value = value
}
}
get label(): string | undefined {
const slot = this.getBoundSubgraphSlot()
if (slot) return slot.label ?? slot.displayName ?? slot.name
// Fall back to persisted widget state (survives save/reload before
// the slot binding is established) then to construction displayName.
const state = this.getWidgetState()
return state?.label ?? this.displayName
}
set label(value: string | undefined) {
const slot = this.getBoundSubgraphSlot()
if (slot) slot.label = value || undefined
// Also persist to widget state store for save/reload resilience
const state = this.getWidgetState()
if (state) state.label = value
}
/**
* Returns the cached bound subgraph slot reference, refreshing only when
* the subgraph node's input list has changed (length mismatch).
*
* Note: Using length as the cache key works because the returned reference
* is the same mutable slot object. When slot properties (label, name) change,
* the caller reads fresh values from that reference. The cache only needs
* to invalidate when slots are added or removed, which changes length.
*/
private getBoundSubgraphSlot(): SubgraphSlotRef | undefined {
const version = this.subgraphNode.inputs?.length ?? 0
if (this._boundSlotVersion === version) return this._boundSlot
this._boundSlot = this.findBoundSubgraphSlot()
this._boundSlotVersion = version
return this._boundSlot
}
private findBoundSubgraphSlot(): SubgraphSlotRef | undefined {
for (const input of this.subgraphNode.inputs ?? []) {
const slot = input._subgraphSlot as SubgraphSlotRef | undefined
if (!slot) continue
const w = input._widget
if (
w &&
isPromotedWidgetView(w) &&
w.sourceNodeId === this.sourceNodeId &&
w.sourceWidgetName === this.sourceWidgetName
) {
return slot
}
}
return undefined
}
get hidden(): boolean {
return this.resolveDeepest()?.widget.hidden ?? false
}
get computeLayoutSize(): IBaseWidget['computeLayoutSize'] {
const resolved = this.resolveDeepest()
const computeLayoutSize = resolved?.widget.computeLayoutSize
if (!computeLayoutSize) return undefined
return (node: LGraphNode) => computeLayoutSize.call(resolved.widget, node)
}
get computeSize(): IBaseWidget['computeSize'] {
const resolved = this.resolveDeepest()
const computeSize = resolved?.widget.computeSize
if (!computeSize) return undefined
return (width?: number) => computeSize.call(resolved.widget, width)
}
draw(
ctx: CanvasRenderingContext2D,
_node: LGraphNode,
widgetWidth: number,
y: number,
H: number,
lowQuality?: boolean
): void {
const resolved = this.resolveDeepest()
if (!resolved) {
drawDisconnectedPlaceholder(ctx, widgetWidth, y, H)
return
}
if (isBaseDOMWidget(resolved.widget)) return this.syncDomOverride(resolved)
const projected = this.getProjectedWidget(resolved)
if (!projected || typeof projected.drawWidget !== 'function') return
const originalY = projected.y
const originalComputedHeight = projected.computedHeight
const originalComputedDisabled = projected.computedDisabled
const originalLabel = projected.label
projected.y = this.y
projected.computedHeight = this.computedHeight
projected.computedDisabled = this.computedDisabled
projected.value = this.value
projected.label = this.label
try {
projected.drawWidget(ctx, {
width: widgetWidth,
showText: !lowQuality,
suppressPromotedOutline: true,
previewImages: resolved.node.imgs
})
} finally {
projected.y = originalY
projected.computedHeight = originalComputedHeight
projected.computedDisabled = originalComputedDisabled
projected.label = originalLabel
}
}
onPointerDown(
pointer: CanvasPointer,
_node: LGraphNode,
canvas: LGraphCanvas
): boolean {
const resolved = this.resolveAtHost()
if (!resolved) return false
const interior = resolved.widget
if (typeof interior.onPointerDown === 'function') {
const handled = interior.onPointerDown(pointer, this.subgraphNode, canvas)
if (handled) return true
}
const concrete = toConcreteWidget(interior, this.subgraphNode, false)
if (concrete)
return this.bindConcretePointerHandlers(pointer, canvas, concrete)
if (hasLegacyMouse(interior))
return this.handleLegacyMouse(pointer, interior)
return false
}
callback(
value: unknown,
canvas?: LGraphCanvas,
node?: LGraphNode,
pos?: Point,
e?: CanvasPointerEvent
) {
this.resolveAtHost()?.widget.callback?.(value, canvas, node, pos, e)
}
private resolveAtHost():
| { node: LGraphNode; widget: IBaseWidget }
| undefined {
return resolvePromotedWidgetAtHost(
this.subgraphNode,
this.sourceNodeId,
this.sourceWidgetName,
this.disambiguatingSourceNodeId
)
}
private resolveDeepest():
| { node: LGraphNode; widget: IBaseWidget }
| undefined {
const frame = this.subgraphNode.rootGraph.primaryCanvas?.frame
if (frame !== undefined && this.cachedDeepestFrame === frame)
return this.cachedDeepestByFrame
const result = resolveConcretePromotedWidget(
this.subgraphNode,
this.sourceNodeId,
this.sourceWidgetName,
this.disambiguatingSourceNodeId
)
const resolved = result.status === 'resolved' ? result.resolved : undefined
if (frame !== undefined) {
this.cachedDeepestFrame = frame
this.cachedDeepestByFrame = resolved
}
return resolved
}
private getWidgetState() {
const linkedState = this.getLinkedInputWidgetStates()[0]
if (linkedState) return linkedState
const resolved = this.resolveDeepest()
if (!resolved) return undefined
return useWidgetValueStore().getWidget(
this.graphId,
stripGraphPrefix(String(resolved.node.id)),
resolved.widget.name
)
}
private getLinkedInputWidgets(): Array<{
nodeId: NodeId
widgetName: string
widget: IBaseWidget
}> {
const linkedInputSlot = this.subgraphNode.inputs.find((input) => {
if (!input._subgraphSlot) return false
if (matchPromotedInput([input], this) !== input) return false
const boundWidget = input._widget
if (boundWidget === this) return true
if (boundWidget && isPromotedWidgetView(boundWidget)) {
return (
boundWidget.sourceNodeId === this.sourceNodeId &&
boundWidget.sourceWidgetName === this.sourceWidgetName &&
boundWidget.disambiguatingSourceNodeId ===
this.disambiguatingSourceNodeId
)
}
return input._subgraphSlot
.getConnectedWidgets()
.filter(hasWidgetNode)
.some(
(widget) =>
String(widget.node.id) === this.sourceNodeId &&
widget.name === this.sourceWidgetName
)
})
const linkedInput = linkedInputSlot?._subgraphSlot
if (!linkedInput) return []
return linkedInput
.getConnectedWidgets()
.filter(hasWidgetNode)
.map((widget) => ({
nodeId: stripGraphPrefix(String(widget.node.id)),
widgetName: widget.name,
widget
}))
}
private getLinkedInputWidgetStates(): WidgetState[] {
const widgetStore = useWidgetValueStore()
return this.getLinkedInputWidgets()
.map(({ nodeId, widgetName }) =>
widgetStore.getWidget(this.graphId, nodeId, widgetName)
)
.filter((state): state is WidgetState => state !== undefined)
}
private getProjectedWidget(resolved: {
node: LGraphNode
widget: IBaseWidget
}): BaseWidget | undefined {
const shouldRebuild =
!this.projectedWidget ||
this.projectedSourceNode !== resolved.node ||
this.projectedSourceWidget !== resolved.widget ||
this.projectedSourceWidgetType !== resolved.widget.type
if (!shouldRebuild) return this.projectedWidget
const concrete = toConcreteWidget(resolved.widget, resolved.node, false)
if (!concrete) {
this.projectedWidget = undefined
this.projectedSourceNode = undefined
this.projectedSourceWidget = undefined
this.projectedSourceWidgetType = undefined
return undefined
}
this.projectedWidget = concrete.createCopyForNode(this.subgraphNode)
this.projectedSourceNode = resolved.node
this.projectedSourceWidget = resolved.widget
this.projectedSourceWidgetType = resolved.widget.type
return this.projectedWidget
}
private bindConcretePointerHandlers(
pointer: CanvasPointer,
canvas: LGraphCanvas,
concrete: BaseWidget
): boolean {
const downEvent = pointer.eDown
if (!downEvent) return false
pointer.onClick = () =>
concrete.onClick({
e: downEvent,
node: this.subgraphNode,
canvas
})
pointer.onDrag = (eMove) =>
concrete.onDrag?.({
e: eMove,
node: this.subgraphNode,
canvas
})
return true
}
private handleLegacyMouse(
pointer: CanvasPointer,
interior: LegacyMouseWidget
): boolean {
const downEvent = pointer.eDown
if (!downEvent) return false
const downPosition: Point = [
downEvent.canvasX - this.subgraphNode.pos[0],
downEvent.canvasY - this.subgraphNode.pos[1]
]
interior.mouse(downEvent, downPosition, this.subgraphNode)
pointer.finally = () => {
const upEvent = pointer.eUp
if (!upEvent) return
const upPosition: Point = [
upEvent.canvasX - this.subgraphNode.pos[0],
upEvent.canvasY - this.subgraphNode.pos[1]
]
interior.mouse(upEvent, upPosition, this.subgraphNode)
}
return true
}
private syncDomOverride(
resolved:
| { node: LGraphNode; widget: IBaseWidget }
| undefined = this.resolveAtHost()
) {
if (!resolved || !isBaseDOMWidget(resolved.widget)) return
useDomWidgetStore().setPositionOverride(resolved.widget.id, {
node: this.subgraphNode,
widget: this
})
}
}
/** Checks if a widget is a BaseDOMWidget (DOMWidget or ComponentWidget). */
function isBaseDOMWidget(
widget: IBaseWidget
): widget is IBaseWidget & { id: string } {
return 'id' in widget && ('element' in widget || 'component' in widget)
}
function drawDisconnectedPlaceholder(
ctx: CanvasRenderingContext2D,
width: number,
y: number,
H: number
) {
const backgroundColor = readDesignToken(
'--color-secondary-background',
'#333'
)
const textColor = readDesignToken('--color-text-secondary', '#999')
const fontSize = readDesignToken('--text-2xs', '11px')
const fontFamily = readDesignToken('--font-inter', 'sans-serif')
ctx.save()
ctx.fillStyle = backgroundColor
ctx.fillRect(15, y, width - 30, H)
ctx.fillStyle = textColor
ctx.font = `${fontSize} ${fontFamily}`
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.fillText(t('subgraphStore.disconnected'), width / 2, y + H / 2)
ctx.restore()
}
function readDesignToken(token: string, fallback: string): string {
if (typeof document === 'undefined') return fallback
const cachedValue = designTokenCache.get(token)
if (cachedValue) return cachedValue
const value = getComputedStyle(document.documentElement)
.getPropertyValue(token)
.trim()
const resolvedValue = value || fallback
designTokenCache.set(token, resolvedValue)
return resolvedValue
}
@@ -0,0 +1,49 @@
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { isPromotedWidgetView } from './promotedWidgetTypes'
import { resolveSubgraphInputLink } from './resolveSubgraphInputLink'
type ResolvedSubgraphInputTarget = {
nodeId: string
widgetName: string
sourceNodeId?: string
}
export function resolveSubgraphInputTarget(
node: LGraphNode,
inputName: string
): ResolvedSubgraphInputTarget | undefined {
return resolveSubgraphInputLink(
node,
inputName,
({ inputNode, targetInput, getTargetWidget }) => {
if (inputNode.isSubgraphNode()) {
const targetWidget = getTargetWidget()
if (!targetWidget) return undefined
if (isPromotedWidgetView(targetWidget)) {
return {
nodeId: String(inputNode.id),
widgetName: targetWidget.sourceWidgetName,
sourceNodeId:
targetWidget.disambiguatingSourceNodeId ??
targetWidget.sourceNodeId
}
}
return {
nodeId: String(inputNode.id),
widgetName: targetInput.name
}
}
const targetWidget = getTargetWidget()
if (!targetWidget) return undefined
return {
nodeId: String(inputNode.id),
widgetName: targetWidget.name
}
}
)
}
@@ -0,0 +1,615 @@
import { remove } from 'es-toolkit'
import { shallowReactive } from 'vue'
import { useChainCallback } from '@/composables/functional/useChainCallback'
import type {
ISlotType,
INodeInputSlot,
INodeOutputSlot
} from '@/lib/litegraph/src/interfaces'
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
import type { LLink } from '@/lib/litegraph/src/LLink'
import { commonType } from '@/lib/litegraph/src/utils/type'
import { resolveNodeRootGraphId } from '@/lib/litegraph/src/utils/widget'
import { transformInputSpecV1ToV2 } from '@/schemas/nodeDef/migration'
import type { ComboInputSpec, InputSpec } from '@/schemas/nodeDefSchema'
import type { InputSpec as InputSpecV2 } from '@/schemas/nodeDef/nodeDefSchemaV2'
import {
zAutogrowOptions,
zDynamicComboInputSpec,
zMatchTypeOptions
} from '@/schemas/nodeDefSchema'
import { useLitegraphService } from '@/services/litegraphService'
import { app } from '@/scripts/app'
import type { ComfyApp } from '@/scripts/app'
import { useWidgetValueStore } from '@/stores/widgetValueStore'
const INLINE_INPUTS = false
type MatchTypeNode = LGraphNode &
Pick<Required<LGraphNode>, 'onConnectionsChange'> & {
comfyDynamic: { matchType: Record<string, Record<string, string>> }
}
type AutogrowNode = LGraphNode &
Pick<Required<LGraphNode>, 'onConnectionsChange' | 'widgets'> & {
comfyDynamic: {
autogrow: Record<
string,
{
min: number
max: number
inputSpecs: InputSpecV2[]
prefix?: string
names?: string[]
}
>
}
}
function ensureWidgetForInput(node: LGraphNode, input: INodeInputSlot) {
node.widgets ??= []
const { widget } = input
if (widget && node.widgets.some((w) => w.name === widget.name)) return
node.widgets.push({
draw(ctx, _n, _w, y) {
ctx.save()
ctx.fillStyle = LiteGraph.NODE_TEXT_COLOR
ctx.fillText(input.label ?? input.name, 20, y + 15)
ctx.restore()
},
name: input.name,
options: {},
serialize: false,
type: 'shim',
y: 0
})
input.alwaysVisible = true
input.widget = { name: input.name }
}
function dynamicComboWidget(
node: LGraphNode,
inputName: string,
untypedInputData: InputSpec,
appArg: ComfyApp,
widgetName?: string
) {
const { addNodeInput } = useLitegraphService()
const parseResult = zDynamicComboInputSpec.safeParse(untypedInputData)
if (!parseResult.success) throw new Error('invalid DynamicCombo spec')
const inputData = parseResult.data
const options = Object.fromEntries(
inputData[1].options.map(({ key, inputs }) => [key, inputs])
)
const subSpec: ComboInputSpec = [Object.keys(options), {}]
const { widget, minWidth, minHeight } = app.widgets['COMBO'](
node,
inputName,
subSpec,
appArg,
widgetName
)
function isInGroup(e: { name: string }): boolean {
return e.name.startsWith(inputName + '.')
}
const updateWidgets = (value?: string) => {
if (!node.widgets) throw new Error('Not Reachable')
const newSpec = value ? options[value] : undefined
const removedInputs = remove(node.inputs, isInGroup)
for (const widget of remove(node.widgets, isInGroup)) widget.onRemove?.()
if (!newSpec) return
const insertionPoint = node.widgets.findIndex((w) => w === widget) + 1
const startingLength = node.widgets.length
const startingInputLength = node.inputs.length
if (insertionPoint === 0)
throw new Error("Dynamic widget doesn't exist on node")
const inputTypes: (Record<string, InputSpec> | undefined)[] = [
newSpec.required,
newSpec.optional
]
inputTypes.forEach((inputType, idx) => {
for (const key in inputType ?? {}) {
const name = `${widget.name}.${key}`
const specToAdd = transformInputSpecV1ToV2(inputType![key], {
name,
isOptional: idx !== 0
})
specToAdd.display_name = key
addNodeInput(node, specToAdd)
const newInputs = node.inputs
.slice(startingInputLength)
.filter((inp) => inp.name.startsWith(name))
for (const newInput of newInputs) {
if (INLINE_INPUTS && !newInput.widget)
ensureWidgetForInput(node, newInput)
}
}
})
const inputInsertionPoint =
node.inputs.findIndex((i) => i.name === widget.name) + 1
const addedWidgets = node.widgets.splice(startingLength)
node.widgets.splice(insertionPoint, 0, ...addedWidgets)
if (inputInsertionPoint === 0) {
if (
addedWidgets.length === 0 &&
node.inputs.length !== startingInputLength
)
//input is inputOnly, but lacks an insertion point
throw new Error('Failed to find input socket for ' + widget.name)
return
}
const addedInputs = spliceInputs(node, startingInputLength).map(
(addedInput) => {
const existingInput = node.inputs.findIndex(
(existingInput) => addedInput.name === existingInput.name
)
return existingInput === -1
? addedInput
: spliceInputs(node, existingInput, 1)[0]
}
)
//assume existing inputs are in correct order
spliceInputs(node, inputInsertionPoint, 0, ...addedInputs)
for (const input of removedInputs) {
const inputIndex = node.inputs.findIndex((inp) => inp.name === input.name)
if (inputIndex === -1) {
node.inputs.push(input)
node.removeInput(node.inputs.length - 1)
} else {
node.inputs[inputIndex].link = input.link
if (!input.link) continue
const link = node.graph?.links?.[input.link]
if (!link) continue
link.target_slot = inputIndex
node.onConnectionsChange?.(
LiteGraph.INPUT,
inputIndex,
true,
link,
node.inputs[inputIndex]
)
}
}
node.size[1] = node.computeSize([...node.size])[1]
if (!node.graph) return
node._setConcreteSlots()
node.arrange()
app.canvas?.setDirty(true, true)
}
//A little hacky, but onConfigure won't work.
//It fires too late and is overly disruptive
let widgetValue = widget.value
const getState = () => {
const graphId = resolveNodeRootGraphId(node)
if (!graphId) return undefined
return useWidgetValueStore().getWidget(graphId, node.id, widget.name)
}
Object.defineProperty(widget, 'value', {
get() {
return getState()?.value ?? widgetValue
},
set(value) {
const state = getState()
if (state) state.value = value
widgetValue = value
updateWidgets(value)
}
})
widget.value = widgetValue
return { widget, minWidth, minHeight }
}
export const dynamicWidgets = { COMFY_DYNAMICCOMBO_V3: dynamicComboWidget }
const dynamicInputs: Record<
string,
(node: LGraphNode, inputSpec: InputSpecV2) => void
> = {
COMFY_AUTOGROW_V3: applyAutogrow,
COMFY_MATCHTYPE_V3: applyMatchType
}
export function applyDynamicInputs(
node: LGraphNode,
inputSpec: InputSpecV2
): boolean {
if (!(inputSpec.type in dynamicInputs)) return false
//TODO: move parsing/validation of inputSpec here?
dynamicInputs[inputSpec.type](node, inputSpec)
return true
}
function spliceInputs(
node: LGraphNode,
startIndex: number,
deleteCount = -1,
...toAdd: INodeInputSlot[]
): INodeInputSlot[] {
if (deleteCount < 0) return node.inputs.splice(startIndex)
const ret = node.inputs.splice(startIndex, deleteCount, ...toAdd)
node.inputs.slice(startIndex).forEach((input, index) => {
const link = input.link && node.graph?.links?.get(input.link)
if (link) link.target_slot = startIndex + index
})
return ret
}
function changeOutputType(
node: LGraphNode,
output: INodeOutputSlot,
combinedType: ISlotType
) {
if (output.type === combinedType) return
output.type = combinedType
//check and potentially remove links
if (!node.graph) return
for (const link_id of output.links ?? []) {
const link = node.graph.links[link_id]
if (!link) continue
const { input, inputNode, subgraphOutput } = link.resolve(node.graph)
const inputType = (input ?? subgraphOutput)?.type
if (!inputType) continue
const keep = LiteGraph.isValidConnection(combinedType, inputType)
if (!keep && subgraphOutput) subgraphOutput.disconnect()
else if (!keep && inputNode) inputNode.disconnectInput(link.target_slot)
if (input && inputNode?.onConnectionsChange)
inputNode.onConnectionsChange(
LiteGraph.INPUT,
link.target_slot,
keep,
link,
input
)
}
}
function withComfyMatchType(node: LGraphNode): asserts node is MatchTypeNode {
if (node.comfyDynamic?.matchType) return
node.comfyDynamic ??= {}
node.comfyDynamic.matchType = {}
const outputGroups = node.constructor.nodeData?.output_matchtypes
node.onConnectionsChange = useChainCallback(
node.onConnectionsChange,
function (
this: MatchTypeNode,
contype: ISlotType,
slot: number,
iscon: boolean,
linf: LLink | null | undefined
) {
const input = this.inputs[slot]
if (contype !== LiteGraph.INPUT || !this.graph || !input) return
if (app.configuringGraph) return
const [matchKey, matchGroup] = Object.entries(
this.comfyDynamic.matchType
).find(([, group]) => input.name in group) ?? ['', undefined]
if (!matchGroup) return
if (iscon && linf) {
const { output, subgraphInput } = linf.resolve(this.graph)
const connectingType = (output ?? subgraphInput)?.type
if (connectingType) linf.type = connectingType
}
//NOTE: inputs contains input
const groupInputs: INodeInputSlot[] = node.inputs.filter(
(inp) => inp.name in matchGroup
)
const connectedTypes = groupInputs.map((inp) => {
if (!inp.link) return '*'
const link = this.graph!.links[inp.link]
if (!link) return '*'
const { output, subgraphInput } = link.resolve(this.graph!)
return (output ?? subgraphInput)?.type ?? '*'
})
//An input slot can accept a connection that is
// - Compatible with original type
// - Compatible with all other input types
//An output slot can output
// - Only what every input can output
groupInputs.forEach((input, idx) => {
const otherConnected = [
...connectedTypes.slice(0, idx),
...connectedTypes.slice(idx + 1)
]
const combinedType = commonType(
...otherConnected,
matchGroup[input.name]
)
if (!combinedType) throw new Error('invalid connection')
input.type = combinedType
})
const outputType = commonType(...connectedTypes)
if (!outputType) throw new Error('invalid connection')
this.outputs.forEach((output, idx) => {
if (!(outputGroups?.[idx] == matchKey)) return
this.outputs[idx] = shallowReactive(this.outputs[idx])
changeOutputType(this, output, outputType)
})
app.canvas?.setDirty(true, true)
}
)
}
function applyMatchType(node: LGraphNode, inputSpec: InputSpecV2) {
const { addNodeInput } = useLitegraphService()
const name = inputSpec.name
const matchTypeSpec = zMatchTypeOptions.safeParse(inputSpec).data
if (!matchTypeSpec) return
const { allowed_types, template_id } = matchTypeSpec.template
const typedSpec = { ...inputSpec, type: allowed_types }
addNodeInput(node, typedSpec)
withComfyMatchType(node)
node.comfyDynamic.matchType[template_id] ??= {}
node.comfyDynamic.matchType[template_id][name] = allowed_types
//TODO: instead apply on output add?
//ensure outputs get updated
const index = node.inputs.length - 1
requestAnimationFrame(() => {
const input = node.inputs[index]
if (!input) return
node.inputs[index] = shallowReactive(input)
node.onConnectionsChange?.(
LiteGraph.INPUT,
index,
!!input.link,
input.link ? node.graph?.links?.[input.link] : undefined,
input
)
})
}
function autogrowOrdinalToName(
ordinal: number,
key: string,
groupName: string,
node: AutogrowNode
) {
const {
names,
prefix = '',
inputSpecs
} = node.comfyDynamic.autogrow[groupName]
const baseName = names
? names[ordinal]
: (inputSpecs.length == 1 ? prefix : key) + ordinal
return { name: `${groupName}.${baseName}`, display_name: baseName }
}
function addAutogrowGroup(
ordinal: number,
groupName: string,
node: AutogrowNode
) {
const { addNodeInput } = useLitegraphService()
const { max, min, inputSpecs } = node.comfyDynamic.autogrow[groupName]
if (ordinal >= max) return
const namedSpecs = inputSpecs.map((input) => ({
...input,
isOptional: ordinal >= (min ?? 0) || input.isOptional,
...autogrowOrdinalToName(ordinal, input.name, groupName, node)
}))
const newInputs = namedSpecs.map((namedSpec) => {
addNodeInput(node, namedSpec)
const input = spliceInputs(node, node.inputs.length - 1, 1)[0]
if (inputSpecs.length !== 1 || (INLINE_INPUTS && !input.widget))
ensureWidgetForInput(node, input)
return input
})
for (const newInput of newInputs) {
for (const existingInput of remove(
node.inputs,
(inp) => inp.name === newInput.name
)) {
//NOTE: link.target_slot is updated on spliceInputs call
newInput.link ??= existingInput.link
}
}
const targetName = autogrowOrdinalToName(
ordinal - 1,
inputSpecs.at(-1)!.name,
groupName,
node
).name
const lastIndex = node.inputs.findLastIndex((inp) =>
inp.name.startsWith(targetName)
)
const insertionIndex = lastIndex === -1 ? node.inputs.length : lastIndex + 1
spliceInputs(node, insertionIndex, 0, ...newInputs)
app.canvas?.setDirty(true, true)
}
const ORDINAL_REGEX = /\d+$/
function resolveAutogrowOrdinal(
inputName: string,
groupName: string,
node: AutogrowNode
): number | undefined {
//TODO preslice groupname?
const name = inputName.slice(groupName.length + 1)
const { names } = node.comfyDynamic.autogrow[groupName]
if (names) {
const ordinal = names.findIndex((s) => s === name)
return ordinal === -1 ? undefined : ordinal
}
const match = name.match(ORDINAL_REGEX)
if (!match) return undefined
const ordinal = parseInt(match[0])
return ordinal !== ordinal ? undefined : ordinal
}
function autogrowInputConnected(index: number, node: AutogrowNode) {
const input = node.inputs[index]
const groupName = input.name.slice(0, input.name.lastIndexOf('.'))
const lastInput = node.inputs.findLast((inp) =>
inp.name.startsWith(groupName + '.')
)
const ordinal = resolveAutogrowOrdinal(input.name, groupName, node)
if (
!lastInput ||
ordinal == undefined ||
(ordinal !== resolveAutogrowOrdinal(lastInput.name, groupName, node) &&
!app.configuringGraph)
)
return
addAutogrowGroup(ordinal + 1, groupName, node)
}
function autogrowInputDisconnected(index: number, node: AutogrowNode) {
const input = node.inputs[index]
if (!input) return
const groupName = input.name.slice(0, input.name.lastIndexOf('.'))
const autogrowGroup = node.comfyDynamic.autogrow[groupName]
if (!autogrowGroup) return
const { min = 1, inputSpecs } = autogrowGroup
const ordinal = resolveAutogrowOrdinal(input.name, groupName, node)
if (ordinal == undefined || ordinal + 1 < min) return
//resolve all inputs in group
const groupInputs = node.inputs.filter(
(inp) =>
inp.name.startsWith(groupName + '.') &&
inp.name.lastIndexOf('.') === groupName.length
)
const stride = inputSpecs.length
if (stride + index >= node.inputs.length) return
if (groupInputs.length % stride !== 0) {
console.error('Failed to group multi-input autogrow inputs')
return
}
app.canvas?.setDirty(true, true)
//groupBy would be nice here, but may not be supported
for (let column = 0; column < stride; column++) {
for (
let bubbleOrdinal = ordinal * stride + column;
bubbleOrdinal + stride < groupInputs.length;
bubbleOrdinal += stride
) {
const curInput = groupInputs[bubbleOrdinal]
curInput.link = groupInputs[bubbleOrdinal + stride].link
if (!curInput.link) continue
const link = node.graph?.links[curInput.link]
if (!link) continue
const curIndex = node.inputs.findIndex((inp) => inp === curInput)
if (curIndex === -1) throw new Error('missing input')
link.target_slot = curIndex
node.onConnectionsChange?.(
LiteGraph.INPUT,
curIndex,
true,
link,
curInput
)
}
const lastInput = groupInputs.at(column - stride)
if (!lastInput) continue
lastInput.link = null
node.onConnectionsChange?.(
LiteGraph.INPUT,
node.inputs.length + column - stride,
false,
null,
lastInput
)
}
const removalChecks = groupInputs.slice(min * stride)
let i
for (i = removalChecks.length - stride; i >= 0; i -= stride) {
if (removalChecks.slice(i, i + stride).some((inp) => inp.link)) break
}
const toRemove = removalChecks.slice(i + stride * 2)
remove(node.inputs, (inp) => toRemove.includes(inp))
for (const input of toRemove) {
const widgetName = input?.widget?.name
if (!widgetName) continue
for (const widget of remove(node.widgets, (w) => w.name === widgetName))
widget.onRemove?.()
}
node.size[1] = node.computeSize([...node.size])[1]
}
function withComfyAutogrow(node: LGraphNode): asserts node is AutogrowNode {
if (node.comfyDynamic?.autogrow) return
node.comfyDynamic ??= {}
node.comfyDynamic.autogrow = {}
let pendingConnection: number | undefined
let swappingConnection = false
const originalOnConnectInput = node.onConnectInput
node.onConnectInput = function (slot: number, ...args) {
pendingConnection = slot
requestAnimationFrame(() => (pendingConnection = undefined))
return originalOnConnectInput?.apply(this, [slot, ...args]) ?? true
}
node.onConnectionsChange = useChainCallback(
node.onConnectionsChange,
function (
this: AutogrowNode,
contype: ISlotType,
slot: number,
iscon: boolean,
linf: LLink | null | undefined
) {
const input = this.inputs[slot]
if (contype !== LiteGraph.INPUT || !input) return
//Return if input isn't known autogrow
const key = input.name.slice(0, input.name.lastIndexOf('.'))
const autogrowGroup = this.comfyDynamic.autogrow[key]
if (!autogrowGroup) return
if (app.configuringGraph && input.widget)
ensureWidgetForInput(node, input)
if (iscon) {
if (swappingConnection || !linf) return
autogrowInputConnected(slot, this)
} else {
if (pendingConnection === slot) {
swappingConnection = true
requestAnimationFrame(() => (swappingConnection = false))
return
}
requestAnimationFrame(() => autogrowInputDisconnected(slot, this))
}
}
)
}
function applyAutogrow(node: LGraphNode, inputSpecV2: InputSpecV2) {
withComfyAutogrow(node)
const parseResult = zAutogrowOptions.safeParse(inputSpecV2)
if (!parseResult.success) throw new Error('invalid Autogrow spec')
const inputSpec = parseResult.data
const { input, min = 1, names, prefix, max = 100 } = inputSpec.template
const inputTypes: (Record<string, InputSpec> | undefined)[] = [
input.required,
input.optional
]
const inputsV2 = inputTypes.flatMap((inputType, index) =>
Object.entries(inputType ?? {}).map(([name, v]) =>
transformInputSpecV1ToV2(v, { name, isOptional: index === 1 })
)
)
node.comfyDynamic.autogrow[inputSpecV2.name] = {
names,
min,
max: names?.length ?? max,
prefix,
inputSpecs: inputsV2
}
for (let i = 0; i === 0 || i < min + 1; i++)
addAutogrowGroup(i, inputSpecV2.name, node)
}
@@ -0,0 +1,31 @@
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import { useExtensionService } from '@/services/extensionService'
import { processDynamicPrompt } from '@/utils/formatUtil'
// Allows for simple dynamic prompt replacement
// Inputs in the format {a|b} will have a random value of a or b chosen when the prompt is queued.
useExtensionService().registerExtension({
name: 'Comfy.DynamicPrompts',
nodeCreated(node: LGraphNode) {
if (node.widgets) {
// Locate dynamic prompt text widgets
// Include any widgets with dynamicPrompts set to true, and customtext
const widgets = node.widgets.filter((w) => w.dynamicPrompts)
for (const widget of widgets) {
// Override the serialization of the value to resolve dynamic prompts for all widgets supporting it in this node
widget.serializeValue = (workflowNode, widgetIndex) => {
if (typeof widget.value !== 'string') return widget.value
const prompt = processDynamicPrompt(widget.value)
// Overwrite the value in the serialized workflow pnginfo
if (workflowNode?.widgets_values)
workflowNode.widgets_values[widgetIndex] = prompt
return prompt
}
}
}
}
})
@@ -0,0 +1,84 @@
import { LGraphCanvas, LiteGraph } from '@/lib/litegraph/src/litegraph'
import { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { app } from '../../scripts/app'
import { ComfyWidgets } from '../../scripts/widgets'
// Node that add notes to your project
app.registerExtension({
name: 'Comfy.NoteNode',
registerCustomNodes() {
class NoteNode extends LGraphNode {
static override category: string
static collapsable: boolean
static title_mode: number
groupcolor = LGraphCanvas.node_colors.yellow.groupcolor
override isVirtualNode: boolean
constructor(title: string) {
super(title)
this.color = LGraphCanvas.node_colors.yellow.color
this.bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
if (!this.properties) {
this.properties = { text: '' }
}
ComfyWidgets.STRING(
this,
'text',
['STRING', { default: this.properties.text, multiline: true }],
app
)
this.serialize_widgets = true
this.isVirtualNode = true
}
}
// Load default visibility
LiteGraph.registerNodeType(
'Note',
Object.assign(NoteNode, {
title_mode: LiteGraph.NORMAL_TITLE,
title: 'Note',
collapsable: true
})
)
NoteNode.category = 'utils'
/** Markdown variant of NoteNode */
class MarkdownNoteNode extends LGraphNode {
static override title = 'Markdown Note'
groupcolor = LGraphCanvas.node_colors.yellow.groupcolor
constructor(title: string) {
super(title)
this.color = LGraphCanvas.node_colors.yellow.color
this.bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
if (!this.properties) {
this.properties = { text: '' }
}
ComfyWidgets.MARKDOWN(
this,
'text',
['STRING', { default: this.properties.text }],
app
)
this.serialize_widgets = true
this.isVirtualNode = true
}
}
LiteGraph.registerNodeType('MarkdownNote', MarkdownNoteNode)
MarkdownNoteNode.category = 'utils'
}
})
@@ -0,0 +1,40 @@
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import {
type ComfyNodeDef,
type InputSpec,
isMediaUploadComboInput
} from '@/schemas/nodeDefSchema'
import { app } from '../../scripts/app'
// Adds an upload button to the nodes
const createUploadInput = (
imageInputName: string,
imageInputOptions: InputSpec
): InputSpec => [
'IMAGEUPLOAD',
{
...imageInputOptions[1],
imageInputName
}
]
app.registerExtension({
name: 'Comfy.UploadImage',
beforeRegisterNodeDef(_nodeType: typeof LGraphNode, nodeData: ComfyNodeDef) {
const { input } = nodeData ?? {}
const { required } = input ?? {}
if (!required) return
const found = Object.entries(required).find(([_, input]) =>
isMediaUploadComboInput(input)
)
// If media combo input found, attach upload input
if (found) {
const [inputName, inputSpec] = found
required.upload = createUploadInput(inputName, inputSpec)
}
}
})
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
// Re-export Subgraph and GraphOrSubgraph from LGraph.ts to maintain compatibility
// This is a temporary fix to resolve circular dependency issues
export { Subgraph, type GraphOrSubgraph } from '@/lib/litegraph/src/LGraph'
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,326 @@
import { t } from '@/i18n'
import { type LGraphNode, isComboWidget } from '@/lib/litegraph/src/litegraph'
import type {
IBaseWidget,
IComboWidget,
IStringWidget
} from '@/lib/litegraph/src/types/widgets'
import { useSettingStore } from '@/platform/settings/settingStore'
import { dynamicWidgets } from '@/core/graph/widgets/dynamicWidgets'
import { useBooleanWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useBooleanWidget'
import { useBoundingBoxWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useBoundingBoxWidget'
import { useCurveWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useCurveWidget'
import { useChartWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useChartWidget'
import { useColorWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useColorWidget'
import { useComboWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useComboWidget'
import { useFloatWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useFloatWidget'
import { useGalleriaWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useGalleriaWidget'
import { useBoundingBoxesWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useBoundingBoxesWidget'
import { useColorsWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useColorsWidget'
import { useImageCompareWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useImageCompareWidget'
import { useImageUploadWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget'
import { useIntWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useIntWidget'
import { useMarkdownWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useMarkdownWidget'
import { usePainterWidget } from '@/renderer/extensions/vueNodes/widgets/composables/usePainterWidget'
import { useRangeWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useRangeWidget'
import { useStringWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useStringWidget'
import { useTextareaWidget } from '@/renderer/extensions/vueNodes/widgets/composables/useTextareaWidget'
import { transformInputSpecV1ToV2 } from '@/schemas/nodeDef/migration'
import type { InputSpec as InputSpecV2 } from '@/schemas/nodeDef/nodeDefSchemaV2'
import type { InputSpec } from '@/schemas/nodeDefSchema'
import type { ComfyApp } from './app'
import './domWidget'
import './errorNodeWidgets'
export type ComfyWidgetConstructorV2 = (
node: LGraphNode,
inputSpec: InputSpecV2
) => IBaseWidget
export type ComfyWidgetConstructor = (
node: LGraphNode,
inputName: string,
inputData: InputSpec,
app: ComfyApp,
widgetName?: string
) => { widget: IBaseWidget; minWidth?: number; minHeight?: number }
/**
* Transforms a V2 widget constructor to a V1 widget constructor.
* @param widgetConstructorV2 The V2 widget constructor to transform.
* @returns The transformed V1 widget constructor.
*/
const transformWidgetConstructorV2ToV1 = (
widgetConstructorV2: ComfyWidgetConstructorV2
): ComfyWidgetConstructor => {
return (node, inputName, inputData) => {
const inputSpec = transformInputSpecV1ToV2(inputData, {
name: inputName
})
const widget = widgetConstructorV2(node, inputSpec)
return {
widget,
minWidth: widget.options.minNodeSize?.[0],
minHeight: widget.options.minNodeSize?.[1]
}
}
}
function controlValueRunBefore() {
return useSettingStore().get('Comfy.WidgetControlMode') === 'before'
}
export function updateControlWidgetLabel(widget: IBaseWidget) {
if (controlValueRunBefore()) {
widget.label = t('g.control_before_generate')
} else {
widget.label = t('g.control_after_generate')
}
}
export const IS_CONTROL_WIDGET = Symbol()
const HAS_EXECUTED = Symbol()
export function addValueControlWidget(
node: LGraphNode,
targetWidget: IBaseWidget,
defaultValue?: string,
_values?: unknown,
widgetName?: string,
inputData?: InputSpec
): IComboWidget {
let name = inputData?.[1]?.control_after_generate
if (typeof name !== 'string') {
name = widgetName
}
const widgets = addValueControlWidgets(
node,
targetWidget,
defaultValue ?? 'randomize',
{
addFilterList: false,
controlAfterGenerateName: name
},
inputData
)
return widgets[0]
}
export function addValueControlWidgets(
node: LGraphNode,
targetWidget: IBaseWidget,
defaultValue?: string,
options?: Record<string, any>,
inputData?: InputSpec
): [IComboWidget, ...IStringWidget[]] {
if (!defaultValue) defaultValue = 'randomize'
if (!options) options = {}
const getName = (defaultName: string, optionName: string) => {
let name = defaultName
if (options[optionName]) {
name = options[optionName]
} else if (typeof inputData?.[1]?.[defaultName] === 'string') {
name = inputData?.[1]?.[defaultName]
} else if (inputData?.[1]?.control_prefix) {
name = inputData?.[1]?.control_prefix + ' ' + name
}
return name
}
const valueControl = node.addWidget(
'combo',
getName('control_after_generate', 'controlAfterGenerateName'),
defaultValue,
function () {},
{
values: ['fixed', 'increment', 'decrement', 'randomize'],
serialize: false, // Don't include this in prompt.
canvasOnly: true
}
) as IComboWidget
valueControl.tooltip =
'Allows the linked widget to be changed automatically, for example randomizing the noise seed.'
valueControl[IS_CONTROL_WIDGET] = true
updateControlWidgetLabel(valueControl)
Object.defineProperty(valueControl, 'disabled', {
get: () => targetWidget.computedDisabled
})
const widgets: [IComboWidget, ...IStringWidget[]] = [valueControl]
const isCombo = isComboWidget(targetWidget)
let comboFilter: IStringWidget
if (isCombo && valueControl.options.values) {
// @ts-expect-error Combo widget values may be a dictionary or legacy function type
valueControl.options.values.push('increment-wrap')
}
if (isCombo && options.addFilterList !== false) {
comboFilter = node.addWidget(
'string',
getName('control_filter_list', 'controlFilterListName'),
'',
function () {},
{
serialize: false // Don't include this in prompt.
}
) as IStringWidget
updateControlWidgetLabel(comboFilter)
comboFilter.tooltip =
"Allows for filtering the list of values when changing the value via the control generate mode. Allows for RegEx matches in the format /abc/ to only filter to values containing 'abc'."
Object.defineProperty(comboFilter, 'disabled', {
get: () => targetWidget.computedDisabled
})
widgets.push(comboFilter)
}
const applyWidgetControl = () => {
var v = valueControl.value
if (isCombo && v !== 'fixed') {
let values = targetWidget.options.values ?? []
const filter = comboFilter?.value
if (filter) {
let check
if (filter.startsWith('/') && filter.endsWith('/')) {
try {
const regex = new RegExp(filter.substring(1, filter.length - 1))
check = (item: string) => regex.test(item)
} catch (error) {
console.error(
'Error constructing RegExp filter for node ' + node.id,
filter,
error
)
}
}
if (!check) {
const lower = filter.toLocaleLowerCase()
check = (item: string) => item.toLocaleLowerCase().includes(lower)
}
// @ts-expect-error Combo widget values may be a dictionary or legacy function type
values = values.filter((item: string) => check(item))
if (!values.length && targetWidget.options.values?.length) {
console.warn(
'Filter for node ' + node.id + ' has filtered out all items',
filter
)
}
}
// @ts-expect-error targetWidget.value can be number or string
let current_index = values.indexOf(targetWidget.value)
let current_length = values.length
switch (v) {
case 'increment':
current_index += 1
break
case 'increment-wrap':
current_index += 1
if (current_index >= current_length) {
current_index = 0
}
break
case 'decrement':
current_index -= 1
break
case 'randomize':
// @ts-expect-error Combo widget values may be a dictionary or legacy function type
current_index = Math.floor(Math.random() * current_length)
break
default:
break
}
current_index = Math.max(0, current_index)
// @ts-expect-error Combo widget values may be a dictionary or legacy function type
current_index = Math.min(current_length - 1, current_index)
if (current_index >= 0) {
// @ts-expect-error Combo widget values may be a dictionary or legacy function type
let value = values[current_index]
targetWidget.value = value
targetWidget.callback?.(value)
}
} else {
//number
let { min = 0, max = 1, step2 = 1 } = targetWidget.options
// limit to something that javascript can handle
max = Math.min(1125899906842624, max)
min = Math.max(-1125899906842624, min)
let range = (max - min) / step2
//adjust values based on valueControl Behaviour
switch (v) {
case 'fixed':
break
case 'increment':
// @ts-expect-error targetWidget.value can be number or string
targetWidget.value += step2
break
case 'decrement':
// @ts-expect-error targetWidget.value can be number or string
targetWidget.value -= step2
break
case 'randomize':
targetWidget.value = Math.floor(Math.random() * range) * step2 + min
break
default:
break
}
/*check if values are over or under their respective
* ranges and set them to min or max.*/
// @ts-expect-error targetWidget.value can be number or string
if (targetWidget.value < min) targetWidget.value = min
// @ts-expect-error targetWidget.value can be number or string
if (targetWidget.value > max) targetWidget.value = max
targetWidget.callback?.(targetWidget.value)
}
}
valueControl.beforeQueued = ({ isPartialExecution } = {}) => {
if (!isPartialExecution && controlValueRunBefore()) {
// Don't run on first execution
if (valueControl[HAS_EXECUTED]) {
applyWidgetControl()
}
}
valueControl[HAS_EXECUTED] = true
}
valueControl.afterQueued = ({ isPartialExecution } = {}) => {
if (!isPartialExecution && !controlValueRunBefore()) {
applyWidgetControl()
}
}
return widgets
}
export const ComfyWidgets = {
INT: transformWidgetConstructorV2ToV1(useIntWidget()),
FLOAT: transformWidgetConstructorV2ToV1(useFloatWidget()),
BOOLEAN: transformWidgetConstructorV2ToV1(useBooleanWidget()),
STRING: transformWidgetConstructorV2ToV1(useStringWidget()),
MARKDOWN: transformWidgetConstructorV2ToV1(useMarkdownWidget()),
COMBO: transformWidgetConstructorV2ToV1(useComboWidget()),
IMAGEUPLOAD: useImageUploadWidget(),
COLOR: transformWidgetConstructorV2ToV1(useColorWidget()),
IMAGECOMPARE: transformWidgetConstructorV2ToV1(useImageCompareWidget()),
BOUNDING_BOX: transformWidgetConstructorV2ToV1(useBoundingBoxWidget()),
CHART: transformWidgetConstructorV2ToV1(useChartWidget()),
GALLERIA: transformWidgetConstructorV2ToV1(useGalleriaWidget()),
PAINTER: transformWidgetConstructorV2ToV1(usePainterWidget()),
TEXTAREA: transformWidgetConstructorV2ToV1(useTextareaWidget()),
CURVE: transformWidgetConstructorV2ToV1(useCurveWidget()),
RANGE: transformWidgetConstructorV2ToV1(useRangeWidget()),
BOUNDING_BOXES: transformWidgetConstructorV2ToV1(useBoundingBoxesWidget()),
COLORS: transformWidgetConstructorV2ToV1(useColorsWidget()),
...dynamicWidgets
} as const
export function isValidWidgetType(
key: unknown
): key is keyof typeof ComfyWidgets {
return ComfyWidgets[key as keyof typeof ComfyWidgets] !== undefined
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Regis Gaughan, III (rgthree)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,126 @@
"""
@author: rgthree
@title: Comfy Nodes
@nickname: rgthree
@description: A bunch of nodes I created that I also find useful.
"""
from glob import glob
import json
import os
import shutil
import re
import random
import execution
from .py.log import log
from .py.config import get_config_value
from .py.server.rgthree_server import *
from .py.context import RgthreeContext
from .py.context_switch import RgthreeContextSwitch
from .py.context_switch_big import RgthreeContextSwitchBig
from .py.display_any import RgthreeDisplayAny, RgthreeDisplayInt
from .py.lora_stack import RgthreeLoraLoaderStack
from .py.seed import RgthreeSeed
from .py.sdxl_empty_latent_image import RgthreeSDXLEmptyLatentImage
from .py.power_prompt import RgthreePowerPrompt
from .py.power_prompt_simple import RgthreePowerPromptSimple
from .py.image_inset_crop import RgthreeImageInsetCrop
from .py.context_big import RgthreeBigContext
from .py.dynamic_context import RgthreeDynamicContext
from .py.dynamic_context_switch import RgthreeDynamicContextSwitch
from .py.ksampler_config import RgthreeKSamplerConfig
from .py.sdxl_power_prompt_postive import RgthreeSDXLPowerPromptPositive
from .py.sdxl_power_prompt_simple import RgthreeSDXLPowerPromptSimple
from .py.any_switch import RgthreeAnySwitch
from .py.context_merge import RgthreeContextMerge
from .py.context_merge_big import RgthreeContextMergeBig
from .py.image_comparer import RgthreeImageComparer
from .py.power_lora_loader import RgthreePowerLoraLoader
from .py.power_primitive import RgthreePowerPrimitive
from .py.image_or_latent_size import RgthreeImageOrLatentSize
from .py.image_resize import RgthreeImageResize
from .py.power_puter import RgthreePowerPuter
NODE_CLASS_MAPPINGS = {
RgthreeBigContext.NAME: RgthreeBigContext,
RgthreeContext.NAME: RgthreeContext,
RgthreeContextSwitch.NAME: RgthreeContextSwitch,
RgthreeContextSwitchBig.NAME: RgthreeContextSwitchBig,
RgthreeContextMerge.NAME: RgthreeContextMerge,
RgthreeContextMergeBig.NAME: RgthreeContextMergeBig,
RgthreeDisplayInt.NAME: RgthreeDisplayInt,
RgthreeDisplayAny.NAME: RgthreeDisplayAny,
RgthreeLoraLoaderStack.NAME: RgthreeLoraLoaderStack,
RgthreeSeed.NAME: RgthreeSeed,
RgthreeImageInsetCrop.NAME: RgthreeImageInsetCrop,
RgthreePowerPrompt.NAME: RgthreePowerPrompt,
RgthreePowerPromptSimple.NAME: RgthreePowerPromptSimple,
RgthreeKSamplerConfig.NAME: RgthreeKSamplerConfig,
RgthreeSDXLEmptyLatentImage.NAME: RgthreeSDXLEmptyLatentImage,
RgthreeSDXLPowerPromptPositive.NAME: RgthreeSDXLPowerPromptPositive,
RgthreeSDXLPowerPromptSimple.NAME: RgthreeSDXLPowerPromptSimple,
RgthreeAnySwitch.NAME: RgthreeAnySwitch,
RgthreeImageComparer.NAME: RgthreeImageComparer,
RgthreePowerLoraLoader.NAME: RgthreePowerLoraLoader,
RgthreePowerPrimitive.NAME: RgthreePowerPrimitive,
RgthreeImageOrLatentSize.NAME: RgthreeImageOrLatentSize,
RgthreeImageResize.NAME: RgthreeImageResize,
RgthreePowerPuter.NAME: RgthreePowerPuter,
}
if get_config_value('unreleased.dynamic_context.enabled') is True:
NODE_CLASS_MAPPINGS[RgthreeDynamicContext.NAME] = RgthreeDynamicContext
NODE_CLASS_MAPPINGS[RgthreeDynamicContextSwitch.NAME] = RgthreeDynamicContextSwitch
# WEB_DIRECTORY is the comfyui nodes directory that ComfyUI will link and auto-load.
WEB_DIRECTORY = "./web/comfyui"
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
DIR_WEB = os.path.abspath(f'{THIS_DIR}/{WEB_DIRECTORY}')
DIR_PY = os.path.abspath(f'{THIS_DIR}/py')
# remove old directories
OLD_DIRS = [
os.path.abspath(f'{THIS_DIR}/../../web/extensions/rgthree'),
os.path.abspath(f'{THIS_DIR}/../../web/extensions/rgthree-comfy'),
]
for old_dir in OLD_DIRS:
if os.path.exists(old_dir):
shutil.rmtree(old_dir)
__all__ = ['NODE_CLASS_MAPPINGS', 'WEB_DIRECTORY']
NOT_NODES = ['constants', 'log', 'utils', 'rgthree', 'rgthree_server', 'image_clipbaord', 'config']
nodes = []
for file in glob(os.path.join(DIR_PY, '*.py')) + glob(os.path.join(DIR_WEB, '*.js')):
name = os.path.splitext(os.path.basename(file))[0]
if name in NOT_NODES or name in nodes:
continue
if name.startswith('_') or name.startswith('base') or 'utils' in name:
continue
nodes.append(name)
if name == 'display_any':
nodes.append('display_int')
print()
adjs = ['exciting', 'extraordinary', 'epic', 'fantastic', 'magnificent']
log(f'Loaded {len(nodes)} {random.choice(adjs)} nodes. 🎉', color='BRIGHT_GREEN')
print()
if get_config_value('announcements.comfy-nodes-20.incompatible', True):
message = (
"ComfyUI's new Node 2.0 rendering may be incompatible with some rgthree-comfy nodes "
"and features, breaking some rendering as well as losing the ability to "
"access a node's properties (a vital part of many nodes). It also appears to run MUCH more "
"slowly spiking CPU usage and causing jankiness and unresponsiveness, especially with large "
"workflows. Personally I am not planning to use the new Nodes 2.0 and, unfortunately, am not "
"able to invest the time to investigate and overhaul rgthree-comfy where needed. "
"If you have issues when Nodes 2.0 is enabled, I'd urge you to switch it off as well and "
"join me in hoping ComfyUI is not planning to deprecate the existing, stable canvas rendering "
"all together.\n"
)
log(message, color='YELLOW', id='announcements.comfy-nodes-20.incompatible', at_most_secs=60)
@@ -0,0 +1,11 @@
NAMESPACE='rgthree'
def get_name(name):
return '{} ({})'.format(name, NAMESPACE)
def get_category(sub_dirs = None):
if sub_dirs is None:
return NAMESPACE
else:
return "{}/utils".format(NAMESPACE)
@@ -0,0 +1,42 @@
from nodes import PreviewImage
from .constants import get_category, get_name
class RgthreeImageComparer(PreviewImage):
"""A node that compares two images in the UI."""
NAME = get_name('Image Comparer')
CATEGORY = get_category()
FUNCTION = "compare_images"
DESCRIPTION = "Compares two images with a hover slider, or click from properties."
@classmethod
def INPUT_TYPES(cls): # pylint: disable = invalid-name, missing-function-docstring
return {
"required": {},
"optional": {
"image_a": ("IMAGE",),
"image_b": ("IMAGE",),
},
"hidden": {
"prompt": "PROMPT",
"extra_pnginfo": "EXTRA_PNGINFO"
},
}
def compare_images(self,
image_a=None,
image_b=None,
filename_prefix="rgthree.compare.",
prompt=None,
extra_pnginfo=None):
result = { "ui": { "a_images":[], "b_images": [] } }
if image_a is not None and len(image_a) > 0:
result['ui']['a_images'] = self.save_images(image_a, filename_prefix, prompt, extra_pnginfo)['ui']['images']
if image_b is not None and len(image_b) > 0:
result['ui']['b_images'] = self.save_images(image_b, filename_prefix, prompt, extra_pnginfo)['ui']['images']
return result
@@ -0,0 +1,504 @@
import type {
IWidget,
LGraphCanvas,
IContextMenuValue,
IFoundSlot,
LGraphEventMode,
LGraphNodeConstructor,
ISerialisedNode,
IBaseWidget,
} from "@comfyorg/frontend";
import type {ComfyNodeDef} from "typings/comfy.js";
import type {RgthreeBaseServerNodeConstructor} from "typings/rgthree.js";
import {app} from "scripts/app.js";
import {ComfyWidgets} from "scripts/widgets.js";
import {SERVICE as KEY_EVENT_SERVICE} from "./services/key_events_services.js";
import {LogLevel, rgthree} from "./rgthree.js";
import {addHelpMenuItem} from "./utils.js";
import {RgthreeHelpDialog} from "rgthree/common/dialog.js";
import {
importIndividualNodesInnerOnDragDrop,
importIndividualNodesInnerOnDragOver,
} from "./feature_import_individual_nodes.js";
import {defineProperty, moveArrayItem} from "rgthree/common/shared_utils.js";
/**
* A base node with standard methods, directly extending the LGraphNode.
* This can be used for ui-nodes and a further base for server nodes.
*/
export abstract class RgthreeBaseNode extends LGraphNode {
/**
* Action strings that can be exposed and triggered from other nodes, like Fast Actions Button.
*/
static exposedActions: string[] = [];
static override title: string = "__NEED_CLASS_TITLE__";
static override type: string = "__NEED_CLASS_TYPE__";
static override category = "rgthree";
static _category = "rgthree"; // `category` seems to get reset by comfy, so reset to this after.
/** Our constructor ensures there's a widget array, so we get rid of the nullability. */
override widgets!: IWidget[];
/**
* The comfyClass is property ComfyUI and extensions may care about, even through it is only for
* server nodes. RgthreeBaseServerNode below overrides this with the expected value and we just
* set it here so extensions that are none the wiser don't break on some unchecked string method
* call on an undefined calue.
*/
override comfyClass: string = "__NEED_COMFY_CLASS__";
/** Used by the ComfyUI-Manager badge. */
readonly nickname = "rgthree";
/** Are we a virtual node? */
override readonly isVirtualNode: boolean = false;
/** Are we able to be dropped on (if config is enabled too). */
isDropEnabled = false;
/** A state member determining if we're currently removed. */
removed = false;
/** A state member determining if we're currently "configuring."" */
configuring = false;
/** A temporary width value that can be used to ensure compute size operates correctly. */
_tempWidth = 0;
/** Private Mode member so we can override the setter/getter and call an `onModeChange`. */
private rgthree_mode?: LGraphEventMode;
/** An internal bool set when `onConstructed` is run. */
private __constructed__ = false;
/** The help dialog. */
private helpDialog: RgthreeHelpDialog | null = null;
constructor(title = RgthreeBaseNode.title, skipOnConstructedCall = true) {
super(title);
if (title == "__NEED_CLASS_TITLE__") {
throw new Error("RgthreeBaseNode needs overrides.");
}
// Ensure these exist since some other extensions will break in their onNodeCreated.
this.widgets = this.widgets || [];
this.properties = this.properties || {};
// Some checks we want to do after we're constructed, looking that data is set correctly and
// that our base's `onConstructed` was called (if not, set a DEV warning).
setTimeout(() => {
// Check we have a comfyClass defined.
if (this.comfyClass == "__NEED_COMFY_CLASS__") {
throw new Error("RgthreeBaseNode needs a comfy class override.");
}
if (this.constructor.type == "__NEED_CLASS_TYPE__") {
throw new Error("RgthreeBaseNode needs overrides.");
}
// Ensure we've called onConstructed before we got here.
this.checkAndRunOnConstructed();
});
defineProperty(this, "mode", {
get: () => {
return this.rgthree_mode;
},
set: (mode: LGraphEventMode) => {
if (this.rgthree_mode != mode) {
const oldMode = this.rgthree_mode;
this.rgthree_mode = mode;
this.onModeChange(oldMode, mode);
}
},
});
}
private checkAndRunOnConstructed() {
if (!this.__constructed__) {
this.onConstructed();
const [n, v] = rgthree.logger.logParts(
LogLevel.DEV,
`[RgthreeBaseNode] Child class did not call onConstructed for "${this.type}.`,
);
console[n]?.(...v);
}
return this.__constructed__;
}
override onDragOver(e: DragEvent): boolean {
if (!this.isDropEnabled) return false;
return importIndividualNodesInnerOnDragOver(this, e);
}
override async onDragDrop(e: DragEvent): Promise<boolean> {
if (!this.isDropEnabled) return false;
return importIndividualNodesInnerOnDragDrop(this, e);
}
/**
* When a node is finished with construction, we must call this. Failure to do so will result in
* an error message from the timeout in this base class. This is broken out and becomes the
* responsibility of the child class because
*/
onConstructed() {
if (this.__constructed__) return false;
// This is kinda a hack, but if this.type is still null, then set it to undefined to match.
this.type = this.type ?? undefined;
this.__constructed__ = true;
rgthree.invokeExtensionsAsync("nodeCreated", this);
return this.__constructed__;
}
override configure(info: ISerialisedNode): void {
this.configuring = true;
super.configure(info);
// Fix https://github.com/comfyanonymous/ComfyUI/issues/1448 locally.
// Can removed when fixed and adopted.
for (const w of this.widgets || []) {
w.last_y = w.last_y || 0;
}
this.configuring = false;
}
/**
* Override clone for, at the least, deep-copying properties.
*/
override clone() {
const cloned = super.clone()!;
// This is wild, but LiteGraph doesn't deep clone data, so we will. We'll use structured clone,
// which most browsers in 2022 support, but but we'll check.
if (cloned?.properties && !!window.structuredClone) {
cloned.properties = structuredClone(cloned.properties);
}
// [🤮] https://github.com/Comfy-Org/ComfyUI_frontend/issues/5037
// ComfyUI started throwing errors when some of our nodes wanted to remove inputs when cloning
// (like our dynamic inputs) because the disconnect method that's automatically called assumes
// there should be a graph. For now, I _think_ we can simply assign the current graph to avoid
// the error, which would then be overwritten when placed...
cloned.graph = this.graph;
return cloned;
}
/** When a mode change, we want all connected nodes to match. */
onModeChange(from: LGraphEventMode | undefined, to: LGraphEventMode) {
// Override
}
/**
* Given a string, do something. At the least, handle any `exposedActions` that may be called and
* passed into from other nodes, like Fast Actions Button
*/
async handleAction(action: string) {
action; // No-op. Should be overridden but OK if not.
}
/**
* This didn't exist in LiteGraph/Comfy, but now it's added. Ours was a bit more flexible, though.
*/
override removeWidget(widget: IBaseWidget | IWidget | number | undefined): void {
if (typeof widget === "number") {
widget = this.widgets[widget];
}
if (!widget) return;
// Comfy added their own removeWidget, but it's not fully rolled out to stable, so keep our
// original implementation.
// TODO: Actually, scratch that. The ComfyUI impl doesn't call widtget.onRemove?.() and so
// we shouldn't switch to it yet. See: https://github.com/Comfy-Org/ComfyUI_frontend/issues/5090
const canUseComfyUIRemoveWidget = false;
if (canUseComfyUIRemoveWidget && typeof super.removeWidget === 'function') {
super.removeWidget(widget as IBaseWidget);
} else {
const index = this.widgets.indexOf(widget as IWidget);
if (index > -1) {
this.widgets.splice(index, 1);
}
widget.onRemove?.();
}
}
/**
* Replaces an existing widget.
*/
replaceWidget(widgetOrSlot: IWidget | number | undefined, newWidget: IWidget) {
let index = null;
if (widgetOrSlot) {
index = typeof widgetOrSlot === "number" ? widgetOrSlot : this.widgets.indexOf(widgetOrSlot);
this.removeWidget(this.widgets[index]!);
}
index = index != null ? index : this.widgets.length - 1;
if (this.widgets.includes(newWidget)) {
moveArrayItem(this.widgets, newWidget, index);
} else {
this.widgets.splice(index, 0, newWidget);
}
}
/**
* A default version of the logive when a node does not set `getSlotMenuOptions`. This is
* necessary because child nodes may want to define getSlotMenuOptions but LiteGraph then won't do
* it's default logic. This bakes it so child nodes can call this instead (and this doesn't set
* getSlotMenuOptions for all child nodes in case it doesn't exist).
*/
defaultGetSlotMenuOptions(slot: IFoundSlot): IContextMenuValue[] {
const menu_info: IContextMenuValue[] = [];
if (slot?.output?.links?.length) {
menu_info.push({content: "Disconnect Links", slot});
}
let inputOrOutput = slot.input || slot.output;
if (inputOrOutput) {
if (inputOrOutput.removable) {
menu_info.push(
inputOrOutput.locked ? {content: "Cannot remove"} : {content: "Remove Slot", slot},
);
}
if (!inputOrOutput.nameLocked) {
menu_info.push({content: "Rename Slot", slot});
}
}
return menu_info;
}
override onRemoved(): void {
super.onRemoved?.();
this.removed = true;
}
static setUp<T extends RgthreeBaseNode>(...args: any[]) {
// No-op.
}
/**
* A function to provide help text to be overridden.
*/
getHelp() {
return "";
}
showHelp() {
const help = this.getHelp() || (this.constructor as any).help;
if (help) {
this.helpDialog = new RgthreeHelpDialog(this, help).show();
this.helpDialog.addEventListener("close", (e) => {
this.helpDialog = null;
});
}
}
override onKeyDown(event: KeyboardEvent): void {
KEY_EVENT_SERVICE.handleKeyDownOrUp(event);
if (event.key == "?" && !this.helpDialog) {
this.showHelp();
}
}
override onKeyUp(event: KeyboardEvent): void {
KEY_EVENT_SERVICE.handleKeyDownOrUp(event);
}
override getExtraMenuOptions(
canvas: LGraphCanvas,
options: (IContextMenuValue<unknown> | null)[],
): (IContextMenuValue<unknown> | null)[] {
// Some other extensions override getExtraMenuOptions on the nodeType as it comes through from
// the server, so we can call out to that if we don't have our own.
if (super.getExtraMenuOptions) {
super.getExtraMenuOptions?.apply(this, [canvas, options]);
} else if (this.constructor.nodeType?.prototype?.getExtraMenuOptions) {
this.constructor.nodeType?.prototype?.getExtraMenuOptions?.apply(this, [canvas, options]);
}
// If we have help content, then add a menu item.
const help = this.getHelp() || (this.constructor as any).help;
if (help) {
addHelpMenuItem(this, help, options);
}
return [];
}
}
/**
* A virtual node. Right now, this is just a wrapper for RgthreeBaseNode (which was the initial
* base virtual node).
*/
export class RgthreeBaseVirtualNode extends RgthreeBaseNode {
override isVirtualNode = true;
constructor(title = RgthreeBaseNode.title) {
super(title, false);
}
static override setUp() {
if (!this.type) {
throw new Error(`Missing type for RgthreeBaseVirtualNode: ${this.title}`);
}
LiteGraph.registerNodeType(this.type, this);
if (this._category) {
this.category = this._category;
}
}
}
/**
* A base node with standard methods, extending the LGraphNode.
* This is somewhat experimental, but if comfyui is going to keep breaking widgets and inputs, it
* seems safer than NOT overriding.
*/
export class RgthreeBaseServerNode extends RgthreeBaseNode {
static nodeType: LGraphNodeConstructor | null = null;
static nodeData: ComfyNodeDef | null = null;
// Drop is enabled by default for server nodes.
override isDropEnabled = true;
constructor(title: string) {
super(title, true);
this.serialize_widgets = true;
this.setupFromServerNodeData();
this.onConstructed();
}
getWidgets() {
return ComfyWidgets;
}
/**
* This takes the server data and builds out the inputs, outputs and widgets. It's similar to the
* ComfyNode constructor in registerNodes in ComfyUI's app.js, but is more stable and thus
* shouldn't break as often when it modifyies widgets and types.
*/
async setupFromServerNodeData() {
const nodeData = (this.constructor as any).nodeData;
if (!nodeData) {
throw Error("No node data");
}
// Necessary for serialization so Comfy backend can check types.
// Serialized as `class_type`. See app.js#graphToPrompt
this.comfyClass = nodeData.name;
let inputs = nodeData["input"]["required"];
if (nodeData["input"]["optional"] != undefined) {
inputs = Object.assign({}, inputs, nodeData["input"]["optional"]);
}
const WIDGETS = this.getWidgets();
const config: {minWidth: number; minHeight: number; widget?: null | {options: any}} = {
minWidth: 1,
minHeight: 1,
widget: null,
};
for (const inputName in inputs) {
const inputData = inputs[inputName];
const type = inputData[0];
// If we're forcing the input, just do it now and forget all that widget stuff.
// This is one of the differences from ComfyNode and provides smoother experience for inputs
// that are going to remain inputs anyway.
// Also, it fixes https://github.com/comfyanonymous/ComfyUI/issues/1404 (for rgthree nodes)
if (inputData[1]?.forceInput) {
this.addInput(inputName, type);
} else {
let widgetCreated = true;
if (Array.isArray(type)) {
// Enums
Object.assign(config, WIDGETS.COMBO(this, inputName, inputData, app) || {});
} else if (`${type}:${inputName}` in WIDGETS) {
// Support custom widgets by Type:Name
Object.assign(
config,
WIDGETS[`${type}:${inputName}`]!(this, inputName, inputData, app) || {},
);
} else if (type in WIDGETS) {
// Standard type widgets
Object.assign(config, WIDGETS[type]!(this, inputName, inputData, app) || {});
} else {
// Node connection inputs
this.addInput(inputName, type);
widgetCreated = false;
}
// Don't actually need this right now, but ported it over from ComfyWidget.
if (widgetCreated && inputData[1]?.forceInput && config?.widget) {
if (!config.widget.options) config.widget.options = {};
config.widget.options.forceInput = inputData[1].forceInput;
}
if (widgetCreated && inputData[1]?.defaultInput && config?.widget) {
if (!config.widget.options) config.widget.options = {};
config.widget.options.defaultInput = inputData[1].defaultInput;
}
}
}
for (const o in nodeData["output"]) {
let output = nodeData["output"][o];
if (output instanceof Array) output = "COMBO";
const outputName = nodeData["output_name"][o] || output;
const outputShape = nodeData["output_is_list"][o]
? LiteGraph.GRID_SHAPE
: LiteGraph.CIRCLE_SHAPE;
this.addOutput(outputName, output, {shape: outputShape});
}
const s = this.computeSize();
// Sometime around v1.12.6 this broke as `minWidth` and `minHeight` were being explicitly set
// to `undefined` in the above Object.assign call (specifically for `WIDGETS[INT]`. We can avoid
// that by ensureing we're at a number in that case.
// See https://github.com/Comfy-Org/ComfyUI_frontend/issues/3045
s[0] = Math.max(config.minWidth ?? 1, s[0] * 1.5);
s[1] = Math.max(config.minHeight ?? 1, s[1]);
this.size = s;
this.serialize_widgets = true;
}
static __registeredForOverride__: boolean = false;
static registerForOverride(
comfyClass: typeof LGraphNode,
nodeData: ComfyNodeDef,
rgthreeClass: RgthreeBaseServerNodeConstructor,
) {
if (OVERRIDDEN_SERVER_NODES.has(comfyClass)) {
throw Error(
`Already have a class to override ${
comfyClass.type || comfyClass.name || comfyClass.title
}`,
);
}
OVERRIDDEN_SERVER_NODES.set(comfyClass, rgthreeClass);
// Mark the rgthreeClass as `__registeredForOverride__` because ComfyUI will repeatedly call
// this and certain setups will only want to setup once (like adding context menus, etc).
if (!rgthreeClass.__registeredForOverride__) {
rgthreeClass.__registeredForOverride__ = true;
rgthreeClass.nodeType = comfyClass;
rgthreeClass.nodeData = nodeData;
rgthreeClass.onRegisteredForOverride(comfyClass, rgthreeClass);
}
}
static onRegisteredForOverride(comfyClass: any, rgthreeClass: any) {
// To be overridden
}
}
/**
* Keeps track of the rgthree-comfy nodes that come from the server (and want to be ComfyNodes) that
* we override into a own, more flexible and cleaner nodes.
*/
const OVERRIDDEN_SERVER_NODES = new Map<any, any>();
const oldregisterNodeType = LiteGraph.registerNodeType;
/**
* ComfyUI calls registerNodeType with its ComfyNode, but we don't trust that will remain stable, so
* we need to identify it, intercept it, and supply our own class for the node.
*/
LiteGraph.registerNodeType = async function (nodeId: string, baseClass: any) {
const clazz = OVERRIDDEN_SERVER_NODES.get(baseClass) || baseClass;
if (clazz !== baseClass) {
const classLabel = clazz.type || clazz.name || clazz.title;
const [n, v] = rgthree.logger.logParts(
LogLevel.DEBUG,
`${nodeId}: replacing default ComfyNode implementation with custom ${classLabel} class.`,
);
console[n]?.(...v);
// Note, we don't currently call our rgthree.invokeExtensionsAsync w/ beforeRegisterNodeDef as
// this runs right after that. However, this does mean that extensions cannot actually change
// anything about overriden server rgthree nodes in their beforeRegisterNodeDef (as when comfy
// calls it, it's for the wrong ComfyNode class). Calling it here, however, would re-run
// everything causing more issues than not. If we wanted to support beforeRegisterNodeDef then
// it would mean rewriting ComfyUI's registerNodeDef which, frankly, is not worth it.
}
return oldregisterNodeType.call(LiteGraph, nodeId, clazz);
};
@@ -0,0 +1,106 @@
import type {LGraphNode, IWidget} from "@comfyorg/frontend";
import {BaseAnyInputConnectedNode} from "./base_any_input_connected_node.js";
import {changeModeOfNodes, PassThroughFollowing} from "./utils.js";
import {wait} from "rgthree/common/shared_utils.js";
export class BaseNodeModeChanger extends BaseAnyInputConnectedNode {
override readonly inputsPassThroughFollowing: PassThroughFollowing = PassThroughFollowing.ALL;
static collapsible = false;
override isVirtualNode = true;
// These Must be overriden
readonly modeOn: number = -1;
readonly modeOff: number = -1;
static "@toggleRestriction" = {
type: "combo",
values: ["default", "max one", "always one"],
};
constructor(title?: string) {
super(title);
this.properties["toggleRestriction"] = "default";
}
override onConstructed(): boolean {
wait(10).then(() => {
if (this.modeOn < 0 || this.modeOff < 0) {
throw new Error("modeOn and modeOff must be overridden.");
}
});
this.addOutput("OPT_CONNECTION", "*");
return super.onConstructed();
}
override handleLinkedNodesStabilization(linkedNodes: LGraphNode[]) {
let changed = false;
for (const [index, node] of linkedNodes.entries()) {
let widget: IWidget | undefined = this.widgets && this.widgets[index];
if (!widget) {
// When we add a widget, litegraph is going to mess up the size, so we
// store it so we can retrieve it in computeSize. Hacky..
(this as any)._tempWidth = this.size[0];
widget = this.addWidget("toggle", "", false, "", {on: "yes", off: "no"}) as IWidget;
changed = true;
}
if (node) {
changed = this.setWidget(widget, node) || changed;
}
}
if (this.widgets && this.widgets.length > linkedNodes.length) {
this.widgets.length = linkedNodes.length;
changed = true;
}
return changed;
}
private setWidget(widget: IWidget, linkedNode: LGraphNode, forceValue?: boolean) {
let changed = false;
const value = forceValue == null ? linkedNode.mode === this.modeOn : forceValue;
let name = `Enable ${linkedNode.title}`;
// Need to set initally
if (widget.name !== name) {
widget.name = `Enable ${linkedNode.title}`;
widget.options = {on: "yes", off: "no"};
widget.value = value;
(widget as any).doModeChange = (forceValue?: boolean, skipOtherNodeCheck?: boolean) => {
let newValue = forceValue == null ? linkedNode.mode === this.modeOff : forceValue;
if (skipOtherNodeCheck !== true) {
if (newValue && (this.properties?.["toggleRestriction"] as string)?.includes(" one")) {
for (const widget of this.widgets) {
(widget as any).doModeChange(false, true);
}
} else if (!newValue && this.properties?.["toggleRestriction"] === "always one") {
newValue = this.widgets.every((w) => !w.value || w === widget);
}
}
changeModeOfNodes(linkedNode, (newValue ? this.modeOn : this.modeOff))
widget.value = newValue;
};
widget.callback = () => {
(widget as any).doModeChange();
};
changed = true;
}
if (forceValue != null) {
const newMode = (forceValue ? this.modeOn : this.modeOff) as 1 | 2 | 3 | 4;
if (linkedNode.mode !== newMode) {
changeModeOfNodes(linkedNode, newMode);
changed = true;
}
}
return changed;
}
forceWidgetOff(widget: IWidget, skipOtherNodeCheck?: boolean) {
(widget as any).doModeChange(false, skipOtherNodeCheck);
}
forceWidgetOn(widget: IWidget, skipOtherNodeCheck?: boolean) {
(widget as any).doModeChange(true, skipOtherNodeCheck);
}
forceWidgetToggle(widget: IWidget, skipOtherNodeCheck?: boolean) {
(widget as any).doModeChange(!widget.value, skipOtherNodeCheck);
}
}
@@ -0,0 +1,480 @@
import {
LGraphCanvas,
LGraphNode,
Vector2,
LGraphNodeConstructor,
CanvasMouseEvent,
ISerialisedNode,
Point,
CanvasPointerEvent,
} from "@comfyorg/frontend";
import type {ComfyNodeDef} from "typings/comfy.js";
import {app} from "scripts/app.js";
import {api} from "scripts/api.js";
import {RgthreeBaseServerNode} from "./base_node.js";
import {NodeTypesString} from "./constants.js";
import {addConnectionLayoutSupport} from "./utils.js";
import {RgthreeBaseHitAreas, RgthreeBaseWidget, RgthreeBaseWidgetBounds} from "./utils_widgets.js";
import {measureText} from "./utils_canvas.js";
type ComfyImageServerData = {filename: string; type: string; subfolder: string};
type ComfyImageData = {name: string; selected: boolean; url: string; img?: HTMLImageElement};
type OldExecutedPayload = {
images: ComfyImageServerData[];
};
type ExecutedPayload = {
a_images?: ComfyImageServerData[];
b_images?: ComfyImageServerData[];
};
function imageDataToUrl(data: ComfyImageServerData) {
return api.apiURL(
`/view?filename=${encodeURIComponent(data.filename)}&type=${data.type}&subfolder=${
data.subfolder
}${app.getPreviewFormatParam()}${app.getRandParam()}`,
);
}
/**
* Compares two images in one canvas node.
*/
export class RgthreeImageComparer extends RgthreeBaseServerNode {
static override title = NodeTypesString.IMAGE_COMPARER;
static override type = NodeTypesString.IMAGE_COMPARER;
static comfyClass = NodeTypesString.IMAGE_COMPARER;
// These is what the core preview image node uses to show the context menu. May not be that helpful
// since it likely will always be "0" when a context menu is invoked without manually changing
// something.
override imageIndex: number = 0;
override imgs: InstanceType<typeof Image>[] = [];
override serialize_widgets = true;
isPointerDown = false;
isPointerOver = false;
pointerOverPos: Vector2 = [0, 0];
private canvasWidget: RgthreeImageComparerWidget | null = null;
static "@comparer_mode" = {
type: "combo",
values: ["Slide", "Click"],
};
constructor(title = RgthreeImageComparer.title) {
super(title);
this.properties["comparer_mode"] = "Slide";
}
override onExecuted(output: ExecutedPayload | OldExecutedPayload) {
super.onExecuted?.(output);
if ("images" in output) {
this.canvasWidget!.value = {
images: (output.images || []).map((d, i) => {
return {
name: i === 0 ? "A" : "B",
selected: true,
url: imageDataToUrl(d),
};
}),
};
} else {
output.a_images = output.a_images || [];
output.b_images = output.b_images || [];
const imagesToChoose: ComfyImageData[] = [];
const multiple = output.a_images.length + output.b_images.length > 2;
for (const [i, d] of output.a_images.entries()) {
imagesToChoose.push({
name: output.a_images.length > 1 || multiple ? `A${i + 1}` : "A",
selected: i === 0,
url: imageDataToUrl(d),
});
}
for (const [i, d] of output.b_images.entries()) {
imagesToChoose.push({
name: output.b_images.length > 1 || multiple ? `B${i + 1}` : "B",
selected: i === 0,
url: imageDataToUrl(d),
});
}
this.canvasWidget!.value = {images: imagesToChoose};
}
}
override onSerialize(serialised: ISerialisedNode) {
super.onSerialize && super.onSerialize(serialised);
for (let [index, widget_value] of (serialised.widgets_values || []).entries()) {
if (this.widgets[index]?.name === "rgthree_comparer") {
serialised.widgets_values![index] = (
this.widgets[index] as unknown as RgthreeImageComparerWidget
).value.images.map((d) => {
d = {...d};
delete d.img;
return d;
});
}
}
}
override onNodeCreated() {
this.canvasWidget = this.addCustomWidget(
new RgthreeImageComparerWidget("rgthree_comparer", this),
) as RgthreeImageComparerWidget;
this.setSize(this.computeSize());
this.setDirtyCanvas(true, true);
}
/**
* Sets mouse as down or up based on param. If it's down, we also loop to check pointer is still
* down. This is because LiteGraph doesn't fire `onMouseUp` every time there's a mouse up, so we
* need to manually monitor `pointer_is_down` and, when it's no longer true, set mouse as up here.
*/
private setIsPointerDown(down: boolean = this.isPointerDown) {
const newIsDown = down && !!app.canvas.pointer_is_down;
if (this.isPointerDown !== newIsDown) {
this.isPointerDown = newIsDown;
this.setDirtyCanvas(true, false);
}
this.imageIndex = this.isPointerDown ? 1 : 0;
if (this.isPointerDown) {
requestAnimationFrame(() => {
this.setIsPointerDown();
});
}
}
override onMouseDown(event: CanvasPointerEvent, pos: Point, canvas: LGraphCanvas): boolean {
super.onMouseDown?.(event, pos, canvas);
this.setIsPointerDown(true);
return false;
}
override onMouseEnter(event: CanvasPointerEvent): void {
super.onMouseEnter?.(event);
this.setIsPointerDown(!!app.canvas.pointer_is_down);
this.isPointerOver = true;
}
override onMouseLeave(event: CanvasPointerEvent): void {
super.onMouseLeave?.(event);
this.setIsPointerDown(false);
this.isPointerOver = false;
}
override onMouseMove(event: CanvasPointerEvent, pos: Point, canvas: LGraphCanvas): void {
super.onMouseMove?.(event, pos, canvas);
this.pointerOverPos = [...pos] as Point;
this.imageIndex = this.pointerOverPos[0] > this.size[0] / 2 ? 1 : 0;
}
override getHelp(): string {
return `
<p>
The ${this.type!.replace("(rgthree)", "")} node compares two images on top of each other.
</p>
<ul>
<li>
<p>
<strong>Notes</strong>
</p>
<ul>
<li><p>
The right-click menu may show image options (Open Image, Save Image, etc.) which will
correspond to the first image (image_a) if clicked on the left-half of the node, or
the second image if on the right half of the node.
</p></li>
</ul>
</li>
<li>
<p>
<strong>Inputs</strong>
</p>
<ul>
<li><p>
<code>image_a</code> <i>Optional.</i> The first image to use to compare.
image_a.
</p></li>
<li><p>
<code>image_b</code> <i>Optional.</i> The second image to use to compare.
</p></li>
<li><p>
<b>Note</b> <code>image_a</code> and <code>image_b</code> work best when a single
image is provided. However, if each/either are a batch, you can choose which item
from each batch are chosen to be compared. If either <code>image_a</code> or
<code>image_b</code> are not provided, the node will choose the first two from the
provided input if it's a batch, otherwise only show the single image (just as
Preview Image would).
</p></li>
</ul>
</li>
<li>
<p>
<strong>Properties.</strong> You can change the following properties (by right-clicking
on the node, and select "Properties" or "Properties Panel" from the menu):
</p>
<ul>
<li><p>
<code>comparer_mode</code> - Choose between "Slide" and "Click". Defaults to "Slide".
</p></li>
</ul>
</li>
</ul>`;
}
static override setUp(comfyClass: typeof LGraphNode, nodeData: ComfyNodeDef) {
RgthreeBaseServerNode.registerForOverride(comfyClass, nodeData, RgthreeImageComparer);
}
static override onRegisteredForOverride(comfyClass: any) {
addConnectionLayoutSupport(RgthreeImageComparer, app, [
["Left", "Right"],
["Right", "Left"],
]);
setTimeout(() => {
RgthreeImageComparer.category = comfyClass.category;
});
}
}
type RgthreeImageComparerWidgetValue = {
images: ComfyImageData[];
};
class RgthreeImageComparerWidget extends RgthreeBaseWidget<RgthreeImageComparerWidgetValue> {
override readonly type = "custom";
private node: RgthreeImageComparer;
protected override hitAreas: RgthreeBaseHitAreas<any> = {
// We dynamically set this when/if we draw the labels.
};
private selected: [ComfyImageData?, ComfyImageData?] = [];
constructor(name: string, node: RgthreeImageComparer) {
super(name);
this.node = node;
}
private _value: RgthreeImageComparerWidgetValue = {images: []};
set value(v: RgthreeImageComparerWidgetValue) {
// Despite `v` typed as RgthreeImageComparerWidgetValue, we may have gotten an array of strings
// from previous versions. We can handle that gracefully.
let cleanedVal;
if (Array.isArray(v)) {
cleanedVal = v.map((d, i) => {
if (!d || typeof d === "string") {
// We usually only have two here, so they're selected.
d = {url: d, name: i == 0 ? "A" : "B", selected: true};
}
return d;
});
} else {
cleanedVal = v.images || [];
}
// If we have multiple items in our sent value but we don't have both an "A" and a "B" then
// just simplify it down to the first two in the list.
if (cleanedVal.length > 2) {
const hasAAndB =
cleanedVal.some((i) => i.name.startsWith("A")) &&
cleanedVal.some((i) => i.name.startsWith("B"));
if (!hasAAndB) {
cleanedVal = [cleanedVal[0], cleanedVal[1]];
}
}
let selected = cleanedVal.filter((d) => d.selected);
// None are selected.
if (!selected.length && cleanedVal.length) {
cleanedVal[0]!.selected = true;
}
selected = cleanedVal.filter((d) => d.selected);
if (selected.length === 1 && cleanedVal.length > 1) {
cleanedVal.find((d) => !d.selected)!.selected = true;
}
this._value.images = cleanedVal;
selected = cleanedVal.filter((d) => d.selected);
this.setSelected(selected as [ComfyImageData, ComfyImageData]);
}
get value() {
return this._value;
}
setSelected(selected: [ComfyImageData, ComfyImageData]) {
this._value.images.forEach((d) => (d.selected = false));
this.node.imgs.length = 0;
for (const sel of selected) {
if (!sel.img) {
sel.img = new Image();
sel.img.src = sel.url;
this.node.imgs.push(sel.img);
}
sel.selected = true;
}
this.selected = selected;
}
draw(ctx: CanvasRenderingContext2D, node: RgthreeImageComparer, width: number, y: number) {
this.hitAreas = {};
if (this.value.images.length > 2) {
ctx.textAlign = "left";
ctx.textBaseline = "top";
ctx.font = `14px Arial`;
// Let's calculate the widths of all the labels.
const drawData: any = [];
const spacing = 5;
let x = 0;
for (const img of this.value.images) {
const width = measureText(ctx, img.name);
drawData.push({
img,
text: img.name,
x,
width: measureText(ctx, img.name),
});
x += width + spacing;
}
x = (node.size[0] - (x - spacing)) / 2;
for (const d of drawData) {
ctx.fillStyle = d.img.selected ? "rgba(180, 180, 180, 1)" : "rgba(180, 180, 180, 0.5)";
ctx.fillText(d.text, x, y);
this.hitAreas[d.text] = {
bounds: [x, y, d.width, 14],
data: d.img,
onDown: this.onSelectionDown,
};
x += d.width + spacing;
}
y += 20;
}
if (node.properties?.["comparer_mode"] === "Click") {
this.drawImage(ctx, this.selected[this.node.isPointerDown ? 1 : 0], y);
} else {
this.drawImage(ctx, this.selected[0], y);
if (node.isPointerOver) {
this.drawImage(ctx, this.selected[1], y, this.node.pointerOverPos[0]);
}
}
}
private onSelectionDown(
event: CanvasMouseEvent,
pos: Vector2,
node: LGraphNode,
bounds?: RgthreeBaseWidgetBounds,
) {
const selected = [...this.selected];
if (bounds?.data.name.startsWith("A")) {
selected[0] = bounds.data;
} else if (bounds?.data.name.startsWith("B")) {
selected[1] = bounds.data;
}
this.setSelected(selected as [ComfyImageData, ComfyImageData]);
}
private drawImage(
ctx: CanvasRenderingContext2D,
image: ComfyImageData | undefined,
y: number,
cropX?: number,
) {
if (!image?.img?.naturalWidth || !image?.img?.naturalHeight) {
return;
}
let [nodeWidth, nodeHeight] = this.node.size as [number, number];
const imageAspect = image?.img.naturalWidth / image?.img.naturalHeight;
let height = nodeHeight - y;
const widgetAspect = nodeWidth / height;
let targetWidth, targetHeight;
let offsetX = 0;
if (imageAspect > widgetAspect) {
targetWidth = nodeWidth;
targetHeight = nodeWidth / imageAspect;
} else {
targetHeight = height;
targetWidth = height * imageAspect;
offsetX = (nodeWidth - targetWidth) / 2;
}
const widthMultiplier = image?.img.naturalWidth / targetWidth;
const sourceX = 0;
const sourceY = 0;
const sourceWidth =
cropX != null ? (cropX - offsetX) * widthMultiplier : image?.img.naturalWidth;
const sourceHeight = image?.img.naturalHeight;
const destX = (nodeWidth - targetWidth) / 2;
const destY = y + (height - targetHeight) / 2;
const destWidth = cropX != null ? cropX - offsetX : targetWidth;
const destHeight = targetHeight;
ctx.save();
ctx.beginPath();
let globalCompositeOperation = ctx.globalCompositeOperation;
if (cropX) {
ctx.rect(destX, destY, destWidth, destHeight);
ctx.clip();
}
ctx.drawImage(
image?.img,
sourceX,
sourceY,
sourceWidth,
sourceHeight,
destX,
destY,
destWidth,
destHeight,
);
// Shows a label overlayed on the image. Not perfect, keeping commented out.
// ctx.globalCompositeOperation = "difference";
// ctx.fillStyle = "rgba(180, 180, 180, 1)";
// ctx.textAlign = "center";
// ctx.font = `32px Arial`;
// ctx.fillText(image.name, nodeWidth / 2, y + 32);
if (cropX != null && cropX >= (nodeWidth - targetWidth) / 2 && cropX <= targetWidth + offsetX) {
ctx.beginPath();
ctx.moveTo(cropX, destY);
ctx.lineTo(cropX, destY + destHeight);
ctx.globalCompositeOperation = "difference";
ctx.strokeStyle = "rgba(255,255,255, 1)";
ctx.stroke();
}
ctx.globalCompositeOperation = globalCompositeOperation;
ctx.restore();
}
computeSize(width: number): Vector2 {
return [width, 20];
}
override serializeValue(
node: LGraphNode,
index: number,
): RgthreeImageComparerWidgetValue | Promise<RgthreeImageComparerWidgetValue> {
const v = [];
for (const data of this._value.images) {
// Remove the img since it can't serialize.
const d = {...data};
delete d.img;
v.push(d);
}
return {images: v};
}
}
app.registerExtension({
name: "rgthree.ImageComparer",
async beforeRegisterNodeDef(nodeType: typeof LGraphNode, nodeData: ComfyNodeDef) {
if (nodeData.name === RgthreeImageComparer.type) {
RgthreeImageComparer.setUp(nodeType, nodeData);
}
},
});
+292
View File
@@ -0,0 +1,292 @@
{
"sources": [
{
"id": "core",
"file": "nodes.py",
"local_file": "core__nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/nodes.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "b8dfdde1de8975be762b085048143cc2dda8fc9202695e460ecc2c8dfe44bc4b",
"git_blob_sha1": "9043a8d0a422b2870e7ef2cf25a1ec6be21a05f1"
},
{
"id": "core",
"file": "comfy_extras/nodes_images.py",
"local_file": "core__comfy_extras__nodes_images.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_images.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "a57638bf58f93698b8b5ed44e53d31ac3d4ac608cc5c49d38c3768fdf722e448",
"git_blob_sha1": "fe1937ba5ec9fe817108162fa620852caae4b9ed"
},
{
"id": "core",
"file": "comfy_extras/nodes_post_processing.py",
"local_file": "core__comfy_extras__nodes_post_processing.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_post_processing.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "96ec39e8d0e9fe9a70b332f97f994d507e1fa223a26699a3c9c9fbeedacf6575",
"git_blob_sha1": "763b8a52fa84fbee9432ee116000f131c0002400"
},
{
"id": "core",
"file": "comfy_extras/nodes_seed.py",
"local_file": "core__comfy_extras__nodes_seed.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_seed.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "f1566b448ca9e4b4a1cbd15767301635905cf36a44a17f586c18b848e23e5932",
"git_blob_sha1": "e64f1d7e3cbcb1f882b4370a5b2413af8b7cc228"
},
{
"id": "core",
"file": "comfy_extras/nodes_mask.py",
"local_file": "core__comfy_extras__nodes_mask.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_mask.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "9ff6c44f6114e36cfd17886a92b6cfb1d824013b43242ea1ee6b86c93a71b7dc",
"git_blob_sha1": "76af338de93ab7cc87b74e924e00281629196d12"
},
{
"id": "core",
"file": "comfy_api/latest/_io.py",
"local_file": "core__comfy_api__latest___io.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_api/latest/_io.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "ac986092cace7600461b8547e21f770126958d8c15eef59d79d6709cca4b7717",
"git_blob_sha1": "58e49d8e2d29b1c07489576263ea84ac0fd67895"
},
{
"id": "core",
"file": "comfy_api/latest/_ui.py",
"local_file": "core__comfy_api__latest___ui.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_api/latest/_ui.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "842ac7eeb8484fbd1746436daf4368b002e2268ff4aafd4d4682a5b24c6ba794",
"git_blob_sha1": "b48713d4108634b6a6887694844fbcb248cb26a1"
},
{
"id": "core",
"file": "comfy/utils.py",
"local_file": "core__comfy__utils.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy/utils.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "8b8805ca837e20c922a846854156d10e214654f69df96be90969522f9def2bdb",
"git_blob_sha1": "61c2a22dd464e40e57e2497e466a9b070dd8402c"
},
{
"id": "core",
"file": "comfy_extras/nodes_sd3.py",
"local_file": "core__comfy_extras__nodes_sd3.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_sd3.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "90a79847332fed7cc97379abbc7092116e6b1b883a7c9e933ac88167a521f693",
"git_blob_sha1": "40e84656bf4f6c15b60942f6eee2fd5d8181c10e"
},
{
"id": "core",
"file": "comfy/samplers.py",
"local_file": "core__comfy__samplers.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy/samplers.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "d882256ae9baa1d23f1367ab2ec3b021fdc15fe39ce4cb49ea2c1ee10026a649",
"git_blob_sha1": "25c5a855fd0435d5d2fd98b2eb016bc54273b07f"
},
{
"id": "core",
"file": "folder_paths.py",
"local_file": "core__folder_paths.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/folder_paths.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "380961714742085363301f980a6c9458f36aca05b1e36ed9b8afa3fb64ccdb50",
"git_blob_sha1": "7304e1b7399da0eb080153336e03c8ab8a9f6c1f"
},
{
"id": "core",
"file": "LICENSE",
"local_file": "core__LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/LICENSE",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"git_blob_sha1": "f288702d2fa16d3cdf0035b15a9fcbc552cd88e7"
},
{
"id": "frontend",
"file": "src/lib/litegraph/src/LGraphNode.ts",
"local_file": "frontend__src__lib__litegraph__src__LGraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/lib/litegraph/src/LGraphNode.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "d7c22582f6a0a5c05521d8b848a04a21e0d6df3339401be746b252b8d0ac5588",
"git_blob_sha1": "934239cc7dc9f7af3bcedec4649d95034d987815"
},
{
"id": "frontend",
"file": "src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"local_file": "frontend__src__lib__litegraph__src__subgraph__SubgraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "bc0436dc3e21ccfa6f1dccf40935c0d0b97b607932f7025b975a4138efe1e24e",
"git_blob_sha1": "f31f5a05280a3788b6b9ca02ff7a4d0fc99ac30c"
},
{
"id": "frontend",
"file": "src/lib/litegraph/src/subgraph/Subgraph.ts",
"local_file": "frontend__src__lib__litegraph__src__subgraph__Subgraph.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/lib/litegraph/src/subgraph/Subgraph.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "321403ca3ba2faa0b448dec6e8bf379e49ddea4bfbe8619547d29926e30d62d2",
"git_blob_sha1": "e1f2f0b255a703e9735761fd83d75ee3eb21334e"
},
{
"id": "frontend",
"file": "src/scripts/app.ts",
"local_file": "frontend__src__scripts__app.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/scripts/app.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "6a0fd5cc4da6aad850ac05d312a22fd2f545fd296735ed7b927b62d7a564c08e",
"git_blob_sha1": "e326db4703c6fdf1098910dab81d3eefad91b009"
},
{
"id": "frontend",
"file": "src/scripts/widgets.ts",
"local_file": "frontend__src__scripts__widgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/scripts/widgets.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "2afe2e069a0e163d36b892a7d46e3074d087f48faeef240610b6e4d55c6fba5c",
"git_blob_sha1": "f1259180cac03fca9a8e4809b5a47c23c3ef625c"
},
{
"id": "frontend",
"file": "src/extensions/core/uploadImage.ts",
"local_file": "frontend__src__extensions__core__uploadImage.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/extensions/core/uploadImage.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "48d062c2ee95bd77c537c539e6c8f8bc03bd71dcec94c5b82487c014ea3e9c06",
"git_blob_sha1": "58e43bb218171534c4713bdced29171ecb96d903"
},
{
"id": "frontend",
"file": "src/core/graph/widgets/dynamicWidgets.ts",
"local_file": "frontend__src__core__graph__widgets__dynamicWidgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/core/graph/widgets/dynamicWidgets.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "cbc7d1a9eccb1c64f90cf2f87db9ad3ba9a301d81ec3f8daea2af48e2ccb8e32",
"git_blob_sha1": "0a304c07f15c06d3d8aaa96725be2c7b5a04f018"
},
{
"id": "frontend",
"file": "src/extensions/core/dynamicPrompts.ts",
"local_file": "frontend__src__extensions__core__dynamicPrompts.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/extensions/core/dynamicPrompts.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "31004dc7ba9b8ea5c8caa92ab3a15a0e63af8a822f57cb487079aad84d06f4bd",
"git_blob_sha1": "57ee13dd2ded06e358ea49a1fc41c64f75a905ab"
},
{
"id": "frontend",
"file": "src/extensions/core/noteNode.ts",
"local_file": "frontend__src__extensions__core__noteNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/extensions/core/noteNode.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "1014f719e3d67d9c5183a5e8631d4c2d6581dfe67083f32eb23774ec3074bef2",
"git_blob_sha1": "7e0ec56a6fb83f81c754efd30eb597b45bd5b072"
},
{
"id": "frontend",
"file": "src/core/graph/subgraph/resolveSubgraphInputTarget.ts",
"local_file": "frontend__src__core__graph__subgraph__resolveSubgraphInputTarget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/core/graph/subgraph/resolveSubgraphInputTarget.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "cbd6d3d16cf94acc0ca3d333028a0b6b91f4c1a011fe5947345c4a31048ba6ed",
"git_blob_sha1": "f5242c03028af4082ad73baf9b956aafa5459711"
},
{
"id": "frontend",
"file": "src/core/graph/subgraph/promotedWidgetView.ts",
"local_file": "frontend__src__core__graph__subgraph__promotedWidgetView.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/src/core/graph/subgraph/promotedWidgetView.ts",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "21b0068dc03cf45bc5100a1741484bd04ff09c51b96c4ff2293f758034ba83e3",
"git_blob_sha1": "610ba4cbec11f73f4b3badadffdeb14ebc932135"
},
{
"id": "frontend",
"file": "LICENSE",
"local_file": "frontend__LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/7bd9f8b0d0b854ccb5a947623468f36a392ea0ff/LICENSE",
"commit": "7bd9f8b0d0b854ccb5a947623468f36a392ea0ff",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"git_blob_sha1": "f288702d2fa16d3cdf0035b15a9fcbc552cd88e7"
},
{
"id": "rgthree",
"file": "__init__.py",
"local_file": "rgthree____init__.py",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/__init__.py",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "06174f22e7246b2b0771961cc0681846f452b853ccb927ca507e074f340abc61",
"git_blob_sha1": "edf954cbbeafef1f99748e7927aa405ab73e3a1d"
},
{
"id": "rgthree",
"file": "py/image_comparer.py",
"local_file": "rgthree__py__image_comparer.py",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/py/image_comparer.py",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "43ccce9b6f9413d5196ce4a7a3ef544969ae1ce2b52c44345f6cc8fb28c596fc",
"git_blob_sha1": "079ebdbf6051fa86cf89f75f55f8502904d0c93f"
},
{
"id": "rgthree",
"file": "src_web/comfyui/image_comparer.ts",
"local_file": "rgthree__src_web__comfyui__image_comparer.ts",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/src_web/comfyui/image_comparer.ts",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "cb15118af030e39aaecdde072a79a7edd501344d2742dd6e296db55e12c14d34",
"git_blob_sha1": "3c648f8f8a36040cd6122ebc510dcc90bfb865fe"
},
{
"id": "rgthree",
"file": "src_web/comfyui/base_node.ts",
"local_file": "rgthree__src_web__comfyui__base_node.ts",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/src_web/comfyui/base_node.ts",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "5aa0ec6dc78ad00ecf46ef05922fa53c09526152f07eb3762a1e2c052b040623",
"git_blob_sha1": "be4e1be533355e24b47acb73cb5d03b988532150"
},
{
"id": "rgthree",
"file": "src_web/comfyui/base_node_mode_changer.ts",
"local_file": "rgthree__src_web__comfyui__base_node_mode_changer.ts",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/src_web/comfyui/base_node_mode_changer.ts",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "ecd92d0b5275dace15e65a33c2bfd3aab49b4604f47cc0ce2e793c486e36921d",
"git_blob_sha1": "ae1afeafd900c6143a696c5612fc63edf59327d3"
},
{
"id": "rgthree",
"file": "py/constants.py",
"local_file": "rgthree__py__constants.py",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/py/constants.py",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "50dee946013b1d88d01fe9d63c2a7ab4d4c59be218cf80171f3542b43f0d8558",
"git_blob_sha1": "73b7d687ad24999c3b441f2c2ef39e4e8b3f3d54"
},
{
"id": "rgthree",
"file": "LICENSE",
"local_file": "rgthree__LICENSE",
"url": "https://raw.githubusercontent.com/rgthree/rgthree-comfy/27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383/LICENSE",
"commit": "27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383",
"sha256": "b34faf7c3e2975fe08d0169958e2b39f076d4d4289cbe2560dd7dd5b1a613ed1",
"git_blob_sha1": "5a4eb87c0791b74af3db40c2a4d362469a8b6b43"
},
{
"id": "core",
"file": "comfy_extras/nodes_compositing.py",
"local_file": "core__comfy_extras__nodes_compositing.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/bb131be9e83d2f773c90f1d6f1e4b248a498c8c5/comfy_extras/nodes_compositing.py",
"commit": "bb131be9e83d2f773c90f1d6f1e4b248a498c8c5",
"sha256": "e001e2963baaa5ea9f031e6b7920e4d70dae248588a70ed31ab595706a29efae",
"git_blob_sha1": "8fcbe720e7398d24d7dbc957787f68ec0d123713"
}
]
}
+92
View File
@@ -0,0 +1,92 @@
"""Foreground local browser check; stop every owned service before returning."""
from __future__ import annotations
import os
import signal
import subprocess
import sys
import time
import urllib.error
import urllib.request
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
OUT = ROOT / ".local-evidence/seedvr2-document/browser"
def main():
OUT.mkdir(parents=True, exist_ok=True)
# Refuse to reuse another operator's service or port.
import socket
for port in (8247, 5173):
with socket.socket() as sock:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("127.0.0.1", port))
processes = []
logs = []
try:
commands = [
([sys.executable, str(ROOT / "e2e/workflow-document-server.py")], ROOT),
(
["node", "node_modules/vite/bin/vite.js", "--host", "127.0.0.1"],
ROOT / "calliope-web",
),
]
for i, (command, cwd) in enumerate(commands):
log = (OUT / f"service-{i}.log").open("w")
logs.append(log)
processes.append(
subprocess.Popen(command, cwd=cwd, stdout=log, stderr=log, start_new_session=True)
)
for url in (
"http://127.0.0.1:8247/api/workflows",
"http://127.0.0.1:5173/connections",
):
deadline = time.monotonic() + 30
while True:
if any(p.poll() is not None for p in processes):
raise RuntimeError("Local service exited; inspect service logs")
try:
with urllib.request.urlopen(url, timeout=1) as response:
if response.status == 200:
break
except (urllib.error.URLError, TimeoutError):
pass
if time.monotonic() > deadline:
raise TimeoutError(url)
time.sleep(0.2)
names = ["seedvr2"]
for name in names:
subprocess.run(["node", f"e2e/{name}-document.mjs"], cwd=ROOT, check=True)
finally:
for p in processes:
if p.poll() is None:
os.killpg(p.pid, signal.SIGTERM)
try:
p.wait(timeout=10)
except subprocess.TimeoutExpired:
os.killpg(p.pid, signal.SIGKILL)
p.wait(timeout=5)
for log in logs:
log.close()
import json
released = []
for port in (8247, 5173):
with socket.socket() as sock:
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("127.0.0.1", port))
released.append(port)
(OUT / "service-stop.json").write_text(
json.dumps(
dict(ports_released=released, child_exit_codes=[p.returncode for p in processes])
)
+ "\n"
)
print("All owned browser services stopped; ports released.")
if __name__ == "__main__":
main()
+102
View File
@@ -0,0 +1,102 @@
// Local GET-only: 9 RTX video positions, no notes, and 29 frozen summaries.
import fs from 'node:fs';
import assert from 'node:assert/strict';
const { chromium } = await import(process.env.PLAYWRIGHT_MODULE || 'playwright');
const out='.local-evidence/seedvr2-document/browser';fs.mkdirSync(out,{recursive:true});
const checks=[],requests=[],errors=[],blockedFonts=[],assertionGroups={},interceptions=[];let group='aggregate';
function check(condition,label){assert.ok(condition,label);checks.push(label);assertionGroups[group]=(assertionGroups[group]||0)+1;console.log('PASS '+label);}
const browser=await chromium.launch({headless:true,executablePath:process.env.BROWSER_EXECUTABLE});
try {
const page=await browser.newPage({viewport:{width:1440,height:1000}});
await page.route('**/*',route=>{
const u=new URL(route.request().url());
if(u.hostname==='fonts.googleapis.com'){blockedFonts.push(String(u));return route.fulfill({contentType:'text/css',body:''});}
if(route.request().method()!=='GET'||u.hostname!=='127.0.0.1'||u.pathname==='/api/view'||(/\.(mp4|png|wav|mp3|webm)$/i.test(u.pathname)&&u.pathname!=='/favicon.png')){errors.push('Forbidden request '+u);return route.abort();}
return route.continue();
});
page.on('request',r=>{if(r.url().includes('/api/'))requests.push({method:r.method(),url:r.url()});});
page.on('pageerror',e=>errors.push(e.message));
requests.push({method:'GET',url:'http://127.0.0.1:8247/api/workflows'});
const records=await(await fetch('http://127.0.0.1:8247/api/workflows')).json();
const names=['Seedvr2_3b_int8_图像放大','RTX_video_upscale','RTX_image_upscale','手动按分镜视频截取','sam3_图像视频-提示词遮罩分割','多视频合成分屏展示','图像4种添加水印节点','birefnet_图像移除背景','加载本地latent解码','截取视频每一帧','双图像或视频合并显示','视频转gif动图图片','加载图片合成视频','视频倒放','NLF_视频人物动作骨架获取','openpose-video-姿态检测','sdpose_视频人物姿势骨架提取','gemma4_提示词反推(图像视频音频)','图像合并成四宫格','图像分割-多宫格分割','Qwen_image2.1_图像编辑_背景移除','Qwen_image2.1_图像编辑_提示词增强','Qwen_image2.1_文生图_提示词增强','ControlNet_aux_常用样例','Qwen3-ASR-语音转文字','Qwen3-ASR-Subtitle语音转字幕','Minimax-H3提示词增强','音频转MP3格式','音频人声分离','视频-音频分离','图像嵌入文字描述'];
const details=[];
for(const name of names){const r=records.find(r=>r.name===name);assert.ok(r);const url=`http://127.0.0.1:8247/api/workflows/${r.id}`;requests.push({method:'GET',url});details.push(await(await fetch(url)).json());}
check(details.length===31&&details.reduce((n,d)=>n+d.doc_json.fixed_version.fields.length,0)===941,'31图941保存位置');
check(details.reduce((n,d)=>n+(d.doc_json.source_notes?.length||0),0)===22,'31图22源注释');
await page.goto('http://127.0.0.1:5173/connections',{waitUntil:'networkidle'});
const dialog=page.getByRole('dialog',{name:'工作流说明'});
const fixedCard=dialog.locator('.card').filter({has:page.getByText('固定版本参数说明',{exact:true})});
async function begin(name){const row=page.locator('.wf-row').filter({has:page.locator('.wf-name').filter({hasText:name})}).first();const button=row.getByRole('button',{name:'说明',exact:true});await button.focus();await page.keyboard.press('Enter');return button;}
async function loaded(){await dialog.getByText('用途与来源',{exact:true}).waitFor();await dialog.evaluate(el=>Promise.all(el.getAnimations().map(a=>a.finished)));}
for(const width of [1440,390]){
await page.setViewportSize({width,height:width===390?844:1000});
for(const d of details){
group=details.indexOf(d)<1?'new_seedvr2':'old_thirty';const b=d.doc_json.fixed_version,button=await begin(d.name);await loaded();
const overview=dialog.locator('.card').filter({has:page.getByText('用途与来源',{exact:true})});
check((await overview.innerText()).includes(b.user_overview),`${width} ${d.name}默认中文用途`);
check(!(await dialog.getByText('源图与审校记录',{exact:true}).locator('..').evaluate(el=>el.open)),`${width} ${d.name}源审校默认折叠`);
check(!(await dialog.getByText('核对范围与来源依据',{exact:true}).locator('..').evaluate(el=>el.open)),`${width} ${d.name}技术范围默认折叠`);
const visible=await fixedCard.innerText();
check(!visible.includes('执行标量')&&!visible.includes('widgetId')&&!visible.includes(b.source_sha256)&&!visible.includes('UUID'),`${width} ${d.name}默认无执行计数/实现标识`);
check(visible.includes('依据固定版本整理,目标环境与实际效果未核对。'),`${width} ${d.name}默认依据限制可见`);
for(const t of ['说明未定稿','未验证实跑','未检查'])check((await dialog.innerText()).includes(t),`${width} ${d.name} ${t}`);
check(!d.is_enabled&&!d.doc_completed_at&&!d.exec_verified_at,`${width} ${d.name}停用/时间戳空`);
check(await fixedCard.locator('summary').filter({hasText:/^节点 [\d:]+ · /}).count()===b.fields.length,`${width} ${d.name}参数全保留`);
check(await dialog.locator('.drawer-body').evaluate(el=>el.scrollWidth<=el.clientWidth),`${width} ${d.name}默认无溢出`);
await dialog.locator('.drawer-body').evaluate(el=>el.scrollTop=0);
if(details.indexOf(d)<1)await page.screenshot({path:`${out}/${width}-${d.id}-default.png`});
if(details.indexOf(d)>0){await page.keyboard.press('Escape');await dialog.waitFor({state:'hidden'});check(await button.evaluate(el=>el===document.activeElement),`${width} ${d.name}旧图归还焦点`);continue;}
await dialog.getByText('源图与审校记录',{exact:true}).click();
check((await overview.innerText()).includes(d.doc_json.purpose)&&(await overview.innerText()).includes(d.source_repo_path),`${width} ${d.name}原用途/源路径展开保留`);
await dialog.getByText('核对范围与来源依据',{exact:true}).click();
const flowText=await fixedCard.innerText();
for(const line of b.flow)check(flowText.includes(line),`${width} ${d.name}展开流程 ${b.flow.indexOf(line)}`);
if(width===1440){await fixedCard.getByText(b.flow[2],{exact:true}).evaluate(el=>el.scrollIntoView({block:'center'}));await page.screenshot({path:`${out}/${width}-${d.id}-branch-flow.png`});}
await dialog.getByText('版本、源图与连线依据',{exact:true}).click();
check((await fixedCard.innerText()).includes(b.source_sha256)&&b.versions.every(v=>(v&&true)),`${width} ${d.name}原件摘要可展开`);
const versionText=await fixedCard.innerText();
for(const v of b.versions)check(versionText.includes(v),`${width} ${d.name}版本 ${b.versions.indexOf(v)}`);
if(details.indexOf(d)<1){
for(const f of b.fields){
const summary=fixedCard.locator(`details[data-fixed-field="${f.pointer}"] > summary`);await summary.focus();await page.keyboard.press('Enter');const box=summary.locator('..');
check(await box.evaluate(el=>el.open),`${width} ${f.node_id}.${f.field}键盘展开`);
let text=await box.innerText();check(text.includes(f.effect)&&text.includes(f.limits)&&text.includes(f.schema_default)&&text.includes(f.execution_note)&&text.includes(f.unit),`${width} ${f.node_id}.${f.field}用途/单位/范围/来源条件`);
check(await box.locator(':scope > pre').textContent()===(typeof f.value==='string'?f.value:JSON.stringify(f.value,null,2)),`${width} ${f.node_id}.${f.field}精确保留现值`);
check(!text.includes(f.pointer),`${width} ${f.node_id}.${f.field}指针默认折叠`);
await box.getByText('来源依据',{exact:true}).click();text=await box.innerText();
check(text.includes(f.pointer)&&text.includes(f.class_type)&&text.includes(f.json_type)&&f.evidence.every(i=>{const e=b.sources[i];return text.includes(e.commit)&&text.includes(e.sha256)&&text.includes(e.lines.join('~'));}),`${width} ${f.node_id}.${f.field}精确源码/类型/指针`);
check(await dialog.locator('.drawer-body').evaluate(el=>el.scrollWidth<=el.clientWidth),`${width} ${f.node_id}.${f.field}展开无溢出`);
if(width===1440&&f.field==='vae_name'&&f.node_id==='66')await page.screenshot({path:`${out}/${width}-${d.id}-${f.node_id}-${f.field}.png`});
await summary.click();
}
for(const n of b.comments){const summary=dialog.getByText(`节点 ${n.node_id}`,{exact:true});await summary.click();const expected=d.doc_json.source_notes.find(x=>String(x.node_id)===n.node_id);check(await summary.locator('..').locator('pre').textContent()===JSON.stringify(expected.content,null,2),`${width}注释${n.node_id}全文`);check(await dialog.locator('.drawer-body').evaluate(el=>el.scrollWidth<=el.clientWidth),`${width}注释${n.node_id}无溢出`);if(width===390){await summary.evaluate(el=>el.scrollIntoView({block:'start'}));await page.screenshot({path:`${out}/${width}-${d.id}-note.png`});}await summary.click();}
await dialog.getByRole('button',{name:'关闭',exact:true}).focus();await page.keyboard.press('Tab');check(await dialog.evaluate(el=>el.contains(document.activeElement)),`${width}Tab焦点保留`);await page.keyboard.press('Shift+Tab');check(await dialog.evaluate(el=>el.contains(document.activeElement)),`${width}ShiftTab焦点保留`);
}
await page.keyboard.press('Escape');await dialog.waitFor({state:'hidden'});check(await button.evaluate(el=>el===document.activeElement),`${width} ${d.name}关闭归还焦点`);
}
}
group='shared_regressions';
for(const name of ['旧工作流回退(隔离测试夹具)','空说明回退(隔离测试夹具)']){await begin(name);await loaded();check((await dialog.innerText()).includes('隔离库旧条目回退测试'),'旧/空说明回退 '+name);await page.keyboard.press('Escape');}
// Missing summary and mismatched bindings are tested with local GET fixtures, without writes.
for(const variant of ['missing-overview','mismatched','html-summary']){
const d=structuredClone(details[0]);
if(variant==='missing-overview')delete d.doc_json.fixed_version.user_overview;
if(variant==='mismatched')d.doc_json.fixed_version={matched:false,notice:'固定版本参数说明待核对:源文件、声明版本或说明依据未匹配,未采用旧定义。'};
if(variant==='html-summary')d.doc_json.fixed_version.user_overview='<img src="https://example.invalid/forbidden">仅纯文本';
await page.route(`**/api/workflows/${d.id}`,route=>{interceptions.push({variant,url:route.request().url()});return route.fulfill({json:d});});await begin(d.name);await loaded();
if(variant==='missing-overview')check((await dialog.innerText()).includes('这张图的用途和操作重点可在下方使用步骤中查看;目标环境与实际效果仍待核对。'),'缺摘要自然中文回退');
if(variant==='mismatched')check((await dialog.innerText()).includes(d.doc_json.fixed_version.notice)&&!await dialog.getByText('核对范围与来源依据',{exact:true}).count(),'错绑定提示明确且不展示旧字段');
if(variant==='html-summary')check((await dialog.innerText()).includes(d.doc_json.fixed_version.user_overview)&&await dialog.locator('img').count()===0,'摘要HTML仅纯文本不创建图像或请求');
check(!(await dialog.innerText()).includes('undefined'),'回退不暴露undefined');await page.keyboard.press('Escape');await page.unroute(`**/api/workflows/${d.id}`);
}
let release,entered,delivered;const hold=new Promise(r=>release=r),intercept=new Promise(r=>entered=r),done=new Promise(r=>delivered=r);
await page.route(`**/api/workflows/${details[0].id}`,async route=>{interceptions.push({variant:"late",url:route.request().url()});entered();await hold;await route.fulfill({json:details[0]});delivered();});
await begin(details[0].name);await intercept;await page.keyboard.press('Escape');await begin(details[1].name);await loaded();release();await done;
check((await dialog.innerText()).includes(details[1].doc_json.fixed_version.user_overview)&&await fixedCard.locator('summary').filter({hasText:/^节点 [\d:]+ · /}).count()===details[1].doc_json.fixed_version.fields.length,'迟到RTX响应不覆盖旧RTX图片摘要/7字段');await page.keyboard.press('Escape');await page.unroute(`**/api/workflows/${details[0].id}`);
await page.route(`**/api/workflows/${details[0].id}`,route=>{interceptions.push({variant:'failure',url:route.request().url()});return route.fulfill({status:500,json:{detail:'隔离失败夹具'}});});await begin(details[0].name);await dialog.getByRole('alert').waitFor({timeout:20000});check(await dialog.getByRole('button',{name:'重试',exact:true}).isVisible(),'GET失败显示重试');check(await dialog.getByText('用途与来源',{exact:true}).count()===0,'读取失败隐藏旧摘要');await page.unroute(`**/api/workflows/${details[0].id}`);await dialog.getByRole('button',{name:'重试',exact:true}).click();await loaded();check((await dialog.innerText()).includes(details[0].doc_json.fixed_version.user_overview),'重试恢复摘要');await page.keyboard.press('Escape');
check(errors.length===0,'无脚本错误或禁止请求 '+JSON.stringify(errors));check(requests.every(r=>r.method==='GET'&&new URL(r.url).hostname==='127.0.0.1'&&!r.url.includes('/api/view')),'全程本地GET无写/生成/目标/历史预览请求');
const polling=requests.filter(r=>['/api/jobs','/api/events'].includes(new URL(r.url).pathname));
const fixed=requests.filter(r=>!polling.includes(r));
const frequencies=rs=>Object.fromEntries([...new Set(rs.map(r=>new URL(r.url).pathname))].sort().map(p=>[p,rs.filter(r=>new URL(r.url).pathname===p).length]));
fs.writeFileSync(`${out}/browser-results.json`,JSON.stringify({request_accounting:{fixed_count:fixed.length,fixed_paths:frequencies(fixed),polling_count:polling.length,polling_paths:frequencies(polling),polling_tolerance:1,reason:'定时轮询可因浏览耗时与计时器边界相差±1;固定请求逐条保存,不忽略真实新请求,禁止请求零容忍。'},assertion_count:checks.length,assertionGroups,interceptions,checks,requests,errors,blockedFonts,viewports:[1440,390]},null,2));
} finally {await browser.close();}