HEL-892: document Gemma saved state against core 0.21.0 and frontend 1.43.18

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-30 13:47:59 +08:00
co-authored by multica-agent
parent 9a5146170e
commit 23f656c7bd
78 changed files with 33859 additions and 7 deletions
@@ -15,6 +15,11 @@ DEFINITION_SHA256 = "c4c7f04fde29dc7485a341207397fcf6191e3fcbe89ecc2d238f4a4f5bc
# Explicit path allowlist; a recomputed caller-supplied digest cannot extend trust.
DEFINITIONS = {
(
"example_ComfyUI_workflows/0-基础处理:图像合并-音频"
"分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图"
"像视频音频).json"
): "a28ce8356253cf4de600eece7f4c5af0f1e765a9376e6e73a63b7ce8a6413989",
(
"example_ComfyUI_workflows/0-基础处理:图像合并-"
"音频分离-视频截取合并-图像视频放大/图像分割-多宫格分割.json"
File diff suppressed because it is too large Load Diff
@@ -192,10 +192,19 @@ def test_ten_documents_only_gain_overview_and_new_block_is_independent():
now = json.loads((REPO / p).read_bytes())
# Freeze the historical eleven-document revision; the two grid additions are
# independently compared against 27e6d56 in test_grid_fixed_document.
# Gemma is separately checked against 9dac1b4 in test_gemma_fixed_document.
additions = [
p for p in DEFINITIONS if p.endswith(("图像合并成四宫格.json", "图像分割-多宫格分割.json"))
p
for p in DEFINITIONS
if p.endswith(
(
"图像合并成四宫格.json",
"图像分割-多宫格分割.json",
"gemma4_提示词反推(图像视频音频).json",
)
)
]
assert len(additions) == 2
assert len(additions) == 3
for p in additions:
now[p].pop("fixed_version_document")
historical = [p for p in DEFINITIONS if p not in additions]
@@ -203,7 +203,7 @@ def test_graph_specific_semantics_and_companion():
def test_other_documents_and_block_swaps():
assert len(DEFINITIONS) == 13
assert len(DEFINITIONS) == 14
for path in DEFINITIONS:
if path == PATH:
continue
@@ -0,0 +1,229 @@
"""Exact Gemma source binding, real document output, old definitions and refusal regressions."""
from __future__ import annotations
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/gemma-document-evidence"
PATH = next(p for p in DEFINITIONS if p.endswith("gemma4_提示词反推(图像视频音频).json"))
RAW = (REPO / PATH).read_bytes()
SOURCE = json.loads(RAW)
REVIEW = review_for(PATH, hashlib.sha1(RAW).hexdigest())
BLOCK = REVIEW["fixed_version_document"]
def pointer(obj, path):
for part in path.strip("/").split("/"):
part = part.replace("~1", "/").replace("~0", "~")
obj = obj[int(part)] if isinstance(obj, list) else obj[part]
return obj
def doc(source=None, review=None, path=PATH):
return build_document(
path,
SOURCE if source is None else source,
None,
None,
[],
REVIEW if review is None else review,
)
@pytest.mark.parametrize("field", BLOCK["fields"], ids=lambda f: f["node_id"] + "." + f["field"])
def test_saved_values_types_and_fixed_citations(field):
v = pointer(SOURCE, field["pointer"])
assert canonical(v) == canonical(field["value"]) and type(v).__name__ == field["json_type"]
node = pointer(SOURCE, field["pointer"].split("/widgets_values/")[0])
assert str(node["id"]) == field["node_id"] and node["type"] == field["class_type"]
assert node["properties"]["ver"] == "0.21.0"
for k in ["label", "schema_default", "unit", "limits", "effect", "execution_note"]:
assert field[k]
for k in field["evidence"]:
e = BLOCK["sources"][k]
raw = (OUT / e["local_file"]).read_bytes()
assert hashlib.sha256(raw).hexdigest() == e["sha256"]
assert len(e["commit"]) == 40 and e["commit"] in e["url"]
assert 1 <= e["lines"][0] <= e["lines"][1] <= len(raw.decode().splitlines())
@pytest.mark.parametrize("index", range(25))
@pytest.mark.parametrize("kind", ["value", "type", "pointer", "citation", "role", "default"])
def test_forged_fields_fail_even_after_caller_digest_recalculation(index, kind):
source, review = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
b = review["fixed_version_document"]
f = b["fields"][index]
if kind in ["value", "type"]:
parent, _, key = f["pointer"].rpartition("/")
pointer(source, parent)[int(key)] = (
{"forged": True} if kind == "value" else (1 if isinstance(f["value"], bool) else False)
)
# Even when source and editorial field are forged consistently, trust cannot expand.
f["value"] = pointer(source, f["pointer"])
f["json_type"] = type(f["value"]).__name__
elif kind == "citation":
b["sources"][f["evidence"][0]]["sha256"] = "0" * 64
else:
f[{"default": "schema_default"}.get(kind, kind)] = "forged"
b["canonical_sha256"] = hashlib.sha256(canonical(source)).hexdigest()
review["caller_digest"] = hashlib.sha256(canonical(b)).hexdigest()
actual = doc(source, review)["fixed_version"]
assert actual["matched"] is False and "fields" not in actual
MUTATIONS = (
[
"/links/0/1",
"/extra/frontendVersion",
"/nodes/2/widgets_values/0",
"/nodes/3/widgets_values/0",
"/nodes/0/properties/models/0/url",
"/nodes/7/outputs/0/links",
"/nodes/8/inputs/2/link",
]
+ [
f"/nodes/{i}/{suffix}"
for i in range(9)
for suffix in ["mode", "type", "properties/ue_properties/version"]
]
+ [f"/nodes/{i}/properties/{key}" for i in [0, 1, 4, 5, 6, 7, 8] for key in ["cnr_id", "ver"]]
)
@pytest.mark.parametrize("path", MUTATIONS)
def test_versions_providers_modes_edges_notes_and_model_metadata_fail_closed(path):
source, review = copy.deepcopy(SOURCE), copy.deepcopy(REVIEW)
parent, _, key = path.rpartition("/")
target = pointer(source, parent)
target[int(key) if isinstance(target, list) else key] = "forged"
review["fixed_version_document"]["canonical_sha256"] = hashlib.sha256(
canonical(source)
).hexdigest()
review["caller_digest"] = hashlib.sha256(
canonical(review["fixed_version_document"])
).hexdigest()
assert not doc(source, review)["fixed_version"]["matched"]
@pytest.mark.parametrize(
"key",
[
"source_path",
"source_sha1",
"source_sha256",
"notice",
"user_overview",
"versions",
"comments",
"flow",
"sources",
],
)
def test_editorial_and_identity_forgery_rejected(key):
review = copy.deepcopy(REVIEW)
review["fixed_version_document"][key] = "forged"
review["caller_digest"] = hashlib.sha256(
canonical(review["fixed_version_document"])
).hexdigest()
assert not doc(review=review)["fixed_version"]["matched"]
def test_real_document_and_frozen_old_thirteen_blocks():
d = doc()
assert d["fixed_version"]["matched"] and d["fixed_version"]["fields"] == BLOCK["fields"]
assert d["status"] == dict(imported=True, doc_done=False, exec_verified=False)
assert d["dependencies"]["check_state"] == "unchecked"
assert "fixed_version" not in doc(path="untrusted.json")
review = copy.deepcopy(REVIEW)
other = next(p for p in DEFINITIONS if p != PATH)
review["fixed_version_document"] = json.loads(
(REPO / "calliope-backend/src/calliope/comfyui/source_reviews.json").read_bytes()
)[other]["fixed_version_document"]
assert not doc(review=review)["fixed_version"]["matched"]
resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
old = json.loads(subprocess.check_output(["git", "show", "9dac1b4:" + resource], cwd=REPO))
now = json.loads((REPO / resource).read_bytes())
assert len(now) == 156 and len(DEFINITIONS) == 14
assert len([r for r in old.values() if "fixed_version_document" in r]) == 13
assert (
sum(
len(r["fixed_version_document"]["fields"])
for r in old.values()
if "fixed_version_document" in r
)
== 351
)
assert now[PATH].pop("fixed_version_document") == BLOCK
assert now == old
def test_exact_topology_nulls_conditions_and_reference_identity():
assert BLOCK["source_sha256"] == hashlib.sha256(RAW).hexdigest()
assert BLOCK["canonical_sha256"] == hashlib.sha256(canonical(SOURCE)).hexdigest()
assert SOURCE["links"] == [
[2, 3, 0, 1, 0, "CLIP"],
[3, 1, 0, 4, 0, "STRING"],
[5, 6, 0, 7, 0, "VIDEO"],
[7, 2, 0, 1, 1, "IMAGE"],
[8, 5, 0, 1, 3, "AUDIO"],
]
assert {n["id"]: n["mode"] for n in SOURCE["nodes"]} == {
1: 0,
3: 0,
4: 0,
8: 0,
9: 0,
2: 4,
5: 4,
6: 4,
7: 4,
}
assert len(BLOCK["fields"]) == 25 and len(BLOCK["comments"]) == 2
assert len([f for f in BLOCK["fields"] if f["role"] == "frontend"]) == 7
for n in BLOCK["comments"]:
assert pointer(SOURCE, n["pointer"]) == n["text"]
preview = [f for f in BLOCK["fields"] if f["node_id"] == "4"]
assert [f["value"] for f in preview] == [None, None, None]
text = [f for f in BLOCK["fields"] if f["node_id"] == "1"]
assert len(text) == 12 and "fixed" not in [f["value"] for f in text]
assert [f["value"] for f in text][-4:] == [0, 0, False, True]
assert text[9]["json_type"] == "int" and text[9]["schema_default"] == "0.0"
assert [f["field"] for f in text][3:10] == [
"sampling_mode." + n
for n in [
"temperature",
"top_k",
"top_p",
"min_p",
"repetition_penalty",
"seed",
"presence_penalty",
]
]
assert {e["commit"] for e in BLOCK["sources"]} == {
"52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"6a207bb52a887b1a70fbf654641ebc57710f97c7",
}
assert BLOCK["zero_saved_nodes"][0]["node_id"] == "7"
assert all(
t in "".join(BLOCK["flow"])
for t in [
"旁路",
"video的link=null",
"images的links=[]",
"null不替换默认",
"RETURN_TYPES",
"UE7.8",
]
)
assert not BLOCK["counts"]["final_prompt_constructed"]
@@ -171,7 +171,10 @@ def test_only_two_reviews_change_and_all_old_blocks_preserved():
resource = "calliope-backend/src/calliope/comfyui/source_reviews.json"
old = json.loads(subprocess.check_output(["git", "show", "27e6d56:" + resource], cwd=REPO))
now = json.loads((REPO / resource).read_bytes())
assert len(DEFINITIONS) == 13
# Gemma addition is independently protected against 9dac1b4 in its own suite.
gemma = next(p for p in now if p.endswith("gemma4_提示词反推(图像视频音频).json"))
now[gemma].pop("fixed_version_document")
assert len(DEFINITIONS) == 14
assert (
sum(
len(r["fixed_version_document"]["fields"])
@@ -235,10 +235,19 @@ def test_old_nine_blocks_and_other_editorial_content_preserved():
background = next(p for p in now if p.endswith("Qwen_image2.1_图像编辑_背景移除.json"))
now[background].pop("fixed_version_document")
# Later grid additions are protected against their own real 27e6d56 baseline.
# Gemma is separately checked against 9dac1b4 in test_gemma_fixed_document.
additions = [
p for p in now if p.endswith(("图像合并成四宫格.json", "图像分割-多宫格分割.json"))
p
for p in now
if p.endswith(
(
"图像合并成四宫格.json",
"图像分割-多宫格分割.json",
"gemma4_提示词反推(图像视频音频).json",
)
)
]
assert len(additions) == 2
assert len(additions) == 3
for p in additions:
now[p].pop("fixed_version_document")
for entry in now.values():
@@ -0,0 +1,815 @@
# Gemma多模态提示词图固定参考中文说明
25新保存位置+2新注释;旧13图351保存位置+11注释逐对象不变。14图376位置+13注释展示,155定稿0、实跑0、新增转换0。
复用SQLite来源库→正常GET详情→现有说明抽屉;仅新增source_reviews说明块和显式受信摘要,不改变转换/执行链。
## gemma4_提示词反推(图像视频音频)
这张图保存了描述图片、转写音频的文本请求,并把生成文本接到预览。但图片、音频、视频和视频拆分四个节点当前都在旁路,视频也未接到生成器;不能直接当作可用的多模态反推流程。模型与素材未核对,转换仍关闭。
固定版本参考说明;当前四媒体节点旁路且视频未接,目标环境与实际效果未核对,转换仍关闭。
源路径:`example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json`
SHA1:988d2cbe5180882e1cf390e981ece3042592eee2
原字节SHA256:1a94bdd5987955a29e403d128c2ea5ca0b6bc8a8d5ece145e1baba07146588b0
规范全图SHA256:8fec62e8291c61add45d0bc79e97ca107284fa3f58493635987ca4745543cc62
源声明core0.21.0=52976f3ea33cc2312c7b5a32e1c7510b203eefb6
源声明frontend1.43.18=6a207bb52a887b1a70fbf654641ebc57710f97c7
UE7.8身份/映射/钩子顺序与目标安装未知;只读固定官方原件,不证明兼容或升级可信注册。
### 具体连线与处理条件
用途与当前状态:原请求是Describe the image, and transcribe the audio。模型加载3→文本生成1→文本预览4是保存的主链;媒体输入不能按标题或注释当已接入执行。
五条物理边:link2为CLIP3槽0→TextGenerate1.clip;link3为Text1槽0→Preview4.source;link5为Video6槽0→Components7.video;link7为Image2槽0→Text1.image;link8为Audio5槽0→Text1.audio。
旁路限制:LoadImage2、LoadAudio5、LoadVideo6、GetVideoComponents7均mode=4(BYPASS),其余5节点mode=0。固定前端跳过旁路节点,resolveOutput先找匹配输入,无匹配则警告并返回undefined;未解析连线不写入API,不是继续把该媒体文件送入模型。加载节点的文件/上传控件不能当IMAGE/AUDIO/VIDEO入口;未执行旁路转换或验证绕过。
视频未接:TextGenerate.video的link=null;Components7.images的links=[]、audio/fps的links=null,均未连到生成器。源标题与能力注释不能证明当前图有可用视频反推链。
模型:CLIP3保持gemma4_e4b_it_fp8_scaled.safetensors/stable_diffusion/default。固定代码包含Gemma4权重键识别分支,不按文件名保证实际模型能力/兼容/精度。下载URL、models记录和路径只是源文本,未访问媒体模型链接。
12保存项:英文请求、2048、on、0.7、64、0.95、0.05、1.05、0、0、false、true。限定名sampling_mode.seed不自动加fixed;源presence_penalty整数0与默认浮点0.0分别保留。单位/范围只认固定schema与token生成循环,不将位置数当运行参数数。
预览与null:PreviewAny三null按固定创建顺序作参考位置;两缓存widget.serialize=false,显示切换仅options.serialize=false,官方持久化序列与源三null不一致,实际恢复未知。后端STRING返回来自固定RETURN_TYPES及result,不是由UI出口推断;null不替换默认。
上传与显示:LoadImage/LoadVideo的image是上传按钮占位,options.serialize与widget.serialize分开;LoadAudio的audioUI/upload两null不当音频输入,audioUI被官方持久化跳过造成布局差异,未强行恢复。
源注释8是模型路径/PR文本,注释9是能力宣传;128K/256K、函数调用、多语言等均未实测。UE7.8空映射不证明无改写,官方tag/commit与许可不证明目标安装或钩子顺序,未导入执行上游。
源物理边:[2, 3, 0, 1, 0, "CLIP"]
源物理边:[3, 1, 0, 4, 0, "STRING"]
源物理边:[5, 6, 0, 7, 0, "VIDEO"]
源物理边:[7, 2, 0, 1, 1, "IMAGE"]
源物理边:[8, 5, 0, 1, 3, "AUDIO"]
源节点3 CLIPLoader:mode=0;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点4 PreviewAny:mode=0;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点8 MarkdownNote:mode=0;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点9 MarkdownNote:mode=0;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点2 LoadImage:mode=4;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点5 LoadAudio:mode=4;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点6 LoadVideo:mode=4;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点7 GetVideoComponents:mode=4;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
源节点1 TextGenerate:mode=0;UE={"widget_ue_connectable": {}, "version": "7.8", "input_ue_unconnectable": {}}
### 使用与核对
这张图保存了描述图片、转写音频的文本请求,并把生成文本接到预览。但图片、音频、视频和视频拆分四个节点当前都在旁路,视频也未接到生成器;不能直接当作可用的多模态反推流程。模型与素材未核对,转换仍关闭。
先核对模型和素材引用、当前四处旁路和视频未接状态;本轮不改mode/连线、不读取媒体。
逐项查看当前值、定义默认、单位/范围和模板条件;显示缓存及上传占位不作运行输入。
实际恢复、模型安装与真实效果仍待核对;保持停用/未检查/未定稿/未实跑,不执行生成。
### 逐保存位置说明
#### 1. 节点3 · 文本编码模型文件(clip_name)
当前保存gemma4_e4b_it_fp8_scaled.safetensors。文件名、models记录和下载URL仅源引用,不证明存在、精度、安装或可运行;未访问模型链接或下载权重。
```json
"gemma4_e4b_it_fp8_scaled.safetensors"
```
类:CLIPLoader;JSON类型:str;角色:scalar。
源位置:`/nodes/0/widgets_values/0`
定义默认:动态text_encoders文件列表,无固定默认;单位:文件名
范围/条件:以目标目录实际列表为准;未检查权重或安装
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [0] CLIPLoader枚举、动态文件列表、设备和load_clip;nodes.py 957~982行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
- [1] 按权重键识别Gemma4,不按文件名保证兼容;comfy/sd.py 1304~1318行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py
- [2] Gemma4权重识别后选择模型与tokenizer;comfy/sd.py 1453~1459行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py
#### 2. 节点3 · 加载类型(type)
原值stable_diffusion保留;代码转为CLIPType并按实际state_dict键识别Gemma4分支,不是凭文件名判断。未读取权重,不能证明本文件会被识别/兼容,不能据Gemma名字改type。
```json
"stable_diffusion"
```
类:CLIPLoader;JSON类型:str;角色:scalar。
源位置:`/nodes/0/widgets_values/1`
定义默认:schema未显式default;首选stable_diffusion;函数默认同名;单位:类别
范围/条件:stable_diffusion/stable_cascade/sd3/stable_audio/mochi/ltxv/pixart/cosmos/lumina2/wan/hidream/chroma/ace/omnigen2/qwen_image/hunyuan_image/flux2/ovis/longcat_image/cogvideox
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [0] CLIPLoader枚举、动态文件列表、设备和load_clip;nodes.py 957~982行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
- [1] 按权重键识别Gemma4,不按文件名保证兼容;comfy/sd.py 1304~1318行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py
- [2] Gemma4权重识别后选择模型与tokenizer;comfy/sd.py 1453~1459行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py
#### 3. 节点3 · 加载设备(device)
当前default交给正常设备管理;cpu分支同时设置load_device与offload_device为CPU。这不证明目标GPU/内存配置、速度或模型实际驻留。
```json
"default"
```
类:CLIPLoader;JSON类型:str;角色:scalar。
源位置:`/nodes/0/widgets_values/2`
定义默认:schema首选default;函数默认default;单位:设备选择
范围/条件:default/cpu;optional advanced
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [0] CLIPLoader枚举、动态文件列表、设备和load_clip;nodes.py 957~982行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
#### 4. 节点4 · Markdown预览保存位置(preview_markdown)
固定扩展先创建preview_markdown,widget.serialize与options.serialize均false,官方工作流/API均跳过。源保存三个null而官方只持久化未禁用widget.serialize的显示切换;这些名字仅依据源三位置与固定创建顺序作参考标注,不是三个null的可靠恢复映射。UE及实际前端未知,布局差异待核对。固定后端独立声明RETURN_TYPES=(STRING,)并返回result,此结论来自后端原件,不靠源UI出口倒推。
```json
null
```
类:PreviewAny;JSON类型:NoneType;角色:frontend。
源位置:`/nodes/1/widgets_values/0`
定义默认:前端显示缓存;后端无此输入默认;单位:无(显示状态)
范围/条件:源原值null;不改为false/空串,不当模型输入
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [22] 三个显示控件的顺序、serialize与options.serialize分别设置;src/extensions/core/previewAny.ts 19~97行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 0ad96628fd56a432adcb29ee72fbd9a7e28dde0863a37db383b5d302790d1b4d;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/previewAny.ts
- [10] PreviewAny真实STRING返回及ui.text;输出节点;comfy_extras/nodes_preview_any.py 9~47行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 2f1a458a82310bd1963ac716016680b5f54fa23779ef8de85b212d7130d39939;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_preview_any.py
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 5. 节点4 · 纯文本预览保存位置(preview_text)
固定扩展第二创建preview_text,widget.serialize与options.serialize均false;仅显示执行返回ui.text。源保存三个null而官方只持久化未禁用widget.serialize的显示切换;这些名字仅依据源三位置与固定创建顺序作参考标注,不是三个null的可靠恢复映射。UE及实际前端未知,布局差异待核对。固定后端独立声明RETURN_TYPES=(STRING,)并返回result,此结论来自后端原件,不靠源UI出口倒推。
```json
null
```
类:PreviewAny;JSON类型:NoneType;角色:frontend。
源位置:`/nodes/1/widgets_values/1`
定义默认:前端显示缓存;后端无此输入默认;单位:无(显示状态)
范围/条件:源原值null;不改为false/空串,不当模型输入
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [22] 三个显示控件的顺序、serialize与options.serialize分别设置;src/extensions/core/previewAny.ts 19~97行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 0ad96628fd56a432adcb29ee72fbd9a7e28dde0863a37db383b5d302790d1b4d;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/previewAny.ts
- [10] PreviewAny真实STRING返回及ui.text;输出节点;comfy_extras/nodes_preview_any.py 9~47行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 2f1a458a82310bd1963ac716016680b5f54fa23779ef8de85b212d7130d39939;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_preview_any.py
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 6. 节点4 · 预览显示方式保存位置(previewMode)
固定扩展第三创建previewMode,仅options.serialize=false,控制Markdown/Plaintext显示,不传入API。源保存三个null而官方只持久化未禁用widget.serialize的显示切换;这些名字仅依据源三位置与固定创建顺序作参考标注,不是三个null的可靠恢复映射。UE及实际前端未知,布局差异待核对。固定后端独立声明RETURN_TYPES=(STRING,)并返回result,此结论来自后端原件,不靠源UI出口倒推。
```json
null
```
类:PreviewAny;JSON类型:NoneType;角色:frontend。
源位置:`/nodes/1/widgets_values/2`
定义默认:官方BOOLEAN默认false(Plaintext);单位:无(显示状态)
范围/条件:源原值null;不改为false/空串,不当模型输入
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [22] 三个显示控件的顺序、serialize与options.serialize分别设置;src/extensions/core/previewAny.ts 19~97行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 0ad96628fd56a432adcb29ee72fbd9a7e28dde0863a37db383b5d302790d1b4d;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/previewAny.ts
- [10] PreviewAny真实STRING返回及ui.text;输出节点;comfy_extras/nodes_preview_any.py 9~47行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 2f1a458a82310bd1963ac716016680b5f54fa23779ef8de85b212d7130d39939;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_preview_any.py
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 7. 节点2 · 输入图片(image)
the_lily_veil.png按固定定义可解码为IMAGE/MASK,MASK未接;物理边7连生成器image,但当前旁路不能称图片已传入。
```json
"the_lily_veil.png"
```
类:LoadImage;JSON类型:str;角色:scalar。
源位置:`/nodes/4/widgets_values/0`
定义默认:动态文件列表,无固定文件默认;单位:文件名
范围/条件:仅源保存引用,未读取/校验真实素材;本节点当前mode=4旁路
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [3] LoadImage文件选择、IMAGE/MASK、读取与校验;nodes.py 1681~1756行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
- [19] 事件模式BYPASS=4;非正常执行状态;src/lib/litegraph/src/types/globalEnums.ts 66~89行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 74d106cbe62141f86991cd50aea7c341462933c4a5d7c66dd26d3764cba7fbe8;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/types/globalEnums.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
- [17] 旁路输出寻找匹配输入;无匹配警告并返回undefined;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 268~294行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
- [18] 旁路同槽/精确类型/兼容类型选择顺序;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 345~374行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
#### 8. 节点2 · 上传按钮保存占位(upload)
这是上传按钮的保存占位,不是另一份媒体输入、不是已上传证明。addWidget把serialize放在options,API阶段跳过;工作流保存/恢复另看widget.serialize。未在目标前端恢复或触发上传。
```json
"image"
```
类:LoadImage;JSON类型:str;角色:frontend。
源位置:`/nodes/4/widgets_values/1`
定义默认:前端构造值image;后端无upload参数;单位:无(按钮状态)
范围/条件:源保存image原样;options.serialize=false不等于widget.serialize=false
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [23] 上传按钮构造image占位,options.serialize=false;src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts 93~104行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c3c06c7bcdc56b2787368dc107fbd522d983466d244c0fdf724bae9ddd356f29;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts
- [13] addWidget把options单独保存在widget.options;src/lib/litegraph/src/LGraphNode.ts 1937~2017行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 9. 节点5 · 输入音频(audio)
voice_demo.mp3按参考定义读取waveform/sample_rate;物理边8连audio,但当前旁路不能称音频已传入或已转写。
```json
"voice_demo.mp3"
```
类:LoadAudio;JSON类型:str;角色:scalar。
源位置:`/nodes/5/widgets_values/0`
定义默认:动态文件列表,无固定文件默认;单位:文件名
范围/条件:仅源保存引用,未读取/校验真实素材;本节点当前mode=4旁路
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [4] LoadAudio唯一后端输入audio及waveform/sample_rate;comfy_extras/nodes_audio.py 296~334行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 cef4ed75f71e6c67a919c1f77ce182f872eaa31d2494465cd0019a39f5a14422;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_audio.py
- [19] 事件模式BYPASS=4;非正常执行状态;src/lib/litegraph/src/types/globalEnums.ts 66~89行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 74d106cbe62141f86991cd50aea7c341462933c4a5d7c66dd26d3764cba7fbe8;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/types/globalEnums.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
- [17] 旁路输出寻找匹配输入;无匹配警告并返回undefined;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 268~294行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
- [18] 旁路同槽/精确类型/兼容类型选择顺序;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 345~374行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
#### 10. 节点5 · 音频播放器保存位置(audioUI)
官方AudioWidget追加audioUI并设widget.serialize=false,工作流保存/恢复会跳过它;API检查options.serialize是另一契约。源仍保存audioUI及upload两null,不能与官方恢复序列强制对齐;null的真实恢复归属与UE钩子顺序待核对,不当运行音频。
```json
null
```
类:LoadAudio;JSON类型:NoneType;角色:frontend。
源位置:`/nodes/5/widgets_values/1`
定义默认:前端DOM显示状态,非后端输入默认;单位:无(显示状态)
范围/条件:源保存null,不替换空串或默认
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [24] audioUI前端追加且widget.serialize=false;不是后端audio输入;src/extensions/core/uploadAudio.ts 91~165行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 11. 节点5 · 音频上传按钮保存位置(upload)
固定按钮构造空串、options.serialize=false,未设置widget.serialize=false;官方跳过audioUI后保存/恢复布局与源三项有差异,不能宣称两null已经恢复成功。仅按源声明控件位置记账,不执行上传。
```json
null
```
类:LoadAudio;JSON类型:NoneType;角色:frontend。
源位置:`/nodes/5/widgets_values/2`
定义默认:官方按钮构造空串;后端无upload参数;单位:无(按钮状态)
范围/条件:源保存null,不替换空串;options.serialize=false控制API
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [25] 音频上传按钮默认空串,options.serialize=false;null照源保留;src/extensions/core/uploadAudio.ts 192~267行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts
- [24] audioUI前端追加且widget.serialize=false;不是后端audio输入;src/extensions/core/uploadAudio.ts 91~165行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts
- [13] addWidget把options单独保存在widget.options;src/lib/litegraph/src/LGraphNode.ts 1937~2017行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 12. 节点6 · 输入视频(file)
video_wan_vace_inpainting_input_video.mp4按参考定义形成VIDEO;边5只到旁路的拆分节点7,未接TextGenerate.video。
```json
"video_wan_vace_inpainting_input_video.mp4"
```
类:LoadVideo;JSON类型:str;角色:scalar。
源位置:`/nodes/6/widgets_values/0`
定义默认:动态文件列表,无固定文件默认;单位:文件名
范围/条件:仅源保存引用,未读取/校验真实素材;本节点当前mode=4旁路
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [5] 视频加载与拆分为images/audio/fps,不等于接入生成器;comfy_extras/nodes_video.py 143~206行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 f9df658d6ea08838af7822d6698fe36c84ff20bc4ba340283f8322125e9dd2b3;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_video.py
- [19] 事件模式BYPASS=4;非正常执行状态;src/lib/litegraph/src/types/globalEnums.ts 66~89行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 74d106cbe62141f86991cd50aea7c341462933c4a5d7c66dd26d3764cba7fbe8;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/types/globalEnums.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
- [17] 旁路输出寻找匹配输入;无匹配警告并返回undefined;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 268~294行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
- [18] 旁路同槽/精确类型/兼容类型选择顺序;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 345~374行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
#### 13. 节点6 · 上传按钮保存占位(upload)
这是上传按钮的保存占位,不是另一份媒体输入、不是已上传证明。addWidget把serialize放在options,API阶段跳过;工作流保存/恢复另看widget.serialize。未在目标前端恢复或触发上传。
```json
"image"
```
类:LoadVideo;JSON类型:str;角色:frontend。
源位置:`/nodes/6/widgets_values/1`
定义默认:前端构造值image;后端无upload参数;单位:无(按钮状态)
范围/条件:源保存image原样;options.serialize=false不等于widget.serialize=false
源保存位置;节点当前mode=4。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [23] 上传按钮构造image占位,options.serialize=false;src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts 93~104行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c3c06c7bcdc56b2787368dc107fbd522d983466d244c0fdf724bae9ddd356f29;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts
- [13] addWidget把options单独保存在widget.options;src/lib/litegraph/src/LGraphNode.ts 1937~2017行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [12] 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 971~983行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 14. 节点1 · 文本请求(prompt)
原英文请求Describe the image, and transcribe the audio要求描述图片并转写音频,不证明旁路媒体实际输入。参考代码传给clip.tokenize;不生成新内容。
```json
"Describe the image, and transcribe the audio"
```
类:TextGenerate;JSON类型:str;角色:scalar。
源位置:`/nodes/8/widgets_values/0`
定义默认:空字符串;单位:文本
范围/条件:multiline、dynamic_prompts=True;本轮仅保存原文不执行
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
#### 15. 节点1 · 生成长度上限(max_length)
参考TextGenerate→Gemma4.generate→transformer逐token循环最多max_length步,遇stop_tokens提前结束;不是注释宣称的128K/256K上下文支持证明,也不承诺精度或实际输出长度。
```json
2048
```
类:TextGenerate;JSON类型:int;角色:scalar。
源位置:`/nodes/8/widgets_values/1`
定义默认:256;单位:新生成token步数上限,不是字数/秒/上下文窗口
范围/条件:schema 1~2048;当前2048
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [9] Gemma4向transformer传递max_length及采样值;comfy/text_encoders/gemma4.py 1239~1259行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 16. 节点1 · 采样模式(sampling_mode)
当前on使do_sample为true。前端动态setter创建sampling_mode限定名,required后optional,恢复按widget顺序消费;官方限定名sampling_mode.seed不满足裸seed自动控制条件,schema也未显式要求control_after_generate,因此此图12保存项不加fixed控制。官方契约只是参考,UE7.8/实际钩子顺序未知,不证明目标恢复或生成。
```json
"on"
```
类:TextGenerate;JSON类型:str;角色:scalar。
源位置:`/nodes/8/widgets_values/2`
定义默认:schema未显式default;首选on;单位:方式
范围/条件:on/off;on分支7子字段,off无子字段
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [11] 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 912~925行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
- [16] API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 68~155行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
#### 17. 节点1 · 温度(sampling_mode.temperature)
采样时logits除以温度;改变分布,不承诺更有创意或更准确。
```json
0.7
```
类:TextGenerate;JSON类型:float;角色:scalar。
源位置:`/nodes/8/widgets_values/3`
定义默认:0.7;单位:无量纲
范围/条件:0.01~2.0;step0.000001;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 18. 节点1 · Top K候选数(sampling_mode.top_k)
大于0仅保留top_k分数候选,0不执行该过滤;不等于输出词数。
```json
64
```
类:TextGenerate;JSON类型:int;角色:scalar。
源位置:`/nodes/8/widgets_values/4`
定义默认:64;单位:候选数
范围/条件:0~1000;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 19. 节点1 · Top P累计概率(sampling_mode.top_p)
小于1按排序累计概率过滤候选;与其他采样过滤共同生效,不承诺特定文本效果。
```json
0.95
```
类:TextGenerate;JSON类型:float;角色:scalar。
源位置:`/nodes/8/widgets_values/5`
定义默认:0.95;单位:无量纲
范围/条件:0~1;step0.01;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 20. 节点1 · 相对最小概率(sampling_mode.min_p)
大于0以过滤前最大概率乘min_p设门槛,低于门槛候选被屏蔽;不是绝对概率阈值。
```json
0.05
```
类:TextGenerate;JSON类型:float;角色:scalar。
源位置:`/nodes/8/widgets_values/6`
定义默认:0.05;单位:无量纲
范围/条件:0~1;step0.01;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 21. 节点1 · 重复惩罚(sampling_mode.repetition_penalty)
不为1时按已出现token对正负logits分别除/乘惩罚;schema含0并不保证所有值安全或输出质量。
```json
1.05
```
类:TextGenerate;JSON类型:float;角色:scalar。
源位置:`/nodes/8/widgets_values/7`
定义默认:1.05;单位:无量纲
范围/条件:0~5;step0.01;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 22. 节点1 · 采样随机种子(sampling_mode.seed)
当前0与schema默认相同;采样参考使用manual_seed(seed),不保证跨硬件/模型/版本可重复。限定名sampling_mode.seed不自动附加控制控件,本图不插入fixed。
```json
0
```
类:TextGenerate;JSON类型:int;角色:scalar。
源位置:`/nodes/8/widgets_values/8`
定义默认:0;单位:种子整数
范围/条件:0~18446744073709551615;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 23. 节点1 · 已出现词元惩罚(sampling_mode.presence_penalty)
源保存整数0(JSON int),与schema浮点默认0.0分列;非零时每个历史token减去该值,当前0不执行该惩罚,不据此推断实际文本。
```json
0
```
类:TextGenerate;JSON类型:int;角色:scalar。
源位置:`/nodes/8/widgets_values/9`
定义默认:0.0;单位:无量纲
范围/条件:0~5;step0.01;optional;仅on分支
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [20] 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 72~201行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
- [21] seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 52~88行;commit 6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
- [7] 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 851~937行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
#### 24. 节点1 · 思考模式(thinking)
当前false与默认相同;传给tokenize。Gemma4参考默认模板仅在thinking=true添加思考system段,跳过模板/自带模板等条件另行处理;false不保证模型无任何内部推理或特定输出。
```json
false
```
类:TextGenerate;JSON类型:bool;角色:scalar。
源位置:`/nodes/8/widgets_values/10`
定义默认:false(optional);单位:无(开关)
范围/条件:true/false;仅模型支持时有意义
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [8] Gemma4参考分词/媒体/模板条件;不证明本图实际媒体输入;comfy/text_encoders/gemma4.py 1060~1146行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py
#### 25. 节点1 · 使用内置模板(use_default_template)
当前true与默认相同,传skip_template=false。Gemma4参考若文本以<|turn>开头仍强制跳过模板;否则先用传入llama_template,再按媒体构造默认user/model段。当前原英文不以该标记开头,但模型文件未核对、媒体处于旁路,不据此承诺实际模板/转写/视频效果。
```json
true
```
类:TextGenerate;JSON类型:bool;角色:scalar。
源位置:`/nodes/8/widgets_values/11`
定义默认:true(optional advanced);单位:无(开关)
范围/条件:true/false;实际模型tokenizer条件适用
源保存位置;节点当前mode=0。固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。
依据:
- [6] TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 4~78行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
- [8] Gemma4参考分词/媒体/模板条件;不证明本图实际媒体输入;comfy/text_encoders/gemma4.py 1060~1146行;commit 52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py
### 零保存节点与源注释
7 GetVideoComponents:固定定义拆分VIDEO为images/audio/fps,零保存位置;当前mode=4旁路,三个出口均未接生成器,不产生已验证视频输入。
节点8,位置`/nodes/2/widgets_values/0`
源作者模型/存放路径/PR说明,仅文本保留;未访问外链或下载,不证明安装/兼容。
```text
Related PR: [#13376](https://github.com/Comfy-Org/ComfyUI/pull/13376)
## Model Links (for Local Users)
**text_encoders**
- [gemma4_e4b_it_fp8_scaled.safetensors](https://huggingface.co/Comfy-Org/gemma-4/resolve/main/text_encoders/gemma4_e4b_it_fp8_scaled.safetensors)
## Model Storage Location
```
📂 ComfyUI/
├── 📂 models/
│ └── 📂 text_encoders/
│ └── gemma4_e4b_it_fp8_scaled.safetensors
```
---
* Other model weights: https://huggingface.co/Comfy-Org/gemma-4/tree/main/text_encoders
## Report Issue
Note: Please update ComfyUI first ([guide](https://docs.comfy.org/installation/update_comfyui)) and prepare required models. Desktop/Cloud updates follow stable releases, so some nightly-supported models may not be available yet.
- Cannot run / runtime errors: [ComfyUI/issues](https://github.com/comfyanonymous/ComfyUI/issues)
- UI / frontend issues: [ComfyUI_frontend/issues](https://github.com/Comfy-Org/ComfyUI_frontend/issues)
- Workflow issues: [workflow_templates/issues](https://github.com/Comfy-Org/workflow_templates/issues)
```
节点9,位置`/nodes/3/widgets_values/0`
源作者能力宣传,包括128K/256K、视频、函数调用、多语言等;不是本图实测,不改变当前旁路/视频未接/模型未知限制。
```text
**Core Capabilities**
[Gemma 4](https://huggingface.co/google/gemma-4-E2B-it) models handle a broad range of tasks across text, vision, and audio. Key capabilities include:
+ **Thinking** – Built-in reasoning mode that lets the model think step-by-step before answering.
+ **Long Context** – Context windows of up to 128K tokens (E2B/E4B) and 256K tokens (26B A4B/31B).
+ **Image Understanding** – Object detection, Document/PDF parsing, screen and UI understanding, chart comprehension, OCR (including multilingual), handwriting recognition, and pointing. Images can be processed at variable aspect ratios and resolutions.
+ **Video Understanding** – Analyze video by processing sequences of frames.
+ **Interleaved Multimodal Input** – Freely mix text and images in any order within a single prompt.
+ **Function Calling** – Native support for structured tool use, enabling agentic workflows.
+ **Coding** – Code generation, completion, and correction.
+ **Multilingual** – Out-of-the-box support for 35+ languages, pre-trained on 140+ languages.
+ **Audio** (E2B and E4B only) – Automatic speech recognition (ASR) and speech-to-translated-text translation across multiple languages.
```
### 固定原件索引
0. CLIPLoader枚举、动态文件列表、设备和load_clip;nodes.py 第957~982行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
1. 按权重键识别Gemma4,不按文件名保证兼容;comfy/sd.py 第1304~1318行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py
2. Gemma4权重识别后选择模型与tokenizer;comfy/sd.py 第1453~1459行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py
3. LoadImage文件选择、IMAGE/MASK、读取与校验;nodes.py 第1681~1756行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
4. LoadAudio唯一后端输入audio及waveform/sample_rate;comfy_extras/nodes_audio.py 第296~334行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 cef4ed75f71e6c67a919c1f77ce182f872eaa31d2494465cd0019a39f5a14422;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_audio.py
5. 视频加载与拆分为images/audio/fps,不等于接入生成器;comfy_extras/nodes_video.py 第143~206行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 f9df658d6ea08838af7822d6698fe36c84ff20bc4ba340283f8322125e9dd2b3;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_video.py
6. TextGenerate完整schema、动态采样、tokenize/generate/decode;comfy_extras/nodes_textgen.py 第4~78行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
7. 逐token生成上限、采样过滤与惩罚、seed和提前终止;comfy/text_encoders/llama.py 第851~937行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py
8. Gemma4参考分词/媒体/模板条件;不证明本图实际媒体输入;comfy/text_encoders/gemma4.py 第1060~1146行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py
9. Gemma4向transformer传递max_length及采样值;comfy/text_encoders/gemma4.py 第1239~1259行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py
10. PreviewAny真实STRING返回及ui.text;输出节点;comfy_extras/nodes_preview_any.py 第9~47行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 2f1a458a82310bd1963ac716016680b5f54fa23779ef8de85b212d7130d39939;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_preview_any.py
11. 恢复按顺序消费保存值,跳过widget.serialize=false;src/lib/litegraph/src/LGraphNode.ts 第912~925行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
12. 工作流持久化检查widget.serialize;src/lib/litegraph/src/LGraphNode.ts 第971~983行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
13. addWidget把options单独保存在widget.options;src/lib/litegraph/src/LGraphNode.ts 第1937~2017行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts
14. 包装保留options与独立serialize属性;src/lib/litegraph/src/widgets/BaseWidget.ts 第155~194行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8ce6071649f79e5effee77a24b65d82fc02ffe0eb2cd103e9f74ef7f66860c65;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/BaseWidget.ts
15. 按钮包装为ButtonWidget,不把options.serialize改成widget.serialize;src/lib/litegraph/src/widgets/widgetMap.ts 第83~98行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 526314f151e509d744422fd078796b8da22c72f340eed9eba7f1f1102a94b34a;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/widgetMap.ts
16. API跳过旁路;options.serialize控制prompt;解析不到的连线不传入;src/utils/executionUtil.ts 第68~155行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts
17. 旁路输出寻找匹配输入;无匹配警告并返回undefined;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 第268~294行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
18. 旁路同槽/精确类型/兼容类型选择顺序;src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts 第345~374行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts
19. 事件模式BYPASS=4;非正常执行状态;src/lib/litegraph/src/types/globalEnums.ts 第66~89行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 74d106cbe62141f86991cd50aea7c341462933c4a5d7c66dd26d3764cba7fbe8;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/types/globalEnums.ts
20. 动态on子控件使用sampling_mode限定名、required后optional及setter重建;src/core/graph/widgets/dynamicWidgets.ts 第72~201行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts
21. seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件;src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts 第52~88行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts
22. 三个显示控件的顺序、serialize与options.serialize分别设置;src/extensions/core/previewAny.ts 第19~97行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 0ad96628fd56a432adcb29ee72fbd9a7e28dde0863a37db383b5d302790d1b4d;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/previewAny.ts
23. 上传按钮构造image占位,options.serialize=false;src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts 第93~104行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 c3c06c7bcdc56b2787368dc107fbd522d983466d244c0fdf724bae9ddd356f29;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts
24. audioUI前端追加且widget.serialize=false;不是后端audio输入;src/extensions/core/uploadAudio.ts 第91~165行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts
25. 音频上传按钮默认空串,options.serialize=false;null照源保留;src/extensions/core/uploadAudio.ts 第192~267行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts
26. MarkdownNote为前端注释;src/extensions/core/noteNode.ts 第1~84行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 1014f719e3d67d9c5183a5e8631d4c2d6581dfe67083f32eb23774ec3074bef2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/noteNode.ts
27. LoadImage/CLIPLoader静态注册;nodes.py 第2010~2055行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
28. 音频/视频/PreviewAny/TextGenerate内置模块清单;不证明目标安装;nodes.py 第2370~2425行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py
29. TextGenerate扩展注册;comfy_extras/nodes_textgen.py 第174~184行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py
30. LoadVideo/GetVideoComponents扩展注册;comfy_extras/nodes_video.py 第260~273行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 f9df658d6ea08838af7822d6698fe36c84ff20bc4ba340283f8322125e9dd2b3;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_video.py
31. LoadAudio扩展注册;comfy_extras/nodes_audio.py 第768~794行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 cef4ed75f71e6c67a919c1f77ce182f872eaa31d2494465cd0019a39f5a14422;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_audio.py
32. DynamicCombo选项与嵌套输入schema转换;comfy_api/latest/_io.py 第1098~1180行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 c7c7b82f81f47c2a72f1c5b386043944006e3049cbbd20602d0fee296fe5bb22;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_api/latest/_io.py
33. 固定官方原件GPL-3.0许可文本;只读未安装/执行;LICENSE 第1~8行;提交52976f3ea33cc2312c7b5a32e1c7510b203eefb6;SHA256 3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986;https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/LICENSE
34. 固定官方原件GPL-3.0许可文本;只读未安装/执行;LICENSE 第1~8行;提交6a207bb52a887b1a70fbf654641ebc57710f97c7;SHA256 3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986;https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/LICENSE
@@ -0,0 +1,2 @@
__pycache__/
*.py[cod]
@@ -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,726 @@
{
"base": "9dac1b42848860bbf466763507ce293777162224",
"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_thirteen_blocks_unchanged": true,
"drawer_css_unchanged": true,
"conversion_rerun": false,
"profiles_28_candidates_9_diffs_6": "unchanged"
}
@@ -0,0 +1,21 @@
{
"pass_assertions": 1496,
"local_api_gets": 60,
"non_assertion_records": {
"font_css_intercepted_locally": 1,
"screenshots": 38
},
"viewports": [
1440,
390
],
"errors": [],
"node_check_exit": 0,
"browser_supervisor_exit": 0,
"owned_services_stopped": true,
"visual_inspection": [
"1440-19-default.png",
"390-19-default.png"
],
"visual_result": "中文概要与旁路/视频未接限制可读,未见明显遮挡/横向溢出。"
}
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,626 @@
"""Source-bound editorial reference; no upstream execution or media access."""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
REPO = Path(__file__).resolve().parents[3]
OUT = Path(__file__).resolve().parent
PATHS = [
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/"
"提示词生成与反推/gemma4_提示词反推(图像视频音频).json"
]
CORE = "52976f3ea33cc2312c7b5a32e1c7510b203eefb6"
FRONT = "6a207bb52a887b1a70fbf654641ebc57710f97c7"
def canonical(value):
return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode()
def build(index=0):
path = PATHS[index]
raw = (REPO / path).read_bytes()
source = json.loads(raw)
refs = []
def ref(repo, file, start, end, claim):
base = OUT.parent / "gemma-reference"
entry = next(
e
for e in json.loads((base / "sources.json").read_bytes())["sources"]
if e["id"] == repo and e["file"] == file
)
data = (base / entry["local_file"]).read_bytes()
assert hashlib.sha256(data).hexdigest() == entry["sha256"]
assert 1 <= start <= end <= len(data.decode().splitlines())
refs.append(
{
**entry,
"local_file": "../gemma-reference/" + entry["local_file"],
"lines": [start, end],
"claim": claim,
}
)
return len(refs) - 1
def core(file, start, end, claim):
return ref("ComfyUI", file, start, end, claim)
def front(file, start, end, claim):
return ref("ComfyUI_frontend", file, start, end, claim)
loader = core("nodes.py", 957, 982, "CLIPLoader枚举、动态文件列表、设备和load_clip")
detect = core("comfy/sd.py", 1304, 1318, "按权重键识别Gemma4,不按文件名保证兼容")
select = core("comfy/sd.py", 1453, 1459, "Gemma4权重识别后选择模型与tokenizer")
image = core("nodes.py", 1681, 1756, "LoadImage文件选择、IMAGE/MASK、读取与校验")
audio = core(
"comfy_extras/nodes_audio.py", 296, 334, "LoadAudio唯一后端输入audio及waveform/sample_rate"
)
video = core(
"comfy_extras/nodes_video.py",
143,
206,
"视频加载与拆分为images/audio/fps,不等于接入生成器",
)
text = core(
"comfy_extras/nodes_textgen.py",
4,
78,
"TextGenerate完整schema、动态采样、tokenize/generate/decode",
)
generation = core(
"comfy/text_encoders/llama.py", 851, 937, "逐token生成上限、采样过滤与惩罚、seed和提前终止"
)
template = core(
"comfy/text_encoders/gemma4.py",
1060,
1146,
"Gemma4参考分词/媒体/模板条件;不证明本图实际媒体输入",
)
bridge = core(
"comfy/text_encoders/gemma4.py", 1239, 1259, "Gemma4向transformer传递max_length及采样值"
)
preview = core(
"comfy_extras/nodes_preview_any.py", 9, 47, "PreviewAny真实STRING返回及ui.text;输出节点"
)
restore = front(
"src/lib/litegraph/src/LGraphNode.ts",
912,
925,
"恢复按顺序消费保存值,跳过widget.serialize=false",
)
persist = front(
"src/lib/litegraph/src/LGraphNode.ts", 971, 983, "工作流持久化检查widget.serialize"
)
add_widget = front(
"src/lib/litegraph/src/LGraphNode.ts",
1937,
2017,
"addWidget把options单独保存在widget.options",
)
front(
"src/lib/litegraph/src/widgets/BaseWidget.ts",
155,
194,
"包装保留options与独立serialize属性",
)
front(
"src/lib/litegraph/src/widgets/widgetMap.ts",
83,
98,
"按钮包装为ButtonWidget,不把options.serialize改成widget.serialize",
)
execute = front(
"src/utils/executionUtil.ts",
68,
155,
"API跳过旁路;options.serialize控制prompt;解析不到的连线不传入",
)
bypass = front(
"src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
268,
294,
"旁路输出寻找匹配输入;无匹配警告并返回undefined",
)
match = front(
"src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
345,
374,
"旁路同槽/精确类型/兼容类型选择顺序",
)
modes = front(
"src/lib/litegraph/src/types/globalEnums.ts", 66, 89, "事件模式BYPASS=4;非正常执行状态"
)
dynamic = front(
"src/core/graph/widgets/dynamicWidgets.ts",
72,
201,
"动态on子控件使用sampling_mode限定名、required后optional及setter重建",
)
integer = front(
"src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts",
52,
88,
"seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件",
)
preview_ui = front(
"src/extensions/core/previewAny.ts",
19,
97,
"三个显示控件的顺序、serialize与options.serialize分别设置",
)
upload_image = front(
"src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts",
93,
104,
"上传按钮构造image占位,options.serialize=false",
)
audio_ui = front(
"src/extensions/core/uploadAudio.ts",
91,
165,
"audioUI前端追加且widget.serialize=false;不是后端audio输入",
)
upload_audio = front(
"src/extensions/core/uploadAudio.ts",
192,
267,
"音频上传按钮默认空串,options.serialize=false;null照源保留",
)
note = front("src/extensions/core/noteNode.ts", 1, 84, "MarkdownNote为前端注释")
core("nodes.py", 2010, 2055, "LoadImage/CLIPLoader静态注册")
core("nodes.py", 2370, 2425, "音频/视频/PreviewAny/TextGenerate内置模块清单;不证明目标安装")
core("comfy_extras/nodes_textgen.py", 174, 184, "TextGenerate扩展注册")
core("comfy_extras/nodes_video.py", 260, 273, "LoadVideo/GetVideoComponents扩展注册")
core("comfy_extras/nodes_audio.py", 768, 794, "LoadAudio扩展注册")
core("comfy_api/latest/_io.py", 1098, 1180, "DynamicCombo选项与嵌套输入schema转换")
for repo in ["ComfyUI", "ComfyUI_frontend"]:
ref(repo, "LICENSE", 1, 8, "固定官方原件GPL-3.0许可文本;只读未安装/执行")
specs = {}
def spec(cls, name, label, typ, default, unit, limits, effect, evidence, role="scalar"):
specs[cls, name] = dict(
field=name,
label=label,
type=typ,
schema_default=default,
unit=unit,
limits=limits,
effect=effect,
evidence=evidence,
role=role,
)
spec(
"CLIPLoader",
"clip_name",
"文本编码模型文件",
"COMBO",
"动态text_encoders文件列表,无固定默认",
"文件名",
"以目标目录实际列表为准;未检查权重或安装",
"当前保存gemma4_e4b_it_fp8_scaled.safetensors。文件名、models记录和下载URL仅源引用,"
"不证明存在、精度、安装或可运行;未访问模型链接或下载权重。",
[loader, detect, select],
)
spec(
"CLIPLoader",
"type",
"加载类型",
"COMBO",
"schema未显式default;首选stable_diffusion;函数默认同名",
"类别",
"stable_diffusion/stable_cascade/sd3"
"/stable_audio/mochi/ltxv/pixart/cos"
"mos/lumina2/"
"wan/hidream/chroma/ace/omnigen2/qwe"
"n_image/hunyuan_image/flux2/ovis/lo"
"ngcat_image/cogvideox",
"原值stable_diffusion保留;代码转为CLIPType并按实际state_dict键识别Gemma4分支,"
"不是凭文件名判断。未读取权重,不能证明本文件会被识别/兼容,不能据Gemma名字改type。",
[loader, detect, select],
)
spec(
"CLIPLoader",
"device",
"加载设备",
"COMBO",
"schema首选default;函数默认default",
"设备选择",
"default/cpu;optional advanced",
"当前default交给正常设备管理;cpu分支同时设置load_device与offload_device为CPU。"
"这不证明目标GPU/内存配置、速度或模型实际驻留。",
[loader],
)
for cls, field, label, ev in [
("LoadImage", "image", "输入图片", image),
("LoadAudio", "audio", "输入音频", audio),
("LoadVideo", "file", "输入视频", video),
]:
spec(
cls,
field,
label,
"COMBO",
"动态文件列表,无固定文件默认",
"文件名",
"仅源保存引用,未读取/校验真实素材;本节点当前mode=4旁路",
{
"LoadImage": "the_lily_veil.png按固定定义可解码为IMAGE/MAS"
"K,MASK未接;物理边7连生成器image,但当前旁路不能称图片已传"
"入。",
"LoadAudio": "voice_demo.mp3按参考定义读取waveform/sampl"
"e_rate;物理边8连audio,但当前旁路不能称音频已传入或已转写"
"。",
"LoadVideo": "video_wan_vace_inpainting_input_vid"
"eo.mp4按参考定义形成VIDEO;边5只到旁路的拆分节点7,未接T"
"extGenerate.video。",
}[cls],
[ev, modes, execute, bypass, match],
)
for cls in ["LoadImage", "LoadVideo"]:
spec(
cls,
"upload",
"上传按钮保存占位",
"IMAGEUPLOAD",
"前端构造值image;后端无upload参数",
"无(按钮状态)",
"源保存image原样;options.serialize=false不等于widget.serialize=false",
"这是上传按钮的保存占位,不是另一份媒体输入、不是已上传证明。addWidget把serialize放在options,"
"API阶段跳过;工作流保存/恢复另看widget.serialize。未在目标前端恢复或触发上传。",
[upload_image, add_widget, restore, persist, execute],
"frontend",
)
spec(
"LoadAudio",
"audioUI",
"音频播放器保存位置",
"AUDIO_UI",
"前端DOM显示状态,非后端输入默认",
"无(显示状态)",
"源保存null,不替换空串或默认",
"官方AudioWidget追加audioUI并设widget.serialize=false,工作流保存/恢复会跳过它;"
"API检查options.serialize是另一契约。源仍保存audioUI及upload两null,不能与官方恢复序列强制对齐;"
"null的真实恢复归属与UE钩子顺序待核对,不当运行音频。",
[audio_ui, restore, persist, execute],
"frontend",
)
spec(
"LoadAudio",
"upload",
"音频上传按钮保存位置",
"AUDIOUPLOAD",
"官方按钮构造空串;后端无upload参数",
"无(按钮状态)",
"源保存null,不替换空串;options.serialize=false控制API",
"固定按钮构造空串、options.serialize=false,未设置widget.serialize=false;"
"官方跳过audioUI后保存/恢复布局与源三项有差异,不能宣称两null已经恢复成功。"
"仅按源声明控件位置记账,不执行上传。",
[upload_audio, audio_ui, add_widget, restore, persist, execute],
"frontend",
)
for field, label, default, effect in [
(
"preview_markdown",
"Markdown预览保存位置",
"前端显示缓存;后端无此输入默认",
"固定扩展先创建preview_markdown,widget.seri"
"alize与options.serialize均false,官方工作流"
"/API均跳过。",
),
(
"preview_text",
"纯文本预览保存位置",
"前端显示缓存;后端无此输入默认",
"固定扩展第二创建preview_text,widget.seriali"
"ze与options.serialize均false;仅显示执行返回u"
"i.text。",
),
(
"previewMode",
"预览显示方式保存位置",
"官方BOOLEAN默认false(Plaintext)",
"固定扩展第三创建previewMode,仅options.serial"
"ize=false,控制Markdown/Plaintext显示,不传"
"入API。",
),
]:
spec(
"PreviewAny",
field,
label,
"前端显示位置",
default,
"无(显示状态)",
"源原值null;不改为false/空串,不当模型输入",
effect + "源保存三个null而官方只持久化未禁用widget.serialize的显示切换;"
"这些名字仅依据源三位置与固定创建顺序作参考标注,不是三个null的可靠恢复映射。"
"UE及实际前端未知,布局差异待核对。固定后端独立声明RETURN_TYPES=(STRING,)并返回result,"
"此结论来自后端原件,不靠源UI出口倒推。",
[preview_ui, preview, restore, persist, execute],
"frontend",
)
spec(
"TextGenerate",
"prompt",
"文本请求",
"STRING",
"空字符串",
"文本",
"multiline、dynamic_prompts=True;本轮仅保存原文不执行",
"原英文请求Describe the image, and transcribe the audio要求描述图片并转写音频,"
"不证明旁路媒体实际输入。参考代码传给clip.tokenize;不生成新内容。",
[text],
)
spec(
"TextGenerate",
"max_length",
"生成长度上限",
"INT",
"256",
"新生成token步数上限,不是字数/秒/上下文窗口",
"schema 1~2048;当前2048",
"参考TextGenerate→Gemma4.generate→transformer逐token循环最多max_length步,"
"遇stop_tokens提前结束;不是注释宣称的128K/256K上下文支持证明,也不承诺精度或实际输出长度。",
[text, bridge, generation],
)
spec(
"TextGenerate",
"sampling_mode",
"采样模式",
"DYNAMICCOMBO",
"schema未显式default;首选on",
"方式",
"on/off;on分支7子字段,off无子字段",
"当前on使do_sample为true。前端动态setter创建sampling_mode限定名,required后optional,"
"恢复按widget顺序消费;官方限定名sampling_mode.seed不满足裸seed自动控制条件,"
"schema也未显式要求control_after_generate,因此此图12保存项不加fixed控制。"
"官方契约只是参考,UE7.8/实际钩子顺序未知,不证明目标恢复或生成。",
[text, dynamic, integer, restore, execute],
)
sampling = [
(
"temperature",
"温度",
"FLOAT",
"0.7",
"0.01~2.0;step0.000001",
"采样时logits除以温度;改变分布,不承诺更有创意或更准确。",
),
(
"top_k",
"Top K候选数",
"INT",
"64",
"0~1000",
"大于0仅保留top_k分数候选,0不执行该过滤;不等于输出词数。",
),
(
"top_p",
"Top P累计概率",
"FLOAT",
"0.95",
"0~1;step0.01",
"小于1按排序累计概率过滤候选;与其他采样过滤共同生效,不承诺特定文本效果。",
),
(
"min_p",
"相对最小概率",
"FLOAT",
"0.05",
"0~1;step0.01",
"大于0以过滤前最大概率乘min_p设门槛,低于门槛候选被屏蔽;不是绝对概率阈值。",
),
(
"repetition_penalty",
"重复惩罚",
"FLOAT",
"1.05",
"0~5;step0.01",
"不为1时按已出现token对正负logits分别除/乘惩罚;schema含0并不保证所有值安全或输出质量。",
),
(
"seed",
"采样随机种子",
"INT",
"0",
"0~18446744073709551615",
"当前0与schema默认相同;采样参考使用manual_seed(seed),不保证跨硬件/模型/版本可重复。"
"限定名sampling_mode.seed不自动附加控制控件,本图不插入fixed。",
),
(
"presence_penalty",
"已出现词元惩罚",
"FLOAT",
"0.0",
"0~5;step0.01;optional",
"源保存整数0(JSON int),与schema浮点默认0.0分列;非零时每个历史token减去该值,"
"当前0不执行该惩罚,不据此推断实际文本。",
),
]
for name, label, typ, default, limits, effect in sampling:
spec(
"TextGenerate",
"sampling_mode." + name,
label,
typ,
default,
"种子整数" if name == "seed" else "候选数" if name == "top_k" else "无量纲",
limits + ";仅on分支",
effect,
[text, dynamic, integer, generation],
)
spec(
"TextGenerate",
"thinking",
"思考模式",
"BOOLEAN",
"false(optional)",
"无(开关)",
"true/false;仅模型支持时有意义",
"当前false与默认相同;传给tokenize。Gemma4参考默认模板仅在thinking=true添加思考system段,"
"跳过模板/自带模板等条件另行处理;false不保证模型无任何内部推理或特定输出。",
[text, template],
)
spec(
"TextGenerate",
"use_default_template",
"使用内置模板",
"BOOLEAN",
"true(optional advanced)",
"无(开关)",
"true/false;实际模型tokenizer条件适用",
"当前true与默认相同,传skip_template=false。Gemma4参考若文本以<|turn>开头仍强制跳过模板;"
"否则先用传入llama_template,再按媒体构造默认user/model段。当前原英文不以该标记开头,"
"但模型文件未核对、媒体处于旁路,不据此承诺实际模板/转写/视频效果。",
[text, template],
)
names = {
"CLIPLoader": ["clip_name", "type", "device"],
"PreviewAny": ["preview_markdown", "preview_text", "previewMode"],
"LoadImage": ["image", "upload"],
"LoadAudio": ["audio", "audioUI", "upload"],
"LoadVideo": ["file", "upload"],
"GetVideoComponents": [],
"TextGenerate": ["prompt", "max_length", "sampling_mode"]
+ ["sampling_mode." + x[0] for x in sampling]
+ ["thinking", "use_default_template"],
}
fields, comments = [], []
for i, node in enumerate(source["nodes"]):
if node["type"] == "MarkdownNote":
comments.append(
dict(
node_id=str(node["id"]),
pointer=f"/nodes/{i}/widgets_values/0",
text=node["widgets_values"][0],
evidence=[note],
meaning=(
"源作者模型/存放路径/PR说明,仅文本保留;未访问外链或下载,不证明安装/兼容。"
if node["id"] == 8
else "源作者能力宣传,包括128K/256K、视频、函数调用、多语言等;"
"不是本图实测,"
"不改变当前旁路/视频未接/模型未知限制。"
),
)
)
continue
assert (
node["properties"]["cnr_id"] == "comfy-core" and node["properties"]["ver"] == "0.21.0"
)
assert len(names[node["type"]]) == len(node["widgets_values"])
for j, (name, value) in enumerate(
zip(names[node["type"]], node["widgets_values"], strict=True)
):
fields.append(
{
**specs[node["type"], name],
"node_id": str(node["id"]),
"definition_node_id": str(node["id"]),
"class_type": node["type"],
"scope": "root",
"pointer": f"/nodes/{i}/widgets_values/{j}",
"value": value,
"json_type": type(value).__name__,
"execution_note": f"源保存位置;节点当前mode={node['mode']}。"
"固定官方版本只作说明参考;UE7.8、目标安装与恢复/运行结果未知,不产prompt。",
}
)
assert len(fields) == 25 and len(comments) == 2
overview = (
"这张图保存了描述图片、转写音频的文本请求,并把生成文本接到预览。"
"但图片、音频、视频和视频拆分四个节点当前都在旁路,视频也未接到生成器;"
"不能直接当作可用的多模态反推流程。模型与素材未核对,转换仍关闭。"
)
flow = [
"用途与当前状态:原请求是Describe the image, and"
" transcribe the audio。模型加载3→文本生成1→文"
"本预览4是保存的主链;媒体输入不能按标题或注释当已接入执行。",
"五条物理边:link2为CLIP3槽0→TextGenerate1.c"
"lip;link3为Text1槽0→Preview4.source;"
"link5为Video6槽0→Components7.video;li"
"nk7为Image2槽0→Text1.image;link8为Audi"
"o5槽0→Text1.audio。",
"旁路限制:LoadImage2、LoadAudio5、LoadVide"
"o6、GetVideoComponents7均mode=4(BYPAS"
"S),其余5节点mode=0。"
"固定前端跳过旁路节点,resolveOutput先找匹配输入,无匹配则警告并返回undefined;未解析连线不写入API,"
"不是继续把该媒体文件送入模型。加载节点的文件/上传控件不能当IMAGE/AUDIO/VIDEO入口;未执行旁路转换或验证绕过。",
"视频未接:TextGenerate.video的link=null;C"
"omponents7.images的links=[]、audio/fp"
"s的links=null,"
"均未连到生成器。源标题与能力注释不能证明当前图有可用视频反推链。",
"模型:CLIP3保持gemma4_e4b_it_fp8_scaled."
"safetensors/stable_diffusion/defaul"
"t。"
"固定代码包含Gemma4权重键识别分支,不按文件名保证实际模型能力/兼"
"容/精度。下载URL、models记录和路径只是源文本,未访问媒体模型"
"链接。",
"12保存项:英文请求、2048、on、0.7、64、0.95、0.05、1.05、0、0、false、true。"
"限定名sampling_mode.seed不自动加fixed;源presence_penalty整数0与默认浮点0.0分别保留。"
"单位/范围只认固定schema与token生成循环,不将位置数当运行参数数。",
"预览与null:PreviewAny三null按固定创建顺序作参考位置;两缓存widget.serialize=false,"
"显示切换仅options.serialize=false,官方持久化序列与源三null不一致,实际恢复未知。"
"后端STRING返回来自固定RETURN_TYPES及result,不是由UI出口推断;null不替换默认。",
"上传与显示:LoadImage/LoadVideo的image是上传按"
"钮占位,options.serialize与widget.serial"
"ize分开;"
"LoadAudio的audioUI/upload两null不当音频输入,audioUI被官方持久化跳过造成布局差异,未强行恢复。",
"源注释8是模型路径/PR文本,注释9是能力宣传;128K/256K、函数调用、多语言等均未实测。"
"UE7.8空映射不证明无改写,官方tag/commit与许可不证明目标安装或钩子顺序,未导入执行上游。",
]
flow += ["源物理边:" + json.dumps(edge, ensure_ascii=False) for edge in source["links"]]
flow += [
f"源节点{n['id']} {n['type']}:mode={n['mode']};UE="
+ json.dumps(n["properties"]["ue_properties"], ensure_ascii=False)
for n in source["nodes"]
]
return dict(
source_path=path,
source_sha1=hashlib.sha1(raw).hexdigest(),
source_sha256=hashlib.sha256(raw).hexdigest(),
canonical_sha256=hashlib.sha256(canonical(source)).hexdigest(),
notice="固定版本参考说明;当前四媒体节点旁路且视频未接,目标环境与实际效果未核对,转换仍关闭。",
user_overview=overview,
versions=[
"源声明core0.21.0=" + CORE,
"源声明frontend1.43.18=" + FRONT,
"UE7.8身份/映射/钩子顺序与目标安装未知;只读固定官方原件,不证明兼容或升级可信注册。",
],
counts=dict(
saved_fields=25,
linked_saved_fields=0,
frontend_only=7,
source_notes=2,
source_nodes=9,
physical_edges=5,
final_scalars=0,
final_prompt_constructed=False,
),
fields=fields,
sources=refs,
comments=comments,
flow=flow,
flow_evidence=list(range(len(refs))),
zero_saved_nodes=[
dict(
node_id="7",
class_type="GetVideoComponents",
evidence=[video, execute, bypass, match],
effect="固定定义拆分VIDEO为images/audio/fps,零保存位置;当前mode=4旁路,三个出口均未接生成器,不产生已验证视频输入。",
)
],
steps=[
overview,
"先核对模型和素材引用、当前四处旁路和视频未接状态;本轮不改mode/连线、不读取媒体。",
"逐项查看当前值、定义默认、单位/范围和模板条件;显示缓存及上传占位不作运行输入。",
"实际恢复、模型安装与真实效果仍待核对;保持停用/未检查/未定稿/未实跑,不执行生成。",
],
)
@@ -0,0 +1,147 @@
[
{
"check": "tests",
"command": [
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"pytest",
"calliope-backend/tests/test_gemma_fixed_document.py",
"calliope-backend/tests/test_grid_fixed_document.py",
"calliope-backend/tests/test_background_fixed_document.py",
"calliope-backend/tests/test_qwen_edit_fixed_document.py",
"calliope-backend/tests/test_qwen_fixed_document.py",
"calliope-backend/tests/test_controlnet_fixed_document.py",
"calliope-backend/tests/test_asr_fixed_document.py",
"calliope-backend/tests/test_media_fixed_document.py",
"calliope-backend/tests/test_audio_fixed_document.py",
"calliope-backend/tests/test_fixed_document.py",
"calliope-backend/tests/test_workflow_library.py",
"calliope-backend/tests/test_supplied_companions.py",
"calliope-backend/tests/test_delivery_scope.py",
"calliope-backend/tests/test_case04_saved_reference.py",
"-q",
"--disable-warnings"
],
"exit_code": 0
},
{
"check": "tests-new",
"command": [
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"pytest",
"calliope-backend/tests/test_gemma_fixed_document.py",
"-q",
"--disable-warnings"
],
"exit_code": 0
},
{
"check": "lint",
"command": [
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"ruff",
"check",
"--config",
"calliope-backend/pyproject.toml",
"docs/hel-892/gemma-document-evidence/build_definition.py",
"docs/hel-892/gemma-document-evidence/rebuild.py",
"docs/hel-892/gemma-document-evidence/recompute.py",
"docs/hel-892/gemma-document-evidence/render_report.py",
"docs/hel-892/gemma-document-evidence/repeat.py",
"docs/hel-892/grid-document-evidence/build_definition.py",
"docs/hel-892/grid-document-evidence/rebuild.py",
"docs/hel-892/grid-document-evidence/recompute.py",
"docs/hel-892/grid-document-evidence/render_report.py",
"docs/hel-892/grid-document-evidence/repeat.py",
"calliope-backend/tests/test_gemma_fixed_document.py",
"calliope-backend/tests/test_grid_fixed_document.py",
"calliope-backend/tests/test_background_fixed_document.py",
"calliope-backend/tests/test_controlnet_fixed_document.py",
"calliope-backend/tests/test_qwen_edit_fixed_document.py",
"calliope-backend/src/calliope/comfyui/fixed_document.py",
"e2e/run-gemma-document.py"
],
"exit_code": 0
},
{
"check": "format",
"command": [
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"ruff",
"format",
"--config",
"calliope-backend/pyproject.toml",
"--check",
"docs/hel-892/gemma-document-evidence/build_definition.py",
"docs/hel-892/gemma-document-evidence/rebuild.py",
"docs/hel-892/gemma-document-evidence/recompute.py",
"docs/hel-892/gemma-document-evidence/render_report.py",
"docs/hel-892/gemma-document-evidence/repeat.py",
"docs/hel-892/grid-document-evidence/build_definition.py",
"docs/hel-892/grid-document-evidence/rebuild.py",
"docs/hel-892/grid-document-evidence/recompute.py",
"docs/hel-892/grid-document-evidence/render_report.py",
"docs/hel-892/grid-document-evidence/repeat.py",
"calliope-backend/tests/test_gemma_fixed_document.py",
"calliope-backend/tests/test_grid_fixed_document.py",
"calliope-backend/tests/test_background_fixed_document.py",
"calliope-backend/tests/test_controlnet_fixed_document.py",
"calliope-backend/tests/test_qwen_edit_fixed_document.py",
"calliope-backend/src/calliope/comfyui/fixed_document.py",
"e2e/run-gemma-document.py"
],
"exit_code": 0
},
{
"check": "build",
"command": [
"uv",
"build",
"--project",
"calliope-backend",
"--offline"
],
"exit_code": 0
},
{
"check": "recompute",
"command": [
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"python",
"docs/hel-892/gemma-document-evidence/recompute.py"
],
"exit_code": 0
},
{
"check": "repeatability",
"command": [
"uv",
"run",
"--project",
"calliope-backend",
"--offline",
"python",
"docs/hel-892/gemma-document-evidence/repeat.py"
],
"exit_code": 0
}
]
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,492 @@
[
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py",
"sha256": "a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe",
"local_file": "../gemma-reference/ComfyUI__nodes.py",
"lines": [
957,
982
],
"claim": "CLIPLoader枚举、动态文件列表、设备和load_clip"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/sd.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py",
"sha256": "737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e",
"local_file": "../gemma-reference/ComfyUI__comfy__sd.py",
"lines": [
1304,
1318
],
"claim": "按权重键识别Gemma4,不按文件名保证兼容"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/sd.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py",
"sha256": "737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e",
"local_file": "../gemma-reference/ComfyUI__comfy__sd.py",
"lines": [
1453,
1459
],
"claim": "Gemma4权重识别后选择模型与tokenizer"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py",
"sha256": "a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe",
"local_file": "../gemma-reference/ComfyUI__nodes.py",
"lines": [
1681,
1756
],
"claim": "LoadImage文件选择、IMAGE/MASK、读取与校验"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_audio.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_audio.py",
"sha256": "cef4ed75f71e6c67a919c1f77ce182f872eaa31d2494465cd0019a39f5a14422",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_audio.py",
"lines": [
296,
334
],
"claim": "LoadAudio唯一后端输入audio及waveform/sample_rate"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_video.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_video.py",
"sha256": "f9df658d6ea08838af7822d6698fe36c84ff20bc4ba340283f8322125e9dd2b3",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_video.py",
"lines": [
143,
206
],
"claim": "视频加载与拆分为images/audio/fps,不等于接入生成器"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_textgen.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py",
"sha256": "e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_textgen.py",
"lines": [
4,
78
],
"claim": "TextGenerate完整schema、动态采样、tokenize/generate/decode"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/text_encoders/llama.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py",
"sha256": "671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e",
"local_file": "../gemma-reference/ComfyUI__comfy__text_encoders__llama.py",
"lines": [
851,
937
],
"claim": "逐token生成上限、采样过滤与惩罚、seed和提前终止"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/text_encoders/gemma4.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py",
"sha256": "c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6",
"local_file": "../gemma-reference/ComfyUI__comfy__text_encoders__gemma4.py",
"lines": [
1060,
1146
],
"claim": "Gemma4参考分词/媒体/模板条件;不证明本图实际媒体输入"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/text_encoders/gemma4.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py",
"sha256": "c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6",
"local_file": "../gemma-reference/ComfyUI__comfy__text_encoders__gemma4.py",
"lines": [
1239,
1259
],
"claim": "Gemma4向transformer传递max_length及采样值"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_preview_any.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_preview_any.py",
"sha256": "2f1a458a82310bd1963ac716016680b5f54fa23779ef8de85b212d7130d39939",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_preview_any.py",
"lines": [
9,
47
],
"claim": "PreviewAny真实STRING返回及ui.text;输出节点"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/LGraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts",
"sha256": "a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__LGraphNode.ts",
"lines": [
912,
925
],
"claim": "恢复按顺序消费保存值,跳过widget.serialize=false"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/LGraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts",
"sha256": "a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__LGraphNode.ts",
"lines": [
971,
983
],
"claim": "工作流持久化检查widget.serialize"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/LGraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts",
"sha256": "a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__LGraphNode.ts",
"lines": [
1937,
2017
],
"claim": "addWidget把options单独保存在widget.options"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/widgets/BaseWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/BaseWidget.ts",
"sha256": "8ce6071649f79e5effee77a24b65d82fc02ffe0eb2cd103e9f74ef7f66860c65",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__widgets__BaseWidget.ts",
"lines": [
155,
194
],
"claim": "包装保留options与独立serialize属性"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/widgets/widgetMap.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/widgetMap.ts",
"sha256": "526314f151e509d744422fd078796b8da22c72f340eed9eba7f1f1102a94b34a",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__widgets__widgetMap.ts",
"lines": [
83,
98
],
"claim": "按钮包装为ButtonWidget,不把options.serialize改成widget.serialize"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/utils/executionUtil.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts",
"sha256": "67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33",
"local_file": "../gemma-reference/ComfyUI_frontend__src__utils__executionUtil.ts",
"lines": [
68,
155
],
"claim": "API跳过旁路;options.serialize控制prompt;解析不到的连线不传入"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"sha256": "c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__subgraph__ExecutableNodeDTO.ts",
"lines": [
268,
294
],
"claim": "旁路输出寻找匹配输入;无匹配警告并返回undefined"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"sha256": "c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__subgraph__ExecutableNodeDTO.ts",
"lines": [
345,
374
],
"claim": "旁路同槽/精确类型/兼容类型选择顺序"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/types/globalEnums.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/types/globalEnums.ts",
"sha256": "74d106cbe62141f86991cd50aea7c341462933c4a5d7c66dd26d3764cba7fbe8",
"local_file": "../gemma-reference/ComfyUI_frontend__src__lib__litegraph__src__types__globalEnums.ts",
"lines": [
66,
89
],
"claim": "事件模式BYPASS=4;非正常执行状态"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/core/graph/widgets/dynamicWidgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts",
"sha256": "5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6",
"local_file": "../gemma-reference/ComfyUI_frontend__src__core__graph__widgets__dynamicWidgets.ts",
"lines": [
72,
201
],
"claim": "动态on子控件使用sampling_mode限定名、required后optional及setter重建"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts",
"sha256": "8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02",
"local_file": "../gemma-reference/ComfyUI_frontend__src__renderer__extensions__vueNodes__widgets__composables__useIntWidget.ts",
"lines": [
52,
88
],
"claim": "seed控制仅裸名匹配或显式开启,限定名不自动添加fixed控件"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/previewAny.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/previewAny.ts",
"sha256": "0ad96628fd56a432adcb29ee72fbd9a7e28dde0863a37db383b5d302790d1b4d",
"local_file": "../gemma-reference/ComfyUI_frontend__src__extensions__core__previewAny.ts",
"lines": [
19,
97
],
"claim": "三个显示控件的顺序、serialize与options.serialize分别设置"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts",
"sha256": "c3c06c7bcdc56b2787368dc107fbd522d983466d244c0fdf724bae9ddd356f29",
"local_file": "../gemma-reference/ComfyUI_frontend__src__renderer__extensions__vueNodes__widgets__composables__useImageUploadWidget.ts",
"lines": [
93,
104
],
"claim": "上传按钮构造image占位,options.serialize=false"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/uploadAudio.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts",
"sha256": "5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178",
"local_file": "../gemma-reference/ComfyUI_frontend__src__extensions__core__uploadAudio.ts",
"lines": [
91,
165
],
"claim": "audioUI前端追加且widget.serialize=false;不是后端audio输入"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/uploadAudio.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts",
"sha256": "5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178",
"local_file": "../gemma-reference/ComfyUI_frontend__src__extensions__core__uploadAudio.ts",
"lines": [
192,
267
],
"claim": "音频上传按钮默认空串,options.serialize=false;null照源保留"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/noteNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/noteNode.ts",
"sha256": "1014f719e3d67d9c5183a5e8631d4c2d6581dfe67083f32eb23774ec3074bef2",
"local_file": "../gemma-reference/ComfyUI_frontend__src__extensions__core__noteNode.ts",
"lines": [
1,
84
],
"claim": "MarkdownNote为前端注释"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py",
"sha256": "a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe",
"local_file": "../gemma-reference/ComfyUI__nodes.py",
"lines": [
2010,
2055
],
"claim": "LoadImage/CLIPLoader静态注册"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py",
"sha256": "a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe",
"local_file": "../gemma-reference/ComfyUI__nodes.py",
"lines": [
2370,
2425
],
"claim": "音频/视频/PreviewAny/TextGenerate内置模块清单;不证明目标安装"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_textgen.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py",
"sha256": "e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_textgen.py",
"lines": [
174,
184
],
"claim": "TextGenerate扩展注册"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_video.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_video.py",
"sha256": "f9df658d6ea08838af7822d6698fe36c84ff20bc4ba340283f8322125e9dd2b3",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_video.py",
"lines": [
260,
273
],
"claim": "LoadVideo/GetVideoComponents扩展注册"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_audio.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_audio.py",
"sha256": "cef4ed75f71e6c67a919c1f77ce182f872eaa31d2494465cd0019a39f5a14422",
"local_file": "../gemma-reference/ComfyUI__comfy_extras__nodes_audio.py",
"lines": [
768,
794
],
"claim": "LoadAudio扩展注册"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_api/latest/_io.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_api/latest/_io.py",
"sha256": "c7c7b82f81f47c2a72f1c5b386043944006e3049cbbd20602d0fee296fe5bb22",
"local_file": "../gemma-reference/ComfyUI__comfy_api__latest___io.py",
"lines": [
1098,
1180
],
"claim": "DynamicCombo选项与嵌套输入schema转换"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"local_file": "../gemma-reference/ComfyUI__LICENSE",
"lines": [
1,
8
],
"claim": "固定官方原件GPL-3.0许可文本;只读未安装/执行"
},
{
"document": "example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json",
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"local_file": "../gemma-reference/ComfyUI_frontend__LICENSE",
"lines": [
1,
8
],
"claim": "固定官方原件GPL-3.0许可文本;只读未安装/执行"
}
]
@@ -0,0 +1 @@
17 files already formatted
@@ -0,0 +1,69 @@
{
"base": "9dac1b42848860bbf466763507ce293777162224",
"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": 25,
"new_notes": 2,
"old_saved": 351,
"old_notes": 11,
"overviews": 14,
"all_disabled": true,
"doc_done": 0,
"executed": 0
}
@@ -0,0 +1 @@
All checks passed!
@@ -0,0 +1 @@
PASS missing packages rejected: 缺少wheel/sdist包产物,请先在仓库根执行:uv build --project calliope-backend --offline
@@ -0,0 +1,23 @@
[
{
"file": "fixed_document.py",
"sha256": "a0566fa145906678b14e374797e3b0394817ba87d7e30a92b22fa4a26aac6708",
"wheel": true,
"sdist": true,
"definitions": 14
},
{
"file": "source_reviews.json",
"sha256": "71e37e443bee6f62f0106a141ab714f51ced572f23dcaf64ca3d84c337427701",
"wheel": true,
"sdist": true,
"definitions": 14
},
{
"file": "library.py",
"sha256": "b9cbfce28267642e6db3ebe9d591cf8dd260c7772a5a21a8d36cb98915eca13c",
"wheel": true,
"sdist": true,
"definitions": 14
}
]
@@ -0,0 +1,3 @@
{
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json": "a28ce8356253cf4de600eece7f4c5af0f1e765a9376e6e73a63b7ce8a6413989"
}
@@ -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 = "9dac1b42848860bbf466763507ce293777162224"
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 13 blocks unchanged")
if __name__ == "__main__":
main()
@@ -0,0 +1,324 @@
"""Actual 9dac1b4 database 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()
reference = OUT.parent / "gemma-reference"
identities = json.loads((reference / "identity.json").read_bytes())
source_records = json.loads((reference / "sources.json").read_bytes())["sources"]
for e in source_records:
assert hashlib.sha256((reference / e["local_file"]).read_bytes()).hexdigest() == e["sha256"]
assert len(e["commit"]) == 40 and e["commit"] in e["url"]
for e in identities:
tag = (reference / (e["repo"] + "-tag.json")).read_bytes()
commit = (reference / (e["repo"] + "-commit.json")).read_bytes()
assert hashlib.sha256(tag).hexdigest() == e["tag_sha256"]
assert hashlib.sha256(commit).hexdigest() == e["commit_record_sha256"]
assert json.loads(tag)["object"] == {
"sha": e["commit"],
"type": "commit",
"url": e["commit_url"],
}
assert json.loads(commit)["sha"] == e["commit"]
write(
"source-check.json",
dict(
fixed_originals=len(source_records),
tags_to_full_commits=identities,
checked_sha256=True,
imported_upstream=False,
),
)
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) == 13
assert all(rebuilt[p]["fixed_version_document"] == b for p, b in old_blocks.items())
write(
"review-delta.json",
dict(
base=BASE,
changed_paths=PATHS,
other_reviews_unchanged=len(previous) - 1,
old_blocks_unchanged=13,
old_saved=351,
old_notes=11,
new_saved=25,
new_notes=2,
total_documents=14,
total_saved=376,
total_notes=13,
),
)
for p, d in DEFINITIONS.items():
assert hashlib.sha256(canonical(rebuilt[p]["fixed_version_document"])).hexdigest() == d
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=25,
new_notes=2,
old_saved=351,
old_notes=11,
overviews=14,
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"
assert (REPO / ui).read_text().split("<style>")[1] == subprocess.check_output(
["git", "show", f"{BASE}:{ui}"], cwd=REPO
).decode().split("<style>")[1]
write(
"boundaries.json",
dict(
base=BASE,
files=kept,
originals=163,
old_thirteen_blocks_unchanged=True,
drawer_css_unchanged=True,
conversion_rerun=False,
profiles_28_candidates_9_diffs_6="unchanged",
),
)
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=14,
)
)
write("package-check.json", packages)
print(
(
"PASS actual 9dac1b4 upgrade1/skip154, "
"repeat155, rollback1, edits1/29cols, f"
"resh155, 1217/3660/294, 14 definitions"
", frozen boundaries, wheel/sdist"
)
)
if __name__ == "__main__":
main()
@@ -0,0 +1 @@
PASS actual 9dac1b4 upgrade1/skip154, repeat155, rollback1, edits1/29cols, fresh155, 1217/3660/294, 14 definitions, frozen boundaries, wheel/sdist
@@ -0,0 +1,111 @@
"""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 = [
"# Gemma多模态提示词图固定参考中文说明",
"",
"25新保存位置+2新注释;旧13图351保存位置+11注释逐对象不变。14图376位置+13注释展示,155定稿0、实跑0、新增转换0。",
"",
"复用SQLite来源库→正常GET详情→现有说明抽屉;仅新增source_reviews说明块和显式受信摘要,不改变转换/执行链。",
"",
]
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["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 / "Gemma多模态提示词图固定参考中文说明.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,49 @@
"""Repeat every deterministic audit and compare reviewed resource/package byte identities."""
from __future__ import annotations
import hashlib
import json
import subprocess
import sys
from build_definition import OUT, REPO, canonical
from rebuild import RESOURCE, build_all
def main():
a, overview = build_all()
b, again = build_all()
assert a == b and overview == again
assert a == json.loads((REPO / RESOURCE).read_bytes())
names = [
"audit-summary.json",
"review-delta.json",
"import-protection.json",
"boundaries.json",
"package-check.json",
"source-check.json",
]
subprocess.run([sys.executable, str(OUT / "recompute.py")], cwd=REPO, check=True)
before = {p: hashlib.sha256((OUT / p).read_bytes()).hexdigest() for p in names}
subprocess.run([sys.executable, str(OUT / "recompute.py")], cwd=REPO, check=True)
assert before == {p: hashlib.sha256((OUT / p).read_bytes()).hexdigest() for p in names}
(OUT / "repeatability.json").write_text(
json.dumps(
dict(
definitions=14,
repeated_build_equal=True,
repeated_audits_equal=True,
resource_sha256=hashlib.sha256(canonical(a)).hexdigest(),
artifacts=before,
),
ensure_ascii=False,
indent=2,
)
+ "\n"
)
print("PASS repeated 14 definitions and upgrade/audit/package recomputation: zero difference")
if __name__ == "__main__":
main()
@@ -0,0 +1,14 @@
{
"definitions": 14,
"repeated_build_equal": true,
"repeated_audits_equal": true,
"resource_sha256": "605c10f4846fa23c2875246bc74cfd5e6ab0254e4b67819b5f1b94893625801f",
"artifacts": {
"audit-summary.json": "b79c3f138241cc4c82f8530637349ec411fc8bd92de0668a07e2a88c4a2cbb7a",
"review-delta.json": "31ba518b1296b968fe7eee382baeecd3b755f823818bd4e205120e09eabb3d1e",
"import-protection.json": "912a5918f4a368c274d8cf6f455d3cca89914755207e85eb3f5370e0d5906127",
"boundaries.json": "158fefbfc835ab2c97780a1c85e158d58c71440680c794d8eed46579cc6de7af",
"package-check.json": "201d0d505714e4cd1bed324f214c745c6ac3eea7818a9193cdea3b8febe56b03",
"source-check.json": "597c410fdebbb5c1b6b6993a4208ca0a7c74063e4b81c596b2eeebca00f71b92"
}
}
@@ -0,0 +1,3 @@
PASS actual 9dac1b4 upgrade1/skip154, repeat155, rollback1, edits1/29cols, fresh155, 1217/3660/294, 14 definitions, frozen boundaries, wheel/sdist
PASS actual 9dac1b4 upgrade1/skip154, repeat155, rollback1, edits1/29cols, fresh155, 1217/3660/294, 14 definitions, frozen boundaries, wheel/sdist
PASS repeated 14 definitions and upgrade/audit/package recomputation: zero difference
@@ -0,0 +1,15 @@
{
"base": "9dac1b42848860bbf466763507ce293777162224",
"changed_paths": [
"example_ComfyUI_workflows/0-基础处理:图像合并-音频分离-视频截取合并-图像视频放大/提示词生成与反推/gemma4_提示词反推(图像视频音频).json"
],
"other_reviews_unchanged": 155,
"old_blocks_unchanged": 13,
"old_saved": 351,
"old_notes": 11,
"new_saved": 25,
"new_notes": 2,
"total_documents": 14,
"total_saved": 376,
"total_notes": 13
}
@@ -0,0 +1,29 @@
{
"fixed_originals": 31,
"tags_to_full_commits": [
{
"repo": "ComfyUI",
"tag": "v0.21.0",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"tag_url": "https://api.github.com/repos/Comfy-Org/ComfyUI/git/ref/tags/v0.21.0",
"tag_sha256": "4bedfdd986251d6195afba580c766f878a54a0c7f592b0400d458771c4c2ca0d",
"commit_url": "https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"commit_record_sha256": "1df87b74139dade5b68c409bb9148b7843559dbd3064d51f00461335ce1ade8b",
"license": "GPL-3.0 text preserved in fixed LICENSE",
"installed_or_executed": false
},
{
"repo": "ComfyUI_frontend",
"tag": "v1.43.18",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"tag_url": "https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/ref/tags/v1.43.18",
"tag_sha256": "57805d7d4b59a7e7428901bcbbbcde084cfb7e0cb23bd6e6bc33f384101fc440",
"commit_url": "https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/commits/6a207bb52a887b1a70fbf654641ebc57710f97c7",
"commit_record_sha256": "328323431968e88b85f3bfd4e9808b45a8647beac068bfdeb762769eafaf8f89",
"license": "GPL-3.0 text preserved in fixed LICENSE",
"installed_or_executed": false
}
],
"checked_sha256": true,
"imported_upstream": false
}
@@ -0,0 +1,5 @@
........................................................................ [ 30%]
........................................................................ [ 61%]
........................................................................ [ 92%]
.................. [100%]
234 passed, 1 warning in 0.39s
@@ -0,0 +1,33 @@
........................................................................ [ 3%]
........................................................................ [ 6%]
........................................................................ [ 9%]
........................................................................ [ 12%]
........................................................................ [ 16%]
........................................................................ [ 19%]
........................................................................ [ 22%]
........................................................................ [ 25%]
........................................................................ [ 28%]
........................................................................ [ 32%]
........................................................................ [ 35%]
........................................................................ [ 38%]
........................................................................ [ 41%]
........................................................................ [ 45%]
........................................................................ [ 48%]
........................................................................ [ 51%]
........................................................................ [ 54%]
........................................................................ [ 57%]
........................................................................ [ 61%]
........................................................................ [ 64%]
........................................................................ [ 67%]
........................................................................ [ 70%]
........................................................................ [ 73%]
........................................................................ [ 77%]
........................................................................ [ 80%]
........................................................................ [ 83%]
........................................................................ [ 86%]
........................................................................ [ 90%]
........................................................................ [ 93%]
........................................................................ [ 96%]
........................................................................ [ 99%]
........ [100%]
2240 passed, 1 warning in 14.71s
@@ -0,0 +1,30 @@
# 仓库根,既有锁定依赖,无新增依赖。
uv sync --project calliope-backend --frozen --extra dev --python 3.11 --offline
npm ci --prefix calliope-web --ignore-scripts --offline
python3 docs/hel-892/gemma-document-evidence/rebuild.py
python3 docs/hel-892/gemma-document-evidence/render_report.py
# tests exit=0
uv run --project calliope-backend --offline pytest calliope-backend/tests/test_gemma_fixed_document.py calliope-backend/tests/test_grid_fixed_document.py calliope-backend/tests/test_background_fixed_document.py calliope-backend/tests/test_qwen_edit_fixed_document.py calliope-backend/tests/test_qwen_fixed_document.py calliope-backend/tests/test_controlnet_fixed_document.py calliope-backend/tests/test_asr_fixed_document.py calliope-backend/tests/test_media_fixed_document.py calliope-backend/tests/test_audio_fixed_document.py calliope-backend/tests/test_fixed_document.py calliope-backend/tests/test_workflow_library.py calliope-backend/tests/test_supplied_companions.py calliope-backend/tests/test_delivery_scope.py calliope-backend/tests/test_case04_saved_reference.py -q --disable-warnings
# tests-new exit=0
uv run --project calliope-backend --offline pytest calliope-backend/tests/test_gemma_fixed_document.py -q --disable-warnings
# lint exit=0
uv run --project calliope-backend --offline ruff check --config calliope-backend/pyproject.toml docs/hel-892/gemma-document-evidence/build_definition.py docs/hel-892/gemma-document-evidence/rebuild.py docs/hel-892/gemma-document-evidence/recompute.py docs/hel-892/gemma-document-evidence/render_report.py docs/hel-892/gemma-document-evidence/repeat.py docs/hel-892/grid-document-evidence/build_definition.py docs/hel-892/grid-document-evidence/rebuild.py docs/hel-892/grid-document-evidence/recompute.py docs/hel-892/grid-document-evidence/render_report.py docs/hel-892/grid-document-evidence/repeat.py calliope-backend/tests/test_gemma_fixed_document.py calliope-backend/tests/test_grid_fixed_document.py calliope-backend/tests/test_background_fixed_document.py calliope-backend/tests/test_controlnet_fixed_document.py calliope-backend/tests/test_qwen_edit_fixed_document.py calliope-backend/src/calliope/comfyui/fixed_document.py e2e/run-gemma-document.py
# format exit=0
uv run --project calliope-backend --offline ruff format --config calliope-backend/pyproject.toml --check docs/hel-892/gemma-document-evidence/build_definition.py docs/hel-892/gemma-document-evidence/rebuild.py docs/hel-892/gemma-document-evidence/recompute.py docs/hel-892/gemma-document-evidence/render_report.py docs/hel-892/gemma-document-evidence/repeat.py docs/hel-892/grid-document-evidence/build_definition.py docs/hel-892/grid-document-evidence/rebuild.py docs/hel-892/grid-document-evidence/recompute.py docs/hel-892/grid-document-evidence/render_report.py docs/hel-892/grid-document-evidence/repeat.py calliope-backend/tests/test_gemma_fixed_document.py calliope-backend/tests/test_grid_fixed_document.py calliope-backend/tests/test_background_fixed_document.py calliope-backend/tests/test_controlnet_fixed_document.py calliope-backend/tests/test_qwen_edit_fixed_document.py calliope-backend/src/calliope/comfyui/fixed_document.py e2e/run-gemma-document.py
# build exit=0
uv build --project calliope-backend --offline
# recompute exit=0
uv run --project calliope-backend --offline python docs/hel-892/gemma-document-evidence/recompute.py
# repeatability exit=0
uv run --project calliope-backend --offline python docs/hel-892/gemma-document-evidence/repeat.py
node --check e2e/gemma-document.mjs
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-gemma-document.py
# 浏览只允许本地GET;字体CSS拦截后本地空响应;finally停止自建服务。
# 真实9dac1b4旧库:1updated/154skip/1excluded;重复155skip;回退1行精确恢复,再导1updated。
# 升级前后各1conflict/154skip、29列整行保护;其余154整行不变。
# 新库155import/1excluded,16pending_check/139needs_conversion;1217/3660/294;全部停用/未检查,定稿0/实跑0。
# 原图/收件163、28profiles/9候选hash/六配套差分与转换执行链冻结,不把候选称可靠转换。
# 上批lint.txt/format.txt原样保留;原命令纠正后日志lint-correction.txt/format-correction.txt,不倒写历史。
# 本轮前端产品文件未改;不重复全量前端检查,旧1错2警/ESLint缺配置仅沿用,未称绿。
# 未复跑全后台和转换组;5个既有失败仅历史记录,不加成本轮结果。
# recompute缺dist中文报错;定义/审计/包检查重复零差异,截图仅工单附件。
@@ -0,0 +1 @@
{"sha":"52976f3ea33cc2312c7b5a32e1c7510b203eefb6","node_id":"C_kwDOIygeJtoAKDUyOTc2ZjNlYTMzY2MyMzEyYzdiNWEzMmUxYzc1MTBiMjAzZWVmYjY","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/52976f3ea33cc2312c7b5a32e1c7510b203eefb6","html_url":"https://github.com/Comfy-Org/ComfyUI/commit/52976f3ea33cc2312c7b5a32e1c7510b203eefb6","author":{"name":"comfyanonymous","email":"comfyanonymous@protonmail.com","date":"2026-05-11T03:32:00Z"},"committer":{"name":"comfyanonymous","email":"comfyanonymous@protonmail.com","date":"2026-05-11T03:32:00Z"},"tree":{"sha":"8e9e2ec37271f54c419f7826111fca479a76c336","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/trees/8e9e2ec37271f54c419f7826111fca479a76c336"},"message":"ComfyUI v0.21.0","parents":[{"sha":"f505cb4070d197f8fc783938319cf49015548e80","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/f505cb4070d197f8fc783938319cf49015548e80","html_url":"https://github.com/Comfy-Org/ComfyUI/commit/f505cb4070d197f8fc783938319cf49015548e80"}],"verification":{"verified":false,"reason":"unsigned","signature":null,"payload":null,"verified_at":null}}
@@ -0,0 +1 @@
{"ref":"refs/tags/v0.21.0","node_id":"REF_kwDOIygeJrFyZWZzL3RhZ3MvdjAuMjEuMA","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/refs/tags/v0.21.0","object":{"sha":"52976f3ea33cc2312c7b5a32e1c7510b203eefb6","type":"commit","url":"https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/52976f3ea33cc2312c7b5a32e1c7510b203eefb6"}}
@@ -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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
from ._io import * # noqa: F403
@@ -0,0 +1,794 @@
from __future__ import annotations
import av
import torchaudio
import torch
import comfy.model_management
import folder_paths
import os
import hashlib
import node_helpers
import logging
from typing_extensions import override
from comfy_api.latest import ComfyExtension, IO, UI
class EmptyLatentAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="EmptyLatentAudio",
display_name="Empty Latent Audio",
category="latent/audio",
essentials_category="Audio",
inputs=[
IO.Float.Input("seconds", default=47.6, min=1.0, max=1000.0, step=0.1),
IO.Int.Input(
"batch_size", default=1, min=1, max=4096, tooltip="The number of latent images in the batch.",
),
],
outputs=[IO.Latent.Output()],
)
@classmethod
def execute(cls, seconds, batch_size) -> IO.NodeOutput:
length = round((seconds * 44100 / 2048) / 2) * 2
latent = torch.zeros([batch_size, 64, length], device=comfy.model_management.intermediate_device())
return IO.NodeOutput({"samples":latent, "type": "audio"})
generate = execute # TODO: remove
class ConditioningStableAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="ConditioningStableAudio",
category="conditioning",
inputs=[
IO.Conditioning.Input("positive"),
IO.Conditioning.Input("negative"),
IO.Float.Input("seconds_start", default=0.0, min=0.0, max=1000.0, step=0.1),
IO.Float.Input("seconds_total", default=47.0, min=0.0, max=1000.0, step=0.1),
],
outputs=[
IO.Conditioning.Output(display_name="positive"),
IO.Conditioning.Output(display_name="negative"),
],
)
@classmethod
def execute(cls, positive, negative, seconds_start, seconds_total) -> IO.NodeOutput:
positive = node_helpers.conditioning_set_values(positive, {"seconds_start": seconds_start, "seconds_total": seconds_total})
negative = node_helpers.conditioning_set_values(negative, {"seconds_start": seconds_start, "seconds_total": seconds_total})
return IO.NodeOutput(positive, negative)
append = execute # TODO: remove
class VAEEncodeAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="VAEEncodeAudio",
search_aliases=["audio to latent"],
display_name="VAE Encode Audio",
category="latent/audio",
inputs=[
IO.Audio.Input("audio"),
IO.Vae.Input("vae"),
],
outputs=[IO.Latent.Output()],
)
@classmethod
def execute(cls, vae, audio) -> IO.NodeOutput:
sample_rate = audio["sample_rate"]
vae_sample_rate = getattr(vae, "audio_sample_rate", 44100)
if vae_sample_rate != sample_rate:
waveform = torchaudio.functional.resample(audio["waveform"], sample_rate, vae_sample_rate)
else:
waveform = audio["waveform"]
t = vae.encode(waveform.movedim(1, -1))
return IO.NodeOutput({"samples": t})
encode = execute # TODO: remove
def vae_decode_audio(vae, samples, tile=None, overlap=None):
if tile is not None:
audio = vae.decode_tiled(samples["samples"], tile_x=tile, tile_y=tile, overlap=overlap).movedim(-1, 1)
else:
audio = vae.decode(samples["samples"]).movedim(-1, 1)
std = torch.std(audio, dim=[1, 2], keepdim=True) * 5.0
std[std < 1.0] = 1.0
audio /= std
vae_sample_rate = getattr(vae, "audio_sample_rate_output", getattr(vae, "audio_sample_rate", 44100))
return {"waveform": audio, "sample_rate": vae_sample_rate if "sample_rate" not in samples else samples["sample_rate"]}
class VAEDecodeAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="VAEDecodeAudio",
search_aliases=["latent to audio"],
display_name="VAE Decode Audio",
category="latent/audio",
inputs=[
IO.Latent.Input("samples"),
IO.Vae.Input("vae"),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, vae, samples) -> IO.NodeOutput:
return IO.NodeOutput(vae_decode_audio(vae, samples))
decode = execute # TODO: remove
class VAEDecodeAudioTiled(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="VAEDecodeAudioTiled",
search_aliases=["latent to audio"],
display_name="VAE Decode Audio (Tiled)",
category="latent/audio",
inputs=[
IO.Latent.Input("samples"),
IO.Vae.Input("vae"),
IO.Int.Input("tile_size", default=512, min=32, max=8192, step=8),
IO.Int.Input("overlap", default=64, min=0, max=1024, step=8),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, vae, samples, tile_size, overlap) -> IO.NodeOutput:
return IO.NodeOutput(vae_decode_audio(vae, samples, tile_size, overlap))
class SaveAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="SaveAudio",
search_aliases=["export flac"],
display_name="Save Audio (FLAC)",
category="audio",
essentials_category="Audio",
inputs=[
IO.Audio.Input("audio"),
IO.String.Input("filename_prefix", default="audio/ComfyUI"),
],
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, audio, filename_prefix="ComfyUI", format="flac") -> IO.NodeOutput:
return IO.NodeOutput(
ui=UI.AudioSaveHelper.get_save_audio_ui(audio, filename_prefix=filename_prefix, cls=cls, format=format)
)
save_flac = execute # TODO: remove
class SaveAudioMP3(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="SaveAudioMP3",
search_aliases=["export mp3"],
display_name="Save Audio (MP3)",
category="audio",
essentials_category="Audio",
inputs=[
IO.Audio.Input("audio"),
IO.String.Input("filename_prefix", default="audio/ComfyUI"),
IO.Combo.Input("quality", options=["V0", "128k", "320k"], default="V0"),
],
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, audio, filename_prefix="ComfyUI", format="mp3", quality="128k") -> IO.NodeOutput:
return IO.NodeOutput(
ui=UI.AudioSaveHelper.get_save_audio_ui(
audio, filename_prefix=filename_prefix, cls=cls, format=format, quality=quality
)
)
save_mp3 = execute # TODO: remove
class SaveAudioOpus(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="SaveAudioOpus",
search_aliases=["export opus"],
display_name="Save Audio (Opus)",
category="audio",
inputs=[
IO.Audio.Input("audio"),
IO.String.Input("filename_prefix", default="audio/ComfyUI"),
IO.Combo.Input("quality", options=["64k", "96k", "128k", "192k", "320k"], default="128k"),
],
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, audio, filename_prefix="ComfyUI", format="opus", quality="V3") -> IO.NodeOutput:
return IO.NodeOutput(
ui=UI.AudioSaveHelper.get_save_audio_ui(
audio, filename_prefix=filename_prefix, cls=cls, format=format, quality=quality
)
)
save_opus = execute # TODO: remove
class PreviewAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="PreviewAudio",
search_aliases=["play audio"],
display_name="Preview Audio",
category="audio",
inputs=[
IO.Audio.Input("audio"),
],
hidden=[IO.Hidden.prompt, IO.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, audio) -> IO.NodeOutput:
return IO.NodeOutput(ui=UI.PreviewAudio(audio, cls=cls))
save_flac = execute # TODO: remove
def f32_pcm(wav: torch.Tensor) -> torch.Tensor:
"""Convert audio to float 32 bits PCM format."""
if wav.dtype.is_floating_point:
return wav
elif wav.dtype == torch.int16:
return wav.float() / (2 ** 15)
elif wav.dtype == torch.int32:
return wav.float() / (2 ** 31)
raise ValueError(f"Unsupported wav dtype: {wav.dtype}")
def load(filepath: str) -> tuple[torch.Tensor, int]:
with av.open(filepath) as af:
if not af.streams.audio:
raise ValueError("No audio stream found in the file.")
stream = af.streams.audio[0]
sr = stream.codec_context.sample_rate
n_channels = stream.channels
frames = []
length = 0
for frame in af.decode(streams=stream.index):
buf = torch.from_numpy(frame.to_ndarray())
if buf.shape[0] != n_channels:
buf = buf.view(-1, n_channels).t()
frames.append(buf)
length += buf.shape[1]
if not frames:
raise ValueError("No audio frames decoded.")
wav = torch.cat(frames, dim=1)
wav = f32_pcm(wav)
return wav, sr
class LoadAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
input_dir = folder_paths.get_input_directory()
files = folder_paths.filter_files_content_types(os.listdir(input_dir), ["audio", "video"])
return IO.Schema(
node_id="LoadAudio",
search_aliases=["import audio", "open audio", "audio file"],
display_name="Load Audio",
category="audio",
essentials_category="Audio",
inputs=[
IO.Combo.Input("audio", upload=IO.UploadType.audio, options=sorted(files)),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio) -> IO.NodeOutput:
audio_path = folder_paths.get_annotated_filepath(audio)
waveform, sample_rate = load(audio_path)
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
return IO.NodeOutput(audio)
@classmethod
def fingerprint_inputs(cls, audio):
image_path = folder_paths.get_annotated_filepath(audio)
m = hashlib.sha256()
with open(image_path, 'rb') as f:
m.update(f.read())
return m.digest().hex()
@classmethod
def validate_inputs(cls, audio):
if not folder_paths.exists_annotated_filepath(audio):
return "Invalid audio file: {}".format(audio)
return True
load = execute # TODO: remove
class RecordAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="RecordAudio",
search_aliases=["microphone input", "audio capture", "voice input"],
display_name="Record Audio",
category="audio",
inputs=[
IO.Custom("AUDIO_RECORD").Input("audio"),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio) -> IO.NodeOutput:
audio_path = folder_paths.get_annotated_filepath(audio)
waveform, sample_rate = load(audio_path)
audio = {"waveform": waveform.unsqueeze(0), "sample_rate": sample_rate}
return IO.NodeOutput(audio)
load = execute # TODO: remove
class TrimAudioDuration(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="TrimAudioDuration",
search_aliases=["cut audio", "audio clip", "shorten audio"],
display_name="Trim Audio Duration",
description="Trim audio tensor into chosen time range.",
category="audio",
inputs=[
IO.Audio.Input("audio"),
IO.Float.Input(
"start_index",
default=0.0,
min=-0xffffffffffffffff,
max=0xffffffffffffffff,
step=0.01,
tooltip="Start time in seconds, can be negative to count from the end (supports sub-seconds).",
),
IO.Float.Input(
"duration",
default=60.0,
min=0.0,
step=0.01,
tooltip="Duration in seconds",
),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio, start_index, duration) -> IO.NodeOutput:
waveform = audio["waveform"]
sample_rate = audio["sample_rate"]
audio_length = waveform.shape[-1]
if start_index < 0:
start_frame = audio_length + int(round(start_index * sample_rate))
else:
start_frame = int(round(start_index * sample_rate))
start_frame = max(0, min(start_frame, audio_length - 1))
end_frame = start_frame + int(round(duration * sample_rate))
end_frame = max(0, min(end_frame, audio_length))
if start_frame >= end_frame:
raise ValueError("AudioTrim: Start time must be less than end time and be within the audio length.")
return IO.NodeOutput({"waveform": waveform[..., start_frame:end_frame], "sample_rate": sample_rate})
trim = execute # TODO: remove
class SplitAudioChannels(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="SplitAudioChannels",
search_aliases=["stereo to mono"],
display_name="Split Audio Channels",
description="Separates the audio into left and right channels.",
category="audio",
inputs=[
IO.Audio.Input("audio"),
],
outputs=[
IO.Audio.Output(display_name="left"),
IO.Audio.Output(display_name="right"),
],
)
@classmethod
def execute(cls, audio) -> IO.NodeOutput:
waveform = audio["waveform"]
sample_rate = audio["sample_rate"]
if waveform.shape[1] != 2:
raise ValueError("AudioSplit: Input audio has only one channel.")
left_channel = waveform[..., 0:1, :]
right_channel = waveform[..., 1:2, :]
return IO.NodeOutput({"waveform": left_channel, "sample_rate": sample_rate}, {"waveform": right_channel, "sample_rate": sample_rate})
separate = execute # TODO: remove
class JoinAudioChannels(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="JoinAudioChannels",
display_name="Join Audio Channels",
description="Joins left and right mono audio channels into a stereo audio.",
category="audio",
inputs=[
IO.Audio.Input("audio_left"),
IO.Audio.Input("audio_right"),
],
outputs=[
IO.Audio.Output(display_name="audio"),
],
)
@classmethod
def execute(cls, audio_left, audio_right) -> IO.NodeOutput:
waveform_left = audio_left["waveform"]
sample_rate_left = audio_left["sample_rate"]
waveform_right = audio_right["waveform"]
sample_rate_right = audio_right["sample_rate"]
if waveform_left.shape[1] != 1 or waveform_right.shape[1] != 1:
raise ValueError("AudioJoin: Both input audios must be mono.")
# Handle different sample rates by resampling to the higher rate
waveform_left, waveform_right, output_sample_rate = match_audio_sample_rates(
waveform_left, sample_rate_left, waveform_right, sample_rate_right
)
# Handle different lengths by trimming to the shorter length
length_left = waveform_left.shape[-1]
length_right = waveform_right.shape[-1]
if length_left != length_right:
min_length = min(length_left, length_right)
if length_left > min_length:
logging.info(f"JoinAudioChannels: Trimming left channel from {length_left} to {min_length} samples.")
waveform_left = waveform_left[..., :min_length]
if length_right > min_length:
logging.info(f"JoinAudioChannels: Trimming right channel from {length_right} to {min_length} samples.")
waveform_right = waveform_right[..., :min_length]
# Join the channels into stereo
left_channel = waveform_left[..., 0:1, :]
right_channel = waveform_right[..., 0:1, :]
stereo_waveform = torch.cat([left_channel, right_channel], dim=1)
return IO.NodeOutput({"waveform": stereo_waveform, "sample_rate": output_sample_rate})
def match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2):
if sample_rate_1 != sample_rate_2:
if sample_rate_1 > sample_rate_2:
waveform_2 = torchaudio.functional.resample(waveform_2, sample_rate_2, sample_rate_1)
output_sample_rate = sample_rate_1
logging.info(f"Resampling audio2 from {sample_rate_2}Hz to {sample_rate_1}Hz for merging.")
else:
waveform_1 = torchaudio.functional.resample(waveform_1, sample_rate_1, sample_rate_2)
output_sample_rate = sample_rate_2
logging.info(f"Resampling audio1 from {sample_rate_1}Hz to {sample_rate_2}Hz for merging.")
else:
output_sample_rate = sample_rate_1
return waveform_1, waveform_2, output_sample_rate
class AudioConcat(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="AudioConcat",
search_aliases=["join audio", "combine audio", "append audio"],
display_name="Audio Concat",
description="Concatenates the audio1 to audio2 in the specified direction.",
category="audio",
inputs=[
IO.Audio.Input("audio1"),
IO.Audio.Input("audio2"),
IO.Combo.Input(
"direction",
options=['after', 'before'],
default="after",
tooltip="Whether to append audio2 after or before audio1.",
)
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio1, audio2, direction) -> IO.NodeOutput:
waveform_1 = audio1["waveform"]
waveform_2 = audio2["waveform"]
sample_rate_1 = audio1["sample_rate"]
sample_rate_2 = audio2["sample_rate"]
if waveform_1.shape[1] == 1:
waveform_1 = waveform_1.repeat(1, 2, 1)
logging.info("AudioConcat: Converted mono audio1 to stereo by duplicating the channel.")
if waveform_2.shape[1] == 1:
waveform_2 = waveform_2.repeat(1, 2, 1)
logging.info("AudioConcat: Converted mono audio2 to stereo by duplicating the channel.")
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
if direction == 'after':
concatenated_audio = torch.cat((waveform_1, waveform_2), dim=2)
elif direction == 'before':
concatenated_audio = torch.cat((waveform_2, waveform_1), dim=2)
return IO.NodeOutput({"waveform": concatenated_audio, "sample_rate": output_sample_rate})
concat = execute # TODO: remove
class AudioMerge(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="AudioMerge",
search_aliases=["mix audio", "overlay audio", "layer audio"],
display_name="Audio Merge",
description="Combine two audio tracks by overlaying their waveforms.",
category="audio",
inputs=[
IO.Audio.Input("audio1"),
IO.Audio.Input("audio2"),
IO.Combo.Input(
"merge_method",
options=["add", "mean", "subtract", "multiply"],
tooltip="The method used to combine the audio waveforms.",
)
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio1, audio2, merge_method) -> IO.NodeOutput:
waveform_1 = audio1["waveform"]
waveform_2 = audio2["waveform"]
sample_rate_1 = audio1["sample_rate"]
sample_rate_2 = audio2["sample_rate"]
waveform_1, waveform_2, output_sample_rate = match_audio_sample_rates(waveform_1, sample_rate_1, waveform_2, sample_rate_2)
length_1 = waveform_1.shape[-1]
length_2 = waveform_2.shape[-1]
if length_2 > length_1:
logging.info(f"AudioMerge: Trimming audio2 from {length_2} to {length_1} samples to match audio1 length.")
waveform_2 = waveform_2[..., :length_1]
elif length_2 < length_1:
logging.info(f"AudioMerge: Padding audio2 from {length_2} to {length_1} samples to match audio1 length.")
pad_shape = list(waveform_2.shape)
pad_shape[-1] = length_1 - length_2
pad_tensor = torch.zeros(pad_shape, dtype=waveform_2.dtype, device=waveform_2.device)
waveform_2 = torch.cat((waveform_2, pad_tensor), dim=-1)
if merge_method == "add":
waveform = waveform_1 + waveform_2
elif merge_method == "subtract":
waveform = waveform_1 - waveform_2
elif merge_method == "multiply":
waveform = waveform_1 * waveform_2
elif merge_method == "mean":
waveform = (waveform_1 + waveform_2) / 2
max_val = waveform.abs().max()
if max_val > 1.0:
waveform = waveform / max_val
return IO.NodeOutput({"waveform": waveform, "sample_rate": output_sample_rate})
merge = execute # TODO: remove
class AudioAdjustVolume(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="AudioAdjustVolume",
search_aliases=["audio gain", "loudness", "audio level"],
display_name="Audio Adjust Volume",
category="audio",
inputs=[
IO.Audio.Input("audio"),
IO.Int.Input(
"volume",
default=1,
min=-100,
max=100,
tooltip="Volume adjustment in decibels (dB). 0 = no change, +6 = double, -6 = half, etc",
)
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio, volume) -> IO.NodeOutput:
if volume == 0:
return IO.NodeOutput(audio)
waveform = audio["waveform"]
sample_rate = audio["sample_rate"]
gain = 10 ** (volume / 20)
waveform = waveform * gain
return IO.NodeOutput({"waveform": waveform, "sample_rate": sample_rate})
adjust_volume = execute # TODO: remove
class EmptyAudio(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="EmptyAudio",
search_aliases=["blank audio"],
display_name="Empty Audio",
category="audio",
inputs=[
IO.Float.Input(
"duration",
default=60.0,
min=0.0,
max=0xffffffffffffffff,
step=0.01,
tooltip="Duration of the empty audio clip in seconds",
),
IO.Int.Input(
"sample_rate",
default=44100,
tooltip="Sample rate of the empty audio clip.",
min=1,
max=192000,
advanced=True,
),
IO.Int.Input(
"channels",
default=2,
min=1,
max=2,
tooltip="Number of audio channels (1 for mono, 2 for stereo).",
advanced=True,
),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, duration, sample_rate, channels) -> IO.NodeOutput:
num_samples = int(round(duration * sample_rate))
waveform = torch.zeros((1, channels, num_samples), dtype=torch.float32)
return IO.NodeOutput({"waveform": waveform, "sample_rate": sample_rate})
create_empty_audio = execute # TODO: remove
class AudioEqualizer3Band(IO.ComfyNode):
@classmethod
def define_schema(cls):
return IO.Schema(
node_id="AudioEqualizer3Band",
search_aliases=["eq", "bass boost", "treble boost", "equalizer"],
display_name="Audio Equalizer (3-Band)",
category="audio",
is_experimental=True,
inputs=[
IO.Audio.Input("audio"),
IO.Float.Input("low_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for Low frequencies (Bass)"),
IO.Int.Input("low_freq", default=100, min=20, max=500, tooltip="Cutoff frequency for Low shelf"),
IO.Float.Input("mid_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for Mid frequencies"),
IO.Int.Input("mid_freq", default=1000, min=200, max=4000, tooltip="Center frequency for Mids"),
IO.Float.Input("mid_q", default=0.707, min=0.1, max=10.0, step=0.1, tooltip="Q factor (bandwidth) for Mids"),
IO.Float.Input("high_gain_dB", default=0.0, min=-24.0, max=24.0, step=0.1, tooltip="Gain for High frequencies (Treble)"),
IO.Int.Input("high_freq", default=5000, min=1000, max=15000, tooltip="Cutoff frequency for High shelf"),
],
outputs=[IO.Audio.Output()],
)
@classmethod
def execute(cls, audio, low_gain_dB, low_freq, mid_gain_dB, mid_freq, mid_q, high_gain_dB, high_freq) -> IO.NodeOutput:
waveform = audio["waveform"]
sample_rate = audio["sample_rate"]
eq_waveform = waveform.clone()
# 1. Apply Low Shelf (Bass)
if low_gain_dB != 0:
eq_waveform = torchaudio.functional.bass_biquad(
eq_waveform,
sample_rate,
gain=low_gain_dB,
central_freq=float(low_freq),
Q=0.707
)
# 2. Apply Peaking EQ (Mids)
if mid_gain_dB != 0:
eq_waveform = torchaudio.functional.equalizer_biquad(
eq_waveform,
sample_rate,
center_freq=float(mid_freq),
gain=mid_gain_dB,
Q=mid_q
)
# 3. Apply High Shelf (Treble)
if high_gain_dB != 0:
eq_waveform = torchaudio.functional.treble_biquad(
eq_waveform,
sample_rate,
gain=high_gain_dB,
central_freq=float(high_freq),
Q=0.707
)
return IO.NodeOutput({"waveform": eq_waveform, "sample_rate": sample_rate})
class AudioExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[IO.ComfyNode]]:
return [
EmptyLatentAudio,
VAEEncodeAudio,
VAEDecodeAudio,
VAEDecodeAudioTiled,
SaveAudio,
SaveAudioMP3,
SaveAudioOpus,
LoadAudio,
PreviewAudio,
ConditioningStableAudio,
RecordAudio,
TrimAudioDuration,
SplitAudioChannels,
JoinAudioChannels,
AudioConcat,
AudioMerge,
AudioAdjustVolume,
EmptyAudio,
AudioEqualizer3Band,
]
async def comfy_entrypoint() -> AudioExtension:
return AudioExtension()
@@ -0,0 +1,47 @@
import json
from comfy.comfy_types.node_typing import IO
import torch
# Preview Any - original implement from
# https://github.com/rgthree/rgthree-comfy/blob/main/py/display_any.py
# upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes
class PreviewAny():
@classmethod
def INPUT_TYPES(cls):
return {
"required": {"source": (IO.ANY, {})},
}
RETURN_TYPES = (IO.STRING,)
FUNCTION = "main"
OUTPUT_NODE = True
CATEGORY = "utils"
SEARCH_ALIASES = ["show output", "inspect", "debug", "print value", "show text"]
def main(self, source=None):
torch.set_printoptions(edgeitems=6)
value = 'None'
if isinstance(source, str):
value = source
elif isinstance(source, (int, float, bool)):
value = str(source)
elif source is not None:
try:
value = json.dumps(source, indent=4)
except Exception:
try:
value = str(source)
except Exception:
value = 'source exists, but could not be serialized.'
torch.set_printoptions()
return {"ui": {"text": (value,)}, "result": (value,)}
NODE_CLASS_MAPPINGS = {
"PreviewAny": PreviewAny,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"PreviewAny": "Preview as Text",
}
@@ -0,0 +1,186 @@
from comfy_api.latest import ComfyExtension, io
from typing_extensions import override
class TextGenerate(io.ComfyNode):
@classmethod
def define_schema(cls):
# Define dynamic combo options for sampling mode
sampling_options = [
io.DynamicCombo.Option(
key="on",
inputs=[
io.Float.Input("temperature", default=0.7, min=0.01, max=2.0, step=0.000001),
io.Int.Input("top_k", default=64, min=0, max=1000),
io.Float.Input("top_p", default=0.95, min=0.0, max=1.0, step=0.01),
io.Float.Input("min_p", default=0.05, min=0.0, max=1.0, step=0.01),
io.Float.Input("repetition_penalty", default=1.05, min=0.0, max=5.0, step=0.01),
io.Int.Input("seed", default=0, min=0, max=0xffffffffffffffff),
io.Float.Input("presence_penalty", optional=True, default=0.0, min=0.0, max=5.0, step=0.01),
]
),
io.DynamicCombo.Option(
key="off",
inputs=[]
),
]
return io.Schema(
node_id="TextGenerate",
display_name="Generate Text",
category="text",
search_aliases=["LLM", "gemma"],
inputs=[
io.Clip.Input("clip"),
io.String.Input("prompt", multiline=True, dynamic_prompts=True, default=""),
io.Image.Input("image", optional=True),
io.Image.Input("video", optional=True, tooltip="Video frames as image batch. Assumed to be 24 FPS; subsampled to 1 FPS internally."),
io.Audio.Input("audio", optional=True),
io.Int.Input("max_length", default=256, min=1, max=2048),
io.DynamicCombo.Input("sampling_mode", options=sampling_options, display_name="Sampling Mode"),
io.Boolean.Input("thinking", optional=True, default=False, tooltip="Operate in thinking mode if the model supports it."),
io.Boolean.Input("use_default_template", optional=True, default=True, tooltip="Use the built in system prompt/template if the model has one.", advanced=True),
],
outputs=[
io.String.Output(display_name="generated_text"),
],
)
@classmethod
def execute(cls, clip, prompt, max_length, sampling_mode, image=None, thinking=False, use_default_template=True, video=None, audio=None) -> io.NodeOutput:
tokens = clip.tokenize(prompt, image=image, skip_template=not use_default_template, min_length=1, thinking=thinking, video=video, audio=audio)
# Get sampling parameters from dynamic combo
do_sample = sampling_mode.get("sampling_mode") == "on"
temperature = sampling_mode.get("temperature", 1.0)
top_k = sampling_mode.get("top_k", 50)
top_p = sampling_mode.get("top_p", 1.0)
min_p = sampling_mode.get("min_p", 0.0)
seed = sampling_mode.get("seed", None)
repetition_penalty = sampling_mode.get("repetition_penalty", 1.0)
presence_penalty = sampling_mode.get("presence_penalty", 0.0)
generated_ids = clip.generate(
tokens,
do_sample=do_sample,
max_length=max_length,
temperature=temperature,
top_k=top_k,
top_p=top_p,
min_p=min_p,
repetition_penalty=repetition_penalty,
presence_penalty=presence_penalty,
seed=seed
)
generated_text = clip.decode(generated_ids)
return io.NodeOutput(generated_text)
LTX2_T2V_SYSTEM_PROMPT = """You are a Creative Assistant. Given a user's raw input prompt describing a scene or concept, expand it into a detailed video generation prompt with specific visuals and integrated audio to guide a text-to-video model.
#### Guidelines
- Strictly follow all aspects of the user's raw input: include every element requested (style, visuals, motions, actions, camera movement, audio).
- If the input is vague, invent concrete details: lighting, textures, materials, scene settings, etc.
- For characters: describe gender, clothing, hair, expressions. DO NOT invent unrequested characters.
- Use active language: present-progressive verbs ("is walking," "speaking"). If no action specified, describe natural movements.
- Maintain chronological flow: use temporal connectors ("as," "then," "while").
- Audio layer: Describe complete soundscape (background audio, ambient sounds, SFX, speech/music when requested). Integrate sounds chronologically alongside actions. Be specific (e.g., "soft footsteps on tile"), not vague (e.g., "ambient sound is present").
- Speech (only when requested):
- For ANY speech-related input (talking, conversation, singing, etc.), ALWAYS include exact words in quotes with voice characteristics (e.g., "The man says in an excited voice: 'You won't believe what I just saw!'").
- Specify language if not English and accent if relevant.
- Style: Include visual style at the beginning: "Style: <style>, <rest of prompt>." Default to cinematic-realistic if unspecified. Omit if unclear.
- Visual and audio only: NO non-visual/auditory senses (smell, taste, touch).
- Restrained language: Avoid dramatic/exaggerated terms. Use mild, natural phrasing.
- Colors: Use plain terms ("red dress"), not intensified ("vibrant blue," "bright red").
- Lighting: Use neutral descriptions ("soft overhead light"), not harsh ("blinding light").
- Facial features: Use delicate modifiers for subtle features (i.e., "subtle freckles").
#### Important notes:
- Analyze the user's raw input carefully. In cases of FPV or POV, exclude the description of the subject whose POV is requested.
- Camera motion: DO NOT invent camera motion unless requested by the user.
- Speech: DO NOT modify user-provided character dialogue unless it's a typo.
- No timestamps or cuts: DO NOT use timestamps or describe scene cuts unless explicitly requested.
- Format: DO NOT use phrases like "The scene opens with...". Start directly with Style (optional) and chronological scene description.
- Format: DO NOT start your response with special characters.
- DO NOT invent dialogue unless the user mentions speech/talking/singing/conversation.
- If the user's raw input prompt is highly detailed, chronological and in the requested format: DO NOT make major edits or introduce new elements. Add/enhance audio descriptions if missing.
#### Output Format (Strict):
- Single continuous paragraph in natural language (English).
- NO titles, headings, prefaces, code fences, or Markdown.
- If unsafe/invalid, return original user prompt. Never ask questions or clarifications.
Your output quality is CRITICAL. Generate visually rich, dynamic prompts with integrated audio for high-quality video generation.
#### Example
Input: "A woman at a coffee shop talking on the phone"
Output:
Style: realistic with cinematic lighting. In a medium close-up, a woman in her early 30s with shoulder-length brown hair sits at a small wooden table by the window. She wears a cream-colored turtleneck sweater, holding a white ceramic coffee cup in one hand and a smartphone to her ear with the other. Ambient cafe sounds fill the space—espresso machine hiss, quiet conversations, gentle clinking of cups. The woman listens intently, nodding slightly, then takes a sip of her coffee and sets it down with a soft clink. Her face brightens into a warm smile as she speaks in a clear, friendly voice, 'That sounds perfect! I'd love to meet up this weekend. How about Saturday afternoon?' She laughs softly—a genuine chuckle—and shifts in her chair. Behind her, other patrons move subtly in and out of focus. 'Great, I'll see you then,' she concludes cheerfully, lowering the phone.
"""
LTX2_I2V_SYSTEM_PROMPT = """You are a Creative Assistant. Given a user's raw input prompt describing a scene or concept, expand it into a detailed video generation prompt with specific visuals and integrated audio to guide a text-to-video model.
You are a Creative Assistant writing concise, action-focused image-to-video prompts. Given an image (first frame) and user Raw Input Prompt, generate a prompt to guide video generation from that image.
#### Guidelines:
- Analyze the Image: Identify Subject, Setting, Elements, Style and Mood.
- Follow user Raw Input Prompt: Include all requested motion, actions, camera movements, audio, and details. If in conflict with the image, prioritize user request while maintaining visual consistency (describe transition from image to user's scene).
- Describe only changes from the image: Don't reiterate established visual details. Inaccurate descriptions may cause scene cuts.
- Active language: Use present-progressive verbs ("is walking," "speaking"). If no action specified, describe natural movements.
- Chronological flow: Use temporal connectors ("as," "then," "while").
- Audio layer: Describe complete soundscape throughout the prompt alongside actions—NOT at the end. Align audio intensity with action tempo. Include natural background audio, ambient sounds, effects, speech or music (when requested). Be specific (e.g., "soft footsteps on tile") not vague (e.g., "ambient sound").
- Speech (only when requested): Provide exact words in quotes with character's visual/voice characteristics (e.g., "The tall man speaks in a low, gravelly voice"), language if not English and accent if relevant. If general conversation mentioned without text, generate contextual quoted dialogue. (i.e., "The man is talking" input -> the output should include exact spoken words, like: "The man is talking in an excited voice saying: 'You won't believe what I just saw!' His hands gesture expressively as he speaks, eyebrows raised with enthusiasm. The ambient sound of a quiet room underscores his animated speech.")
- Style: Include visual style at beginning: "Style: <style>, <rest of prompt>." If unclear, omit to avoid conflicts.
- Visual and audio only: Describe only what is seen and heard. NO smell, taste, or tactile sensations.
- Restrained language: Avoid dramatic terms. Use mild, natural, understated phrasing.
#### Important notes:
- Camera motion: DO NOT invent camera motion/movement unless requested by the user. Make sure to include camera motion only if specified in the input.
- Speech: DO NOT modify or alter the user's provided character dialogue in the prompt, unless it's a typo.
- No timestamps or cuts: DO NOT use timestamps or describe scene cuts unless explicitly requested.
- Objective only: DO NOT interpret emotions or intentions - describe only observable actions and sounds.
- Format: DO NOT use phrases like "The scene opens with..." / "The video starts...". Start directly with Style (optional) and chronological scene description.
- Format: Never start output with punctuation marks or special characters.
- DO NOT invent dialogue unless the user mentions speech/talking/singing/conversation.
- Your performance is CRITICAL. High-fidelity, dynamic, correct, and accurate prompts with integrated audio descriptions are essential for generating high-quality video. Your goal is flawless execution of these rules.
#### Output Format (Strict):
- Single concise paragraph in natural English. NO titles, headings, prefaces, sections, code fences, or Markdown.
- If unsafe/invalid, return original user prompt. Never ask questions or clarifications.
#### Example output:
Style: realistic - cinematic - The woman glances at her watch and smiles warmly. She speaks in a cheerful, friendly voice, "I think we're right on time!" In the background, a café barista prepares drinks at the counter. The barista calls out in a clear, upbeat tone, "Two cappuccinos ready!" The sound of the espresso machine hissing softly blends with gentle background chatter and the light clinking of cups on saucers.
"""
class TextGenerateLTX2Prompt(TextGenerate):
@classmethod
def define_schema(cls):
parent_schema = super().define_schema()
return io.Schema(
node_id="TextGenerateLTX2Prompt",
display_name="Generate LTX2 Prompt",
category=parent_schema.category,
inputs=parent_schema.inputs,
outputs=parent_schema.outputs,
search_aliases=["prompt enhance", "LLM", "gemma"],
)
@classmethod
def execute(cls, clip, prompt, max_length, sampling_mode, image=None, thinking=False, use_default_template=True, video=None, audio=None) -> io.NodeOutput:
if image is None:
formatted_prompt = f"<start_of_turn>system\n{LTX2_T2V_SYSTEM_PROMPT.strip()}<end_of_turn>\n<start_of_turn>user\nUser Raw Input Prompt: {prompt}.<end_of_turn>\n<start_of_turn>model\n"
else:
formatted_prompt = f"<start_of_turn>system\n{LTX2_I2V_SYSTEM_PROMPT.strip()}<end_of_turn>\n<start_of_turn>user\n\n<image_soft_token>\n\nUser Raw Input Prompt: {prompt}.<end_of_turn>\n<start_of_turn>model\n"
return super().execute(clip, formatted_prompt, max_length, sampling_mode, image=image, thinking=thinking, use_default_template=use_default_template, video=video, audio=audio)
class TextgenExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
TextGenerate,
TextGenerateLTX2Prompt,
]
async def comfy_entrypoint() -> TextgenExtension:
return TextgenExtension()
@@ -0,0 +1,273 @@
from __future__ import annotations
import os
import av
import torch
import folder_paths
import json
from typing import Optional
from typing_extensions import override
from fractions import Fraction
from comfy_api.latest import ComfyExtension, io, ui, Input, InputImpl, Types
from comfy.cli_args import args
class SaveWEBM(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="SaveWEBM",
search_aliases=["export webm"],
display_name="Save WEBM",
category="video",
is_experimental=True,
inputs=[
io.Image.Input("images"),
io.String.Input("filename_prefix", default="ComfyUI"),
io.Combo.Input("codec", options=["vp9", "av1"]),
io.Float.Input("fps", default=24.0, min=0.01, max=1000.0, step=0.01),
io.Float.Input("crf", default=32.0, min=0, max=63.0, step=1, tooltip="Higher crf means lower quality with a smaller file size, lower crf means higher quality higher filesize."),
],
hidden=[io.Hidden.prompt, io.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, images, codec, fps, filename_prefix, crf) -> io.NodeOutput:
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
filename_prefix, folder_paths.get_output_directory(), images[0].shape[1], images[0].shape[0]
)
file = f"{filename}_{counter:05}_.webm"
container = av.open(os.path.join(full_output_folder, file), mode="w")
if cls.hidden.prompt is not None:
container.metadata["prompt"] = json.dumps(cls.hidden.prompt)
if cls.hidden.extra_pnginfo is not None:
for x in cls.hidden.extra_pnginfo:
container.metadata[x] = json.dumps(cls.hidden.extra_pnginfo[x])
codec_map = {"vp9": "libvpx-vp9", "av1": "libsvtav1"}
stream = container.add_stream(codec_map[codec], rate=Fraction(round(fps * 1000), 1000))
stream.width = images.shape[-2]
stream.height = images.shape[-3]
stream.pix_fmt = "yuv420p10le" if codec == "av1" else "yuv420p"
stream.bit_rate = 0
stream.options = {'crf': str(crf)}
if codec == "av1":
stream.options["preset"] = "6"
for frame in images:
frame = av.VideoFrame.from_ndarray(torch.clamp(frame[..., :3] * 255, min=0, max=255).to(device=torch.device("cpu"), dtype=torch.uint8).numpy(), format="rgb24")
for packet in stream.encode(frame):
container.mux(packet)
container.mux(stream.encode())
container.close()
return io.NodeOutput(ui=ui.PreviewVideo([ui.SavedResult(file, subfolder, io.FolderType.output)]))
class SaveVideo(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="SaveVideo",
search_aliases=["export video"],
display_name="Save Video",
category="video",
essentials_category="Basics",
description="Saves the input images to your ComfyUI output directory.",
inputs=[
io.Video.Input("video", tooltip="The video to save."),
io.String.Input("filename_prefix", default="video/ComfyUI", tooltip="The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes."),
io.Combo.Input("format", options=Types.VideoContainer.as_input(), default="auto", tooltip="The format to save the video as."),
io.Combo.Input("codec", options=Types.VideoCodec.as_input(), default="auto", tooltip="The codec to use for the video."),
],
hidden=[io.Hidden.prompt, io.Hidden.extra_pnginfo],
is_output_node=True,
)
@classmethod
def execute(cls, video: Input.Video, filename_prefix, format: str, codec) -> io.NodeOutput:
width, height = video.get_dimensions()
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(
filename_prefix,
folder_paths.get_output_directory(),
width,
height
)
saved_metadata = None
if not args.disable_metadata:
metadata = {}
if cls.hidden.extra_pnginfo is not None:
metadata.update(cls.hidden.extra_pnginfo)
if cls.hidden.prompt is not None:
metadata["prompt"] = cls.hidden.prompt
if len(metadata) > 0:
saved_metadata = metadata
file = f"{filename}_{counter:05}_.{Types.VideoContainer.get_extension(format)}"
video.save_to(
os.path.join(full_output_folder, file),
format=Types.VideoContainer(format),
codec=codec,
metadata=saved_metadata
)
return io.NodeOutput(ui=ui.PreviewVideo([ui.SavedResult(file, subfolder, io.FolderType.output)]))
class CreateVideo(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="CreateVideo",
search_aliases=["images to video"],
display_name="Create Video",
category="video",
description="Create a video from images.",
inputs=[
io.Image.Input("images", tooltip="The images to create a video from."),
io.Float.Input("fps", default=30.0, min=1.0, max=120.0, step=1.0),
io.Audio.Input("audio", optional=True, tooltip="The audio to add to the video."),
],
outputs=[
io.Video.Output(),
],
)
@classmethod
def execute(cls, images: Input.Image, fps: float, audio: Optional[Input.Audio] = None) -> io.NodeOutput:
return io.NodeOutput(
InputImpl.VideoFromComponents(Types.VideoComponents(images=images, audio=audio, frame_rate=Fraction(fps)))
)
class GetVideoComponents(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="GetVideoComponents",
search_aliases=["extract frames", "split video", "video to images", "demux"],
display_name="Get Video Components",
category="video",
description="Extracts all components from a video: frames, audio, and framerate.",
inputs=[
io.Video.Input("video", tooltip="The video to extract components from."),
],
outputs=[
io.Image.Output(display_name="images"),
io.Audio.Output(display_name="audio"),
io.Float.Output(display_name="fps"),
],
)
@classmethod
def execute(cls, video: Input.Video) -> io.NodeOutput:
components = video.get_components()
return io.NodeOutput(components.images, components.audio, float(components.frame_rate))
class LoadVideo(io.ComfyNode):
@classmethod
def define_schema(cls):
input_dir = folder_paths.get_input_directory()
files = [f for f in os.listdir(input_dir) if os.path.isfile(os.path.join(input_dir, f))]
files = folder_paths.filter_files_content_types(files, ["video"])
return io.Schema(
node_id="LoadVideo",
search_aliases=["import video", "open video", "video file"],
display_name="Load Video",
category="video",
essentials_category="Basics",
inputs=[
io.Combo.Input("file", options=sorted(files), upload=io.UploadType.video),
],
outputs=[
io.Video.Output(),
],
)
@classmethod
def execute(cls, file) -> io.NodeOutput:
video_path = folder_paths.get_annotated_filepath(file)
return io.NodeOutput(InputImpl.VideoFromFile(video_path))
@classmethod
def fingerprint_inputs(s, file):
video_path = folder_paths.get_annotated_filepath(file)
mod_time = os.path.getmtime(video_path)
# Instead of hashing the file, we can just use the modification time to avoid
# rehashing large files.
return mod_time
@classmethod
def validate_inputs(s, file):
if not folder_paths.exists_annotated_filepath(file):
return "Invalid video file: {}".format(file)
return True
class VideoSlice(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="Video Slice",
display_name="Video Slice",
search_aliases=[
"trim video duration",
"skip first frames",
"frame load cap",
"start time",
],
category="video",
essentials_category="Video Tools",
inputs=[
io.Video.Input("video"),
io.Float.Input(
"start_time",
default=0.0,
max=1e5,
min=-1e5,
step=0.001,
tooltip="Start time in seconds",
),
io.Float.Input(
"duration",
default=0.0,
min=0.0,
step=0.001,
tooltip="Duration in seconds, or 0 for unlimited duration",
),
io.Boolean.Input(
"strict_duration",
default=False,
tooltip="If True, when the specified duration is not possible, an error will be raised.",
),
],
outputs=[
io.Video.Output(),
],
)
@classmethod
def execute(cls, video: io.Video.Type, start_time: float, duration: float, strict_duration: bool) -> io.NodeOutput:
trimmed = video.as_trimmed(start_time, duration, strict_duration=strict_duration)
if trimmed is not None:
return io.NodeOutput(trimmed)
raise ValueError(
f"Failed to slice video:\nSource duration: {video.get_duration()}\nStart time: {start_time}\nTarget duration: {duration}"
)
class VideoExtension(ComfyExtension):
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
SaveWEBM,
SaveVideo,
CreateVideo,
GetVideoComponents,
LoadVideo,
VideoSlice,
]
async def comfy_entrypoint() -> VideoExtension:
return VideoExtension()
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
{"sha":"6a207bb52a887b1a70fbf654641ebc57710f97c7","node_id":"C_kwDOMIrOxtoAKDZhMjA3YmI1MmE4ODdiMWE3MGZiZjY1NDY0MWViYzU3NzEwZjk3Yzc","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/commits/6a207bb52a887b1a70fbf654641ebc57710f97c7","html_url":"https://github.com/Comfy-Org/ComfyUI_frontend/commit/6a207bb52a887b1a70fbf654641ebc57710f97c7","author":{"name":"Comfy Org PR Bot","email":"snomiao+comfy-pr@gmail.com","date":"2026-05-09T04:48:32Z"},"committer":{"name":"GitHub","email":"noreply@github.com","date":"2026-05-09T04:48:32Z"},"tree":{"sha":"a2867f4300a1eb98df082a4dc41be02b7d3d98ea","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/trees/a2867f4300a1eb98df082a4dc41be02b7d3d98ea"},"message":"1.43.18 (#12100)\n\nPatch version increment to 1.43.18\n\n**Base branch:** `core/1.43`\n\n┆Issue is synchronized with this [Notion\npage](https://www.notion.so/PR-12100-1-43-18-35b6d73d3650819daa52f361dabf0c8b)\nby [Unito](https://www.unito.io)\n\nCo-authored-by: dante01yoon <6510430+dante01yoon@users.noreply.github.com>","parents":[{"sha":"e9272bd48ae4a89172ff9c00af34e0adcb10f2dc","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/commits/e9272bd48ae4a89172ff9c00af34e0adcb10f2dc","html_url":"https://github.com/Comfy-Org/ComfyUI_frontend/commit/e9272bd48ae4a89172ff9c00af34e0adcb10f2dc"}],"verification":{"verified":true,"reason":"valid","signature":"-----BEGIN PGP SIGNATURE-----\n\nwsFcBAABCAAQBQJp/rygCRC1aQ7uu5UhlAAAOdIQAIffbIVUPNMRXAAqm5g27o42\nPbF5qcWnZ+pEj0fsJNSsuuzrvc7A7Tmd52tMuV4K+Apks/D7h3eJ+g16O/lOk2Ft\nVaRU+y6bwH4Mxae2zvnB265gaVzDjlXL99iO30tN4mDJpbxT4hKmngOkQODZjr+C\nLXgQUHgleudfL42P56SAffXeOPkyhHe1JuBBBx9VrsdLSaAWljebCJYn0omUKLWk\n+qc/Nln3AV0tLGx8y7KbmTgHHpbfMiGrEo3MsKUdue2OXWi3vX+pC20HQEUgS/rP\n0q1ATN94S1TG5ktIgJVBi4TLOi2836aTIexbLOzMex7ZUTen2mLj4xTLnjBPEZBh\nf2YJeQNcmIBRgIsMyZ0XhjoD64v+5jjOhpEOvv2F7lJKWXQUI/yFMRjndpYPdXw9\nUxvchLLO6ABoOthbVszEdLKt90eguFt3krSvKt1dUhsWO9BEdHq+0r6T47DTKkOB\nlBvwFeYrNP07MnNQc2JgbGDQYwDOOSCxI+Jgt3wlj3mgeup/DMG7qq13Cs7t5IR8\nCcTsFKwOsQYYL2i24EeDJLgOS/gZKqX0R4SESJ4GN8wdbU60klFGHx6O6GcAM4MJ\nbNsgrB+VrjG1lNMwVad/34due4ZfFpqosJwWBVQJMD/nBzT6CcAqaVM4oo477Tnu\nEwu3ejrPGvUH1QVudBUE\n=00aa\n-----END PGP SIGNATURE-----\n","payload":"tree a2867f4300a1eb98df082a4dc41be02b7d3d98ea\nparent e9272bd48ae4a89172ff9c00af34e0adcb10f2dc\nauthor Comfy Org PR Bot <snomiao+comfy-pr@gmail.com> 1778302112 +0900\ncommitter GitHub <noreply@github.com> 1778302112 +0900\n\n1.43.18 (#12100)\n\nPatch version increment to 1.43.18\n\n**Base branch:** `core/1.43`\n\n┆Issue is synchronized with this [Notion\npage](https://www.notion.so/PR-12100-1-43-18-35b6d73d3650819daa52f361dabf0c8b)\nby [Unito](https://www.unito.io)\n\nCo-authored-by: dante01yoon <6510430+dante01yoon@users.noreply.github.com>","verified_at":"2026-05-09T04:48:32Z"}}
@@ -0,0 +1 @@
{"ref":"refs/tags/v1.43.18","node_id":"REF_kwDOMIrOxrJyZWZzL3RhZ3MvdjEuNDMuMTg","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/refs/tags/v1.43.18","object":{"sha":"6a207bb52a887b1a70fbf654641ebc57710f97c7","type":"commit","url":"https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/commits/6a207bb52a887b1a70fbf654641ebc57710f97c7"}}
@@ -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,609 @@
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 { 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'
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
Object.defineProperty(widget, 'value', {
get() {
return widgetValue
},
set(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
changeOutputType(this, output, outputType)
})
// Force Vue reactivity update for output slot types.
// Outputs are wrapped in shallowReactive by useGraphNodeManager,
// so mutating output.type alone doesn't trigger re-render.
this.outputs = [...this.outputs]
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,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,97 @@
/*
Preview Any - original implement from
https://github.com/rgthree/rgthree-comfy/blob/main/py/display_any.py
upstream requested in https://github.com/Kosinkadink/rfcs/blob/main/rfcs/0000-corenodes.md#preview-nodes
*/
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import { app } from '@/scripts/app'
import { type DOMWidget } from '@/scripts/domWidget'
import { ComfyWidgets } from '@/scripts/widgets'
import { useExtensionService } from '@/services/extensionService'
useExtensionService().registerExtension({
name: 'Comfy.PreviewAny',
async beforeRegisterNodeDef(
nodeType: typeof LGraphNode,
nodeData: ComfyNodeDef
) {
if (nodeData.name === 'PreviewAny') {
const onNodeCreated = nodeType.prototype.onNodeCreated
nodeType.prototype.onNodeCreated = function () {
onNodeCreated ? onNodeCreated.apply(this, []) : undefined
const showValueWidget = ComfyWidgets['MARKDOWN'](
this,
'preview_markdown',
['MARKDOWN', {}],
app
).widget as DOMWidget<HTMLTextAreaElement, string>
const showValueWidgetPlain = ComfyWidgets['STRING'](
this,
'preview_text',
['STRING', { multiline: true }],
app
).widget as DOMWidget<HTMLTextAreaElement, string>
const showAsPlaintextWidget = ComfyWidgets['BOOLEAN'](
this,
'previewMode',
[
'BOOLEAN',
{ label_on: 'Markdown', label_off: 'Plaintext', default: false }
],
app
)
showAsPlaintextWidget.widget.callback = (value: boolean) => {
showValueWidget.hidden = !value
showValueWidget.options.hidden = !value
showValueWidgetPlain.hidden = value
showValueWidgetPlain.options.hidden = value
}
showValueWidget.label = 'Preview'
showValueWidget.hidden = true
showValueWidget.options.hidden = true
showValueWidget.options.read_only = true
showValueWidget.options.serialize = false
showValueWidget.element.readOnly = true
showValueWidget.serialize = false
showValueWidgetPlain.label = 'Preview'
showValueWidgetPlain.hidden = false
showValueWidgetPlain.options.hidden = false
showValueWidgetPlain.options.read_only = true
showValueWidgetPlain.options.serialize = false
showValueWidgetPlain.element.readOnly = true
showValueWidgetPlain.serialize = false
// The previewMode toggle is a frontend-only display preference and
// is not declared in the backend INPUT_TYPES, so it must not be
// serialized into the API prompt (would alter the cache signature).
showAsPlaintextWidget.widget.options.serialize = false
}
const onExecuted = nodeType.prototype.onExecuted
nodeType.prototype.onExecuted = function (message) {
onExecuted === null || onExecuted === void 0
? void 0
: onExecuted.apply(this, [message])
const previewWidgets =
this.widgets?.filter((w) => w.name.startsWith('preview_')) ?? []
for (const previewWidget of previewWidgets) {
const text = message.text ?? ''
previewWidget.value = Array.isArray(text)
? (text?.join('\n\n') ?? '')
: text
}
}
}
}
})
@@ -0,0 +1,452 @@
import { MediaRecorder as ExtendableMediaRecorder } from 'extendable-media-recorder'
import { useNodeDragAndDrop } from '@/composables/node/useNodeDragAndDrop'
import { useNodeFileInput } from '@/composables/node/useNodeFileInput'
import { useNodePaste } from '@/composables/node/useNodePaste'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { resolveNodeRootGraphId } from '@/lib/litegraph/src/litegraph'
import type {
IBaseWidget,
IStringWidget
} from '@/lib/litegraph/src/types/widgets'
import { useToastStore } from '@/platform/updates/common/toastStore'
import {
getResourceURL,
splitFilePath
} from '@/renderer/extensions/vueNodes/widgets/utils/audioUtils'
import type { NodeExecutionOutput } from '@/schemas/apiSchema'
import type { ComfyNodeDef } from '@/schemas/nodeDefSchema'
import type { DOMWidget } from '@/scripts/domWidget'
import { useAudioService } from '@/services/audioService'
import { type NodeLocatorId } from '@/types'
import { getNodeByLocatorId } from '@/utils/graphTraversalUtil'
import { api } from '../../scripts/api'
import { app } from '../../scripts/app'
import { useWidgetValueStore } from '@/stores/widgetValueStore'
function updateUIWidget(
audioUIWidget: DOMWidget<HTMLAudioElement, string>,
url: string = ''
) {
audioUIWidget.element.src = url
audioUIWidget.value = url
audioUIWidget.callback?.(url)
if (url) audioUIWidget.element.classList.remove('empty-audio-widget')
else audioUIWidget.element.classList.add('empty-audio-widget')
}
async function uploadFile(
audioWidget: IStringWidget,
audioUIWidget: DOMWidget<HTMLAudioElement, string>,
file: File,
updateNode: boolean,
pasted: boolean = false
): Promise<boolean> {
try {
// Wrap file in formdata so it includes filename
const body = new FormData()
body.append('image', file)
if (pasted) body.append('subfolder', 'pasted')
const resp = await api.fetchApi('/upload/image', {
method: 'POST',
body
})
if (resp.status === 200) {
const data = await resp.json()
// Add the file to the dropdown list and update the widget value
let path = data.name
if (data.subfolder) path = data.subfolder + '/' + path
// @ts-expect-error fixme ts strict error
if (!audioWidget.options.values.includes(path)) {
// @ts-expect-error fixme ts strict error
audioWidget.options.values.push(path)
}
if (updateNode) {
updateUIWidget(
audioUIWidget,
api.apiURL(getResourceURL(...splitFilePath(path)))
)
audioWidget.value = path
// Manually trigger the callback to update VueNodes
audioWidget.callback?.(path)
}
return true
} else {
useToastStore().addAlert(resp.status + ' - ' + resp.statusText)
return false
}
} catch (error) {
// @ts-expect-error fixme ts strict error
useToastStore().addAlert(error)
return false
}
}
// AudioWidget MUST be registered first, as AUDIOUPLOAD depends on AUDIO_UI to be
// present.
app.registerExtension({
name: 'Comfy.AudioWidget',
async beforeRegisterNodeDef(
nodeType: typeof LGraphNode,
nodeData: ComfyNodeDef
) {
if (
[
'LoadAudio',
'SaveAudio',
'PreviewAudio',
'SaveAudioMP3',
'SaveAudioOpus'
].includes(
// @ts-expect-error fixme ts strict error
nodeType.prototype.comfyClass
)
) {
// @ts-expect-error fixme ts strict error
nodeData.input.required.audioUI = ['AUDIO_UI', {}]
}
},
getCustomWidgets() {
return {
AUDIO_UI(node: LGraphNode, inputName: string) {
const audio = document.createElement('audio')
audio.controls = true
audio.classList.add('comfy-audio')
audio.setAttribute('name', 'media')
const audioUIWidget: DOMWidget<HTMLAudioElement, string> =
node.addDOMWidget(inputName, /* name=*/ 'audioUI', audio)
audioUIWidget.serialize = false
const { nodeData } = node.constructor
if (nodeData == null) throw new TypeError('nodeData is null')
const isOutputNode = nodeData.output_node
if (isOutputNode) {
// Hide the audio widget when there is no audio initially.
audioUIWidget.element.classList.add('empty-audio-widget')
// Populate the audio widget UI on node execution.
const onExecuted = node.onExecuted
node.onExecuted = function (output: NodeExecutionOutput) {
onExecuted?.call(this, output)
const audios = output.audio
if (!audios?.length) return
const audio = audios[0]
const resourceUrl = getResourceURL(
audio.subfolder ?? '',
audio.filename ?? '',
audio.type
)
updateUIWidget(audioUIWidget, api.apiURL(resourceUrl))
}
}
audioUIWidget.options.getValue = () =>
(useWidgetValueStore().getWidget(
resolveNodeRootGraphId(node, app.rootGraph.id),
node.id,
inputName
)?.value as string) ?? ''
audioUIWidget.options.setValue = (v) => {
const graphId = resolveNodeRootGraphId(node, app.rootGraph.id)
const widgetState = useWidgetValueStore().getWidget(
graphId,
node.id,
inputName
)
if (widgetState) widgetState.value = v
}
return { widget: audioUIWidget }
}
}
},
onNodeOutputsUpdated(
nodeOutputs: Record<NodeLocatorId, NodeExecutionOutput>
) {
for (const [nodeLocatorId, output] of Object.entries(nodeOutputs)) {
if (!output.audio?.length) continue
const node = getNodeByLocatorId(app.rootGraph, nodeLocatorId)
if (!node) continue
const audioUIWidget = node.widgets?.find(
(w) => w.name === 'audioUI'
) as unknown as DOMWidget<HTMLAudioElement, string>
const audio = output.audio[0]
const resourceUrl = getResourceURL(
audio.subfolder ?? '',
audio.filename ?? '',
audio.type
)
updateUIWidget(audioUIWidget, api.apiURL(resourceUrl))
}
}
})
app.registerExtension({
name: 'Comfy.UploadAudio',
async beforeRegisterNodeDef(
_nodeType: typeof LGraphNode,
nodeData: ComfyNodeDef
) {
if (nodeData?.input?.required?.audio?.[1]?.audio_upload === true) {
nodeData.input.required.upload = ['AUDIOUPLOAD', {}]
}
},
getCustomWidgets() {
return {
AUDIOUPLOAD(node, inputName: string) {
// The widget that allows user to select file.
// @ts-expect-error fixme ts strict error
const audioWidget = node.widgets.find(
(w) => w.name === 'audio'
) as IStringWidget
// @ts-expect-error fixme ts strict error
const audioUIWidget = node.widgets.find(
(w) => w.name === 'audioUI'
) as unknown as DOMWidget<HTMLAudioElement, string>
const onAudioWidgetUpdate = () => {
updateUIWidget(
audioUIWidget,
api.apiURL(
getResourceURL(...splitFilePath(audioWidget.value ?? ''))
)
)
}
// Initially load default audio file to audioUIWidget.
onAudioWidgetUpdate()
audioWidget.callback = onAudioWidgetUpdate
// Load saved audio file widget values if restoring from workflow
const onGraphConfigured = node.onGraphConfigured
node.onGraphConfigured = function () {
// @ts-expect-error fixme ts strict error
onGraphConfigured?.apply(this, arguments)
onAudioWidgetUpdate()
}
const handleUpload = async (files: File[]) => {
if (files?.length) {
const previousValue = audioWidget.value
audioWidget.value = files[0].name
const success = await uploadFile(
audioWidget,
audioUIWidget,
files[0],
true
)
if (!success) {
audioWidget.value = previousValue
}
}
return files
}
const isAudioFile = (file: File) => file.type.startsWith('audio/')
const { openFileSelection } = useNodeFileInput(node, {
accept: 'audio/*',
onSelect: handleUpload
})
// The widget to pop up the upload dialog.
const uploadWidget = node.addWidget(
'button',
inputName,
'',
openFileSelection,
{ serialize: false, canvasOnly: true }
)
uploadWidget.label = t('g.choose_file_to_upload')
useNodeDragAndDrop(node, {
fileFilter: isAudioFile,
onDrop: handleUpload
})
useNodePaste(node, {
fileFilter: isAudioFile,
onPaste: handleUpload
})
node.previewMediaType = 'audio'
return { widget: uploadWidget }
}
}
}
})
app.registerExtension({
name: 'Comfy.RecordAudio',
getCustomWidgets() {
return {
AUDIO_RECORD(node, inputName: string) {
const audio = document.createElement('audio')
audio.controls = true
audio.classList.add('comfy-audio')
audio.setAttribute('name', 'media')
const audioUIWidget: DOMWidget<HTMLAudioElement, string> =
node.addDOMWidget(inputName, /* name=*/ 'audioUI', audio)
audioUIWidget.options.canvasOnly = false
let mediaRecorder: MediaRecorder | null = null
let isRecording = false
let audioChunks: Blob[] = []
let currentStream: MediaStream | null = null
let recordWidget: IBaseWidget | null = null
let stopPromise: Promise<void> | null = null
let stopResolve: (() => void) | null = null
audioUIWidget.serializeValue = async () => {
if (isRecording && mediaRecorder) {
stopPromise = new Promise((resolve) => {
stopResolve = resolve
})
mediaRecorder.stop()
await stopPromise
}
const audioSrc = audioUIWidget.element.src
if (!audioSrc) {
useToastStore().addAlert(t('g.noAudioRecorded'))
return ''
}
const blob = await fetch(audioSrc).then((r) => r.blob())
return await useAudioService().convertBlobToFileAndSubmit(blob)
}
recordWidget = node.addWidget(
'button',
inputName,
'',
async () => {
if (!isRecording) {
try {
currentStream = await navigator.mediaDevices.getUserMedia({
audio: true
})
mediaRecorder = new ExtendableMediaRecorder(currentStream, {
mimeType: 'audio/wav'
}) as unknown as MediaRecorder
audioChunks = []
mediaRecorder.ondataavailable = (event) => {
audioChunks.push(event.data)
}
mediaRecorder.onstop = async () => {
const audioBlob = new Blob(audioChunks, { type: 'audio/wav' })
useAudioService().stopAllTracks(currentStream)
if (
audioUIWidget.element.src &&
audioUIWidget.element.src.startsWith('blob:')
) {
URL.revokeObjectURL(audioUIWidget.element.src)
}
updateUIWidget(audioUIWidget, URL.createObjectURL(audioBlob))
isRecording = false
if (recordWidget) {
recordWidget.label = t('g.startRecording')
}
if (stopResolve) {
stopResolve()
stopResolve = null
stopPromise = null
}
}
mediaRecorder.onerror = (event) => {
console.error('MediaRecorder error:', event)
useAudioService().stopAllTracks(currentStream)
isRecording = false
if (recordWidget) {
recordWidget.label = t('g.startRecording')
}
if (stopResolve) {
stopResolve()
stopResolve = null
stopPromise = null
}
}
mediaRecorder.start()
isRecording = true
if (recordWidget) {
recordWidget.label = t('g.stopRecording')
}
} catch (err) {
console.error('Error accessing microphone:', err)
useToastStore().addAlert(t('g.micPermissionDenied'))
if (mediaRecorder) {
try {
mediaRecorder.stop()
} catch {}
}
useAudioService().stopAllTracks(currentStream)
currentStream = null
isRecording = false
if (recordWidget) {
recordWidget.label = t('g.startRecording')
}
}
} else if (mediaRecorder && isRecording) {
mediaRecorder.stop()
}
},
{ serialize: false, canvasOnly: false }
)
recordWidget.label = t('g.startRecording')
// Override the type for Vue rendering while keeping 'button' for LiteGraph
recordWidget.type = 'audiorecord'
const originalOnRemoved = node.onRemoved
node.onRemoved = function () {
if (isRecording && mediaRecorder) {
mediaRecorder.stop()
}
useAudioService().stopAllTracks(currentStream)
if (audioUIWidget.element.src?.startsWith('blob:')) {
URL.revokeObjectURL(audioUIWidget.element.src)
}
originalOnRemoved?.call(this)
}
return { widget: recordWidget }
}
}
},
async nodeCreated(node: LGraphNode) {
if (node.constructor.comfyClass !== 'RecordAudio') return
await useAudioService().registerWavEncoder()
}
})
@@ -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)
}
}
})
@@ -0,0 +1,425 @@
import type { LGraph } from '@/lib/litegraph/src/LGraph'
import type { LGraphNode, NodeId } from '@/lib/litegraph/src/LGraphNode'
import { InvalidLinkError } from '@/lib/litegraph/src/infrastructure/InvalidLinkError'
import { NullGraphError } from '@/lib/litegraph/src/infrastructure/NullGraphError'
import { RecursionError } from '@/lib/litegraph/src/infrastructure/RecursionError'
import { SlotIndexError } from '@/lib/litegraph/src/infrastructure/SlotIndexError'
import type { ISlotType } from '@/lib/litegraph/src/interfaces'
import { LGraphEventMode, LiteGraph } from '@/lib/litegraph/src/litegraph'
import type { Subgraph } from './Subgraph'
import type { SubgraphNode } from './SubgraphNode'
export type ExecutionId = string
/**
* Interface describing the data transfer objects used when compiling a graph for execution.
*/
export type ExecutableLGraphNode = Omit<
ExecutableNodeDTO,
'graph' | 'node' | 'subgraphNode'
>
/**
* The end result of resolving a DTO input.
* When a widget value is returned, {@link widgetInfo} is present and {@link origin_slot} is `-1`.
*/
type ResolvedInput = {
/** DTO for the node that the link originates from. */
node: ExecutableLGraphNode
/** Full unique execution ID of the node that the link originates from. In the case of a widget value, this is the ID of the subgraph node. */
origin_id: ExecutionId
/** The slot index of the output on the node that the link originates from. `-1` when widget value is set. */
origin_slot: number
/** Boxed widget value (e.g. for widgets). If this box is `undefined`, then an input link is connected, and widget values from the subgraph node are ignored. */
widgetInfo?: { value: unknown }
}
/**
* Concrete implementation of {@link ExecutableLGraphNode}.
* @remarks This is the class that is used to create the data transfer objects for executable nodes.
*/
export class ExecutableNodeDTO implements ExecutableLGraphNode {
applyToGraph?(
...args: Parameters<NonNullable<typeof this.node.applyToGraph>>
): ReturnType<NonNullable<typeof this.node.applyToGraph>>
/** The graph that this node is a part of. */
readonly graph: LGraph | Subgraph
inputs: { linkId: number | null; name: string; type: ISlotType }[]
/** Backing field for {@link id}. */
private _id: ExecutionId
/**
* The path to the actual node through subgraph instances, represented as a list of all subgraph node IDs (instances),
* followed by the actual original node ID within the subgraph. Each segment is separated by `:`.
*
* e.g. `1:2:3`:
* - `1` is the node ID of the first subgraph node in the parent workflow
* - `2` is the node ID of the second subgraph node in the first subgraph
* - `3` is the node ID of the actual node in the subgraph definition
*/
get id() {
return this._id
}
get type() {
return this.node.type
}
get title() {
return this.node.title
}
get mode() {
return this.node.mode
}
get comfyClass() {
return this.node.comfyClass
}
get isVirtualNode() {
return this.node.isVirtualNode
}
get widgets() {
return this.node.widgets
}
get subgraphId() {
return this.subgraphNode?.subgraph.id
}
constructor(
/** The actual node that this DTO wraps. */
readonly node: LGraphNode | SubgraphNode,
/** A list of subgraph instance node IDs from the root graph to the containing instance. @see {@link id} */
readonly subgraphNodePath: readonly NodeId[],
/** A flattened map of all DTOs in this node network. Subgraph instances have been expanded into their inner nodes. */
readonly nodesByExecutionId: Map<ExecutionId, ExecutableLGraphNode>,
/** The actual subgraph instance that contains this node, otherwise undefined. */
readonly subgraphNode?: SubgraphNode
) {
if (!node.graph) throw new NullGraphError()
// Set the internal ID of the DTO
this._id = [...this.subgraphNodePath, this.node.id].join(':')
this.graph = node.graph
this.inputs = this.node.inputs.map((x) => ({
linkId: x.link,
name: x.name,
type: x.type
}))
// Only create a wrapper if the node has an applyToGraph method
if (this.node.applyToGraph) {
this.applyToGraph = (...args) => this.node.applyToGraph?.(...args)
}
}
/** Returns either the DTO itself, or the DTOs of the inner nodes of the subgraph. */
getInnerNodes(): ExecutableLGraphNode[] {
return this.node.isSubgraphNode()
? this.node.getInnerNodes(this.nodesByExecutionId, this.subgraphNodePath)
: [this]
}
/**
* Resolves the executable node & link IDs for a given input slot.
* @param slot The slot index of the input.
* @param visited Leave empty unless overriding this method.
* A set of unique IDs, used to guard against infinite recursion.
* If overriding, ensure that the set is passed on all recursive calls.
* @returns The node and the origin ID / slot index of the output.
*/
resolveInput(
slot: number,
visited = new Set<string>(),
type?: ISlotType
): ResolvedInput | undefined {
const uniqueId = `${this.subgraphNode?.subgraph.id}:${this.node.id}[I]${slot}`
if (visited.has(uniqueId)) {
const nodeInfo = `${this.node.id}${this.node.title ? ` (${this.node.title})` : ''}`
const pathInfo =
this.subgraphNodePath.length > 0
? ` at path ${this.subgraphNodePath.join(':')}`
: ''
throw new RecursionError(
`Circular reference detected while resolving input ${slot} of node ${nodeInfo}${pathInfo}. ` +
`This creates an infinite loop in link resolution. UniqueID: [${uniqueId}]`
)
}
visited.add(uniqueId)
const input = this.inputs.at(slot)
if (!input)
throw new SlotIndexError(
`No input found for flattened id [${this.id}] slot [${slot}]`
)
// Nothing connected
if (input.linkId == null) return
const link = this.graph.getLink(input.linkId)
if (!link)
throw new InvalidLinkError(
`No link found in parent graph for id [${this.id}] slot [${slot}] ${input.name}`
)
const { subgraphNode } = this
// Link goes up and out of this subgraph
if (subgraphNode && link.originIsIoNode) {
const subgraphNodeInput = subgraphNode.inputs.at(link.origin_slot)
if (!subgraphNodeInput)
throw new SlotIndexError(
`No input found for slot [${link.origin_slot}] ${input.name}`
)
// Nothing connected
const linkId = subgraphNodeInput.link
if (linkId == null) {
const widget = subgraphNode.getWidgetFromSlot(subgraphNodeInput)
if (!widget) return
// Special case: SubgraphNode widget.
return {
node: this,
origin_id: this.id,
origin_slot: -1,
widgetInfo: { value: widget.value }
}
}
if (!subgraphNode.graph)
throw new NullGraphError(
`SubgraphNode ${subgraphNode.id} has no graph during input resolution`
)
const outerLink = subgraphNode.graph.getLink(linkId)
if (!outerLink)
throw new InvalidLinkError(
`No outer link found for slot [${link.origin_slot}] ${input.name}`
)
const subgraphNodeExecutionId = this.subgraphNodePath.join(':')
const subgraphNodeDto = this.nodesByExecutionId.get(
subgraphNodeExecutionId
)
if (!subgraphNodeDto)
throw new Error(
`No subgraph node DTO found for id [${subgraphNodeExecutionId}]`
)
return subgraphNodeDto.resolveInput(outerLink.target_slot, visited)
}
// Not part of a subgraph; use the original link
const outputNode = this.graph.getNodeById(link.origin_id)
if (!outputNode)
throw new InvalidLinkError(
`No input node found for id [${this.id}] slot [${slot}] ${input.name}`
)
const outputNodeExecutionId = [
...this.subgraphNodePath,
outputNode.id
].join(':')
const outputNodeDto = this.nodesByExecutionId.get(outputNodeExecutionId)
if (!outputNodeDto)
throw new Error(
`No output node DTO found for id [${outputNodeExecutionId}]`
)
return outputNodeDto.resolveOutput(
link.origin_slot,
type ?? input.type,
visited
)
}
/**
* Determines whether this output is a valid endpoint for a link (non-virtual, non-bypass).
* @param slot The slot index of the output.
* @param type The type of the input
* @param visited A set of unique IDs to guard against infinite recursion. See {@link resolveInput}.
* @returns The node and the origin ID / slot index of the output.
*/
resolveOutput(
slot: number,
type: ISlotType,
visited: Set<string>
): ResolvedInput | undefined {
const uniqueId = `${this.subgraphNode?.subgraph.id}:${this.node.id}[O]${slot}`
if (visited.has(uniqueId)) {
const nodeInfo = `${this.node.id}${this.node.title ? ` (${this.node.title})` : ''}`
const pathInfo =
this.subgraphNodePath.length > 0
? ` at path ${this.subgraphNodePath.join(':')}`
: ''
throw new RecursionError(
`Circular reference detected while resolving output ${slot} of node ${nodeInfo}${pathInfo}. ` +
`This creates an infinite loop in link resolution. UniqueID: [${uniqueId}]`
)
}
visited.add(uniqueId)
// Muted nodes produce no output
if (this.mode === LGraphEventMode.NEVER) return
// Upstreamed: Bypass nodes are bypassed using the first input with matching type
if (this.mode === LGraphEventMode.BYPASS) {
// Bypass nodes by finding first input with matching type
const matchingIndex = this._getBypassSlotIndex(slot, type)
// No input types match - bypass not possible
if (matchingIndex === -1) {
console.warn(
`[ExecutableNodeDTO.resolveOutput] No input types match type [${type}] for id [${this.id}] slot [${slot}]`,
this
)
return
}
return this.resolveInput(matchingIndex, visited)
}
const { node } = this
if (node.isSubgraphNode())
return this._resolveSubgraphOutput(slot, type, visited)
if (node.isVirtualNode) {
// Cross-graph virtual nodes (e.g. Set/Get) resolve their source directly.
const virtualSource = this.node.resolveVirtualOutput?.(slot)
if (virtualSource) {
const inputNodeDto = [...this.nodesByExecutionId.values()].find(
(dto) =>
dto instanceof ExecutableNodeDTO && dto.node === virtualSource.node
)
if (!inputNodeDto)
throw new Error(
`No DTO found for virtual source node [${virtualSource.node.id}]`
)
return inputNodeDto.resolveOutput(virtualSource.slot, type, visited)
}
const virtualLink = this.node.getInputLink(slot)
if (virtualLink) {
const { inputNode } = virtualLink.resolve(this.graph)
if (!inputNode)
throw new InvalidLinkError(
`Virtual node failed to resolve parent [${this.id}] slot [${slot}]`
)
const inputNodeExecutionId = [
...this.subgraphNodePath,
inputNode.id
].join(':')
const inputNodeDto = this.nodesByExecutionId.get(inputNodeExecutionId)
if (!inputNodeDto)
throw new Error(`No input node DTO found for id [${inputNode.id}]`)
return inputNodeDto.resolveInput(virtualLink.target_slot, visited, type)
}
// Virtual nodes without a matching input should be discarded.
return
}
return {
node: this,
origin_id: this.id,
origin_slot: slot
}
}
/**
* Finds the index of the input slot on this node that matches the given output {@link slot} index.
* Used when bypassing nodes.
* @param slot The output slot index on this node
* @param type The type of the final target input (so type list matches are accurate)
* @returns The index of the input slot on this node, otherwise `-1`.
*/
private _getBypassSlotIndex(slot: number, type: ISlotType) {
const { inputs } = this
const oppositeInput = inputs[slot]
const outputType = this.node.outputs[slot].type
// Any type short circuit - match slot ID, fallback to first slot
if (type === '*' || type === '') {
return inputs.length > slot ? slot : 0
}
// Prefer input with the same slot ID
if (
oppositeInput &&
LiteGraph.isValidConnection(oppositeInput.type, outputType) &&
LiteGraph.isValidConnection(oppositeInput.type, type)
) {
return slot
}
// Preserve legacy behaviour; use exact match first.
const exactMatch = inputs.findIndex((input) => input.type === type)
if (exactMatch !== -1) return exactMatch
// Find first matching slot - prefer exact type
return inputs.findIndex(
(input) =>
LiteGraph.isValidConnection(input.type, outputType) &&
LiteGraph.isValidConnection(input.type, type)
)
}
/**
* Resolves the link inside a subgraph node, from the subgraph IO node to the node inside the subgraph.
* @param slot The slot index of the output on the subgraph node.
* @param visited A set of unique IDs to guard against infinite recursion. See {@link resolveInput}.
* @returns A DTO for the node, and the origin ID / slot index of the output.
*/
private _resolveSubgraphOutput(
slot: number,
type: ISlotType,
visited: Set<string>
): ResolvedInput | undefined {
const { node } = this
const output = node.outputs.at(slot)
if (!output)
throw new SlotIndexError(
`No output found for flattened id [${this.id}] slot [${slot}]`
)
if (!node.isSubgraphNode())
throw new TypeError(`Node is not a subgraph node: ${node.id}`)
// Link inside the subgraph
const innerResolved = node.resolveSubgraphOutputLink(slot)
if (!innerResolved) return
const innerNode = innerResolved.outputNode
if (!innerNode)
throw new Error(
`No output node found for id [${this.id}] slot [${slot}] ${output.name}`
)
// Recurse into the subgraph
const innerNodeExecutionId = [
...this.subgraphNodePath,
node.id,
innerNode.id
].join(':')
const innerNodeDto = this.nodesByExecutionId.get(innerNodeExecutionId)
if (!innerNodeDto)
throw new Error(
`No inner node DTO found for id [${innerNodeExecutionId}]`
)
return innerNodeDto.resolveOutput(
innerResolved.link.origin_slot,
type,
visited
)
}
}
@@ -0,0 +1,139 @@
/** Node slot type - input or output */
export enum NodeSlotType {
INPUT = 1,
OUTPUT = 2
}
/** Shape that an object will render as - used by nodes and slots */
export enum RenderShape {
/** Rectangle with square corners */
BOX = 1,
/** Rounded rectangle */
ROUND = 2,
/** Circle is circle */
CIRCLE = 3,
/** Two rounded corners: top left & bottom right */
CARD = 4,
/** Slot shape: Arrow */
ARROW = 5,
/** Slot shape: Grid */
GRID = 6,
/** Slot shape: Hollow circle */
HollowCircle = 7
}
/** Bit flags used to indicate what the pointer is currently hovering over. */
export enum CanvasItem {
/** No items / none */
Nothing = 0,
/** At least one node */
Node = 1,
/** At least one group */
Group = 1 << 1,
/** A reroute (not its path) */
Reroute = 1 << 2,
/** The path of a link */
Link = 1 << 3,
/** A reroute slot */
RerouteSlot = 1 << 5,
/** A subgraph input or output node */
SubgraphIoNode = 1 << 6,
/** A subgraph input or output slot */
SubgraphIoSlot = 1 << 7
}
/** The direction that a link point will flow towards - e.g. horizontal outputs are right by default */
export enum LinkDirection {
NONE = 0,
UP = 1,
DOWN = 2,
LEFT = 3,
RIGHT = 4,
CENTER = 5
}
/** The path calculation that links follow */
export enum LinkRenderType {
HIDDEN_LINK = -1,
/** Juts out from the input & output a little @see LinkDirection, then a straight line between them */
STRAIGHT_LINK = 0,
/** 90° angles, clean and box-like */
LINEAR_LINK = 1,
/** Smooth curved links - default */
SPLINE_LINK = 2
}
/** The marker in the middle of a link */
export enum LinkMarkerShape {
/** Do not display markers */
None = 0,
/** Circles (default) */
Circle = 1,
/** Directional arrows */
Arrow = 2
}
export enum TitleMode {
NORMAL_TITLE = 0,
NO_TITLE = 1,
TRANSPARENT_TITLE = 2,
AUTOHIDE_TITLE = 3
}
export enum LGraphEventMode {
ALWAYS = 0,
ON_EVENT = 1,
NEVER = 2,
ON_TRIGGER = 3,
BYPASS = 4
}
export enum EaseFunction {
EASE_IN_OUT_QUAD = 'easeInOutQuad'
}
/** Bit flags used to indicate what the pointer is currently hovering over. */
export enum Alignment {
/** No items / none */
None = 0,
/** Top */
Top = 1,
/** Bottom */
Bottom = 1 << 1,
/** Vertical middle */
Middle = 1 << 2,
/** Left */
Left = 1 << 3,
/** Right */
Right = 1 << 4,
/** Horizontal centre */
Centre = 1 << 5,
/** Top left */
TopLeft = Top | Left,
/** Top side, horizontally centred */
TopCentre = Top | Centre,
/** Top right */
TopRight = Top | Right,
/** Left side, vertically centred */
MidLeft = Left | Middle,
/** Middle centre */
MidCentre = Middle | Centre,
/** Right side, vertically centred */
MidRight = Right | Middle,
/** Bottom left */
BottomLeft = Bottom | Left,
/** Bottom side, horizontally centred */
BottomCentre = Bottom | Centre,
/** Bottom right */
BottomRight = Bottom | Right
}
/**
* Checks if the bitwise {@link flag} is set in the {@link flagSet}.
* @param flagSet The unknown set of flags - will be checked for the presence of {@link flag}
* @param flag The flag to check for
* @returns `true` if the flag is set, `false` otherwise.
*/
export function hasFlag(flagSet: number, flag: number): boolean {
return (flagSet & flag) === flag
}
@@ -0,0 +1,456 @@
import { t } from '@/i18n'
import { drawTextInArea } from '@/lib/litegraph/src/draw'
import { cachedMeasureText } from '@/lib/litegraph/src/utils/textMeasureCache'
import { Rectangle } from '@/lib/litegraph/src/infrastructure/Rectangle'
import type { Point } from '@/lib/litegraph/src/interfaces'
import type { NodeId } from '@/lib/litegraph/src/LGraphNode'
import type {
CanvasPointer,
LGraphCanvas,
LGraphNode,
Size
} from '@/lib/litegraph/src/litegraph'
import { LiteGraph } from '@/lib/litegraph/src/litegraph'
import type { CanvasPointerEvent } from '@/lib/litegraph/src/types/events'
import type {
IBaseWidget,
NodeBindable,
TWidgetType
} from '@/lib/litegraph/src/types/widgets'
import { usePromotionStore } from '@/stores/promotionStore'
import type { WidgetState } from '@/stores/widgetValueStore'
import { useWidgetValueStore } from '@/stores/widgetValueStore'
export interface DrawWidgetOptions {
/** The width of the node where this widget will be displayed. */
width: number
/** Synonym for "low quality". */
showText?: boolean
/** When true, suppresses the promoted outline color (e.g. for projected copies on SubgraphNode). */
suppressPromotedOutline?: boolean
/** Transient image source for preview widgets rendered on behalf of another node (e.g. subgraph promotion). */
previewImages?: HTMLImageElement[]
}
interface DrawTruncatingTextOptions extends DrawWidgetOptions {
/** The canvas context to draw the text on. */
ctx: CanvasRenderingContext2D
/** The amount of padding to add to the left of the text. */
leftPadding?: number
/** The amount of padding to add to the right of the text. */
rightPadding?: number
}
export interface WidgetEventOptions {
e: CanvasPointerEvent
node: LGraphNode
canvas: LGraphCanvas
}
export abstract class BaseWidget<TWidget extends IBaseWidget = IBaseWidget>
implements IBaseWidget, NodeBindable
{
/** From node edge to widget edge */
static margin = 15
/** From widget edge to tip of arrow button */
static arrowMargin = 6
/** Arrow button width */
static arrowWidth = 10
/** Absolute minimum display width of widget values */
static minValueWidth = 42
/** Minimum gap between label and value */
static labelValueGap = 5
declare computedHeight?: number
declare serialize?: boolean
computeLayoutSize?(node: LGraphNode): {
minHeight: number
maxHeight?: number
minWidth: number
maxWidth?: number
}
private _node: LGraphNode
/** The node that this widget belongs to. */
get node() {
return this._node
}
linkedWidgets?: IBaseWidget[]
name: string
options: TWidget['options']
type: TWidget['type']
y: number = 0
last_y?: number
width?: number
computedDisabled?: boolean
tooltip?: string
private _state: Omit<WidgetState, 'nodeId'> &
Partial<Pick<WidgetState, 'nodeId'>>
get label(): string | undefined {
return this._state.label
}
set label(value: string | undefined) {
this._state.label = value
}
hidden?: boolean
advanced?: boolean
get disabled(): boolean | undefined {
return this._state.disabled
}
set disabled(value: boolean | undefined) {
this._state.disabled = value ?? false
}
element?: HTMLElement
callback?(
value: TWidget['value'],
canvas?: LGraphCanvas,
node?: LGraphNode,
pos?: Point,
e?: CanvasPointerEvent
): void
mouse?(
event: CanvasPointerEvent,
pointerOffset: Point,
node: LGraphNode
): boolean
computeSize?(width?: number): Size
onPointerDown?(
pointer: CanvasPointer,
node: LGraphNode,
canvas: LGraphCanvas
): boolean
get value(): TWidget['value'] {
return this._state.value as TWidget['value']
}
set value(value: TWidget['value']) {
this._state.value = value
}
/**
* Associates this widget with a node ID and registers it in the WidgetValueStore.
* Once set, value reads/writes will be delegated to the store.
*/
setNodeId(nodeId: NodeId): void {
const graphId = this.node.graph?.rootGraph.id
if (!graphId) return
this._state = useWidgetValueStore().registerWidget(graphId, {
...this._state,
// BaseWidget: this.value getter returns this._state.value. So value: this.value === value: this._state.value.
// BaseDOMWidgetImpl: this.value getter returns options.getValue?.() ?? ''. Resolves the correct initial value instead of undefined.
// I.e., calls overriden getter -> options.getValue() -> correct value (https://github.com/Comfy-Org/ComfyUI_frontend/issues/9194).
value: this.value,
nodeId
})
}
constructor(widget: TWidget & { node: LGraphNode })
constructor(widget: TWidget, node: LGraphNode)
constructor(widget: TWidget & { node: LGraphNode }, node?: LGraphNode) {
// Private fields
this._node = node ?? widget.node
// The set and get functions for DOM widget values are hacked on to the options object;
// attempting to set value before options will throw.
// https://github.com/Comfy-Org/ComfyUI_frontend/blob/df86da3d672628a452baed3df3347a52c0c8d378/src/scripts/domWidget.ts#L125
this.name = widget.name
this.options = widget.options
this.type = widget.type
// `node` has no setter - Object.assign will throw.
// TODO: Resolve this workaround. Ref: https://github.com/Comfy-Org/litegraph.js/issues/1022
const {
node: _,
// @ts-expect-error Prevent naming conflicts with custom nodes.
outline_color,
// @ts-expect-error Prevent naming conflicts with custom nodes.
background_color,
// @ts-expect-error Prevent naming conflicts with custom nodes.
height,
// @ts-expect-error Prevent naming conflicts with custom nodes.
text_color,
// @ts-expect-error Prevent naming conflicts with custom nodes.
secondary_text_color,
// @ts-expect-error Prevent naming conflicts with custom nodes.
disabledTextColor,
// @ts-expect-error Prevent naming conflicts with custom nodes.
displayName,
// @ts-expect-error Prevent naming conflicts with custom nodes.
displayValue,
// @ts-expect-error Prevent naming conflicts with custom nodes.
labelBaseline,
label,
disabled,
value,
linkedWidgets,
...safeValues
} = widget
Object.assign(this, safeValues)
this._state = {
name: this.name,
type: this.type as TWidgetType,
value,
label,
disabled: disabled ?? false,
serialize: this.serialize,
options: this.options
}
}
getOutlineColor(suppressPromotedOutline = false) {
const graphId = this.node.graph?.rootGraph.id
if (
graphId &&
!suppressPromotedOutline &&
usePromotionStore().isPromotedByAny(graphId, {
sourceNodeId: String(this.node.id),
sourceWidgetName: this.name
})
)
return LiteGraph.WIDGET_PROMOTED_OUTLINE_COLOR
return this.advanced
? LiteGraph.WIDGET_ADVANCED_OUTLINE_COLOR
: LiteGraph.WIDGET_OUTLINE_COLOR
}
get outline_color() {
return this.getOutlineColor()
}
get background_color() {
return LiteGraph.WIDGET_BGCOLOR
}
get height() {
return LiteGraph.NODE_WIDGET_HEIGHT
}
get text_color() {
return LiteGraph.WIDGET_TEXT_COLOR
}
get secondary_text_color() {
return LiteGraph.WIDGET_SECONDARY_TEXT_COLOR
}
get disabledTextColor() {
return LiteGraph.WIDGET_DISABLED_TEXT_COLOR
}
get displayName() {
return this.label || this.name
}
// TODO: Resolve this workaround. Ref: https://github.com/Comfy-Org/litegraph.js/issues/1022
get _displayValue(): string {
return this.computedDisabled ? '' : String(this.value)
}
get labelBaseline() {
return this.y + this.height * 0.7
}
/**
* Draws the widget
* @param ctx The canvas context
* @param options The options for drawing the widget
* @remarks Not naming this `draw` as `draw` conflicts with the `draw` method in
* custom widgets.
*/
abstract drawWidget(
ctx: CanvasRenderingContext2D,
options: DrawWidgetOptions
): void
/**
* Draws the standard widget shape - elongated capsule. The path of the widget shape is not
* cleared, and may be used for further drawing.
* @param ctx The canvas context
* @param options The options for drawing the widget
* @remarks Leaves {@link ctx} dirty.
*/
protected drawWidgetShape(
ctx: CanvasRenderingContext2D,
{ width, showText, suppressPromotedOutline }: DrawWidgetOptions
): void {
const { height, y } = this
const { margin } = BaseWidget
ctx.textAlign = 'left'
ctx.strokeStyle = this.getOutlineColor(suppressPromotedOutline)
ctx.fillStyle = this.background_color
ctx.beginPath()
if (showText) {
ctx.roundRect(margin, y, width - margin * 2, height, [height * 0.5])
} else {
ctx.rect(margin, y, width - margin * 2, height)
}
ctx.fill()
if (showText && !this.computedDisabled) ctx.stroke()
}
/**
* Draws a placeholder for widgets that only have a Vue implementation.
* @param ctx The canvas context
* @param options The options for drawing the widget
* @param label The label to display (e.g., "ImageCrop", "BoundingBox")
*/
protected drawVueOnlyWarning(
ctx: CanvasRenderingContext2D,
{ width, suppressPromotedOutline }: DrawWidgetOptions,
label: string
): void {
const { y, height } = this
ctx.save()
ctx.fillStyle = this.background_color
ctx.fillRect(15, y, width - 30, height)
ctx.strokeStyle = this.getOutlineColor(suppressPromotedOutline)
ctx.strokeRect(15, y, width - 30, height)
ctx.fillStyle = this.text_color
ctx.font = '11px monospace'
ctx.textAlign = 'center'
ctx.textBaseline = 'middle'
ctx.fillText(
`${label}: ${t('widgets.node2only')}`,
width / 2,
y + height / 2
)
ctx.restore()
}
/**
* A shared routine for drawing a label and value as text, truncated
* if they exceed the available width.
*/
protected drawTruncatingText({
ctx,
width,
leftPadding = 5,
rightPadding = 20
}: DrawTruncatingTextOptions): void {
const { height, y } = this
const { margin } = BaseWidget
// Measure label and value
const { displayName, _displayValue } = this
const labelWidth = cachedMeasureText(ctx, displayName)
const valueWidth = cachedMeasureText(ctx, _displayValue)
const gap = BaseWidget.labelValueGap
const x = margin * 2 + leftPadding
const totalWidth = width - x - 2 * margin - rightPadding
const requiredWidth = labelWidth + gap + valueWidth
const area = new Rectangle(x, y, totalWidth, height * 0.7)
ctx.fillStyle = this.secondary_text_color
if (requiredWidth <= totalWidth) {
// Draw label & value normally
drawTextInArea({ ctx, text: displayName, area, align: 'left' })
} else if (LiteGraph.truncateWidgetTextEvenly) {
// Label + value will not fit - scale evenly to fit
const scale = (totalWidth - gap) / (requiredWidth - gap)
area.width = labelWidth * scale
drawTextInArea({ ctx, text: displayName, area, align: 'left' })
// Move the area to the right to render the value
area.right = x + totalWidth
area.setWidthRightAnchored(valueWidth * scale)
} else if (LiteGraph.truncateWidgetValuesFirst) {
// Label + value will not fit - use legacy scaling of value first
const cappedLabelWidth = Math.min(labelWidth, totalWidth)
area.width = cappedLabelWidth
drawTextInArea({ ctx, text: displayName, area, align: 'left' })
area.right = x + totalWidth
area.setWidthRightAnchored(
Math.max(totalWidth - gap - cappedLabelWidth, 0)
)
} else {
// Label + value will not fit - scale label first
const cappedValueWidth = Math.min(valueWidth, totalWidth)
area.width = Math.max(totalWidth - gap - cappedValueWidth, 0)
drawTextInArea({ ctx, text: displayName, area, align: 'left' })
area.right = x + totalWidth
area.setWidthRightAnchored(cappedValueWidth)
}
ctx.fillStyle = this.text_color
drawTextInArea({ ctx, text: _displayValue, area, align: 'right' })
}
/**
* Handles the click event for the widget
* @param options The options for handling the click event
*/
abstract onClick(options: WidgetEventOptions): void
/**
* Handles the drag event for the widget
* @param options The options for handling the drag event
*/
onDrag?(options: WidgetEventOptions): void
/**
* Sets the value of the widget
* @param value The value to set
* @param options The options for setting the value
*/
setValue(
value: TWidget['value'],
{ e, node, canvas }: WidgetEventOptions
): void {
const oldValue = this.value
if (value === this.value) return
const v = this.type === 'number' ? Number(value) : value
this.value = v
if (
this.options?.property &&
node.properties[this.options.property] !== undefined
) {
node.setProperty(this.options.property, v)
}
const pos = canvas.graph_mouse
this.callback?.(this.value, canvas, node, pos, e)
node.onWidgetChanged?.(this.name ?? '', v, oldValue, this)
if (node.graph) node.graph._version++
}
/**
* Clones the widget.
* @param node The node that will own the cloned widget.
* @returns A new widget with the same properties as the original
* @remarks Subclasses with custom constructors must override this method.
*
* Correctly and safely typing this is currently not possible (practical?) in TypeScript 5.8.
*/
createCopyForNode(node: LGraphNode): this {
// @ts-expect-error - Constructor type casting for widget cloning
const cloned: this = new (this.constructor as typeof this)(this, node)
cloned.value = this.value
return cloned
}
}
@@ -0,0 +1,71 @@
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type { IButtonWidget } from '@/lib/litegraph/src/types/widgets'
import { BaseWidget } from './BaseWidget'
import type { DrawWidgetOptions, WidgetEventOptions } from './BaseWidget'
export class ButtonWidget
extends BaseWidget<IButtonWidget>
implements IButtonWidget
{
override type = 'button' as const
clicked: boolean
constructor(widget: IButtonWidget, node: LGraphNode) {
super(widget, node)
this.clicked ??= false
}
/**
* Draws the widget
* @param ctx The canvas context
* @param options The options for drawing the widget
*/
override drawWidget(
ctx: CanvasRenderingContext2D,
{ width, showText = true, suppressPromotedOutline }: DrawWidgetOptions
) {
// Store original context attributes
const { fillStyle, strokeStyle, textAlign } = ctx
const { height, y } = this
const { margin } = BaseWidget
// Draw button background
ctx.fillStyle = this.background_color
if (this.clicked) {
ctx.fillStyle = '#AAA'
this.clicked = false
}
ctx.fillRect(margin, y, width - margin * 2, height)
// Draw button outline if not disabled
if (showText && !this.computedDisabled) {
ctx.strokeStyle = this.getOutlineColor(suppressPromotedOutline)
ctx.strokeRect(margin, y, width - margin * 2, height)
}
// Draw button text
if (showText) this.drawLabel(ctx, width * 0.5)
// Restore original context attributes
Object.assign(ctx, { textAlign, strokeStyle, fillStyle })
}
drawLabel(ctx: CanvasRenderingContext2D, x: number): void {
ctx.textAlign = 'center'
ctx.fillStyle = this.text_color
ctx.fillText(this.displayName, x, this.y + this.height * 0.7)
}
override onClick({ e, node, canvas }: WidgetEventOptions) {
const pos = canvas.graph_mouse
// Set clicked state and mark canvas as dirty
this.clicked = true
canvas.setDirty(true)
// Call the callback with widget value
this.callback?.(this.value, canvas, node, pos, e)
}
}
@@ -0,0 +1,164 @@
import type { LGraphNode } from '@/lib/litegraph/src/LGraphNode'
import type {
IAssetWidget,
IBaseWidget,
IComboWidget,
IWidget,
TWidgetType
} from '@/lib/litegraph/src/types/widgets'
import { toClass } from '@/lib/litegraph/src/utils/type'
import { AssetWidget } from './AssetWidget'
import { BaseWidget } from './BaseWidget'
import { BooleanWidget } from './BooleanWidget'
import { BoundingBoxWidget } from './BoundingBoxWidget'
import { ButtonWidget } from './ButtonWidget'
import { ChartWidget } from './ChartWidget'
import { ColorWidget } from './ColorWidget'
import { ComboWidget } from './ComboWidget'
import { CurveWidget } from './CurveWidget'
import { FileUploadWidget } from './FileUploadWidget'
import { GalleriaWidget } from './GalleriaWidget'
import { GradientSliderWidget } from './GradientSliderWidget'
import { ImageCompareWidget } from './ImageCompareWidget'
import { PainterWidget } from './PainterWidget'
import { ImageCropWidget } from './ImageCropWidget'
import { KnobWidget } from './KnobWidget'
import { LegacyWidget } from './LegacyWidget'
import { MarkdownWidget } from './MarkdownWidget'
import { MultiSelectWidget } from './MultiSelectWidget'
import { NumberWidget } from './NumberWidget'
import { SelectButtonWidget } from './SelectButtonWidget'
import { SliderWidget } from './SliderWidget'
import { TextWidget } from './TextWidget'
import { TextareaWidget } from './TextareaWidget'
import { TreeSelectWidget } from './TreeSelectWidget'
export type WidgetTypeMap = {
button: ButtonWidget
toggle: BooleanWidget
slider: SliderWidget
gradientslider: GradientSliderWidget
knob: KnobWidget
combo: ComboWidget
number: NumberWidget
string: TextWidget
text: TextWidget
custom: LegacyWidget
fileupload: FileUploadWidget
color: ColorWidget
markdown: MarkdownWidget
treeselect: TreeSelectWidget
multiselect: MultiSelectWidget
chart: ChartWidget
galleria: GalleriaWidget
imagecompare: ImageCompareWidget
selectbutton: SelectButtonWidget
textarea: TextareaWidget
asset: AssetWidget
imagecrop: ImageCropWidget
boundingbox: BoundingBoxWidget
curve: CurveWidget
painter: PainterWidget
[key: string]: BaseWidget
}
/**
* Convert a widget POJO to a proper widget instance.
* @param widget The POJO to convert.
* @param node The node the widget belongs to.
* @param wrapLegacyWidgets Whether to wrap legacy widgets in a `LegacyWidget` instance.
* @returns A concrete widget instance.
*/
export function toConcreteWidget<TWidget extends IWidget | IBaseWidget>(
widget: TWidget,
node: LGraphNode,
wrapLegacyWidgets?: true
): WidgetTypeMap[TWidget['type']]
export function toConcreteWidget<TWidget extends IWidget | IBaseWidget>(
widget: TWidget,
node: LGraphNode,
wrapLegacyWidgets: false
): WidgetTypeMap[TWidget['type']] | undefined
export function toConcreteWidget<TWidget extends IWidget | IBaseWidget>(
widget: TWidget,
node: LGraphNode,
wrapLegacyWidgets = true
): WidgetTypeMap[TWidget['type']] | undefined {
if (widget instanceof BaseWidget) return widget
// Assertion: TypeScript has no concept of "all strings except X"
type RemoveBaseWidgetType<T> = T extends { type: TWidgetType } ? T : never
const narrowedWidget = widget as RemoveBaseWidgetType<TWidget>
switch (narrowedWidget.type) {
case 'button':
return toClass(ButtonWidget, narrowedWidget, node)
case 'toggle':
return toClass(BooleanWidget, narrowedWidget, node)
case 'slider':
return toClass(SliderWidget, narrowedWidget, node)
case 'gradientslider':
return toClass(GradientSliderWidget, narrowedWidget, node)
case 'knob':
return toClass(KnobWidget, narrowedWidget, node)
case 'combo':
return toClass(ComboWidget, narrowedWidget, node)
case 'number':
return toClass(NumberWidget, narrowedWidget, node)
case 'string':
return toClass(TextWidget, narrowedWidget, node)
case 'text':
return toClass(TextWidget, narrowedWidget, node)
case 'fileupload':
return toClass(FileUploadWidget, narrowedWidget, node)
case 'color':
return toClass(ColorWidget, narrowedWidget, node)
case 'markdown':
return toClass(MarkdownWidget, narrowedWidget, node)
case 'treeselect':
return toClass(TreeSelectWidget, narrowedWidget, node)
case 'multiselect':
return toClass(MultiSelectWidget, narrowedWidget, node)
case 'chart':
return toClass(ChartWidget, narrowedWidget, node)
case 'galleria':
return toClass(GalleriaWidget, narrowedWidget, node)
case 'imagecompare':
return toClass(ImageCompareWidget, narrowedWidget, node)
case 'selectbutton':
return toClass(SelectButtonWidget, narrowedWidget, node)
case 'textarea':
return toClass(TextareaWidget, narrowedWidget, node)
case 'asset':
return toClass(AssetWidget, narrowedWidget, node)
case 'imagecrop':
return toClass(ImageCropWidget, narrowedWidget, node)
case 'boundingbox':
return toClass(BoundingBoxWidget, narrowedWidget, node)
case 'curve':
return toClass(CurveWidget, narrowedWidget, node)
case 'painter':
return toClass(PainterWidget, narrowedWidget, node)
default: {
if (wrapLegacyWidgets) return toClass(LegacyWidget, widget, node)
}
}
}
// #region Type Guards
/** Type guard: Narrow **from {@link IBaseWidget}** to {@link IComboWidget}. */
export function isComboWidget(widget: IBaseWidget): widget is IComboWidget {
return widget.type === 'combo'
}
/**
* Type guard: Narrow **from {@link IBaseWidget}** to {@link IAssetWidget}.
* @knipIgnoreUnusedButUsedByCustomNodes
*/
export function isAssetWidget(widget: IBaseWidget): widget is IAssetWidget {
return widget.type === 'asset'
}
// #endregion Type Guards
@@ -0,0 +1,268 @@
import { ref } from 'vue'
import MultiSelectWidget from '@/components/graph/widgets/MultiSelectWidget.vue'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import { isComboWidget } from '@/lib/litegraph/src/litegraph'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import { assetService } from '@/platform/assets/services/assetService'
import { createAssetWidget } from '@/platform/assets/utils/createAssetWidget'
import { isCloud } from '@/platform/distribution/types'
import type {
ComboInputSpec,
InputSpec
} from '@/schemas/nodeDef/nodeDefSchemaV2'
import { isComboInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import { transformInputSpecV2ToV1 } from '@/schemas/nodeDef/migration'
import { ComponentWidgetImpl, addWidget } from '@/scripts/domWidget'
import type { BaseDOMWidget } from '@/scripts/domWidget'
import type { ComfyWidgetConstructorV2 } from '@/scripts/widgets'
import { addValueControlWidgets } from '@/scripts/widgets'
import { useAssetsStore } from '@/stores/assetsStore'
import { getMediaTypeFromFilename } from '@/utils/formatUtil'
import { useRemoteWidget } from './useRemoteWidget'
const getDefaultValue = (inputSpec: ComboInputSpec) => {
if (inputSpec.default) return inputSpec.default
if (inputSpec.options?.length) return inputSpec.options[0]
if (inputSpec.remote) return 'Loading...'
return undefined
}
// Map node types to expected media types
const NODE_MEDIA_TYPE_MAP: Record<string, 'image' | 'video' | 'audio'> = {
LoadImage: 'image',
LoadVideo: 'video',
LoadAudio: 'audio'
}
// Map node types to placeholder i18n keys
const NODE_PLACEHOLDER_MAP: Record<string, string> = {
LoadImage: 'widgets.uploadSelect.placeholderImage',
LoadVideo: 'widgets.uploadSelect.placeholderVideo',
LoadAudio: 'widgets.uploadSelect.placeholderAudio'
}
const bindDynamicValuesOption = (
widget: IBaseWidget,
getValues: () => unknown
) => {
const options = widget.options
let fallbackValues = Array.isArray(options.values)
? options.values
: ([] as unknown[])
Object.defineProperty(options, 'values', {
configurable: true,
enumerable: true,
get: () => {
const values = getValues()
if (values === undefined || values === null) return fallbackValues
return values
},
set: (values: unknown[]) => {
fallbackValues = Array.isArray(values) ? values : fallbackValues
}
})
}
const addMultiSelectWidget = (
node: LGraphNode,
inputSpec: ComboInputSpec
): IBaseWidget => {
const widgetValue = ref<string[]>([])
const widget = new ComponentWidgetImpl({
node,
name: inputSpec.name,
component: MultiSelectWidget,
inputSpec,
options: {
getValue: () => widgetValue.value,
setValue: (value: string[]) => {
widgetValue.value = value
}
}
})
addWidget(node, widget as BaseDOMWidget<object | string>)
// TODO: Add remote support to multi-select widget
// https://github.com/Comfy-Org/ComfyUI_frontend/issues/3003
if (inputSpec.control_after_generate) {
const defaultType =
typeof inputSpec.control_after_generate === 'string'
? inputSpec.control_after_generate
: 'fixed'
widget.linkedWidgets = addValueControlWidgets(
node,
widget,
defaultType,
undefined,
transformInputSpecV2ToV1(inputSpec)
)
}
return widget
}
function createAssetBrowserWidget(
node: LGraphNode,
inputSpec: ComboInputSpec,
defaultValue: string | undefined
): IBaseWidget {
return createAssetWidget({
node,
widgetName: inputSpec.name,
nodeTypeForBrowser: node.comfyClass ?? '',
inputNameForBrowser: inputSpec.name,
defaultValue,
onValueChange: (widget, newValue, oldValue) => {
node.onWidgetChanged?.(widget.name, newValue, oldValue, widget)
}
})
}
const createInputMappingWidget = (
node: LGraphNode,
inputSpec: ComboInputSpec,
defaultValue: string | undefined
): IBaseWidget => {
const assetsStore = useAssetsStore()
const widget = node.addWidget(
'combo',
inputSpec.name,
defaultValue ?? '',
() => {},
{
values: [],
getOptionLabel: (value?: string | null) => {
if (!value) {
const placeholderKey =
NODE_PLACEHOLDER_MAP[node.comfyClass ?? ''] ??
'widgets.uploadSelect.placeholder'
return t(placeholderKey)
}
return assetsStore.getInputName(value)
}
}
)
if (assetsStore.inputAssets.length === 0 && !assetsStore.inputLoading) {
void assetsStore.updateInputs().then(() => {
// edge for users using nodes with 0 prior inputs
// force canvas refresh the first time they add an asset
// so they see filenames instead of hashes.
node.setDirtyCanvas(true, false)
})
}
bindDynamicValuesOption(widget, () =>
assetsStore.inputAssets
.filter(
(asset) =>
getMediaTypeFromFilename(asset.name) ===
NODE_MEDIA_TYPE_MAP[node.comfyClass ?? '']
)
.map((asset) => asset.asset_hash)
.filter((hash): hash is string => !!hash)
)
if (inputSpec.control_after_generate) {
if (!isComboWidget(widget)) {
throw new Error(`Expected combo widget but received ${widget.type}`)
}
const defaultType =
typeof inputSpec.control_after_generate === 'string'
? inputSpec.control_after_generate
: 'randomize'
widget.linkedWidgets = addValueControlWidgets(
node,
widget,
defaultType,
undefined,
transformInputSpecV2ToV1(inputSpec)
)
}
return widget
}
const addComboWidget = (
node: LGraphNode,
inputSpec: ComboInputSpec
): IBaseWidget => {
const defaultValue = getDefaultValue(inputSpec)
if (isCloud) {
if (assetService.shouldUseAssetBrowser(node.comfyClass, inputSpec.name)) {
return createAssetBrowserWidget(node, inputSpec, defaultValue)
}
if (NODE_MEDIA_TYPE_MAP[node.comfyClass ?? '']) {
return createInputMappingWidget(node, inputSpec, defaultValue)
}
}
// Standard combo widget
const widget = node.addWidget(
'combo',
inputSpec.name,
defaultValue,
() => {},
{
values: inputSpec.options ?? []
}
)
if (inputSpec.remote) {
if (!isComboWidget(widget)) {
throw new Error(`Expected combo widget but received ${widget.type}`)
}
const remoteWidget = useRemoteWidget({
remoteConfig: inputSpec.remote,
defaultValue,
node,
widget
})
if (inputSpec.remote.refresh_button) remoteWidget.addRefreshButton()
bindDynamicValuesOption(widget, () => remoteWidget.getValue())
}
if (inputSpec.control_after_generate) {
if (!isComboWidget(widget)) {
throw new Error(`Expected combo widget but received ${widget.type}`)
}
const defaultType =
typeof inputSpec.control_after_generate === 'string'
? inputSpec.control_after_generate
: 'randomize'
widget.linkedWidgets = addValueControlWidgets(
node,
widget,
defaultType,
undefined,
transformInputSpecV2ToV1(inputSpec)
)
}
return widget
}
export const useComboWidget = () => {
const widgetConstructor: ComfyWidgetConstructorV2 = (
node: LGraphNode,
inputSpec: InputSpec
) => {
if (!isComboInputSpec(inputSpec)) {
throw new Error(`Invalid input data: ${inputSpec}`)
}
return inputSpec.multi_select
? addMultiSelectWidget(node, inputSpec)
: addComboWidget(node, inputSpec)
}
return widgetConstructor
}
@@ -0,0 +1,129 @@
import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
import { useNodeImageUpload } from '@/composables/node/useNodeImageUpload'
import { t } from '@/i18n'
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { IComboWidget } from '@/lib/litegraph/src/types/widgets'
import type { ResultItemType } from '@/schemas/apiSchema'
import type { InputSpec } from '@/schemas/nodeDefSchema'
import type { ComfyWidgetConstructor } from '@/scripts/widgets'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
import { isImageUploadInput } from '@/types/nodeDefAugmentation'
import { createAnnotatedPath } from '@/utils/createAnnotatedPath'
import { addToComboValues } from '@/utils/litegraphUtil'
import {
ACCEPTED_IMAGE_TYPES,
ACCEPTED_VIDEO_TYPES
} from '@/utils/mediaUploadUtil'
const isImageFile = (file: File) => file.type.startsWith('image/')
const isVideoFile = (file: File) => file.type.startsWith('video/')
const findFileComboWidget = (
node: LGraphNode,
inputName: string
): IComboWidget | undefined =>
node.widgets?.find((w): w is IComboWidget => w.name === inputName)
export const useImageUploadWidget = () => {
const widgetConstructor: ComfyWidgetConstructor = (
node: LGraphNode,
inputName: string,
inputData: InputSpec
) => {
if (!isImageUploadInput(inputData)) {
throw new Error(
'Image upload widget requires imageInputName augmentation'
)
}
const inputOptions = inputData[1]
const { imageInputName, allow_batch, image_folder = 'input' } = inputOptions
const folder: ResultItemType | undefined = image_folder
const nodeOutputStore = useNodeOutputStore()
const isAnimated = !!inputOptions.animated_image_upload
const isVideo = !!inputOptions.video_upload
const accept = isVideo ? ACCEPTED_VIDEO_TYPES : ACCEPTED_IMAGE_TYPES
const { showPreview } = isVideo ? useNodeVideo(node) : useNodeImage(node)
const fileFilter = isVideo ? isVideoFile : isImageFile
const fileComboWidget = findFileComboWidget(node, imageInputName)
if (!fileComboWidget) {
throw new Error(`Widget "${imageInputName}" not found on node`)
}
const formatPath = (value: string) =>
createAnnotatedPath(value, { rootFolder: image_folder })
// Setup file upload handling
let rollback: (() => void) | undefined
const { openFileSelection } = useNodeImageUpload(node, {
allow_batch,
fileFilter,
accept,
folder,
onUploadStart: (files) => {
if (files.length > 0) {
const prev = fileComboWidget.value
fileComboWidget.value = files[0].name
rollback = () => {
fileComboWidget.value = prev
}
}
},
onUploadError: () => {
rollback?.()
rollback = undefined
},
onUploadComplete: (output) => {
rollback = undefined
const annotated = output.map(formatPath)
annotated.forEach((path) => {
addToComboValues(fileComboWidget, path)
})
const newValue = allow_batch ? annotated : annotated[0]
// @ts-expect-error litegraph combo value type does not support arrays yet
fileComboWidget.value = newValue
fileComboWidget.callback?.(newValue)
}
})
// Create the button widget for selecting the files
const uploadWidget = node.addWidget(
'button',
inputName,
'image',
() => openFileSelection(),
{
serialize: false,
canvasOnly: true
}
)
uploadWidget.label = t('g.choose_file_to_upload')
// Add our own callback to the combo widget to render an image when it changes
fileComboWidget.callback = function () {
node.imgs = undefined
nodeOutputStore.setNodeOutputs(node, String(fileComboWidget.value), {
isAnimated
})
node.graph?.setDirtyCanvas(true)
}
// On load if we have a value then render the image
// The value isn't set immediately so we need to wait a moment
// No change callbacks seem to be fired on initial setting of the value
requestAnimationFrame(() => {
nodeOutputStore.setNodeOutputs(node, String(fileComboWidget.value), {
isAnimated
})
showPreview({ block: false })
})
return { widget: uploadWidget }
}
return widgetConstructor
}
@@ -0,0 +1,93 @@
import type { LGraphNode } from '@/lib/litegraph/src/litegraph'
import type { INumericWidget } from '@/lib/litegraph/src/types/widgets'
import { useSettingStore } from '@/platform/settings/settingStore'
import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import { isIntInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import type { ComfyWidgetConstructorV2 } from '@/scripts/widgets'
import { addValueControlWidget } from '@/scripts/widgets'
import { transformInputSpecV2ToV1 } from '@/schemas/nodeDef/migration'
function onValueChange(this: INumericWidget, v: number) {
// For integers, always round to the nearest step
// step === 0 is invalid, assign 1 if options.step is 0
const step = this.options.step2 || 1
if (step === 1) {
// Simple case: round to nearest integer
this.value = Math.round(v)
} else {
// Round to nearest multiple of step
// First, determine if min value creates an offset
const min = this.options.min ?? 0
const offset = min % step
// Round to nearest step, accounting for offset
this.value = Math.round((v - offset) / step) * step + offset
}
}
export const _for_testing = {
onValueChange
}
export const useIntWidget = () => {
const widgetConstructor: ComfyWidgetConstructorV2 = (
node: LGraphNode,
inputSpec: InputSpec
) => {
if (!isIntInputSpec(inputSpec)) {
throw new Error(`Invalid input data: ${inputSpec}`)
}
const settingStore = useSettingStore()
const sliderEnabled = !settingStore.get('Comfy.DisableSliders')
const display_type = inputSpec.display
const widgetType =
sliderEnabled && display_type == 'slider'
? 'slider'
: display_type == 'knob'
? 'knob'
: 'number'
const step = inputSpec.step ?? 1
/** Assertion {@link inputSpec.default} */
const defaultValue = (inputSpec.default as number | undefined) ?? 0
const widget = node.addWidget(
widgetType,
inputSpec.name,
defaultValue,
onValueChange,
{
min: inputSpec.min ?? 0,
max: inputSpec.max ?? 2048,
/** @deprecated Use step2 instead. The 10x value is a legacy implementation. */
step: step * 10,
step2: step,
precision: 0
}
)
const controlAfterGenerate =
inputSpec.control_after_generate ??
['seed', 'noise_seed'].includes(inputSpec.name)
if (controlAfterGenerate) {
const defaultType =
typeof inputSpec.control_after_generate === 'string'
? inputSpec.control_after_generate
: 'randomize'
const controlWidget = addValueControlWidget(
node,
widget,
defaultType,
undefined,
undefined,
transformInputSpecV2ToV1(inputSpec)
)
widget.linkedWidgets = [controlWidget]
}
return widget
}
return widgetConstructor
}
@@ -0,0 +1,415 @@
import _ from 'es-toolkit/compat'
import { type Component, toRaw } from 'vue'
import { useChainCallback } from '@/composables/functional/useChainCallback'
import {
LGraphNode,
LegacyWidget,
LiteGraph
} from '@/lib/litegraph/src/litegraph'
import type {
IBaseWidget,
IWidgetOptions
} from '@/lib/litegraph/src/types/widgets'
import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
import { useDomWidgetStore } from '@/stores/domWidgetStore'
import { usePromotionStore } from '@/stores/promotionStore'
import { generateUUID } from '@/utils/formatUtil'
export interface BaseDOMWidget<
V extends object | string = object | string
> extends IBaseWidget<V, string, DOMWidgetOptions<V>> {
// ICustomWidget properties
type: string
options: DOMWidgetOptions<V>
value: V
callback?: (value: V) => void
// BaseDOMWidget properties
/** The unique ID of the widget. */
readonly id: string
/** The node that the widget belongs to. */
readonly node: LGraphNode
/** Whether the widget is visible. */
isVisible(): boolean
/** The margin of the widget. */
margin: number
}
/**
* A DOM widget that wraps a custom HTML element as a litegraph widget.
*/
export interface DOMWidget<
T extends HTMLElement,
V extends object | string
> extends BaseDOMWidget<V> {
element: T
/**
* @deprecated Legacy property used by some extensions for customtext
* (textarea) widgets. Use {@link element} instead as it provides the same
* functionality and works for all DOMWidget types.
*/
inputEl?: T
}
/**
* Additional props that can be passed to component widgets.
* These are in addition to the standard props that are always provided:
* - modelValue: The widget's value (handled by v-model)
* - widget: Reference to the widget instance
* - onUpdate:modelValue: The update handler for v-model
*/
type ComponentWidgetCustomProps = Record<string, unknown>
/**
* Standard props that are handled separately by DomWidget.vue and should be
* omitted when defining custom props for component widgets
*/
export type ComponentWidgetStandardProps =
| 'modelValue'
| 'widget'
| 'onUpdate:modelValue'
/**
* A DOM widget that wraps a Vue component as a litegraph widget.
*/
export interface ComponentWidget<
V extends object | string,
P extends ComponentWidgetCustomProps = ComponentWidgetCustomProps
> extends BaseDOMWidget<V> {
readonly component: Component
readonly inputSpec: InputSpec
readonly props?: P
}
export interface DOMWidgetOptions<
V extends object | string
> extends IWidgetOptions {
/**
* Whether to render a placeholder rectangle when zoomed out.
*/
hideOnZoom?: boolean
selectOn?: string[]
onHide?: (widget: BaseDOMWidget<V>) => void
getValue?: () => V
setValue?: (value: V) => void
getMinHeight?: () => number
getMaxHeight?: () => number
getHeight?: () => string | number
onDraw?: (widget: BaseDOMWidget<V>) => void
margin?: number
/**
* @deprecated Use `afterResize` instead. This callback is a legacy API
* that fires before resize happens, but it is no longer supported. Now it
* fires after resize happens.
* The resize logic has been upstreamed to litegraph in
* https://github.com/Comfy-Org/ComfyUI_frontend/pull/2557
*/
beforeResize?: (this: BaseDOMWidget<V>, node: LGraphNode) => void
afterResize?: (this: BaseDOMWidget<V>, node: LGraphNode) => void
}
export const isDOMWidget = <T extends HTMLElement, V extends object | string>(
widget: IBaseWidget
): widget is DOMWidget<T, V> => 'element' in widget && !!widget.element
export const isComponentWidget = <V extends object | string>(
widget: IBaseWidget
): widget is ComponentWidget<V> => 'component' in widget && !!widget.component
abstract class BaseDOMWidgetImpl<V extends object | string>
extends LegacyWidget<IBaseWidget<V, string, DOMWidgetOptions<V>>>
implements BaseDOMWidget<V>
{
static readonly DEFAULT_MARGIN = 10
declare readonly name: string
declare readonly options: DOMWidgetOptions<V>
declare callback?: (value: V) => void
readonly promotionStore = usePromotionStore()
readonly id: string
constructor(obj: {
node: LGraphNode
name: string
type: string
options: DOMWidgetOptions<V>
}) {
const { node, name, type, options } = obj
super({ y: 0, name, type, options }, node)
this.id = generateUUID()
}
override get value(): V {
return this.options.getValue?.() ?? ('' as V)
}
override set value(v: V) {
this.options.setValue?.(v)
this.callback?.(this.value)
}
get margin(): number {
return this.options.margin ?? BaseDOMWidgetImpl.DEFAULT_MARGIN
}
isVisible(): boolean {
return !this.hidden && this.node.isWidgetVisible(this)
}
override draw(
ctx: CanvasRenderingContext2D,
_node: LGraphNode,
widget_width: number,
y: number,
widget_height: number,
lowQuality?: boolean
): void {
const isVisible = this.isVisible()
if (this.options.hideOnZoom && lowQuality && isVisible) {
// Draw a placeholder rectangle
const originalFillStyle = ctx.fillStyle
ctx.beginPath()
ctx.fillStyle = LiteGraph.WIDGET_BGCOLOR
ctx.rect(
this.margin,
y + this.margin,
widget_width - this.margin * 2,
(this.computedHeight ?? widget_height) - 2 * this.margin
)
ctx.fill()
ctx.fillStyle = originalFillStyle
} else {
if (!isVisible) {
this.options.onDraw?.(this)
return
}
const graphId = this.node.graph?.rootGraph.id
const isPromoted =
graphId &&
this.promotionStore.isPromotedByAny(graphId, {
sourceNodeId: String(this.node.id),
sourceWidgetName: this.name
})
if (!isPromoted) {
this.options.onDraw?.(this)
return
}
ctx.save()
const adjustedMargin = this.margin - 1
ctx.beginPath()
ctx.strokeStyle = LiteGraph.WIDGET_PROMOTED_OUTLINE_COLOR
ctx.strokeRect(
adjustedMargin,
y + adjustedMargin,
widget_width - adjustedMargin * 2,
(this.computedHeight ?? widget_height) - 2 * adjustedMargin
)
ctx.restore()
}
this.options.onDraw?.(this)
}
override onRemove(): void {
useDomWidgetStore().unregisterWidget(this.id)
}
override createCopyForNode(node: LGraphNode): this {
// @ts-expect-error
const cloned: this = new (this.constructor as typeof this)({
node: node,
name: this.name,
type: this.type,
options: this.options
})
cloned.value = this.value
// Preserve the Y position from the original widget to maintain proper positioning
// when widgets are promoted through subgraph nesting
cloned.y = this.y
return cloned
}
}
export class DOMWidgetImpl<T extends HTMLElement, V extends object | string>
extends BaseDOMWidgetImpl<V>
implements DOMWidget<T, V>
{
override readonly element: T
constructor(obj: {
node: LGraphNode
name: string
type: string
element: T
options: DOMWidgetOptions<V>
}) {
super(obj)
this.element = obj.element
}
override createCopyForNode(node: LGraphNode): this {
// @ts-expect-error
const cloned: this = new (this.constructor as typeof this)({
node: node,
name: this.name,
type: this.type,
element: this.element, // Include the element!
options: this.options
})
cloned.value = this.value
// Preserve the Y position from the original widget to maintain proper positioning
// when widgets are promoted through subgraph nesting
cloned.y = this.y
return cloned
}
/** Extract DOM widget size info */
override computeLayoutSize(node: LGraphNode) {
if (this.type === 'hidden') {
return {
minHeight: 0,
maxHeight: 0,
minWidth: 0
}
}
const styles = getComputedStyle(this.element)
let minHeight =
this.options.getMinHeight?.() ??
parseInt(styles.getPropertyValue('--comfy-widget-min-height'))
let maxHeight =
this.options.getMaxHeight?.() ??
parseInt(styles.getPropertyValue('--comfy-widget-max-height'))
let prefHeight: string | number =
this.options.getHeight?.() ??
styles.getPropertyValue('--comfy-widget-height')
if (typeof prefHeight === 'string' && prefHeight.endsWith?.('%')) {
prefHeight =
node.size[1] *
(parseFloat(prefHeight.substring(0, prefHeight.length - 1)) / 100)
} else {
prefHeight =
typeof prefHeight === 'number' ? prefHeight : parseInt(prefHeight)
if (isNaN(minHeight)) {
minHeight = prefHeight
}
}
return {
minHeight: isNaN(minHeight) ? 50 : minHeight,
maxHeight: isNaN(maxHeight) ? undefined : maxHeight,
minWidth: 0
}
}
}
export class ComponentWidgetImpl<
V extends object | string,
P extends ComponentWidgetCustomProps = ComponentWidgetCustomProps
>
extends BaseDOMWidgetImpl<V>
implements ComponentWidget<V, P>
{
readonly component: Component
readonly inputSpec: InputSpec
readonly props?: P
constructor(obj: {
node: LGraphNode
name: string
component: Component
inputSpec: InputSpec
props?: P
options: DOMWidgetOptions<V>
type?: string
}) {
super({
type: 'custom',
...obj
})
this.component = obj.component
this.inputSpec = obj.inputSpec
this.props = obj.props
}
override computeLayoutSize() {
const minHeight = this.options.getMinHeight?.() ?? 50
const maxHeight = this.options.getMaxHeight?.()
return {
minHeight,
maxHeight,
minWidth: 0
}
}
override serializeValue(): V {
return toRaw(this.value)
}
}
export const addWidget = <W extends BaseDOMWidget<object | string>>(
node: LGraphNode,
widget: W
) => {
node.addCustomWidget(widget)
if (node.graph) {
useDomWidgetStore().registerWidget(widget)
}
node.onAdded = useChainCallback(node.onAdded, () => {
useDomWidgetStore().registerWidget(widget)
})
node.onRemoved = useChainCallback(node.onRemoved, () => {
widget.onRemove?.()
})
node.onResize = useChainCallback(node.onResize, () => {
widget.options.beforeResize?.call(widget, node)
widget.options.afterResize?.call(widget, node)
})
}
LGraphNode.prototype.addDOMWidget = function <
T extends HTMLElement,
V extends object | string
>(
this: LGraphNode,
name: string,
type: string,
element: T,
options: DOMWidgetOptions<V> = {}
): DOMWidget<T, V> {
const widget = new DOMWidgetImpl({
node: this,
name,
type,
element,
options: { hideOnZoom: true, ...options }
})
// Note: Before `LGraphNode.configure` is called, `this.id` is always `-1`.
addWidget(this, widget as unknown as BaseDOMWidget<object | string>)
// Workaround for https://github.com/Comfy-Org/ComfyUI_frontend/issues/2493
// Some custom nodes are explicitly expecting getter and setter of `value`
// property to be on instance instead of prototype.
Object.defineProperty(widget, 'value', {
get(this: DOMWidgetImpl<T, V>): V {
return this.options.getValue?.() ?? ('' as V)
},
set(this: DOMWidgetImpl<T, V>, v: V) {
this.options.setValue?.(v)
this.callback?.(this.value)
}
})
return widget
}
@@ -0,0 +1,320 @@
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 { 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 { 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()),
...dynamicWidgets
} as const
export function isValidWidgetType(
key: unknown
): key is keyof typeof ComfyWidgets {
return ComfyWidgets[key as keyof typeof ComfyWidgets] !== undefined
}
@@ -0,0 +1,999 @@
import _ from 'es-toolkit/compat'
import { downloadFile, openFileInNewTab } from '@/base/common/downloadUtil'
import { useSelectedLiteGraphItems } from '@/composables/canvas/useSelectedLiteGraphItems'
import { useSubgraphOperations } from '@/composables/graph/useSubgraphOperations'
import { useNodeAnimatedImage } from '@/composables/node/useNodeAnimatedImage'
import { useNodeCanvasImagePreview } from '@/composables/node/useNodeCanvasImagePreview'
import { useNodeImage, useNodeVideo } from '@/composables/node/useNodeImage'
import {
addWidgetPromotionOptions,
isPreviewPseudoWidget
} from '@/core/graph/subgraph/promotionUtils'
import { applyDynamicInputs } from '@/core/graph/widgets/dynamicWidgets'
import { st, t } from '@/i18n'
import {
LGraphCanvas,
LGraphEventMode,
LGraphNode,
LiteGraph,
RenderShape,
SubgraphNode,
createBounds
} from '@/lib/litegraph/src/litegraph'
import type {
CreateNodeOptions,
GraphAddOptions,
IContextMenuValue,
Point,
Subgraph
} from '@/lib/litegraph/src/litegraph'
import type {
ExportedSubgraphInstance,
ISerialisableNodeInput,
ISerialisableNodeOutput,
ISerialisedNode
} from '@/lib/litegraph/src/types/serialisation'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useToastStore } from '@/platform/updates/common/toastStore'
import { useWorkflowStore } from '@/platform/workflow/management/stores/workflowStore'
import type { NodeId } from '@/platform/workflow/validation/schemas/workflowSchema'
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
import { useDialogService } from '@/services/dialogService'
import { resolveSubgraphPseudoWidgetCache } from '@/services/subgraphPseudoWidgetCache'
import type { SubgraphPseudoWidgetCache } from '@/services/subgraphPseudoWidgetCache'
import { transformInputSpecV2ToV1 } from '@/schemas/nodeDef/migration'
import type {
ComfyNodeDef as ComfyNodeDefV2,
InputSpec,
OutputSpec
} from '@/schemas/nodeDef/nodeDefSchemaV2'
import type { ComfyNodeDef as ComfyNodeDefV1 } from '@/schemas/nodeDefSchema'
import { ComfyApp, app } from '@/scripts/app'
import { isComponentWidget, isDOMWidget } from '@/scripts/domWidget'
import { $el } from '@/scripts/ui'
import { useDomWidgetStore } from '@/stores/domWidgetStore'
import { useExecutionStore } from '@/stores/executionStore'
import { useNodeOutputStore } from '@/stores/nodeOutputStore'
import { ComfyNodeDefImpl } from '@/stores/nodeDefStore'
import { usePromotionStore } from '@/stores/promotionStore'
import { useSubgraphStore } from '@/stores/subgraphStore'
import { useFavoritedWidgetsStore } from '@/stores/workspace/favoritedWidgetsStore'
import { useRightSidePanelStore } from '@/stores/workspace/rightSidePanelStore'
import { useWidgetStore } from '@/stores/widgetStore'
import { normalizeI18nKey } from '@/utils/formatUtil'
import {
isAnimatedOutput,
isImageNode,
isVideoNode,
isVideoOutput,
migrateWidgetsValues
} from '@/utils/litegraphUtil'
import { getOrderedInputSpecs } from '@/workbench/utils/nodeDefOrderingUtil'
import { useExtensionService } from './extensionService'
import { useMaskEditor } from '@/composables/maskeditor/useMaskEditor'
async function reencodeAsPngBlob(
blob: Blob,
width: number,
height: number
): Promise<Blob> {
const canvas = $el('canvas', { width, height }) as HTMLCanvasElement
const ctx = canvas.getContext('2d')
if (!ctx) throw new Error('Could not get canvas context')
let image: ImageBitmap | HTMLImageElement
if (typeof window.createImageBitmap === 'undefined') {
const img = new Image()
const loaded = new Promise<void>((resolve, reject) => {
img.onload = () => resolve()
img.onerror = () => reject(new Error('Image load failed'))
})
img.src = URL.createObjectURL(blob)
try {
await loaded
} finally {
URL.revokeObjectURL(img.src)
}
image = img
} else {
image = await createImageBitmap(blob)
}
try {
ctx.drawImage(image, 0, 0)
} finally {
if ('close' in image && typeof image.close === 'function') {
image.close()
}
}
return new Promise<Blob>((resolve, reject) => {
canvas.toBlob((result) => {
if (result) resolve(result)
else reject(new Error('PNG conversion failed'))
}, 'image/png')
})
}
export interface HasInitialMinSize {
_initialMinSize: { width: number; height: number }
}
export const CONFIG = Symbol()
export const GET_CONFIG = Symbol()
export function getExtraOptionsForWidget(
node: LGraphNode,
widget: IBaseWidget
) {
const options: IContextMenuValue[] = []
const input = node.inputs.find((inp) => inp.widget?.name === widget.name)
if (input) {
options.unshift({
content: `${t('contextMenu.RenameWidget')}: ${widget.label ?? widget.name}`,
callback: async () => {
const newLabel = await useDialogService().prompt({
title: t('g.rename'),
message: t('g.enterNewNamePrompt'),
defaultValue: widget.label,
placeholder: widget.name
})
if (newLabel === null) return
widget.label = newLabel || undefined
input.label = newLabel || undefined
widget.callback?.(widget.value)
useCanvasStore().canvas?.setDirty(true)
}
})
}
const favoritedWidgetsStore = useFavoritedWidgetsStore()
const isFavorited = favoritedWidgetsStore.isFavorited(node, widget.name)
options.unshift({
content: isFavorited
? `${t('contextMenu.UnfavoriteWidget')}: ${widget.label ?? widget.name}`
: `${t('contextMenu.FavoriteWidget')}: ${widget.label ?? widget.name}`,
callback: () => {
favoritedWidgetsStore.toggleFavorite(node, widget.name)
}
})
if (node.graph && !node.graph.isRootGraph) {
addWidgetPromotionOptions(options, widget, node)
}
return options
}
/**
* Service that augments litegraph with ComfyUI specific functionality.
*/
export const useLitegraphService = () => {
const extensionService = useExtensionService()
const toastStore = useToastStore()
const widgetStore = useWidgetStore()
const canvasStore = useCanvasStore()
const { toggleSelectedNodesMode } = useSelectedLiteGraphItems()
const subgraphPseudoWidgetCache = new WeakMap<
SubgraphNode,
SubgraphPseudoWidgetCache<LGraphNode, IBaseWidget>
>()
function invalidateSubgraphPseudoWidgetCache(node: SubgraphNode) {
subgraphPseudoWidgetCache.delete(node)
}
function getPseudoWidgetPreviewTargets(node: SubgraphNode): LGraphNode[] {
const promotionStore = usePromotionStore()
const promotions = promotionStore.getPromotionsRef(
node.rootGraph.id,
node.id
)
const resolved = resolveSubgraphPseudoWidgetCache({
cache: subgraphPseudoWidgetCache.get(node) ?? null,
promotions,
getNodeById: (nodeId) => node.subgraph.getNodeById(nodeId) ?? undefined,
isPreviewPseudoWidget
})
subgraphPseudoWidgetCache.set(node, resolved.cache)
return resolved.nodes
}
/**
* @internal The key for the node definition in the i18n file.
*/
function nodeKey(node: LGraphNode): string {
return `nodeDefs.${normalizeI18nKey(node.constructor.nodeData!.name)}`
}
/**
* @internal Add input sockets to the node. (No widget)
*/
function addInputSocket(node: LGraphNode, inputSpec: InputSpec) {
const inputName = inputSpec.name
const nameKey = `${nodeKey(node)}.inputs.${normalizeI18nKey(inputName)}.name`
const widgetConstructor = widgetStore.widgets.get(
inputSpec.widgetType ?? inputSpec.type
)
if (
(widgetConstructor && !inputSpec.forceInput) ||
applyDynamicInputs(node, inputSpec)
)
return
const input = node.addInput(inputName, inputSpec.type, {
shape: inputSpec.isOptional ? RenderShape.HollowCircle : undefined,
localized_name: st(nameKey, inputName)
})
input.label ??= inputSpec.display_name
}
/**
* @internal Setup stroke styles for the node under various conditions.
*/
function setupStrokeStyles(node: LGraphNode) {
node.strokeStyles['running'] = function (this: LGraphNode) {
const nodeId = String(this.id)
const nodeLocatorId = useWorkflowStore().nodeIdToNodeLocatorId(nodeId)
const state =
useExecutionStore().nodeLocationProgressStates[nodeLocatorId]?.state
if (state === 'running') {
return { color: '#0f0', lineWidth: 3 }
}
}
node.strokeStyles['dragOver'] = function (this: LGraphNode) {
if (app.dragOverNode?.id == this.id) {
return { color: 'dodgerblue' }
}
}
node.strokeStyles['executionError'] = function (this: LGraphNode) {
if (app.lastExecutionError?.node_id == this.id) {
return { color: '#f0f', lineWidth: 3 }
}
}
}
/**
* Utility function. Implemented for use with dynamic widgets
*/
function addNodeInput(node: LGraphNode, inputSpec: InputSpec) {
addInputSocket(node, inputSpec)
addInputWidget(node, inputSpec, { dynamic: true })
}
/**
* @internal Add a widget to the node. For both primitive types and custom widgets
* (unless `socketless`), an input socket is also added.
*/
function addInputWidget(
node: LGraphNode,
inputSpec: InputSpec,
{ dynamic }: { dynamic?: boolean } = {}
) {
const widgetInputSpec = { ...inputSpec }
if (inputSpec.widgetType) {
widgetInputSpec.type = inputSpec.widgetType
}
const inputName = inputSpec.name
const nameKey = `${nodeKey(node)}.inputs.${normalizeI18nKey(inputName)}.name`
const widgetConstructor = widgetStore.widgets.get(widgetInputSpec.type)
if (!widgetConstructor || inputSpec.forceInput) return
const {
widget,
minWidth = 1,
minHeight = 1
} = widgetConstructor(
node,
inputName,
transformInputSpecV2ToV1(widgetInputSpec),
app
) ?? {}
if (widget) {
widget.label = st(
nameKey,
widget.label ?? widgetInputSpec.display_name ?? inputName
)
widget.options ??= {}
Object.assign(widget.options, {
advanced: inputSpec.advanced,
hidden: inputSpec.hidden
})
if (dynamic) widget.tooltip = inputSpec.tooltip
}
if (!widget?.options?.socketless) {
const inputSpecV1 = transformInputSpecV2ToV1(widgetInputSpec)
node.addInput(inputName, inputSpec.type, {
shape: inputSpec.isOptional ? RenderShape.HollowCircle : undefined,
localized_name: st(nameKey, inputName),
widget: { name: inputName, [GET_CONFIG]: () => inputSpecV1 }
})
}
const castedNode = node as LGraphNode & HasInitialMinSize
castedNode._initialMinSize.width = Math.max(
castedNode._initialMinSize.width,
minWidth
)
castedNode._initialMinSize.height = Math.max(
castedNode._initialMinSize.height,
minHeight
)
}
/**
* @internal Add inputs to the node.
*/
function addInputs(node: LGraphNode, inputs: Record<string, InputSpec>) {
// Use input_order if available to ensure consistent widget ordering
//@ts-expect-error was ComfyNode.nodeData as ComfyNodeDefImpl
const nodeDefImpl = node.constructor.nodeData as ComfyNodeDefImpl
const orderedInputSpecs = getOrderedInputSpecs(nodeDefImpl, inputs)
// Create sockets and widgets in the determined order
for (const inputSpec of orderedInputSpecs) addInputSocket(node, inputSpec)
for (const inputSpec of orderedInputSpecs) addInputWidget(node, inputSpec)
}
/**
* @internal Add outputs to the node.
*/
function addOutputs(node: LGraphNode, outputs: OutputSpec[]) {
for (const output of outputs) {
const { name, is_list } = output
// TODO: Fix the typing at the node spec level
const type = output.type === 'COMFY_MATCHTYPE_V3' ? '*' : output.type
const shapeOptions = is_list ? { shape: LiteGraph.GRID_SHAPE } : {}
const nameKey = `${nodeKey(node)}.outputs.${output.index}.name`
const typeKey = `dataTypes.${normalizeI18nKey(type)}`
const outputOptions = {
...shapeOptions,
// If the output name is different from the output type, use the output name.
// e.g.
// - type ("INT"); name ("Positive") => translate name
// - type ("FLOAT"); name ("FLOAT") => translate type
localized_name: type !== name ? st(nameKey, name) : st(typeKey, name)
}
node.addOutput(name, type, outputOptions)
}
}
/**
* @internal Set the initial size of the node.
*/
function setInitialSize(node: LGraphNode) {
const s = node.computeSize()
// Expand the width a little to fit widget values on screen.
const pad =
node.widgets?.length &&
!useSettingStore().get('LiteGraph.Node.DefaultPadding')
const castedNode = node as LGraphNode & HasInitialMinSize
s[0] = Math.max(castedNode._initialMinSize.width, s[0] + (pad ? 60 : 0))
s[1] = Math.max(castedNode._initialMinSize.height, s[1])
node.setSize(s)
}
function registerSubgraphNodeDef(
nodeDefV1: ComfyNodeDefV1,
subgraph: Subgraph,
instanceData: ExportedSubgraphInstance
) {
const node = class ComfyNode
extends SubgraphNode
implements HasInitialMinSize
{
static comfyClass: string
static override title: string
static override category: string
static override nodeData: ComfyNodeDefV1 & ComfyNodeDefV2
_initialMinSize = { width: 1, height: 1 }
constructor() {
super(app.rootGraph, subgraph, instanceData)
// Set up event listener for promoted widget registration
subgraph.events.addEventListener('widget-promoted', (event) => {
invalidateSubgraphPseudoWidgetCache(this)
const { widget } = event.detail
// Only handle DOM widgets
if (!isDOMWidget(widget) && !isComponentWidget(widget)) return
const domWidgetStore = useDomWidgetStore()
if (!domWidgetStore.widgetStates.has(widget.id)) {
domWidgetStore.registerWidget(widget)
// Set initial visibility based on whether the widget's node is in the current graph
const widgetState = domWidgetStore.widgetStates.get(widget.id)
if (widgetState) {
const currentGraph = canvasStore.getCanvas().graph
widgetState.visible =
currentGraph?.nodes.includes(widget.node) ?? false
}
}
})
// Set up event listener for promoted widget removal
subgraph.events.addEventListener('widget-demoted', (event) => {
invalidateSubgraphPseudoWidgetCache(this)
const { widget } = event.detail
// Only handle DOM widgets
if (!isDOMWidget(widget) && !isComponentWidget(widget)) return
const domWidgetStore = useDomWidgetStore()
if (domWidgetStore.widgetStates.has(widget.id)) {
domWidgetStore.unregisterWidget(widget.id)
}
})
setupStrokeStyles(this)
addInputs(this, ComfyNode.nodeData.inputs)
addOutputs(this, ComfyNode.nodeData.outputs)
setInitialSize(this)
this.serialize_widgets = true
void extensionService.invokeExtensionsAsync('nodeCreated', this)
}
/**
* Configure the node from a serialised node. Keep 'name', 'type', 'shape',
* and 'localized_name' information from the original node definition.
*/
override configure(data: ISerialisedNode): void {
const RESERVED_KEYS = ['name', 'type', 'shape', 'localized_name']
// Note: input name is unique in a node definition, so we can lookup
// input by name.
const inputByName = new Map<string, ISerialisableNodeInput>(
data.inputs?.map((input) => [input.name, input]) ?? []
)
// Inputs defined by the node definition.
const definedInputNames = new Set(
this.inputs.map((input) => input.name)
)
const definedInputs = this.inputs.map((input) => {
const inputData = inputByName.get(input.name)
return inputData
? {
...inputData,
// Whether the input has associated widget follows the
// original node definition.
..._.pick(input, RESERVED_KEYS.concat('widget'))
}
: input
})
// Extra inputs that potentially dynamically added by custom js logic.
const extraInputs = data.inputs?.filter(
(input) => !definedInputNames.has(input.name)
)
data.inputs = [...definedInputs, ...(extraInputs ?? [])]
// Note: output name is not unique, so we cannot lookup output by name.
// Use index instead.
data.outputs = _.zip(this.outputs, data.outputs).map(
([output, outputData]) => {
// If there are extra outputs in the serialised node, use them directly.
// There are currently custom nodes that dynamically add outputs via
// js logic.
if (!output) return outputData as ISerialisableNodeOutput
return outputData
? {
...outputData,
..._.pick(output, RESERVED_KEYS)
}
: output
}
)
data.widgets_values = migrateWidgetsValues(
ComfyNode.nodeData.inputs,
this.widgets ?? [],
data.widgets_values ?? []
)
super.configure(data)
}
}
addNodeContextMenuHandler(node)
addDrawBackgroundHandler(node)
addNodeKeyHandler(node)
// Note: Some extensions expects node.comfyClass to be set in
// `beforeRegisterNodeDef`.
node.prototype.comfyClass = nodeDefV1.name
node.comfyClass = nodeDefV1.name
const nodeDef = new ComfyNodeDefImpl(nodeDefV1)
node.nodeData = nodeDef
LiteGraph.registerNodeType(subgraph.id, node)
// Note: Do not following assignments before `LiteGraph.registerNodeType`
// because `registerNodeType` will overwrite the assignments.
node.category = nodeDef.category
node.skip_list = true
node.title = nodeDef.display_name || nodeDef.name
}
async function registerNodeDef(nodeId: string, nodeDefV1: ComfyNodeDefV1) {
const node = class ComfyNode
extends LGraphNode
implements HasInitialMinSize
{
static comfyClass: string
static override title: string
static override category: string
static override nodeData: ComfyNodeDefV1 & ComfyNodeDefV2
_initialMinSize = { width: 1, height: 1 }
constructor(title: string) {
super(title)
setupStrokeStyles(this)
addInputs(this, ComfyNode.nodeData.inputs)
addOutputs(this, ComfyNode.nodeData.outputs)
setInitialSize(this)
this.serialize_widgets = true
// Mark API Nodes yellow by default to distinguish with other nodes.
if (ComfyNode.nodeData.api_node) {
this.color = LGraphCanvas.node_colors.yellow.color
this.bgcolor = LGraphCanvas.node_colors.yellow.bgcolor
}
void extensionService.invokeExtensionsAsync('nodeCreated', this)
}
/**
* Configure the node from a serialised node. Keep 'name', 'type', 'shape',
* and 'localized_name' information from the original node definition.
*/
override configure(data: ISerialisedNode): void {
const RESERVED_KEYS = ['name', 'type', 'shape', 'localized_name']
// Note: input name is unique in a node definition, so we can lookup
// input by name.
const inputByName = new Map<string, ISerialisableNodeInput>(
data.inputs?.map((input) => [input.name, input]) ?? []
)
// Inputs defined by the node definition.
const definedInputNames = new Set(
this.inputs.map((input) => input.name)
)
const definedInputs = this.inputs.map((input) => {
const inputData = inputByName.get(input.name)
return inputData
? {
...inputData,
// Whether the input has associated widget follows the
// original node definition.
..._.pick(input, RESERVED_KEYS.concat('widget'))
}
: input
})
// Extra inputs that potentially dynamically added by custom js logic.
const extraInputs = data.inputs?.filter(
(input) => !definedInputNames.has(input.name)
)
data.inputs = [...definedInputs, ...(extraInputs ?? [])]
// Note: output name is not unique, so we cannot lookup output by name.
// Use index instead.
data.outputs = _.zip(this.outputs, data.outputs).map(
([output, outputData]) => {
// If there are extra outputs in the serialised node, use them directly.
// There are currently custom nodes that dynamically add outputs via
// js logic.
if (!output) return outputData as ISerialisableNodeOutput
return outputData
? {
...outputData,
..._.pick(output, RESERVED_KEYS)
}
: output
}
)
data.widgets_values = migrateWidgetsValues(
ComfyNode.nodeData.inputs,
this.widgets ?? [],
data.widgets_values ?? []
)
super.configure(data)
}
}
addNodeContextMenuHandler(node)
addDrawBackgroundHandler(node)
addNodeKeyHandler(node)
// Note: Some extensions expects node.comfyClass to be set in
// `beforeRegisterNodeDef`.
node.prototype.comfyClass = nodeDefV1.name
node.comfyClass = nodeDefV1.name
await extensionService.invokeExtensionsAsync(
'beforeRegisterNodeDef',
node,
nodeDefV1 // Receives V1 NodeDef, and potentially make modifications to it
)
const nodeDef = new ComfyNodeDefImpl(nodeDefV1)
node.nodeData = nodeDef
LiteGraph.registerNodeType(nodeId, node)
// Note: Do not following assignments before `LiteGraph.registerNodeType`
// because `registerNodeType` will overwrite the assignments.
node.category = nodeDef.category
node.title = nodeDef.display_name || nodeDef.name
// Set skip_list for dev-only nodes based on current DevMode setting
// This ensures nodes registered after initial load respect the current setting
if (nodeDef.dev_only) {
const settingStore = useSettingStore()
node.skip_list = !settingStore.get('Comfy.DevMode')
}
}
/**
* Adds special context menu handling for nodes
* e.g. this adds Open Image functionality for nodes that show images
* @param {*} node The node to add the menu handler
*/
function addNodeContextMenuHandler(node: typeof LGraphNode) {
function getCopyImageOption(img: HTMLImageElement): IContextMenuValue[] {
if (typeof window.ClipboardItem === 'undefined') return []
return [
{
content: 'Copy Image',
callback: async () => {
const url = new URL(img.src)
url.searchParams.delete('preview')
try {
const data = await fetch(url)
const blob = await data.blob()
try {
await navigator.clipboard.write([
new ClipboardItem({ [blob.type]: blob })
])
} catch (error) {
// Chrome seems to only support PNG on write, convert and try again
if (blob.type !== 'image/png') {
const pngBlob = await reencodeAsPngBlob(
blob,
img.naturalWidth,
img.naturalHeight
)
await navigator.clipboard.write([
new ClipboardItem({ 'image/png': pngBlob })
])
return
}
throw error
}
} catch (error) {
toastStore.addAlert(
t('toastMessages.errorCopyImage', {
// @ts-expect-error fixme ts strict error
error: error.message ?? error
})
)
}
}
}
]
}
node.prototype.getExtraMenuOptions = function (canvas, options) {
if (this.imgs) {
// If this node has images then we add an open in new tab item
let img
if (this.imageIndex != null) {
// An image is selected so select that
img = this.imgs[this.imageIndex]
} else if (this.overIndex != null) {
// No image is selected but one is hovered
img = this.imgs[this.overIndex]
}
if (img) {
options.unshift(
{
content: 'Open Image',
callback: () => {
const url = new URL(img.src)
url.searchParams.delete('preview')
void openFileInNewTab(url.toString())
}
},
...getCopyImageOption(img),
{
content: 'Save Image',
callback: () => {
const url = new URL(img.src)
url.searchParams.delete('preview')
const filename = new URLSearchParams(url.search).get('filename')
downloadFile(url.toString(), filename ?? undefined)
}
}
)
}
}
options.push({
content: 'Bypass',
callback: () => {
toggleSelectedNodesMode(LGraphEventMode.BYPASS)
canvas.setDirty(true, true)
}
})
// prevent conflict of clipspace content
if (!ComfyApp.clipspace_return_node) {
options.push({
content: 'Copy (Clipspace)',
callback: () => {
ComfyApp.copyToClipspace(this)
}
})
if (ComfyApp.clipspace != null) {
options.push({
content: 'Paste (Clipspace)',
callback: () => {
ComfyApp.pasteFromClipspace(this)
}
})
}
if (isImageNode(this)) {
options.push({
content: 'Open in MaskEditor | Image Canvas',
callback: () => {
useMaskEditor().openMaskEditor(this)
}
})
}
}
if (this instanceof SubgraphNode) {
options.unshift(
{
content: 'Edit Subgraph Widgets',
callback: () => {
useRightSidePanelStore().openPanel('subgraph')
}
},
{
content: 'Unpack Subgraph',
callback: () => {
const { unpackSubgraph } = useSubgraphOperations()
unpackSubgraph()
}
}
)
}
const [x, y] = canvas.graph_mouse
const overWidget = this.getWidgetOnPos(x, y, true)
if (overWidget)
options.unshift(...getExtraOptionsForWidget(this, overWidget))
return []
}
}
function updatePreviews(node: LGraphNode, callback?: () => void) {
try {
unsafeUpdatePreviews.call(node, callback)
} catch (error) {
console.error('Error drawing node background', error)
}
}
function unsafeUpdatePreviews(this: LGraphNode, callback?: () => void) {
if (this.flags.collapsed) return
const nodeOutputStore = useNodeOutputStore()
const { showAnimatedPreview, removeAnimatedPreview } =
useNodeAnimatedImage()
const { showCanvasImagePreview, removeCanvasImagePreview } =
useNodeCanvasImagePreview()
const output = nodeOutputStore.getNodeOutputs(this)
const preview = nodeOutputStore.getNodePreviews(this)
const isNewOutput = output && this.images !== output.images
const isNewPreview = preview && this.preview !== preview
if (isNewPreview) this.preview = preview
if (isNewOutput) this.images = output.images
if (isNewOutput || isNewPreview) {
this.animatedImages = isAnimatedOutput(output)
const isVideo = isVideoOutput(output) || isVideoNode(this)
if (isVideo) {
useNodeVideo(this, callback).showPreview()
} else {
useNodeImage(this, callback).showPreview()
}
}
// Nothing to do
if (!this.imgs?.length) return
if (this.animatedImages) {
removeCanvasImagePreview(this)
showAnimatedPreview(this)
} else {
removeAnimatedPreview(this)
showCanvasImagePreview(this)
}
}
/**
* Adds Custom drawing logic for nodes
* e.g. Draws images and handles thumbnail navigation on nodes that output images
* @param {*} node The node to add the draw handler
*/
function addDrawBackgroundHandler(node: typeof LGraphNode) {
/**
* @deprecated No longer needed as we use {@link useImagePreviewWidget}
*/
node.prototype.setSizeForImage = function (this: LGraphNode) {
console.warn(
'node.setSizeForImage is deprecated. Now it has no effect. Please remove the call to it.'
)
}
node.prototype.onDrawBackground = function () {
updatePreviews(this)
if (this instanceof SubgraphNode) {
const parentGraph = this.graph
for (const interiorNode of getPseudoWidgetPreviewTargets(this)) {
updatePreviews(interiorNode, () => {
parentGraph?.setDirtyCanvas(true)
})
}
}
}
}
function addNodeKeyHandler(node: typeof LGraphNode) {
const origNodeOnKeyDown = node.prototype.onKeyDown
node.prototype.onKeyDown = function (e) {
// @ts-expect-error fixme ts strict error
if (origNodeOnKeyDown && origNodeOnKeyDown.apply(this, e) === false) {
return false
}
if (this.flags.collapsed || !this.imgs || this.imageIndex === null) {
return
}
let handled = false
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
if (e.key === 'ArrowLeft') {
// @ts-expect-error fixme ts strict error
this.imageIndex -= 1
} else if (e.key === 'ArrowRight') {
// @ts-expect-error fixme ts strict error
this.imageIndex += 1
}
// @ts-expect-error fixme ts strict error
this.imageIndex %= this.imgs.length
// @ts-expect-error fixme ts strict error
if (this.imageIndex < 0) {
// @ts-expect-error fixme ts strict error
this.imageIndex = this.imgs.length + this.imageIndex
}
handled = true
} else if (e.key === 'Escape') {
this.imageIndex = null
handled = true
}
if (handled === true) {
e.preventDefault()
e.stopImmediatePropagation()
return false
}
}
}
function addNodeOnGraph(
nodeDef: ComfyNodeDefV1 | ComfyNodeDefV2,
options: CreateNodeOptions = {},
addOptions?: GraphAddOptions
): LGraphNode | null {
options.pos ??= getCanvasCenter()
if (nodeDef.name.startsWith(useSubgraphStore().typePrefix)) {
const canvas = canvasStore.getCanvas()
const bp = useSubgraphStore().getBlueprint(nodeDef.name)
const items: object = {
nodes: bp.nodes,
subgraphs: bp.definitions?.subgraphs
}
const results = canvas._deserializeItems(items, {
position: options.pos
})
if (!results) throw new Error('Failed to add subgraph blueprint')
const node = results.nodes.values().next().value
if (!node)
throw new Error(
'Subgraph blueprint was added, but failed to resolve a subgraph Node'
)
return node
}
const node = LiteGraph.createNode(
nodeDef.name,
nodeDef.display_name,
options
)
const graph = useWorkflowStore().activeSubgraph ?? app.graph
if (!graph || !node) return null
graph.add(node, addOptions)
return node
}
function getCanvasCenter(): Point {
const dpi = Math.max(window.devicePixelRatio ?? 1, 1)
const visibleArea = app.canvas?.ds?.visible_area
if (!visibleArea) {
return [0, 0]
}
const [x, y, w, h] = visibleArea
return [x + w / dpi / 2, y + h / dpi / 2]
}
function goToNode(nodeId: NodeId) {
const graphNode = app.canvas.graph?.getNodeById(nodeId)
if (!graphNode) return
app.canvas.animateToBounds(graphNode.boundingRect)
}
function ensureBounds(nodes: LGraphNode[]) {
for (const node of nodes) {
if (!node.boundingRect.every((i) => i === 0)) continue
node.updateArea()
}
}
/**
* Resets the canvas view to the default
*/
function resetView() {
const canvas = canvasStore.canvas
if (!canvas) return
canvas.ds.scale = 1
canvas.ds.offset = [0, 0]
canvas.setDirty(true, true)
}
function fitView() {
const canvas = canvasStore.getCanvas()
const nodes = canvas.graph?.nodes
if (!nodes) return
ensureBounds(nodes)
const bounds = createBounds(nodes)
if (!bounds) return
canvas.ds.fitToBounds(bounds)
canvas.setDirty(true, true)
}
return {
registerNodeDef,
registerSubgraphNodeDef,
addNodeOnGraph,
addNodeInput,
getCanvasCenter,
getExtraOptionsForWidget,
goToNode,
resetView,
fitView,
updatePreviews
}
}
@@ -0,0 +1,159 @@
import type {
ExecutableLGraphNode,
ExecutionId,
LGraph
} from '@/lib/litegraph/src/litegraph'
import {
ExecutableNodeDTO,
LGraphEventMode
} from '@/lib/litegraph/src/litegraph'
import type {
ComfyApiWorkflow,
ComfyWorkflowJSON
} from '@/platform/workflow/validation/schemas/workflowSchema'
import { ExecutableGroupNodeDTO, isGroupNode } from './executableGroupNodeDto'
import { compressWidgetInputSlots } from './litegraphUtil'
/**
* Converts the current graph workflow for sending to the API.
* @note Node widgets are updated before serialization to prepare queueing.
*
* @param graph The graph to convert.
* @param options The options for the conversion.
* - `sortNodes`: Whether to sort the nodes by execution order.
* @returns The workflow and node links
*/
export const graphToPrompt = async (
graph: LGraph,
options: { sortNodes?: boolean } = {}
): Promise<{ workflow: ComfyWorkflowJSON; output: ComfyApiWorkflow }> => {
const { sortNodes = false } = options
for (const node of graph.computeExecutionOrder(false)) {
const innerNodes = node.getInnerNodes
? node.getInnerNodes(new Map())
: [node]
for (const innerNode of innerNodes) {
if (innerNode.isVirtualNode) {
innerNode.applyToGraph?.()
}
}
}
const workflow = graph.serialize({ sortNodes })
// Remove localized_name from the workflow
for (const node of workflow.nodes) {
for (const slot of node.inputs ?? []) {
delete slot.localized_name
}
for (const slot of node.outputs ?? []) {
delete slot.localized_name
}
}
compressWidgetInputSlots(workflow)
workflow.extra ??= {}
workflow.extra.frontendVersion = __COMFYUI_FRONTEND_VERSION__
const nodeDtoMap = new Map<ExecutionId, ExecutableLGraphNode>()
for (const node of graph.computeExecutionOrder(false)) {
const dto: ExecutableLGraphNode = isGroupNode(node)
? new ExecutableGroupNodeDTO(node, [], nodeDtoMap)
: new ExecutableNodeDTO(node, [], nodeDtoMap)
nodeDtoMap.set(dto.id, dto)
if (
node.mode === LGraphEventMode.NEVER ||
node.mode === LGraphEventMode.BYPASS
) {
continue
}
for (const innerNode of dto.getInnerNodes()) {
nodeDtoMap.set(innerNode.id, innerNode)
}
}
const output: ComfyApiWorkflow = {}
// Process nodes in order of execution
for (const node of nodeDtoMap.values()) {
// Don't serialize muted nodes
if (
node.isVirtualNode ||
node.mode === LGraphEventMode.NEVER ||
node.mode === LGraphEventMode.BYPASS
) {
continue
}
const inputs: ComfyApiWorkflow[string]['inputs'] = {}
const { widgets } = node
// Store all widget values in the API prompt.
// Note: widget.options.serialize controls prompt inclusion (checked here).
// widget.serialize controls workflow persistence (checked by LGraphNode).
if (widgets) {
for (const [i, widget] of widgets.entries()) {
if (!widget.name || widget.options?.serialize === false) continue
const widgetValue = widget.serializeValue
? await widget.serializeValue(node, i)
: widget.value
// By default, Array values are reserved to represent node connections.
// We need to wrap the array as an object to avoid the misinterpretation
// of the array as a node connection.
// The backend automatically unwraps the object to an array during
// execution.
inputs[widget.name] = Array.isArray(widgetValue)
? widget.type === 'curve'
? { __type__: 'CURVE', __value__: widgetValue }
: { __value__: widgetValue }
: widgetValue
}
}
// Store all node links
for (const [i, input] of node.inputs.entries()) {
const resolvedInput = node.resolveInput(i)
if (!resolvedInput) continue
// Resolved to an actual widget value rather than a node connection
if (resolvedInput.widgetInfo) {
const { value } = resolvedInput.widgetInfo
inputs[input.name] = Array.isArray(value) ? { __value__: value } : value
continue
}
inputs[input.name] = [
String(resolvedInput.origin_id),
// @ts-expect-error link.origin_slot is already number.
parseInt(resolvedInput.origin_slot)
]
}
output[String(node.id)] = {
inputs,
// TODO(huchenlei): Filter out all nodes that cannot be mapped to a
// comfyClass.
class_type: node.comfyClass!,
// Ignored by the backend.
_meta: {
title: node.title
}
}
}
// Remove inputs connected to removed nodes
for (const { inputs } of Object.values(output)) {
for (const [i, input] of Object.entries(inputs)) {
if (Array.isArray(input) && input.length === 2 && !output[input[0]]) {
delete inputs[i]
}
}
}
return { workflow: workflow as ComfyWorkflowJSON, output }
}
@@ -0,0 +1,24 @@
[
{
"repo": "ComfyUI",
"tag": "v0.21.0",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"tag_url": "https://api.github.com/repos/Comfy-Org/ComfyUI/git/ref/tags/v0.21.0",
"tag_sha256": "4bedfdd986251d6195afba580c766f878a54a0c7f592b0400d458771c4c2ca0d",
"commit_url": "https://api.github.com/repos/Comfy-Org/ComfyUI/git/commits/52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"commit_record_sha256": "1df87b74139dade5b68c409bb9148b7843559dbd3064d51f00461335ce1ade8b",
"license": "GPL-3.0 text preserved in fixed LICENSE",
"installed_or_executed": false
},
{
"repo": "ComfyUI_frontend",
"tag": "v1.43.18",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"tag_url": "https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/ref/tags/v1.43.18",
"tag_sha256": "57805d7d4b59a7e7428901bcbbbcde084cfb7e0cb23bd6e6bc33f384101fc440",
"commit_url": "https://api.github.com/repos/Comfy-Org/ComfyUI_frontend/git/commits/6a207bb52a887b1a70fbf654641ebc57710f97c7",
"commit_record_sha256": "328323431968e88b85f3bfd4e9808b45a8647beac068bfdeb762769eafaf8f89",
"license": "GPL-3.0 text preserved in fixed LICENSE",
"installed_or_executed": false
}
]
@@ -0,0 +1,9 @@
{
"number": 25,
"state": "open",
"merged": false,
"head": "agent/agent/a64a969a6a44",
"head_sha": "9dac1b42848860bbf466763507ce293777162224",
"base": "main",
"base_sha": "1fc8bdb8bb2a88ccace6f21a507fd77bcf22f532"
}
+270
View File
@@ -0,0 +1,270 @@
{
"sources": [
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"local_file": "ComfyUI__LICENSE"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "nodes.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/nodes.py",
"sha256": "a890bd2ab07e7da5084fd019177ae45bdc284f385d3fd3dfea9513c695b2e5fe",
"local_file": "ComfyUI__nodes.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_textgen.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_textgen.py",
"sha256": "e6577f5791db4d34cecf56cfc7e2776388d2994aa602acf5765d035d1241d8a2",
"local_file": "ComfyUI__comfy_extras__nodes_textgen.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_audio.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_audio.py",
"sha256": "cef4ed75f71e6c67a919c1f77ce182f872eaa31d2494465cd0019a39f5a14422",
"local_file": "ComfyUI__comfy_extras__nodes_audio.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_video.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_video.py",
"sha256": "f9df658d6ea08838af7822d6698fe36c84ff20bc4ba340283f8322125e9dd2b3",
"local_file": "ComfyUI__comfy_extras__nodes_video.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_extras/nodes_preview_any.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_extras/nodes_preview_any.py",
"sha256": "2f1a458a82310bd1963ac716016680b5f54fa23779ef8de85b212d7130d39939",
"local_file": "ComfyUI__comfy_extras__nodes_preview_any.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/sd.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/sd.py",
"sha256": "737ea97de395c1ef21391714b752959b1f14af71ed3e7c5ddb88e8c08765da8e",
"local_file": "ComfyUI__comfy__sd.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_api/latest/_io.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_api/latest/_io.py",
"sha256": "c7c7b82f81f47c2a72f1c5b386043944006e3049cbbd20602d0fee296fe5bb22",
"local_file": "ComfyUI__comfy_api__latest___io.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy_api/latest/_io_public.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy_api/latest/_io_public.py",
"sha256": "c805d754d61aba1ea72ed2d9d5c371de35be9affa5305d35426fb298fcb7c046",
"local_file": "ComfyUI__comfy_api__latest___io_public.py"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "LICENSE",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/LICENSE",
"sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986",
"local_file": "ComfyUI_frontend__LICENSE"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/utils/executionUtil.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/utils/executionUtil.ts",
"sha256": "67bbc3d626a5092f0093e45d2df2308a2bf5cd69a85c26f81cb6fa143fda2d33",
"local_file": "ComfyUI_frontend__src__utils__executionUtil.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/LGraphNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LGraphNode.ts",
"sha256": "a8c356bb585a4376ad2abfa4a32b3cafa63acf5dce7a26473c65f60a44901a1b",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__LGraphNode.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/core/graph/widgets/dynamicWidgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/core/graph/widgets/dynamicWidgets.ts",
"sha256": "5fc7857cae8d9441088ad6a0a501246c40c7d9b39e7a6aad7cc8e9e94353d9f6",
"local_file": "ComfyUI_frontend__src__core__graph__widgets__dynamicWidgets.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/scripts/widgets.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/scripts/widgets.ts",
"sha256": "43e1551ebcf9753e8a3ee47afc0b647eacbecebd2303bab7f155dd3f311c820d",
"local_file": "ComfyUI_frontend__src__scripts__widgets.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/uploadImage.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadImage.ts",
"sha256": "48d062c2ee95bd77c537c539e6c8f8bc03bd71dcec94c5b82487c014ea3e9c06",
"local_file": "ComfyUI_frontend__src__extensions__core__uploadImage.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/uploadAudio.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/uploadAudio.ts",
"sha256": "5ba5f67f9d3666c7b730ddd350faee939537e94e11ec6df05c5bd86db5d56178",
"local_file": "ComfyUI_frontend__src__extensions__core__uploadAudio.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/previewAny.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/previewAny.ts",
"sha256": "0ad96628fd56a432adcb29ee72fbd9a7e28dde0863a37db383b5d302790d1b4d",
"local_file": "ComfyUI_frontend__src__extensions__core__previewAny.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/extensions/core/noteNode.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/extensions/core/noteNode.ts",
"sha256": "1014f719e3d67d9c5183a5e8631d4c2d6581dfe67083f32eb23774ec3074bef2",
"local_file": "ComfyUI_frontend__src__extensions__core__noteNode.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.ts",
"sha256": "c3c06c7bcdc56b2787368dc107fbd522d983466d244c0fdf724bae9ddd356f29",
"local_file": "ComfyUI_frontend__src__renderer__extensions__vueNodes__widgets__composables__useImageUploadWidget.ts"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/text_encoders/gemma4.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/gemma4.py",
"sha256": "c6ffbb2fbecd8f97e781a654a06ccf3910dc670867d38c0ce30542312f00cde6",
"local_file": "ComfyUI__comfy__text_encoders__gemma4.py"
},
{
"id": "ComfyUI",
"commit": "52976f3ea33cc2312c7b5a32e1c7510b203eefb6",
"file": "comfy/text_encoders/llama.py",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI/52976f3ea33cc2312c7b5a32e1c7510b203eefb6/comfy/text_encoders/llama.py",
"sha256": "671d1ddfe0b169cb0e6dd6123ae96d2580eb7a716166fcaab7f8ff353b22138e",
"local_file": "ComfyUI__comfy__text_encoders__llama.py"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"sha256": "c4b48e9cd302f2c8981f888b31124d8af5d8d102e9b1c4a61802c37f5f53a0e9",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__subgraph__ExecutableNodeDTO.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/types/globalEnums.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/types/globalEnums.ts",
"sha256": "74d106cbe62141f86991cd50aea7c341462933c4a5d7c66dd26d3764cba7fbe8",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__types__globalEnums.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/LiteGraphGlobal.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/LiteGraphGlobal.ts",
"sha256": "21b91a130e211d4966c2c78db85414199bdeda5ecda8a3e3dca268c01eadb64e",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__LiteGraphGlobal.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/scripts/domWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/scripts/domWidget.ts",
"sha256": "a650da0a8fde363b0d890fff03ee78f45fbceea730a565831263e8e22b8e0b83",
"local_file": "ComfyUI_frontend__src__scripts__domWidget.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/services/litegraphService.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/services/litegraphService.ts",
"sha256": "a1ad240d8fb0286f2308926fd5f0c17e27a2b4953c27be9e9f85fd6494ac611e",
"local_file": "ComfyUI_frontend__src__services__litegraphService.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useIntWidget.ts",
"sha256": "8720d5a8194c9987eddbb42d0e925bcbb20e96e94f52c5f21750ba90b2113e02",
"local_file": "ComfyUI_frontend__src__renderer__extensions__vueNodes__widgets__composables__useIntWidget.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/renderer/extensions/vueNodes/widgets/composables/useComboWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/renderer/extensions/vueNodes/widgets/composables/useComboWidget.ts",
"sha256": "06341a8021e483e712810aa5a7e178eaca29cb9493f2edd8f2c0d24b54992373",
"local_file": "ComfyUI_frontend__src__renderer__extensions__vueNodes__widgets__composables__useComboWidget.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/widgets/widgetMap.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/widgetMap.ts",
"sha256": "526314f151e509d744422fd078796b8da22c72f340eed9eba7f1f1102a94b34a",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__widgets__widgetMap.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/widgets/BaseWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/BaseWidget.ts",
"sha256": "8ce6071649f79e5effee77a24b65d82fc02ffe0eb2cd103e9f74ef7f66860c65",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__widgets__BaseWidget.ts"
},
{
"id": "ComfyUI_frontend",
"commit": "6a207bb52a887b1a70fbf654641ebc57710f97c7",
"file": "src/lib/litegraph/src/widgets/ButtonWidget.ts",
"url": "https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/6a207bb52a887b1a70fbf654641ebc57710f97c7/src/lib/litegraph/src/widgets/ButtonWidget.ts",
"sha256": "149df13858e08347910732d9ea1605222e9a4627c34d0500601bbed3fb1ab8c7",
"local_file": "ComfyUI_frontend__src__lib__litegraph__src__widgets__ButtonWidget.ts"
}
],
"missing": [
{
"file": "src/extensions/core/audio.ts",
"error": "HTTP Error 404: Not Found"
},
{
"file": "src/renderer/extensions/vueNodes/widgets/composables/useAudioUploadWidget.ts",
"error": "HTTP Error 404: Not Found"
},
{
"file": "src/renderer/extensions/vueNodes/widgets/composables/useAudioWidget.ts",
"error": "HTTP Error 404: Not Found"
},
{
"file": "comfy/ldm/llama/model.py",
"error": "HTTP Error 404: Not Found"
}
]
}
+95
View File
@@ -0,0 +1,95 @@
// Local GET-only Gemma 25 positions and fourteen source-bound 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/gemma-document/browser';fs.mkdirSync(out,{recursive:true});
const checks=[],requests=[],errors=[],blockedFonts=[];
function check(condition,label){assert.ok(condition,label);checks.push(label);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(u.hostname!=='127.0.0.1'||u.pathname==='/api/view'){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));
const records=await(await fetch('http://127.0.0.1:8247/api/workflows')).json();
const names=['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===14&&details.reduce((n,d)=>n+d.doc_json.fixed_version.fields.length,0)===376,'14图376保存位置');
check(details.reduce((n,d)=>n+(d.doc_json.source_notes?.length||0),0)===13,'14图13源注释');
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){
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);
await page.screenshot({path:`${out}/${width}-${d.id}-default.png`});
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)}`);
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(['previewMode','audioUI','max_length','sampling_mode.seed','use_default_template'].includes(f.field))await page.screenshot({path:`${out}/${width}-${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}无溢出`);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}关闭归还焦点`);
}
}
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=>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=>{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()===26,'迟到Gemma响应不覆盖四宫格图摘要/26字段');await page.keyboard.press('Escape');await page.unroute(`**/api/workflows/${details[0].id}`);
await page.route(`**/api/workflows/${details[0].id}`,route=>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无写/生成/目标/历史预览请求');
fs.writeFileSync(`${out}/browser-results.json`,JSON.stringify({assertion_count:checks.length,checks,requests,errors,blockedFonts,viewports:[1440,390]},null,2));
} finally {await browser.close();}
+78
View File
@@ -0,0 +1,78 @@
"""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/gemma-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 = ["gemma"]
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()
print("All owned browser services stopped.")
if __name__ == "__main__":
main()