Compare commits

...
2 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 4.6 3957ec7d21 feat: Lora Loader (LoraManager) detection, M-tab Groups drop, P-tab Groups subtab (v0.3.32)
- I/Metadata tabs: detect LoRAs from Lora Loader (LoraManager) nodes in both workflow and API formats (inputs.loras.__value__)
- Fix strength parsing: use parseFloat to handle string values like "0.20" from LoraManager
- placeLoraMgrNode: sync text widget with LoRA syntax (<lora:name:s:c>) after drop
- M tab Groups: add "All N LoRAs" drag/drop item to place Lora Loader (LoraManager) with full group
- P tab: add Groups subtab (row2) showing wfm_prompt_preset_groups from localStorage
- Help (i18n.js), README, DEVLOG updated for v0.3.32

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 22:11:02 +09:00
ketle-manandClaude Sonnet 4.6 0c7ca31c99 feat: split LoRA pane into Single/Stack tabs, fix GenUI Model LoRA handling (v0.3.31)
- renderLoraPane rewritten: Single tab (filter, dropdown, M/C strength, Apply, P,
  LORA SYNTAX, TRIGGER WORDS) and Stack tab (target, Apply, P, toggle-all,
  global adj, LORA SYNTAX, TRIGGER WORDS, model list) are now independent
- _refreshLoraSingleDynamic: auto-updates LORA SYNTAX/TRIGGER WORDS on model or
  strength change in Single tab
- comfyEditor.switchLoraSingleTab() / disableAllStack() added for external access
- applyToGenUI (models-tab): now handles Lora Loader (LoraManager) via lora_nodes;
  switches to Single tab, disables Stack, updates LORA SYNTAX/TRIGGER WORDS display
- i18n helpGen5 / helpModels8 updated (EN/JA/ZH)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 18:47:13 +09:00
9 changed files with 550 additions and 167 deletions
+61
View File
@@ -1,5 +1,66 @@
# DEVLOG - ComfyUI-Workflow-Studio
## 2026-06-08: v0.3.32 — Lora Loader (LoraManager) LoRA検出対応・ライブラリ機能拡張
### 変更内容
#### Lora Loader (LoraManager) LoRA検出対応(`web/comfyui/node_sets_menu.js`, `static/js/metadata-tab.js`)
- `_extractLoRAs` / `extractLoRAs` の `add` 関数を `parseFloat` ベースに変更。LoraManager ノードは `strength` / `clipStrength` を文字列 (`"0.20"`) で保存するため `typeof === "number"` では `1.0` にフォールバックしていたバグを修正
- APIフォーマット(`class_type` ベース)の `else` 節に `Lora Loader (LoraManager)` を追加。`inputs.loras.__value__` からLoRAリストを取得(`Array.isArray(inputs.loras)` をフォールバックとして併用)
- Iタブ(ライブラリ)・Metadataタブの両方に同様の修正を適用
#### `placeLoraMgrNode` textウィジェット同期(`web/comfyui/node_sets_menu.js`)
- LoraManagerノード配置時に `loras` ウィジェット(配列)だけでなく `text` ウィジェット(LoRA構文)も明示的に更新するよう修正
- strength = clipStrength の場合 `<lora:name:s>`、異なる場合 `<lora:name:s:c>` の形式で構文を生成
- `l.strength` フォールバックを追加し、GroupsのloraList形式(`strength` キー直接)にも対応
#### Mタブ Groupsの LoRAグループ → LoraManagerドロップ対応(`web/comfyui/node_sets_menu.js`)
- `renderModelGroups` でLoRAタイプのグループリスト末尾に「All N LoRAs → Lora Loader (LoraManager)」アイテムを追加
- ドラッグで `application/x-wfm-lora-multi` データ送出 → キャンバスに Lora Loader (LoraManager) ノードを全LoRAセット済みで配置
- ダブルクリックでも即時配置(`placeLoraMgrNode`)
- モデルファイル名から stem(拡張子・パス除去)に変換して LoraManager 名前形式に合わせる
#### Pタブ Groupsサブタブ追加(`web/comfyui/node_sets_menu.js`)
- `state` に `promptSubTab2` と `promptGroups` を追加
- `loadPromptData` で `localStorage["wfm_prompt_preset_groups"]` からグループを読み込み、存在しないIDをクリーンアップ
- Pタブのrow2に「📁 Groups」サブタブを追加(Wタブ・Nタブと同様の2段構成)
- `renderPromptGroups` 関数を実装:グループ名セクション展開・検索フィルター対応・`createDraggablePromptItem` でドラッグ動作を継承
- Batchで作成したPromptグループが同じlocalStorageを参照するためそのままライブラリから利用可能
#### ヘルプ更新(`static/js/i18n.js`)
- `helpSidepanel11`(EN/JA/ZH):PタブGroups追加・MタブLoRAグループ→LoraManagerドロップを追記
- `helpSidepanel13`(EN/JA/ZH):Lora Loader (LoraManager) ノードタイプ対応を追記
- `helpSidepanel15`(EN/JA/ZH):LoRA検出ノードタイプ一覧・APIフォーマット対応・LoRA構文自動入力を追記
---
## 2026-06-08: v0.3.31 — LoRAペイン Single/Stack タブ分割・GenUI Model LoRA対応強化
### 変更内容
#### LoRAペイン Single/Stack タブ分割(`static/js/comfyui-editor.js`, `static/css/main.css`)
- `renderLoraPane` を全面書き換え。Single / Stack の2タブ構成に変更
- **Single タブ**: フィルター・モデルドロップダウン・強度(M/C)・ターゲットノード選択・Apply・P・LORA SYNTAX表示・TRIGGER WORDS表示
- モデル選択・強度変更時にLORA SYNTAX が自動更新
- Apply: ワークフローノードへの適用 + LORA SYNTAX/TRIGGER WORDS を Positive プロンプトへ差分更新
- P: Positive プロンプトをワークフローに反映
- **Stack タブ**: ターゲットノード選択・Apply・P・Toggle-all・グローバル強度調整(+/−)・LORA SYNTAX・TRIGGER WORDS・モデルリスト
- 検索フィルターとモデルドロップダウンを削除(Stack専用UIに整理)
- `_refreshLoraSingleDynamic(metadata, civitaiCache)` 関数を追加(Single タブの動的更新)
- `comfyEditor.switchLoraSingleTab()` メソッドを追加(外部からSingleタブへ切り替え)
- `comfyEditor.disableAllStack()` メソッドを追加(外部からStack全無効化)
#### GenUI Model LoRA対応強化(`static/js/models-tab.js`)
- `Lora Loader (LoraManager)` ノード対応: `lora_name` 検索ではなく `currentAnalysis.lora_nodes` を参照し `is_lora_manager` で書き込み形式を分岐
- LoRA適用時: Singleタブへ切り替え・Stack全無効化・`wfm-lora-single-syntax`/`wfm-lora-single-triggers` を更新
- Positive promptへの直接書き込みを廃止(Apply/Pボタンで明示的に反映する設計に統一)
#### ヘルプ更新(`static/js/i18n.js`)
- `helpGen5`: LoRA に「(Single/Stack タブ)」の説明を追加(EN/JA/ZH)
- `helpModels8`: GenUI Model LoRA 動作の詳細を追記(EN/JA/ZH)
---
## 2026-06-08: v0.3.30 — LoRAスタック トリガーワードバグ修正・ヘルプ更新
### 変更内容
+15 -5
View File
@@ -5,7 +5,7 @@ A comprehensive workflow management and generation UI plugin for [ComfyUI](https
Browse, organize, and execute workflows directly from a dedicated studio interface — without switching between windows or manually editing JSON.
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.3.30-green)
![Version](https://img.shields.io/badge/version-0.3.32-green)
## Screenshots
@@ -172,12 +172,12 @@ Requires the **[comfyui-image-feeder](https://github.com/ketle-man/comfyui-image
- **N — Nodes tab** — browse favorite nodes (All / ★ Favorites / Groups / Sets / 📂 Category / 🧩 Package sub-tabs), ★ star shown for favorites in All view
- **Category sub-tab** — dropdown to filter nodes by top-level category
- **Package sub-tab** — dropdown to filter nodes by custom node package name
- **M — Models tab** — browse installed models (All / ★ Favorites / Groups / By Type sub-tabs)
- **P — Prompts tab** — browse prompt presets with All / Favorites / Categories sub-tabs
- **I — Information tab** — drop a ComfyUI-generated PNG/WebP or workflow JSON in the side panel to view its metadata; supports `UnetLoaderGGUF` and `QuadrupleCLIPLoader` node types; preview area fixed at 110px
- **M — Models tab** — browse installed models (All / ★ Favorites / Groups / By Type sub-tabs); LoRA groups show an **All N LoRAs** item — drag to canvas to place a `Lora Loader (LoraManager)` node with all LoRAs pre-loaded
- **P — Prompts tab** — browse prompt presets with All / ★ Favorites / Categories sub-tabs; **Groups sub-tab** (row 2) — view presets by group (shared with the Batch tab's `wfm_prompt_preset_groups`)
- **I — Information tab** — drop a ComfyUI-generated PNG/WebP or workflow JSON in the side panel to view its metadata; detects LoRAs from `LoraLoader`, `LoraLoaderModelOnly`, and `Lora Loader (LoraManager)` nodes (API format supported); supports `UnetLoaderGGUF` and `QuadrupleCLIPLoader` node types; preview area fixed at 110px
- **A — AI TOOL tab** — 3-pane layout (Translation | TOOLS | Settings) always visible; Translation and TOOLS (VLM) powered by Ollama or LM Studio; settings (backend, URL, model) shared with the SPA AI TOOL tab via `localStorage`
- **model sub-tab** — Checkpoint, VAE, Diffusion Model, and Text Encoder; drag items to canvas to place the corresponding loader node (Checkpoint → `CheckpointLoaderSimple`, VAE → `VAELoader`, Diffusion Model → `UNETLoader`, Text Encoder → `CLIPLoader`); double-click also places at canvas center
- **lora sub-tab** — LoRA names with `strength_model / strength_clip` values; drag individual LoRA to place `LoraLoader`; **Multiple LORA** section (appears for 1+ LoRAs) drags all LoRAs into a single `Lora Loader (LoraManager)` node
- **lora sub-tab** — detects LoRAs from `LoraLoader`, `LoraLoaderModelOnly`, and `Lora Loader (LoraManager)` nodes (API format `inputs.loras.__value__` supported); shows `strength_model / strength_clip` values; drag individual LoRA to place `LoraLoader`; **Multiple LORA** section (appears for 1+ LoRAs) drags all LoRAs into a single `Lora Loader (LoraManager)` node with LoRA syntax pre-filled
- **Prompts sub-tab** — POS / NEG badge list; drag a prompt to place `CLIPTextEncode` with text pre-filled; click any entry to view full text + Copy button
- **Drag & drop workflows** — drag a workflow onto the canvas to load it
- **Drag & drop nodes** — drag nodes/node sets onto the canvas to place them
@@ -280,6 +280,16 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
## Changelog
### v0.3.32
- **Lora Loader (LoraManager) LoRA detection** — I tab and Metadata tab now correctly detect LoRAs from `Lora Loader (LoraManager)` nodes in API format (`inputs.loras.__value__`); `strength`/`clipStrength` stored as strings (e.g. `"0.20"`) are now parsed correctly
- **LoraManager node placement — LoRA syntax** — placing a `Lora Loader (LoraManager)` node via drag now also updates the `text` widget with `<lora:name:strength>` syntax (previously only the `loras` array widget was set)
- **M tab Groups — LoRA → LoraManager drop** — LoRA groups in the Library M tab show an **All N LoRAs** item; drag to canvas places a `Lora Loader (LoraManager)` node with all group LoRAs; double-click also places at canvas center
- **P tab — Groups sub-tab** — new Groups sub-tab (row 2) in the Library P tab; groups are read from `localStorage["wfm_prompt_preset_groups"]` (shared with Batch); expanding a group shows draggable preset items
### v0.3.31
- **LoRA pane — Single/Stack tabs** — LoRA pane split into two tabs: Single (filter, model dropdown, M/C strength, target node, Apply, P, LORA SYNTAX, TRIGGER WORDS) and Stack (target node, Apply, P, Toggle-all, global strength adjuster, LORA SYNTAX, TRIGGER WORDS, model list); each tab has independent strength settings
- **GenUI Model — LoRA improvements** — now correctly handles `Lora Loader (LoraManager)` nodes (previously failed to find the node); on apply: switches to Single tab, disables all Stack models, and updates LORA SYNTAX / TRIGGER WORDS in the Single tab panel
### v0.3.30
- **LoRA Stack trigger words fix** — inactive stack models no longer show their trigger words in the Trigger words display; both initial render and per-model toggle/toggle-all now filter to active models only
- **Help troubleshooting** — added entry for "No such file or directory" error when running LoRA Stack (comfyui-lora-manager compatibility issue)
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-workflow-studio"
description = "A comprehensive workflow management and generation UI plugin for ComfyUI. Browse, organize, and execute workflows from a dedicated studio interface."
version = "0.3.30"
version = "0.3.32"
license = "MIT"
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+38
View File
@@ -625,6 +625,44 @@ body {
padding: 0;
}
/* ── LoRA pane tabs ─────────────────────────────────────── */
.wfm-lora-tab-header {
display: flex;
border-bottom: 1px solid var(--wfm-border);
gap: 0;
padding: 0 8px;
flex-shrink: 0;
}
.wfm-lora-tab-btn {
padding: 6px 14px;
font-size: 12px;
font-weight: 500;
color: var(--wfm-text-secondary);
background: none;
border: none;
border-bottom: 2px solid transparent;
cursor: pointer;
margin-bottom: -1px;
text-transform: none;
letter-spacing: 0;
transition: color 0.15s, border-color 0.15s;
}
.wfm-lora-tab-btn:hover { color: var(--wfm-text); }
.wfm-lora-tab-btn.active {
color: var(--wfm-accent);
border-bottom-color: var(--wfm-accent);
}
.wfm-lora-tab-content {
padding: 10px 12px;
display: flex;
flex-direction: column;
gap: 6px;
}
/* ── LoRA pane sections ──────────────────────────────────── */
.wfm-lora-unified {
padding: 10px 12px;
+214 -125
View File
@@ -72,6 +72,29 @@ function _refreshLoraPaneDynamic(stackModels, metadata, civitaiCache) {
}
}
function _refreshLoraSingleDynamic(metadata, civitaiCache) {
const modelName = document.getElementById("wfm-lora-select")?.value;
const syntaxEl = document.getElementById("wfm-lora-single-syntax");
const triggersEl = document.getElementById("wfm-lora-single-triggers");
if (!modelName) {
if (syntaxEl) syntaxEl.textContent = "—";
if (triggersEl) triggersEl.innerHTML = `<span style="color:var(--wfm-text-secondary);font-size:12px;">—</span>`;
return;
}
const stem = _loraBasename(modelName);
const strM = parseFloat(document.getElementById("wfm-lora-str-model")?.value) || 1.0;
const strC = parseFloat(document.getElementById("wfm-lora-str-clip")?.value) || 1.0;
if (syntaxEl) syntaxEl.textContent = `<lora:${stem}:${strM}:${strC}>`;
if (triggersEl) {
const sha = (metadata[modelName] || {}).sha256;
const civInfo = sha && civitaiCache[sha];
const words = civInfo?.trainedWords || [];
triggersEl.innerHTML = words.length
? words.map(w => `<span class="wfm-lora-trigger-word">${w}</span>`).join(" ")
: `<span style="color:var(--wfm-text-secondary);font-size:12px;">—</span>`;
}
}
function _syncStackToggleAll(stackModels) {
const cb = document.getElementById("wfm-lora-stack-toggle-all");
if (!cb) return;
@@ -273,9 +296,8 @@ export const comfyEditor = {
const loraNodes = analysis.lora_nodes || [];
const loras = this.models.loras || [];
// Stack target defaults to first LoraManager node if present
const defaultStackTarget = (loraNodes.find((n) => n.is_lora_manager) || loraNodes[0])?.id;
const targetOpts = loraNodes
const nodeOpts = loraNodes
.map((n) => `<option value="${n.id}">ID:${n.id} (${n.title})</option>`)
.join("");
const stackTargetOpts = loraNodes
@@ -299,31 +321,26 @@ export const comfyEditor = {
civitaiCache = civRes.ok ? await civRes.json() : {};
} catch { /* ignore */ }
// Initialize strength / active state for new models
stackModels.forEach((m) => {
if (!_stackStrengths[m]) _stackStrengths[m] = { m: 1.0, c: 1.0 };
if (_stackActive[m] === undefined) _stackActive[m] = true;
});
// Build trigger words from CivitAI data
const allTriggerWords = [];
// Build Stack trigger words
const activeTriggerWords = [];
const allStackTriggers = [];
stackModels.forEach((m) => {
const sha = (metadata[m] || {}).sha256;
const civInfo = sha && civitaiCache[sha];
if (civInfo?.trainedWords?.length) {
allTriggerWords.push(...civInfo.trainedWords);
if (_stackActive[m] !== false) {
activeTriggerWords.push(...civInfo.trainedWords);
}
allStackTriggers.push(...civInfo.trainedWords);
if (_stackActive[m] !== false) activeTriggerWords.push(...civInfo.trainedWords);
}
});
const triggerHtml = activeTriggerWords.length
const stackTriggerHtml = activeTriggerWords.length
? activeTriggerWords.map((w) => `<span class="wfm-lora-trigger-word">${w}</span>`).join(" ")
: `<span style="color:var(--wfm-text-secondary);font-size:12px;">—</span>`;
const loraSyntax = _buildLoraSyntax(stackModels);
const stackLoraSyntax = _buildLoraSyntax(stackModels);
const allActive = stackModels.every((m) => _stackActive[m] !== false);
const anyActive = stackModels.some((m) => _stackActive[m] !== false);
@@ -343,25 +360,48 @@ export const comfyEditor = {
}).join("");
el.innerHTML = `
<div class="wfm-lora-unified">
<div class="wfm-lora-tab-header">
<button class="wfm-lora-tab-btn active" data-tab="single">Single</button>
<button class="wfm-lora-tab-btn" data-tab="stack">Stack</button>
</div>
<!-- Single tab -->
<div class="wfm-lora-tab-content" id="wfm-lora-panel-single">
<input type="text" class="wfm-input" id="wfm-lora-filter" placeholder="Filter...">
<select class="wfm-select" id="wfm-lora-select">
${loras.map((m) => `<option value="${m}" ${m === currentVal ? "selected" : ""}>${m}</option>`).join("")}
</select>
<div class="wfm-lora-strength-single">
<span>M</span>
<input type="number" class="wfm-input" id="wfm-lora-str-model" value="1.0" step="0.05" min="0" max="2">
<span>C</span>
<input type="number" class="wfm-input" id="wfm-lora-str-clip" value="1.0" step="0.05" min="0" max="2">
</div>
<div class="wfm-lora-stack-header">
<select class="wfm-select" id="wfm-lora-single-target" style="flex:1;min-width:0;">${nodeOpts}</select>
<button class="wfm-btn wfm-btn-sm" id="wfm-lora-single-apply" title="Apply LoRA to node and sync to Positive prompt">Apply</button>
<button class="wfm-btn wfm-btn-sm wfm-lora-p-btn" id="wfm-lora-single-pos-apply" title="Apply Positive prompt to workflow">P</button>
</div>
<div class="wfm-lora-stack-info-block">
<div class="wfm-lora-stack-info-label">Lora syntax</div>
<div id="wfm-lora-single-syntax" class="wfm-lora-stack-syntax">—</div>
</div>
<div class="wfm-lora-stack-info-block">
<div class="wfm-lora-stack-info-label">Trigger words</div>
<div id="wfm-lora-single-triggers" class="wfm-lora-stack-triggers"><span style="color:var(--wfm-text-secondary);font-size:12px;">—</span></div>
</div>
</div>
<!-- Stack tab -->
<div class="wfm-lora-tab-content" id="wfm-lora-panel-stack" style="display:none;">
<div class="wfm-lora-stack-header">
<select class="wfm-select" id="wfm-lora-stack-target" style="flex:1;min-width:0;">${stackTargetOpts}</select>
<button class="wfm-btn wfm-btn-sm" id="wfm-lora-stack-apply" title="Apply to node and sync LoRA syntax + trigger words to Positive prompt">Apply</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-lora-stack-apply" title="Apply Stack to node and sync to Positive prompt">Apply</button>
<button class="wfm-btn wfm-btn-sm wfm-lora-p-btn" id="wfm-lora-pos-apply" title="Apply Positive prompt to workflow">P</button>
</div>
<div class="wfm-lora-strength-combined">
<span class="wfm-lora-stack-label" style="margin-right:4px;flex-shrink:0;">Stack</span>
<input type="checkbox" id="wfm-lora-stack-toggle-all" ${allActive ? "checked" : ""} title="Toggle all stack models" style="flex-shrink:0;margin-right:8px;">
<div class="wfm-lora-strength-single">
<span>M</span>
<input type="number" class="wfm-input" id="wfm-lora-str-model" value="1.0" step="0.05" min="0" max="2">
<span>C</span>
<input type="number" class="wfm-input" id="wfm-lora-str-clip" value="1.0" step="0.05" min="0" max="2">
</div>
${stackModels.length > 0 ? `
<div class="wfm-lora-stack-global-adj-groups">
<div class="wfm-lora-stack-global-adj-group">
@@ -381,11 +421,11 @@ export const comfyEditor = {
</div>
<div class="wfm-lora-stack-info-block">
<div class="wfm-lora-stack-info-label">Lora syntax</div>
<div id="wfm-lora-stack-syntax" class="wfm-lora-stack-syntax">${loraSyntax || "—"}</div>
<div id="wfm-lora-stack-syntax" class="wfm-lora-stack-syntax">—</div>
</div>
<div class="wfm-lora-stack-info-block">
<div class="wfm-lora-stack-info-label">Trigger words</div>
<div id="wfm-lora-stack-triggers" class="wfm-lora-stack-triggers">${triggerHtml}</div>
<div id="wfm-lora-stack-triggers" class="wfm-lora-stack-triggers">${stackTriggerHtml}</div>
</div>
<div class="wfm-lora-stack-models">
${stackModelRows || `<p class="wfm-placeholder">No models in Stack group</p>`}
@@ -393,11 +433,22 @@ export const comfyEditor = {
</div>
`;
// Fix: <lora:...> syntax injected via innerHTML is parsed as HTML tags — overwrite with textContent
// Fix: overwrite textContent to avoid HTML parsing of <lora:...> syntax
const _synEl = document.getElementById("wfm-lora-stack-syntax");
if (_synEl) _synEl.textContent = loraSyntax || "—";
if (_synEl) _synEl.textContent = stackLoraSyntax || "—";
// ── Filter ──────────────────────────────────────────
// ── Tab switching ────────────────────────────────────
el.querySelectorAll(".wfm-lora-tab-btn").forEach((btn) => {
btn.addEventListener("click", () => {
el.querySelectorAll(".wfm-lora-tab-btn").forEach(b => b.classList.remove("active"));
btn.classList.add("active");
const tab = btn.dataset.tab;
document.getElementById("wfm-lora-panel-single").style.display = tab === "single" ? "" : "none";
document.getElementById("wfm-lora-panel-stack").style.display = tab === "stack" ? "" : "none";
});
});
// ── Single: filter ───────────────────────────────────
document.getElementById("wfm-lora-filter")?.addEventListener("input", (e) => {
const filter = e.target.value.toLowerCase();
const select = document.getElementById("wfm-lora-select");
@@ -406,33 +457,74 @@ export const comfyEditor = {
.filter((m) => m.toLowerCase().includes(filter))
.map((m) => `<option value="${m}">${m}</option>`)
.join("");
_refreshLoraSingleDynamic(metadata, civitaiCache);
});
// ── P button: apply Positive prompt to workflow ───────
document.getElementById("wfm-lora-pos-apply")?.addEventListener("click", () => {
const nodeId = document.getElementById("wfm-prompt-pos-target")?.value;
const text = document.getElementById("wfm-prompt-pos-text")?.value;
if (nodeId && comfyUI.currentWorkflow?.[nodeId]) {
const promptNode = comfyUI.currentAnalysis?.prompt_nodes?.find(n => n.id === nodeId);
const textKey = promptNode?.textKey || "text";
comfyUI.currentWorkflow[nodeId].inputs[textKey] = text;
// ── Single: update SYNTAX/TRIGGERS on model or strength change ──
document.getElementById("wfm-lora-select")?.addEventListener("change", () => _refreshLoraSingleDynamic(metadata, civitaiCache));
document.getElementById("wfm-lora-str-model")?.addEventListener("input", () => _refreshLoraSingleDynamic(metadata, civitaiCache));
document.getElementById("wfm-lora-str-clip")?.addEventListener("input", () => _refreshLoraSingleDynamic(metadata, civitaiCache));
// ── Single: Apply button ─────────────────────────────
document.getElementById("wfm-lora-single-apply")?.addEventListener("click", () => {
const nodeId = document.getElementById("wfm-lora-single-target")?.value;
const select = document.getElementById("wfm-lora-select");
if (!nodeId || !comfyUI.currentWorkflow?.[nodeId] || !select?.value) return;
const node = loraNodes.find((n) => String(n.id) === String(nodeId));
const strModel = parseFloat(document.getElementById("wfm-lora-str-model")?.value) || 1.0;
const strClip = parseFloat(document.getElementById("wfm-lora-str-clip")?.value) || 1.0;
_applyLoraToNode(nodeId, select.value, strModel, strClip, node?.is_lora_manager);
_syncRawJson();
// Sync to Positive prompt
const posTextarea = document.getElementById("wfm-prompt-pos-text");
if (!posTextarea) return;
const stem = _loraBasename(select.value);
const loraSyntax = `<lora:${stem}:${strModel}:${strClip}>`;
const sha = (metadata[select.value] || {}).sha256;
const civInfo = sha && civitaiCache[sha];
const triggerWords = civInfo?.trainedWords || [];
let cleaned = posTextarea.value;
const escapedStem = stem.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
cleaned = cleaned.replace(new RegExp(`,?\\s*<lora:${escapedStem}:[^>]*>`, "gi"), "");
if (triggerWords.length > 0) {
const wordSet = new Set(triggerWords.map(w => w.trim().toLowerCase()));
cleaned = cleaned.split(",").map(p => p.trim()).filter(p => p && !wordSet.has(p.toLowerCase())).join(", ");
}
cleaned = cleaned.replace(/,\s*$/, "").trim();
const append = triggerWords.length > 0 ? `${loraSyntax}, ${triggerWords.join(", ")}` : loraSyntax;
posTextarea.value = cleaned ? `${cleaned}, ${append}` : append;
const posNodeId = document.getElementById("wfm-prompt-pos-target")?.value;
if (posNodeId && comfyUI.currentWorkflow?.[posNodeId]) {
const promptNode = comfyUI.currentAnalysis?.prompt_nodes?.find(n => String(n.id) === String(posNodeId));
comfyUI.currentWorkflow[posNodeId].inputs[promptNode?.textKey || "text"] = posTextarea.value;
_syncRawJson();
}
});
// ── Stack strength inputs + per-model toggle ─────────
// ── Single: P button ─────────────────────────────────
document.getElementById("wfm-lora-single-pos-apply")?.addEventListener("click", () => {
const nodeId = document.getElementById("wfm-prompt-pos-target")?.value;
const text = document.getElementById("wfm-prompt-pos-text")?.value;
if (nodeId && comfyUI.currentWorkflow?.[nodeId]) {
const promptNode = comfyUI.currentAnalysis?.prompt_nodes?.find(n => String(n.id) === String(nodeId));
comfyUI.currentWorkflow[nodeId].inputs[promptNode?.textKey || "text"] = text;
_syncRawJson();
}
});
// ── Stack: per-model strength + toggle ───────────────
el.querySelectorAll(".wfm-lora-stack-model-row").forEach((row) => {
const modelName = row.dataset.model;
const inputM = row.querySelector(".wfm-lora-stack-str-m");
const inputC = row.querySelector(".wfm-lora-stack-str-c");
const cbActive = row.querySelector(".wfm-lora-stack-active-cb");
const nameSpan = row.querySelector(".wfm-lora-stack-model-name");
const onStrChange = () => {
_stackStrengths[modelName] = {
m: parseFloat(inputM.value) || 1.0,
c: parseFloat(inputC.value) || 1.0,
};
_stackStrengths[modelName] = { m: parseFloat(inputM.value) || 1.0, c: parseFloat(inputC.value) || 1.0 };
_refreshLoraPaneDynamic(stackModels, metadata, civitaiCache);
};
inputM?.addEventListener("input", onStrChange);
@@ -449,7 +541,7 @@ export const comfyEditor = {
});
});
// ── Toggle-all checkbox ───────────────────────────────
// ── Stack: toggle-all checkbox ───────────────────────
const toggleAllCb = document.getElementById("wfm-lora-stack-toggle-all");
if (toggleAllCb) {
toggleAllCb.indeterminate = !allActive && anyActive;
@@ -469,19 +561,17 @@ export const comfyEditor = {
});
}
// ── Global strength adjustment ─────────────────────
// ── Stack: global strength adjustment ────────────────
if (stackModels.length > 0) {
const adjApply = (key, sign) => {
const stepEl = document.getElementById(`wfm-stack-adj-step-${key}`);
const delta = sign * (parseFloat(stepEl?.value) || 0.05);
const delta = sign * (parseFloat(document.getElementById(`wfm-stack-adj-step-${key}`)?.value) || 0.05);
stackModels.forEach((m) => {
const str = _stackStrengths[m] || { m: 1.0, c: 1.0 };
str[key] = Math.max(0, Math.round((str[key] + delta) * 1000) / 1000);
_stackStrengths[m] = str;
});
el.querySelectorAll(".wfm-lora-stack-model-row").forEach((row) => {
const model = row.dataset.model;
const str = _stackStrengths[model];
const str = _stackStrengths[row.dataset.model];
if (!str) return;
const inp = row.querySelector(`.wfm-lora-stack-str-${key}`);
if (inp) inp.value = str[key];
@@ -494,105 +584,70 @@ export const comfyEditor = {
document.getElementById("wfm-stack-adj-c-dec")?.addEventListener("click", () => adjApply("c", -1));
}
// ── Apply button (unified: stack or single fallback) ──
// ── Stack: Apply button ──────────────────────────────
document.getElementById("wfm-lora-stack-apply")?.addEventListener("click", () => {
// Step 1: apply to node
const targetSelect = document.getElementById("wfm-lora-stack-target");
const nodeId = targetSelect?.value;
if (nodeId && comfyUI.currentWorkflow?.[nodeId]) {
const node = loraNodes.find((n) => String(n.id) === String(nodeId));
if (stackModels.length > 0) {
if (node?.is_lora_manager) {
// LoraManager: apply all stack models; respect active/inactive state
const loraValue = stackModels.map((m) => {
const stem = _loraBasename(m);
const str = _stackStrengths[m] || { m: 1.0, c: 1.0 };
const active = _stackActive[m] !== false;
return { name: stem, strength: str.m, active, expanded: false, clipStrength: str.c, locked: false };
});
comfyUI.currentWorkflow[nodeId].inputs.loras = { __value__: loraValue };
comfyUI.currentWorkflow[nodeId].inputs.text = _buildLoraManagerSyntax(stackModels);
} else {
// Standard LoraLoader: apply first model of stack
const first = stackModels[0];
if (first) {
comfyUI.currentWorkflow[nodeId].inputs.lora_name = first;
comfyUI.currentWorkflow[nodeId].inputs.strength_model = _stackStrengths[first]?.m ?? 1.0;
comfyUI.currentWorkflow[nodeId].inputs.strength_clip = _stackStrengths[first]?.c ?? 1.0;
}
}
} else {
// No stack — apply selected single LoRA
const select = document.getElementById("wfm-lora-select");
if (select?.value) {
const strModel = parseFloat(document.getElementById("wfm-lora-str-model")?.value) || 1.0;
const strClip = parseFloat(document.getElementById("wfm-lora-str-clip")?.value) || 1.0;
_applyLoraToNode(nodeId, select.value, strModel, strClip, node?.is_lora_manager);
}
}
_syncRawJson();
}
const nodeId = document.getElementById("wfm-lora-stack-target")?.value;
if (!nodeId || !comfyUI.currentWorkflow?.[nodeId]) return;
// Step 2: sync LoRA syntax + trigger words to Positive prompt
const node = loraNodes.find((n) => String(n.id) === String(nodeId));
if (node?.is_lora_manager) {
const loraValue = stackModels.map((m) => {
const stem = _loraBasename(m);
const str = _stackStrengths[m] || { m: 1.0, c: 1.0 };
const active = _stackActive[m] !== false;
return { name: stem, strength: str.m, active, expanded: false, clipStrength: str.c, locked: false };
});
comfyUI.currentWorkflow[nodeId].inputs.loras = { __value__: loraValue };
comfyUI.currentWorkflow[nodeId].inputs.text = _buildLoraManagerSyntax(stackModels);
} else {
const first = stackModels[0];
if (first) {
comfyUI.currentWorkflow[nodeId].inputs.lora_name = first;
comfyUI.currentWorkflow[nodeId].inputs.strength_model = _stackStrengths[first]?.m ?? 1.0;
comfyUI.currentWorkflow[nodeId].inputs.strength_clip = _stackStrengths[first]?.c ?? 1.0;
}
}
_syncRawJson();
// Sync Stack LORA SYNTAX + TRIGGER WORDS to Positive prompt
const posTextarea = document.getElementById("wfm-prompt-pos-text");
if (!posTextarea) return;
let effectiveModels, effectiveSyntax, effectiveTriggerWords, allTriggers;
if (stackModels.length > 0) {
effectiveModels = stackModels;
effectiveSyntax = _buildLoraSyntax(stackModels);
effectiveTriggerWords = activeTriggerWords;
allTriggers = [];
stackModels.forEach((m) => {
const sha = (metadata[m] || {}).sha256;
const civInfo = sha && civitaiCache[sha];
if (civInfo?.trainedWords?.length) allTriggers.push(...civInfo.trainedWords);
});
} else {
const singleModel = document.getElementById("wfm-lora-select")?.value;
effectiveModels = singleModel ? [singleModel] : [];
if (singleModel) {
const stem = _loraBasename(singleModel);
const strM = parseFloat(document.getElementById("wfm-lora-str-model")?.value) || 1.0;
const strC = parseFloat(document.getElementById("wfm-lora-str-clip")?.value) || 1.0;
effectiveSyntax = `<lora:${stem}:${strM}:${strC}>`;
const sha = (metadata[singleModel] || {}).sha256;
const civInfo = sha && civitaiCache[sha];
effectiveTriggerWords = civInfo?.trainedWords || [];
allTriggers = effectiveTriggerWords;
} else {
effectiveSyntax = "";
effectiveTriggerWords = [];
allTriggers = [];
}
}
const effectiveSyntax = _buildLoraSyntax(stackModels);
let cleaned = posTextarea.value;
for (const m of effectiveModels) {
for (const m of stackModels) {
const stem = _loraBasename(m).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
cleaned = cleaned.replace(new RegExp(`,?\\s*<lora:${stem}:[^>]*>`, "gi"), "");
}
if (allTriggers.length > 0) {
const wordSet = new Set(allTriggers.map(w => w.trim().toLowerCase()));
if (allStackTriggers.length > 0) {
const wordSet = new Set(allStackTriggers.map(w => w.trim().toLowerCase()));
cleaned = cleaned.split(",").map(p => p.trim()).filter(p => p && !wordSet.has(p.toLowerCase())).join(", ");
}
cleaned = cleaned.replace(/,\s*$/, "").trim();
if (effectiveSyntax) {
const append = effectiveTriggerWords.length > 0
? `${effectiveSyntax}, ${effectiveTriggerWords.join(", ")}`
const append = activeTriggerWords.length > 0
? `${effectiveSyntax}, ${activeTriggerWords.join(", ")}`
: effectiveSyntax;
posTextarea.value = cleaned ? `${cleaned}, ${append}` : append;
} else {
posTextarea.value = cleaned;
}
const posTarget = document.getElementById("wfm-prompt-pos-target");
const posNodeId = posTarget?.value;
const posNodeId = document.getElementById("wfm-prompt-pos-target")?.value;
if (posNodeId && comfyUI.currentWorkflow?.[posNodeId]) {
const promptNode = comfyUI.currentAnalysis?.prompt_nodes?.find(n => n.id === posNodeId);
const textKey = promptNode?.textKey || "text";
comfyUI.currentWorkflow[posNodeId].inputs[textKey] = posTextarea.value;
const promptNode = comfyUI.currentAnalysis?.prompt_nodes?.find(n => String(n.id) === String(posNodeId));
comfyUI.currentWorkflow[posNodeId].inputs[promptNode?.textKey || "text"] = posTextarea.value;
_syncRawJson();
}
});
// ── Stack: P button ──────────────────────────────────
document.getElementById("wfm-lora-pos-apply")?.addEventListener("click", () => {
const nodeId = document.getElementById("wfm-prompt-pos-target")?.value;
const text = document.getElementById("wfm-prompt-pos-text")?.value;
if (nodeId && comfyUI.currentWorkflow?.[nodeId]) {
const promptNode = comfyUI.currentAnalysis?.prompt_nodes?.find(n => String(n.id) === String(nodeId));
comfyUI.currentWorkflow[nodeId].inputs[promptNode?.textKey || "text"] = text;
_syncRawJson();
}
});
@@ -612,6 +667,9 @@ export const comfyEditor = {
_syncRawJson();
}
}
// Initial single tab display
_refreshLoraSingleDynamic(metadata, civitaiCache);
},
renderSettingsTab(analysis, containerId) {
@@ -833,6 +891,37 @@ export const comfyEditor = {
comfyUI.currentWorkflow[negTarget].inputs[negTextKey] = negText;
}
},
disableAllStack(containerId = "wfm-gen-lora-fields") {
for (const k of Object.keys(_stackActive)) {
_stackActive[k] = false;
}
const toggleAll = document.getElementById("wfm-lora-stack-toggle-all");
if (toggleAll) toggleAll.checked = false;
const container = document.getElementById(containerId);
if (!container) return;
container.querySelectorAll(".wfm-lora-stack-model-row").forEach((row) => {
row.classList.add("wfm-lora-stack-model-row--off");
const cb = row.querySelector(".wfm-lora-stack-active-cb");
const inM = row.querySelector(".wfm-lora-stack-str-m");
const inC = row.querySelector(".wfm-lora-stack-str-c");
if (cb) cb.checked = false;
if (inM) inM.disabled = true;
if (inC) inC.disabled = true;
});
},
switchLoraSingleTab() {
const container = document.getElementById("wfm-gen-lora-fields");
if (!container) return;
container.querySelectorAll(".wfm-lora-tab-btn").forEach(b => b.classList.remove("active"));
const singleBtn = container.querySelector(".wfm-lora-tab-btn[data-tab='single']");
if (singleBtn) singleBtn.classList.add("active");
const singlePanel = document.getElementById("wfm-lora-panel-single");
const stackPanel = document.getElementById("wfm-lora-panel-stack");
if (singlePanel) singlePanel.style.display = "";
if (stackPanel) stackPanel.style.display = "none";
},
};
function _nodeOptions(nodes) {
+15 -15
View File
@@ -424,7 +424,7 @@ const LANGUAGES = {
helpGen2: "Load workflows from Workflow tab (App format .app.json not supported)",
helpGen3: "5-tab layout — Input (Prompt + Image), Model, Settings, Feeder, Batch — Input/Model/Settings each include a Raw JSON column for instant preview and direct editing",
helpGen4: "Input tab: Prompt (top) and Image drag-and-drop (bottom) in the left column",
helpGen5: "Model tab: Checkpoint, VAE, LoRA, ControlNet, UNET, TextEncoder selectors with filter",
helpGen5: "Model tab: Checkpoint, VAE, LoRA (Single/Stack tabs), ControlNet, UNET, TextEncoder selectors with filter",
helpGen6: "Settings tab: KSampler and Latent Image side by side, each at 50% width",
helpGen7: "Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow",
helpGen8: "Seed control: random, fixed, increment, decrement",
@@ -481,7 +481,7 @@ const LANGUAGES = {
helpModels5: "CivitAI integration: fetch model info by SHA256 hash, batch fetch per model type; preview image is automatically downloaded and saved if none exists",
helpModels6: "Detail modal: preview image, CivitAI info (base model, trained words, tags), thumbnail change — upload any image format; changes take effect immediately; broken/empty preview files are automatically skipped",
helpModels7: "Group management: create, rename, delete groups and assign/remove models",
helpModels8: "GenUI Model button: apply the selected model to the corresponding node in GenerateUI's current workflow (Checkpoint / LoRA / VAE / ControlNet / UNET / TextEncoder)",
helpModels8: "GenUI Model button: applies the selected model to the workflow node; LoRA additionally switches to the Single tab, disables all Stack models, and shows LORA SYNTAX / TRIGGER WORDS (Checkpoint / LoRA / VAE / ControlNet / UNET / TextEncoder)",
helpModels9: "User-defined badges: assign free-label badges with custom colors shared with the Workflow tab",
helpModels10: "Enable/Disable models: toggle visibility in ComfyUI by renaming file extension (.disabled suffix). Disable per model (⏸ button on each card) or per group (Enable All / Disable All in Group panel). Changes take effect after ComfyUI refresh.",
helpModels11: "Multi-select & bulk operations: click Select to enter selection mode, check multiple models, then use the bulk action bar to add/remove from groups or permanently delete files (model file + preview images + sidecar files such as .json/.info).",
@@ -508,11 +508,11 @@ const LANGUAGES = {
helpSidepanel8: "Copy individual positive (P) or negative (N) prompts from sidebar items",
helpSidepanel9: "Double-click items to load/place without dragging",
helpSidepanel10: "Search within each sub-tab to quickly find items",
helpSidepanel11: "Models tab: All / ★ Favorites / Groups / By Type sub-tabs",
helpSidepanel11: "Models tab: All / ★ Favorites / Groups / By Type sub-tabs; Prompts tab: All / ★ Favorites / Categories sub-tabs + Groups sub-tab (row 2); Models Groups — LoRA groups show an \"All N LoRAs\" item to drag all into a single Lora Loader (LoraManager) node",
helpSidepanel12: "⚙ Theme button (header): customize panel background, sub-header background, text, border, and secondary text colors — changes are saved to localStorage and applied on next open",
helpSidepanel13: "I tab (Information): drop a ComfyUI PNG/WebP/JSON to inspect model, LoRA, and prompt metadata in the side panel — sub-tabs: model / lora / Prompts; supports UnetLoaderGGUF and QuadrupleCLIPLoader node types",
helpSidepanel13: "I tab (Information): drop a ComfyUI PNG/WebP/JSON to inspect model, LoRA, and prompt metadata in the side panel — sub-tabs: model / lora / Prompts; supports UnetLoaderGGUF, QuadrupleCLIPLoader, and Lora Loader (LoraManager) node types",
helpSidepanel14: "Information tab — drag items to canvas: model sub-tab places the loader node (Checkpoint → CheckpointLoaderSimple, VAE → VAELoader, Diffusion Model → UNETLoader, Text Encoder → CLIPLoader); double-click also places at canvas center",
helpSidepanel15: "Information tab — LoRA sub-tab: drag individual LoRA to place LoraLoader; \"Multiple LORA\" section at bottom places all LoRAs in a single Lora Loader (LoraManager) node; Prompts sub-tab: drag a prompt to place CLIPTextEncode node with text pre-filled; click prompt to view full text and copy",
helpSidepanel15: "Information tab — LoRA sub-tab: detects LoRAs from LoraLoader, LoraLoaderModelOnly, and Lora Loader (LoraManager) nodes (API format supported); drag individual LoRA to place LoraLoader; \"Multiple LORA\" section places all LoRAs in a single Lora Loader (LoraManager) node with LoRA syntax pre-filled; Prompts sub-tab: drag a prompt to place CLIPTextEncode node with text pre-filled; click prompt to view full text and copy",
helpSidepanel16: "A tab (AI Tools): Translation and VLM sub-tabs powered by Ollama or LM Studio; settings (backend, URL, model) are shared with the SPA AI tab via localStorage",
helpAiTitle: "AI Tab (A)",
helpAi1: "Translation sub-tab: translate text between Japanese, English, Chinese, or a custom Free language using Ollama or LM Studio",
@@ -1095,7 +1095,7 @@ const LANGUAGES = {
helpGen2: "Workflowタブからワークフローを読み込み(App形式 .app.json は非対応)",
helpGen3: "5タブ構成 — Input(プロンプト+画像)、Model、Settings、Feeder、Batch — Input/Model/SettingsタブにはRaw JSON列を常時表示",
helpGen4: "Inputタブ:左列にPrompt(上段)+ Image ドラッグ&ドロップ(下段)",
helpGen5: "Modelタブ:Checkpoint/VAE/LoRA/ControlNet/UNET/TextEncoderのセレクタ(フィルタ検索付き)",
helpGen5: "Modelタブ:Checkpoint/VAE/LoRA(Single/Stackタブ)/ControlNet/UNET/TextEncoderのセレクタ(フィルタ検索付き)",
helpGen6: "Settingsタブ:KSamplerとLatent Imageを横並び(各50%幅)",
helpGen7: "Raw JSONを各タブの右列に常時表示 — 直接編集してApplyでワークフロー即時反映",
helpGen8: "シード管理:ランダム / 固定 / 増加 / 減少",
@@ -1152,7 +1152,7 @@ const LANGUAGES = {
helpModels5: "CivitAI連携:SHA256ハッシュでモデル情報取得、モデルタイプごとの一括取得;プレビュー画像がない場合は自動でダウンロード・保存",
helpModels6: "詳細モーダル:プレビュー画像、CivitAI情報(ベースモデル、トリガーワード、タグ)、サムネイル変更 — 任意の画像形式をアップロード可能;ComfyUI再起動なしで即時反映;破損/空のプレビューファイルは自動スキップ",
helpModels7: "グループ管理:グループの作成・名前変更・削除、モデルの割り当て・解除",
helpModels8: "GenUI Modelボタン:選択モデルをGenerateUIの現在のワークフローの該当ノードに直接適用(Checkpoint / LoRA / VAE / ControlNet / UNET / TextEncoder)",
helpModels8: "GenUI Modelボタン:選択モデルをワークフローノードに適用。LoRAはSingleタブへ切り替え・Stack全無効化・LORA SYNTAX/TRIGGER WORDSをLoRAペインに表示(Checkpoint / LoRA / VAE / ControlNet / UNET / TextEncoder)",
helpModels9: "ユーザー定義バッジ:自由ラベルのバッジをモデルに付与(Workflowタブと色パレットを共有)",
helpModels10: "モデルの有効/無効切り替え:拡張子リネーム(.disabledサフィックス)でComfyUIへの表示を制御。各カードの⏸ボタンで単体操作、グループパネルの「全て有効化 / 全て無効化」でグループ一括操作。変更はComfyUIリフレッシュ後に反映。",
helpModels11: "複数選択と一括操作:「選択」ボタンで選択モードに入り複数モデルにチェックを入れると、一括操作バーからグループへの追加/削除、またはファイルの完全削除(モデルファイル+プレビュー画像+.json/.infoなどのサイドカーファイル)が行えます。",
@@ -1179,11 +1179,11 @@ const LANGUAGES = {
helpSidepanel8: "サイドバーアイテムからポジティブ(P)/ネガティブ(N)プロンプトを個別コピー",
helpSidepanel9: "ダブルクリックでもアイテムの読み込み・配置が可能",
helpSidepanel10: "各サブタブ内で検索してアイテムをすばやく検索",
helpSidepanel11: "Modelsタブ:All / ★ Favorites / Groups / By Typeサブタブ",
helpSidepanel11: "Modelsタブ:All / ★ Favorites / Groups / By Type サブタブ;Promptsタブ:All / ★ Favorites / Categories サブタブ+Groupsサブタブ(下段);Models Groupsの LoRA グループには「All N LoRAs」アイテムがあり、ドラッグで全 LoRA を Lora Loader (LoraManager) ノードに一括配置できる",
helpSidepanel12: "⚙ テーマボタン(ヘッダー):パネル背景・サブヘッダー背景・文字色・ボーダー・補助テキスト色をカスタマイズ可能、設定はlocalStorageに保存され次回起動時も反映",
helpSidepanel13: "I タブ(Information):ComfyUI の PNG / WebP / JSON をドロップするとサイドパネル内でモデル・LoRA・プロンプトのメタデータを確認可能 — サブタブ: model / lora / Prompts;UnetLoaderGGUF・QuadrupleCLIPLoader ノードタイプに対応",
helpSidepanel13: "I タブ(Information):ComfyUI の PNG / WebP / JSON をドロップするとサイドパネル内でモデル・LoRA・プロンプトのメタデータを確認可能 — サブタブ: model / lora / Prompts;UnetLoaderGGUF・QuadrupleCLIPLoader・Lora Loader (LoraManager) ノードタイプに対応",
helpSidepanel14: "Information タブ — キャンバスへドラッグ:model サブタブのアイテムをドラッグすると対応ローダーノードを配置(Checkpoint → CheckpointLoaderSimple、VAE → VAELoader、Diffusion Model → UNETLoader、Text Encoder → CLIPLoader);ダブルクリックでもキャンバス中央に配置可能",
helpSidepanel15: "Information タブ — lora サブタブ:個別 LoRA をドラッグで LoraLoader を配置;下部の「Multiple LORA」セクションをドラッグすると全 LoRA を一括で Lora Loader (LoraManager) に配置;Prompts サブタブ:プロンプトをドラッグするとテキスト入力済みの CLIPTextEncode ノードを配置;クリックで全文表示・コピー可能",
helpSidepanel15: "Information タブ — lora サブタブ:LoraLoader・LoraLoaderModelOnly・Lora Loader (LoraManager) ノード(APIフォーマット含む)から LoRA を検出;個別 LoRA をドラッグで LoraLoader を配置;「Multiple LORA」セクションで全 LoRA を Lora Loader (LoraManager) ノードに一括配置(LoRA構文自動入力);Prompts サブタブ:プロンプトをドラッグするとテキスト入力済みの CLIPTextEncode ノードを配置;クリックで全文表示・コピー可能",
helpSidepanel16: "A タブ(AI ツール):翻訳・VLM サブタブ;設定(バックエンド・URL・モデル)は SPA の AI タブと localStorage で共有される",
helpAiTitle: "AI タブ(A)",
helpAi1: "翻訳サブタブ:Ollama または LM Studio を使って日本語・英語・中国語・カスタム言語(Free)間でテキストを翻訳",
@@ -1762,7 +1762,7 @@ const LANGUAGES = {
helpGen2: "从工作流标签页加载工作流(不支持App格式.app.json)",
helpGen3: "5标签布局 — Input(提示词+图像)、Model、Settings、Feeder、Batch — Input/Model/Settings各含实时预览和直接编辑的Raw JSON列",
helpGen4: "Input标签:左列为Prompt(上)+ Image拖放(下)",
helpGen5: "Model标签:Checkpoint/VAE/LoRA/ControlNet/UNET/TextEncoder选择器(含筛选)",
helpGen5: "Model标签:Checkpoint/VAE/LoRA(Single/Stack标签)/ControlNet/UNET/TextEncoder选择器(含筛选)",
helpGen6: "Settings标签:KSampler与Latent Image并排显示(各占50%宽度)",
helpGen7: "Raw JSON在每个标签右列常驻显示 — 直接编辑并Apply即时重载工作流",
helpGen8: "种子管理:随机/固定/递增/递减",
@@ -1819,7 +1819,7 @@ const LANGUAGES = {
helpModels5: "CivitAI集成:通过SHA256哈希获取模型信息,按模型类型批量获取;无预览图时自动下载并保存",
helpModels6: "详情弹窗:预览图片、CivitAI信息(基础模型、触发词、标签)、缩略图更改 — 可上传任意格式图片;无需重启ComfyUI立即生效;损坏/空预览文件自动跳过",
helpModels7: "分组管理:创建、重命名、删除分组,分配/移除模型",
helpModels8: "GenUI Model按钮:将选中模型直接应用到GenerateUI当前工作流的对应节点(Checkpoint / LoRA / VAE / ControlNet / UNET / TextEncoder)",
helpModels8: "GenUI Model按钮:将选中模型应用到工作流节点;LoRA还会切换到Single标签、禁用所有Stack模型并在LoRA面板显示LORA SYNTAX/TRIGGER WORDS(Checkpoint / LoRA / VAE / ControlNet / UNET / TextEncoder)",
helpModels9: "用户自定义徽章:为模型添加自由标签徽章(颜色调色板与Workflow标签共享)",
helpModels10: "模型启用/禁用:通过重命名文件扩展名(添加.disabled后缀)控制ComfyUI中的显示。点击每个卡片上的⏸按钮单独操作,或在分组面板中使用「全部启用/全部禁用」进行批量操作。更改在刷新ComfyUI后生效。",
helpModels11: "多选与批量操作:点击「选择」按钮进入选择模式,勾选多个模型后,可通过批量操作栏将其添加/移出分组,或永久删除文件(模型文件+预览图+.json/.info等附属文件)。",
@@ -1846,11 +1846,11 @@ const LANGUAGES = {
helpSidepanel8: "从侧边栏项目中单独复制正面(P)或负面(N)提示词",
helpSidepanel9: "双击项目也可加载/放置",
helpSidepanel10: "在各子标签内搜索快速查找项目",
helpSidepanel11: "Models标签:All / ★ Favorites / Groups / By Type子标签",
helpSidepanel11: "Models标签:All / ★ Favorites / Groups / By Type子标签;Prompts标签:All / ★ Favorites / Categories子标签+Groups子标签(第二行);Models Groups的LoRA组显示「All N LoRAs」条目,可拖拽将全部LoRA放入单个Lora Loader (LoraManager)节点",
helpSidepanel12: "⚙ 主题按钮(标题栏):可自定义面板背景、子标题背景、文字颜色、边框及辅助文字颜色,设置保存至localStorage并在下次打开时生效",
helpSidepanel13: "I 标签(Information):拖放 ComfyUI PNG/WebP/JSON 即可在侧面板内查看模型、LoRA 和提示词元数据 — 子标签:model / lora / Prompts;支持 UnetLoaderGGUF 和 QuadrupleCLIPLoader 节点类型",
helpSidepanel13: "I 标签(Information):拖放 ComfyUI PNG/WebP/JSON 即可在侧面板内查看模型、LoRA 和提示词元数据 — 子标签:model / lora / Prompts;支持 UnetLoaderGGUF、QuadrupleCLIPLoader 和 Lora Loader (LoraManager) 节点类型",
helpSidepanel14: "Information 标签 — 拖拽到画布:model 子标签拖拽可放置对应加载节点(Checkpoint → CheckpointLoaderSimple、VAE → VAELoader、Diffusion Model → UNETLoader、Text Encoder → CLIPLoader);双击也可放置到画布中央",
helpSidepanel15: "Information 标签 — lora 子标签:拖拽单个 LoRA 放置 LoraLoader;底部「Multiple LORA」区域可将全部 LoRA 一次性放入 Lora Loader (LoraManager) 节点;Prompts 子标签:拖拽提示词放置预填文本的 CLIPTextEncode 节点;点击可查看全文并复制",
helpSidepanel15: "Information 标签 — lora 子标签:可检测 LoraLoader、LoraLoaderModelOnly 及 Lora Loader (LoraManager) 节点(含API格式)的 LoRA;拖拽单个 LoRA 放置 LoraLoader;「Multiple LORA」区域可将全部 LoRA 一次性放入 Lora Loader (LoraManager) 节点并自动填入LoRA语法;Prompts 子标签:拖拽提示词放置预填文本的 CLIPTextEncode 节点;点击可查看全文并复制",
helpSidepanel16: "A 标签(AI 工具):翻译子标签和 VLM 子标签;设置(后端、URL、模型)通过 localStorage 与 SPA 的 AI 标签共享",
helpAiTitle: "AI 标签页(A)",
helpAi1: "翻译子标签:使用 Ollama 或 LM Studio 在日语、英语、中文或自定义语言(Free)之间翻译文本",
+8 -1
View File
@@ -154,7 +154,9 @@ function extractLoRAs(wf) {
function add(name, sm, sc) {
if (!name || typeof name !== "string" || name === "None" || seen.has(name)) return;
seen.add(name);
results.push({ name, strength_model: typeof sm === "number" ? sm : 1.0, strength_clip: typeof sc === "number" ? sc : 1.0 });
const smNum = parseFloat(sm);
const scNum = parseFloat(sc);
results.push({ name, strength_model: isNaN(smNum) ? 1.0 : smNum, strength_clip: isNaN(scNum) ? 1.0 : scNum });
}
if (Array.isArray(wf.nodes)) {
for (const n of collectAllNodes(wf)) {
@@ -170,6 +172,11 @@ function extractLoRAs(wf) {
const ct = n.class_type ?? "";
if (ct === "LoraLoader") add(n.inputs?.lora_name, n.inputs?.strength_model, n.inputs?.strength_clip);
else if (ct === "LoraLoaderModelOnly") add(n.inputs?.lora_name, n.inputs?.strength, 1.0);
else if (ct === "Lora Loader (LoraManager)") {
const lorasData = n.inputs?.loras;
const list = lorasData?.__value__ ?? (Array.isArray(lorasData) ? lorasData : null);
if (list) for (const l of list) { if (l?.active !== false) add(l?.name, l?.strength ?? 1.0, l?.clipStrength ?? l?.strength ?? 1.0); }
}
}
}
return results;
+70 -15
View File
@@ -92,25 +92,81 @@ function applyToGenUI(modelName, modelType) {
return;
}
const { key, inputKey } = mapping;
let selectEl = null;
// Find the first matching node in the current workflow
const nodeId = Object.keys(comfyUI.currentWorkflow).find((id) => {
const node = comfyUI.currentWorkflow[id];
return node.inputs && inputKey in node.inputs;
});
if (modelType === "lora") {
// Use lora_nodes from analysis to correctly handle Lora Loader (LoraManager)
const loraNodes = comfyUI.currentAnalysis?.lora_nodes || [];
let nodeId = null;
let isLoraManager = false;
if (!nodeId) {
showToast(t("modelsGenUINoNode", TYPE_LABELS[modelType] || modelType), "warning");
return;
if (loraNodes.length > 0) {
const targetNode = loraNodes[0];
nodeId = targetNode.id;
isLoraManager = !!targetNode.is_lora_manager;
} else {
// Fallback: find a standard LoraLoader node by lora_name input
nodeId = Object.keys(comfyUI.currentWorkflow).find((id) => {
const node = comfyUI.currentWorkflow[id];
return node.inputs && "lora_name" in node.inputs;
});
}
if (!nodeId || !comfyUI.currentWorkflow[nodeId]) {
showToast(t("modelsGenUINoNode", TYPE_LABELS[modelType] || modelType), "warning");
return;
}
const stem = modelName.replace(/\\/g, "/").split("/").pop().replace(/\.[^.]+$/, "");
if (isLoraManager) {
comfyUI.currentWorkflow[nodeId].inputs.loras = {
__value__: [{ name: stem, strength: 1.0, active: true, expanded: false, clipStrength: 1.0, locked: false }],
};
comfyUI.currentWorkflow[nodeId].inputs.text = `<lora:${stem}:1:1>`;
} else {
comfyUI.currentWorkflow[nodeId].inputs.lora_name = modelName;
}
// Disable all Stack models and switch to Single tab
comfyEditor.disableAllStack("wfm-gen-lora-fields");
comfyEditor.switchLoraSingleTab();
// Update Single tab LORA SYNTAX and TRIGGER WORDS displays
const loraSyntax = `<lora:${stem}:1:1>`;
const sha = (state.modelMetadata[modelName] || {}).sha256;
const civInfo = sha && state.civitaiCache[sha];
const triggerWords = civInfo?.trainedWords || [];
const singleSyntaxEl = document.getElementById("wfm-lora-single-syntax");
if (singleSyntaxEl) singleSyntaxEl.textContent = loraSyntax;
const singleTriggersEl = document.getElementById("wfm-lora-single-triggers");
if (singleTriggersEl) {
singleTriggersEl.innerHTML = triggerWords.length
? triggerWords.map(w => `<span class="wfm-lora-trigger-word">${w}</span>`).join(" ")
: `<span style="color:var(--wfm-text-secondary);font-size:12px;">—</span>`;
}
selectEl = document.getElementById("wfm-lora-select");
} else {
const { key, inputKey } = mapping;
const nodeId = Object.keys(comfyUI.currentWorkflow).find((id) => {
const node = comfyUI.currentWorkflow[id];
return node.inputs && inputKey in node.inputs;
});
if (!nodeId) {
showToast(t("modelsGenUINoNode", TYPE_LABELS[modelType] || modelType), "warning");
return;
}
comfyUI.currentWorkflow[nodeId].inputs[inputKey] = modelName;
selectEl = document.getElementById(`wfm-model-${key}`);
}
comfyUI.currentWorkflow[nodeId].inputs[inputKey] = modelName;
// Sync GenUI select element if visible
const selectEl = document.getElementById(`wfm-model-${key}`);
if (selectEl) {
// Add option if not present (subdir paths may not be in list)
if (![...selectEl.options].some(o => o.value === modelName)) {
const opt = document.createElement("option");
opt.value = modelName;
@@ -120,7 +176,6 @@ function applyToGenUI(modelName, modelType) {
selectEl.value = modelName;
}
// Sync raw JSON display
const rawTextarea = document.getElementById("wfm-gen-raw-json");
if (rawTextarea) {
rawTextarea.value = JSON.stringify(comfyUI.currentWorkflow, null, 2);
+128 -5
View File
@@ -43,9 +43,11 @@ const state = {
wfLoaded: false,
// Prompts sub-tabs
promptSubTab: "prompt-all", // "prompt-all" | "prompt-favorites" | "prompt-categories"
promptSubTab2: null, // "prompt-groups" | null
promptList: [], // full prompt array from API
promptFavorites: [], // favorite === true
promptCategories: [], // unique category strings
promptGroups: {}, // { groupName: [promptId, ...] } from localStorage
promptLoaded: false,
// Models sub-tabs
modelSubTab: "model-all", // "model-all" | "model-favorites" | "model-groups"
@@ -143,6 +145,15 @@ const loadPromptData = async () => {
if (c) catSet.add(c);
}
state.promptCategories = [...catSet].sort();
try {
state.promptGroups = JSON.parse(localStorage.getItem("wfm_prompt_preset_groups") || "{}");
} catch { state.promptGroups = {}; }
const validIds = new Set(prompts.map(p => p.id));
for (const g of Object.keys(state.promptGroups)) {
state.promptGroups[g] = (state.promptGroups[g] || []).filter(id => validIds.has(id));
}
state.promptLoaded = true;
};
@@ -478,9 +489,21 @@ const placeLoraMgrNode = (loras, pos) => {
node.pos = pos || centerPos;
graph.add(node);
if (node.widgets) {
const loraList = loras.map(l => ({ name: l.name, strength: l.strength_model ?? 1.0, clipStrength: l.strength_clip ?? l.strength_model ?? 1.0, active: true }));
const loraList = loras.map(l => ({ name: l.name, strength: l.strength_model ?? l.strength ?? 1.0, clipStrength: l.strength_clip ?? l.strength_model ?? l.strength ?? 1.0, active: true }));
const w = node.widgets.find(ww => Array.isArray(ww.value) || ww.name === "loras");
if (w) { w.value = loraList; if (w.callback) w.callback(loraList); }
const textW = node.widgets.find(ww => ww.name === "text");
if (textW) {
textW.value = loraList
.filter(l => l.active !== false)
.map(l => {
const s = parseFloat(l.strength) || 1.0;
const c = parseFloat(l.clipStrength) || s;
return s === c ? `<lora:${l.name}:${s}>` : `<lora:${l.name}:${s}:${c}>`;
})
.join(" ");
if (textW.callback) textW.callback(textW.value);
}
}
app.canvas.setDirty(true, true);
showToast(`Placed: Lora Loader (${loras.length} loras)`, "success");
@@ -892,8 +915,11 @@ const rebuildSubTabs = () => {
{ key: "prompt-favorites", label: "\u2605 Favorites" },
{ key: "prompt-categories", label: "\ud83d\udcc1 Categories" },
];
const row2Tabs = [
{ key: "prompt-groups", label: "\ud83d\udcc1 Groups" },
];
const activeKey = state.promptSubTab;
const activeKey = state.promptSubTab2 || state.promptSubTab;
for (const t of row1Tabs) {
const btn = document.createElement("button");
@@ -902,13 +928,26 @@ const rebuildSubTabs = () => {
btn.textContent = t.label;
btn.addEventListener("click", () => {
state.promptSubTab = t.key;
state.promptSubTab2 = null;
updateAllActive();
btn.classList.add("active");
renderContent();
});
row1.appendChild(btn);
}
// No row2 tabs for prompts
for (const t of row2Tabs) {
const btn = document.createElement("button");
btn.className = "wfm-nlp-tab wfm-nlp-sub-tab" + (activeKey === t.key ? " active" : "");
btn.dataset.subtab = t.key;
btn.textContent = t.label;
btn.addEventListener("click", () => {
state.promptSubTab2 = t.key;
updateAllActive();
btn.classList.add("active");
renderContent();
});
row2.appendChild(btn);
}
} else if (state.topTab === "workflows") {
const row1Tabs = [
{ key: "wf-all", label: "All" },
@@ -1040,10 +1079,12 @@ const renderContent = () => {
content.innerHTML = `<div class="wfm-nlp-empty">Loading...</div>`;
return;
}
switch (state.promptSubTab) {
const promptKey = state.promptSubTab2 || state.promptSubTab;
switch (promptKey) {
case "prompt-all": renderPromptAll(content); break;
case "prompt-favorites": renderPromptFavorites(content); break;
case "prompt-categories": renderPromptCategories(content); break;
case "prompt-groups": renderPromptGroups(content); break;
}
} else if (state.topTab === "workflows") {
if (!state.wfLoaded) {
@@ -1529,6 +1570,32 @@ const renderModelGroups = async (container) => {
const item = createModelItem(name, type);
listEl.appendChild(item);
}
if (modelType === "lora" && filtered.length >= 1) {
const sep = document.createElement("div");
sep.className = "wfm-nlp-info-section-title";
sep.style.marginTop = "6px";
listEl.appendChild(sep);
const multiItem = document.createElement("div");
multiItem.className = "wfm-nlp-item wfm-nlp-model-item";
multiItem.draggable = true;
multiItem.title = `Drag to canvas to place Lora Loader (LoraManager) with all ${filtered.length} loras`;
multiItem.innerHTML = `<div class="wfm-nlp-item-row"><div class="wfm-nlp-item-body"><div class="wfm-nlp-item-label">All ${filtered.length} LoRAs</div><div class="wfm-nlp-item-sub">→ Lora Loader (LoraManager)</div></div></div>`;
const buildLoraList = () => filtered.map(n => {
const stem = n.replace(/\\/g, "/").split("/").pop().replace(/\.[^.]+$/, "");
return { name: stem, strength: 1.0, clipStrength: 1.0, active: true };
});
multiItem.addEventListener("dragstart", (e) => {
e.dataTransfer.effectAllowed = "copy";
e.dataTransfer.setData("application/x-wfm-lora-multi", JSON.stringify({ loras: buildLoraList() }));
multiItem.classList.add("dragging");
});
multiItem.addEventListener("dragend", () => multiItem.classList.remove("dragging"));
multiItem.addEventListener("dblclick", (e) => { e.stopPropagation(); placeLoraMgrNode(buildLoraList()); });
listEl.appendChild(multiItem);
}
section.appendChild(listEl);
container.appendChild(section);
}
@@ -1722,6 +1789,55 @@ const renderPromptCategories = (container) => {
}
};
const renderPromptGroups = (container) => {
container.innerHTML = "";
const groupNames = Object.keys(state.promptGroups).sort();
if (groupNames.length === 0) {
container.innerHTML = `<div class="wfm-nlp-empty">
No groups.<br><small>Create groups in Workflow Studio</small>
</div>`;
return;
}
const promptMap = new Map(state.promptList.map(p => [p.id, p]));
let hasAny = false;
for (const groupName of groupNames) {
const ids = state.promptGroups[groupName] || [];
const prompts = ids.map(id => promptMap.get(id)).filter(Boolean);
const filtered = prompts.filter(matchesPromptSearch);
if (state.searchText && filtered.length === 0) continue;
hasAny = true;
const section = document.createElement("div");
section.className = "wfm-nlp-group-section";
const header = document.createElement("div");
header.className = "wfm-nlp-group-header collapsed";
header.innerHTML = `<span>${esc(groupName)}</span> <span class="wfm-nlp-badge">${filtered.length}</span>`;
header.addEventListener("click", () => {
const list = section.querySelector(".wfm-nlp-group-list");
list.style.display = list.style.display === "none" ? "block" : "none";
header.classList.toggle("collapsed");
});
section.appendChild(header);
const list = document.createElement("div");
list.className = "wfm-nlp-group-list";
list.style.display = "none";
for (const p of filtered) {
list.appendChild(createDraggablePromptItem(p));
}
section.appendChild(list);
container.appendChild(section);
}
if (!hasAny) {
container.innerHTML = `<div class="wfm-nlp-empty">No matches.</div>`;
}
};
// ============================================
// Render – Node sub-tabs (existing)
// ============================================
@@ -2217,7 +2333,9 @@ function _extractLoRAs(wf) {
function add(name, sm, sc) {
if (!name || typeof name !== "string" || name === "None" || seen.has(name)) return;
seen.add(name);
results.push({ name, strength_model: typeof sm === "number" ? sm : 1.0, strength_clip: typeof sc === "number" ? sc : 1.0 });
const smNum = parseFloat(sm);
const scNum = parseFloat(sc);
results.push({ name, strength_model: isNaN(smNum) ? 1.0 : smNum, strength_clip: isNaN(scNum) ? 1.0 : scNum });
}
if (Array.isArray(wf.nodes)) {
for (const n of _collectAllNodes(wf)) {
@@ -2233,6 +2351,11 @@ function _extractLoRAs(wf) {
const ct = n.class_type ?? "";
if (ct === "LoraLoader") add(n.inputs?.lora_name, n.inputs?.strength_model, n.inputs?.strength_clip);
else if (ct === "LoraLoaderModelOnly") add(n.inputs?.lora_name, n.inputs?.strength, 1.0);
else if (ct === "Lora Loader (LoraManager)") {
const lorasData = n.inputs?.loras;
const list = lorasData?.__value__ ?? (Array.isArray(lorasData) ? lorasData : null);
if (list) for (const l of list) { if (l?.active !== false) add(l?.name, l?.strength ?? 1.0, l?.clipStrength ?? l?.strength ?? 1.0); }
}
}
}
return results;