# comfyUI-utils-lf **Repository Path**: wadivision/comfyUI-utils-lf ## Basic Information - **Project Name**: comfyUI-utils-lf - **Description**: comfyUI的自定义节点 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-16 - **Last Updated**: 2026-07-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ComfyUI-utils-lf ComfyUI 自定义工具节点集合,提供 LoRA 切换与视频/图像合并等实用节点。 ## 节点列表 ### Lora 切换器(分类:`lf-utils/Lora`) | 节点 | 显示名称 | 说明 | | --- | --- | --- | | `lf LoraSwitcher` | 简易Lora切换器 (lf) | 通过 `select` 选择当前生效的 LoRA,输出 `lora_stack` 与 LoRA 名称(去扩展名) | | `lf LoraSwitcherFullName` | 简易Lora切换器(全路径)(lf) | 同上,但输出的 LoRA 名称为完整路径 | **输入参数:** - `toggle`:开关,关闭时输出 `None` - `select`:当前选中的 LoRA 序号(1~50) - `num_loras`:使用的 LoRA 数量 - `lora_strength`:LoRA 强度(-10.0 ~ 10.0) - `lora_1_name` ~ `lora_50_name`:可选的 LoRA 文件列表 - `optional_lora_stack`:可选的已有 LORA_STACK,会与当前选择合并 **输出:** - `lora_stack`:可串联到加载器的 LORA_STACK - `lora_name`:当前选中 LoRA 的名称 > 移植自 [comfyui-easy-use](https://github.com/yolain/ComfyUI-Easy-Use)。 ### 视频合并(分类:`lf-utils/Video`) | 节点 | 显示名称 | 说明 | | --- | --- | --- | | `lf MergeImages` | 合并图像 (lf) | 将多组图像沿 batch 维度拼接,支持最多 50 路输入 | | `lf MergeLatents` | 合并Latent (lf) | 将两组 Latent 沿 batch 维度拼接 | | `lf MergeMasks` | 合并Mask (lf) | 将两组 Mask 沿 batch 维度拼接 | **合并策略(merge_strategy):** - 两组输入(Latent / Mask):`match A` / `match B` / `match smaller` / `match larger` - 多组输入(Images):`match first` / `match largest` / `match smallest` **缩放方法(scale_method):** `nearest-exact` / `bilinear` / `area` / `bicubic` / `bislerp` **裁剪方法(crop):** `disabled` / `center` 当输入尺寸不一致时,会按所选策略选择模板尺寸,将其它输入缩放(可选居中裁剪)后拼接。`MergeImages` 通过 `num_images` 指定输入数量,未连接的输入会被自动跳过。 > 移植自 [comfyui-videohelpersuite (VHS)](https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite)。 ## 安装 将本目录放入 ComfyUI 的 `custom_nodes/` 文件夹下,重启 ComfyUI 即可: ``` ComfyUI/custom_nodes/ComfyUI-utils-lf ``` ## 文件结构 ``` ComfyUI-utils-lf/ ├── __init__.py # 节点注册入口 ├── lora_switcher_fullname.py # LoraSwitcher / LoraSwitcherFullName ├── merge_video.py # MergeImages / MergeLatents / MergeMasks ├── prompt.py # 提示词节点集合 ├── data/ # 提示词模板、通配符、风格资源 │ ├── prompt_template.py # PROMPT_TEMPLATE 模板 │ ├── wildcards.py # 通配符处理器(移植自 easy-use) │ ├── fooocus_styles.json # Fooocus 风格库 │ ├── styles/ # 自定义风格(your_styles.json.example) │ └── wildcards/ # 通配符词库(example.txt) └── readme.md ``` ## 提示词节点(分类:`lf-utils/Prompt`) > 移植自 [comfyui-easy-use](https://github.com/yolain/ComfyUI-Easy-Use) 的 prompt 节点,改造为不依赖 easy-use 前端控件与消息机制的独立实现。 | 节点 | 显示名称 | 说明 | | --- | --- | --- | | `lf PositivePrompt` | 正向提示词 (lf) | 透传正向提示词文本 | | `lf NegativePrompt` | 负向提示词 (lf) | 透传负向提示词文本 | | `lf Prompt` | 提示词模板 (lf) | 组合 prefix/subject/action/clothes/environment/background/nsfw/women_clothes/cosplay 模板片段 | **模板分类扩展:** - `women_clothes`(女装):选项来自 `data/clothes.md`,自动解析其中 `- **English** —— 中文` 列表提取(共约 63 项)。 - `cosplay`(角色扮演):选项来自 `data/cospaly.md`,自动解析表格第二列(英文名)提取(共约 117 项)。 **显示与输出:** - 全部分类(prefix/subject/action/clothes/environment/background/nsfw/women_clothes/cosplay)的下拉框均以 `English(中文)` 形式展示,例如 `a woman(一个女人)`、`Mini skirt(迷你裙)`、`Wonder Woman(神奇女侠)`。 - 选择某选项后,组合的**英文**提示词会回写到 `text`(Prompt)编辑框中,可直接查看与继续编辑;该编辑框同时作为节点输出,可连接到 CLIP/Conditioning。 - 下拉选项同时包含 `English(中文)` 与纯 `English` 两种形式,兼容旧版保存的纯英文工作流,避免 "Value not in list" 校验错误。 - 修改 `clothes.md` / `cospaly.md` 后重启 ComfyUI 即可生效。 - 修改这两个 markdown 文件后,重启 ComfyUI 即可在「提示词模板 (lf)」节点的下拉框中看到更新后的选项。 | `lf PromptList` | 提示词列表 (lf) | 将最多 5 路文本与可选 LIST 汇总为列表输出 | | `lf PromptLine` | 提示词行拆分 (lf) | 将多行文本按起始索引、最大行数、是否去空行拆分为行列表 | | `lf PromptConcat` | 提示词拼接 (lf) | 用分隔符拼接两段提示词 | | `lf PromptReplace` | 提示词替换 (lf) | 按最多 3 组 查找/替换 规则修改提示词 | | `lf WildcardsPrompt` | 通配符提示词 (lf) | 支持 `__keyword__` 通配符与 `{a\|b}` 选项语法,可选多行模式 | | `lf WildcardsPromptMatrix` | 通配符提示词矩阵 (lf) | 返回包含通配符的提示词生成的所有组合 | | `lf StylesSelector` | 风格选择器 (lf) | 应用所选 Fooocus 风格到 prompt/negative | **通配符用法:** - 选项:`{red|green|blue}` 随机选一个;`{a|b}$$2` 选 2 个;可加权重 `1.5::red`。 - 词库:`__example__` 从 `data/wildcards/` 下的 txt/yaml/json 随机取词。在 `data/wildcards/` 中新增 `xxx.txt`(每行一个词),即可用 `__xxx__` 引用。 - 风格:在 `data/styles/` 下放置 `your_styles.json`(参考 `your_styles.json.example`),节点 `styles` 下拉框会自动列出,并用逗号分隔的名称在 `select_styles` 中指定要应用的多项风格。 ## 依赖 - ComfyUI(需内置 `folder_paths`、`comfy.utils`) - PyTorch