Compare commits

...
1 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 4.6 080d75b8c4 feat: remove card view, add 4-type batch selector UI (v0.3.22)
- Remove Card view from Workflow and Models tabs (Thumbnail/Table only);
  localStorage fallback: stored "card" value defaults to "thumb"
- Replace Checkpoint Batch toggle with per-column-header checkboxes in
  Batch Queue pane (Checkpoint/Lora/Prompt/Workflow, radio behavior);
  Batch panel below Generate repurposed as status display + Pause/Stop
- Add _runBatchLoop() generic loop + _runBatchGenerate() 4-type dispatcher:
  Checkpoint (file-tree + group), Lora (group), Prompt (preset objects →
  positive/negative nodes), Workflow (group, restores original after batch)
- Remove ~86 lines of card-view CSS; keep nodes-tab card view intact
- Update help strings (EN/JA/ZH): helpWf1, helpModels2, helpGen11/13/14
- Update README features and Changelog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 16:22:29 +09:00
11 changed files with 1210 additions and 276 deletions
+15
View File
@@ -185,3 +185,18 @@ os.environ["HF_HOME"] = "D:\\hf_cache"
5. `INPUT_TYPES` 変更時は `widgets_values` も同時更新
6. 削除した依存への参照が残っていないか grep で確認
7. ComfyUI完全再起動 → ワークフロー読み込み → エンドツーエンド実行確認
---
## リリース手順
コミット・プッシュ・GitHub リリース(`gh release create`)を行う際は、**必ず以下の順序**で実施する。
1. `pyproject.toml` の `version` を新バージョン番号に更新してステージングに含める
2. `README.md` のバージョンバッジを更新(`![Version](https://img.shields.io/badge/version-X.Y.Z-green)`)
3. `README.md` の Changelog に新バージョンのエントリを追加
4. `DEVLOG.md` の先頭に変更詳細エントリを追加
5. 上記すべてを同一コミットにまとめてプッシュ
6. `gh release create vX.Y.Z` でリリースを作成
`pyproject.toml` のバージョン変更が GitHub Actions のトリガー(`paths: pyproject.toml`)になっており、ComfyUI Registry への自動公開もここで行われる。バージョン更新を忘れると Registry に反映されない。
+346
View File
@@ -1,5 +1,351 @@
# DEVLOG - ComfyUI-Workflow-Studio
## 2026-06-05: v0.3.22 — カードビュー廃止 + Batch タイプ切り替え UI + 4タイプバッチ生成
### 概要
WorkflowタブとModelsタブのカードビューを廃止(サムネイル/テーブルの2択に統一)。
生成UIタブのBatch機能を4タイプ(Checkpoint/Lora/Prompt/Workflow)のいずれかを有効化する
ラジオ選択型に拡張し、バッチ実行ループも全タイプ対応。
**カードビュー廃止(Workflow・Models タブ)**
- ビュー切り替えボタンから Card(&#9776;)を削除(Thumb・Table の2択)
- `viewMode` の初期値に `"card"` が保存されている場合は `"thumb"` にフォールバック
- Nodes タブのカードビューは変更なし
**Batch タイプ切り替え(BATCH QUEUE ヘッダー)**
- 各列ヘッダー右端にチェックボックスを追加(Checkpoint / Lora / Prompt / Workflow)
- ラジオ動作:1つを選択すると他3つは自動解除(`_activeBatchType` 変数で管理)
- バッチ有効時に Generate ボタンを押すと対応タイプのバッチ実行
**Batch ステータスパネル(旧 Checkpoint Batch)**
- "Checkpoint Batch" チェックボックス+ラベルを廃止
- 「Batch」+ アクティブタイプ名の常時表示に変更(実行中は青色ハイライト)
- 進捗バー・Pause ボタンはバッチ実行中のみ表示
**バッチ生成 4タイプ対応**
- 汎用ループ `_runBatchLoop(items, applyFn, labelFn)` を実装
- `_runBatchGenerate()` が `_activeBatchType` に応じてディスパッチ:
- Checkpoint: `checkpoint_nodes` の `ckpt_name` を差し替え
- Lora: `lora_nodes` の `lora_name` を差し替え
- Prompt: `prompt_nodes` の positive に `text`、negative に `negText` を適用(`textKey` 経由)
- Workflow: 各ファイルをロード → 生成 → 完了後に元ワークフローを復元
**バグ修正**
- Prompt バッチ: `_getSelectedPromptGroupItems()` がすでにプリセットオブジェクト配列を返すにもかかわらず、ID として再解決しようとして `list` が空になるバグを修正
### 変更内容
#### `templates/index.html`
- Workflow タブ・Models タブのビュー切り替えから Card ボタンを削除
- BATCH QUEUE 各列ヘッダー: テキストを `<span>` でラップ + `<input class="wfm-batch-type-cb" data-batch-type="...">` を追加
- Checkpoint Batch パネル: チェックボックス削除 → `wfm-batch-type-label` スパン(アクティブタイプ名表示)に置換。`wfm-ckpt-batch-body` の `display:none` 初期非表示を廃止
#### `static/js/workflow-tab.js`
- `viewMode` 初期値: `localStorage` の値が `"table"` 以外なら `"thumb"` にフォールバック
- `renderGrid()`: `thumb`/`card` の分岐を削除。常にサムネイルビューを描画
- `tags` 変数宣言を削除(カードビューでしか使用していなかったため)
#### `static/js/models-tab.js`
- `viewMode` 初期値: 同上フォールバック
- `renderModelGrid()`: `else if (viewMode === "card")` 分岐を削除。`thumb`/`table` の2択に
- `renderCardView()` 関数を削除(62行)
#### `static/js/generate-tab.js`
- `_activeBatchType` 変数追加(`null | "checkpoint" | "lora" | "prompt" | "workflow"`)
- `_updateBatchTypeLabel(running)`: バッチステータスパネルのタイプ名ラベルを更新
- `initCheckpointBatch()`: 旧チェックボックスハンドラを削除 → `.wfm-batch-type-cb` のラジオ動作ハンドラに置換
- `_runBatchLoop(items, applyFn, labelFn)`: 汎用バッチループ実装(進捗表示・一時停止・中断対応)
- `_runBatchGenerate()`: Checkpoint単体から4タイプディスパッチャに書き換え
- `handleGenerate()`: `wfm-ckpt-batch-enabled` チェック → `_activeBatchType !== null` に変更
#### `static/css/main.css`
- Workflow/Models カードビュー関連スタイルを削除(計約86行):
- `.wfm-view-card` 系全ルール / `.wfm-card-io` / `.wfm-model-card` / `.wfm-view-card .wfm-toggle-btn` 等
- `.wfm-batch-queue-col-header`: `display: flex; justify-content: space-between` 追加
- `.wfm-batch-type-cb`: チェックボックス用スタイル追加(12px、accent-color 指定)
---
## 2026-06-05: (未リリース) — 生成UIタブ Batch 4タイプ対応(Lora/Prompt/Workflow グループ選択 + BATCH QUEUE 4列化)
### 概要
生成UIタブの Batch ペインを Checkpoint 単体から Lora・Prompt・Workflow を含む4タイプ対応に拡張。
グループチェックペイン(中央ペイン)の Lora・Prompt・Workflow タブに実際のグループリストを実装し、
BATCH QUEUE(右ペイン)を4列横並びレイアウトに変更。
**グループチェックペイン(中央)**
- Lora タブ: `/api/wfm/models/groups?type=lora` からグループ取得。ファイル名(末尾)を表示
- Prompt タブ: `/api/wfm/prompts` でプリセット取得 + `localStorage[wfm_prompt_preset_groups]` でグループ取得。ID を `name` フィールドで解決して表示
- Workflow タブ: `localStorage[wfm_groups]` からグループ取得。`.json` 除去したファイル名を表示
- 各タブクリック時に対応するグループを再ロード。Batchサブタブ表示時は全タイプを一括ロード
**BATCH QUEUE(右ペイン)**
- Checkpoint / Lora / Prompt / Workflow の4列横並び表示
- 各列ヘッダー・件数・アイテムリストを独立表示
- 右ペイン幅を `flex: 1.2; min-width: 320px` に拡大
**バグ修正**
- ワークフロー カードビュー の B ボタンを左端から右下(★の下)に移動
- Prompt グループ選択ペインで UUID がそのまま表示されていた問題を修正(`title` → `name` フィールド)
### 変更内容
#### `templates/index.html`
- Lora/Prompt/Workflow タブ: "Coming soon" プレースホルダー → グループリストコンテナ(`wfm-batch-lora-group-list` / `wfm-batch-prompt-group-list` / `wfm-batch-wf-group-list`)に置換
- BATCH QUEUE 右ペイン: 単一リスト → `wfm-batch-queue-grid` 内に4列(各 `wfm-batch-queue-col`)
#### `static/js/generate-tab.js`
**`_batchGroupState` 拡張**
- Lora: `loraGroups` / `loraSelectedGroups` / `loraPartialSelections`
- Prompt: `promptGroups` / `promptPresets` / `promptSelectedGroups` / `promptPartialSelections`
- Workflow: `wfGroups` / `wfSelectedGroups` / `wfPartialSelections`
**新規汎用関数**
- `_getItemsFromGroupState(groupsData, selectedGroups, partialSelections)` — グループ状態からメンバーSet取得
- `_getGroupSelCountFrom(name, ...)` — 汎用選択数カウント
- `_renderAnyGroupList(listEl, groupsData, ...)` — Checkpoint と同じグループリストUIを任意タイプで再利用
**新規選択取得関数**
- `_getSelectedLoraGroupItems()` / `_getSelectedPromptGroupItems()` / `_getSelectedWfGroupItems()`
**新規ロード/レンダー関数**
- `_loadBatchLoraGroups()` / `_renderBatchLoraGroupList()`
- `_loadPromptGroupsForBatch()` / `_renderBatchPromptGroupList()`
- `_loadWorkflowGroupsForBatch()` / `_renderBatchWfGroupList()`
**`_renderBatchPreview()` リファクタリング**
- `_renderQueueColumn(countId, listId, items, displayFn, singular, plural)` を抽出
- 4タイプ(Checkpoint/Lora/Prompt/Workflow)を各列に独立レンダリング
**`initBatchTab()` 更新**
- 内部タブクリック時に対応する load 関数を呼び出し
- Batch サブタブ表示時に全タイプを一括ロード
**バグ修正**
- Prompt グループ表示: `presetsMap.get(id)?.title` → `presetsMap.get(id)?.name`(APIフィールド名修正)
#### `static/js/workflow-tab.js`
- カードビュー HTML: B ボタンと★ボタンを `wfm-card-actions` ラッパーで包み縦並び(★上・B下)に変更
#### `static/css/main.css`
- `.wfm-batch-right`: 固定210px → `flex: 1.2; min-width: 320px`
- `.wfm-batch-queue-grid` / `.wfm-batch-queue-col` / `.wfm-batch-queue-col-header`: 4列横並びレイアウト用スタイル追加
- `.wfm-view-card .wfm-card`: `align-items: stretch` に変更
- `.wfm-view-card .wfm-card-actions`: `flex-direction: column; justify-content: space-between` で縦並び配置
---
## 2026-06-05: (未リリース) — Prompt・Workflow Batchグループ登録UI
### 概要
Prompt タブと Workflow タブに Batch グループへの登録・解除 UI を追加。
モデルタブと同じ操作感で統一されており、B ボタンで登録/解除、B フィルターで絞り込み、BC ボタンで一括解除が可能。
**Prompt タブ**
- 各プリセットアイテムの★ボタン左隣に B ボタンを追加(黄色=登録済み)
- 検索ボックス右端に BC ボタンを追加(`wfm-pm-search` 行を flex 化)
**Workflow タブ**
- サムネイルビュー:`wfm-card-thumb` 左上に B ボタン(絶対配置)
- カードビュー:カード左下に B ボタン(絶対配置)
- テーブルビュー:右端に B 列追加
- フィルター行の★ボタン右隣に B フィルタリングボタンを追加
- View Settings ボタン右隣に BC ボタンを追加
### 変更内容
#### `static/js/prompt-tab.js`
**新規関数**
- `isInBatchPreset(id)` — `pmGroups["Batch"]` に id が含まれるか判定
- `toggleBatchPreset(id)` — バッチへの登録/解除トグル → `saveGroups()` で LocalStorage 保存
- `clearBatchPresets()` — `pmGroups["Batch"] = []` で一括解除
**`createPmItem()`**
- `inBatch` 変数を追加し `.pm-batch-btn` クラスに `batch-active` を付与
- ★ボタンの左に `<button class="wfm-pm-action-btn pm-batch-btn">B</button>` を追加
- `.pm-batch-btn` クリックで `toggleBatchPreset()` を呼び出し
**`initPromptTab()`**
- `wfm-pm-batch-clear-btn` クリック → `clearBatchPresets()` 呼び出し
#### `static/js/workflow-tab.js`
**新規 state フィールド**
- `state.showBatchOnly: false`
**新規関数**
- `isInBatch(filename)` / `toggleBatch(filename)` / `clearBatch()` — groups.data["Batch"] を操作
**`filterWorkflows()`**
- `state.showBatchOnly` が true のとき Batch グループメンバーのみに絞り込む処理を追加
**`renderModelFilters()`**
- ★フィルターボタンの右に B フィルタリングボタン(`.wfm-wf-batch-filter-btn`)を追加
- クリックで `state.showBatchOnly` トグル
**`renderGrid()` — thumbビュー**
- `wfm-card-thumb` 内に `<button class="wfm-batch-btn">B</button>` を追加(左上絶対配置)
**`renderGrid()` — cardビュー**
- favBtnの前に `<button class="wfm-batch-btn">B</button>` を追加(左下絶対配置)
**`renderTableView()`**
- thead 右端に空の th を追加(width:30px)
- 各行右端に `<td class="wfm-table-td-batch">B ボタン</td>` を追加
**`initWorkflowTab()`**
- `wfm-wf-batch-clear-btn` クリック → `clearBatch()` 呼び出し
#### `templates/index.html`
- Prompt タブ: `wfm-pm-search` 内にBC ボタン(`wfm-pm-batch-clear-btn`)を追加、入力ボックスに `flex:1` 追加
- Workflow タブ: View Settings ボタン(`wfm-badge-settings-btn`)の右に BC ボタン(`wfm-wf-batch-clear-btn`)を追加
#### `static/css/main.css`
- `.wfm-pm-search { display: flex; gap: 4px; align-items: center; }` — BC ボタン配置用
- `.wfm-pm-action-btn.batch-active { color: #f0c040; }` — Prompt タブ Bボタン active 時
- `.wfm-card-thumb { position: relative; }` — ワークフローthumbビューの Bボタン絶対配置基準
- `#wfm-workflow-grid.wfm-view-card .wfm-batch-btn { position: absolute; bottom: 6px; left: 6px; }` — ワークフローcardビュー専用(モデルタブと区別)
#### `static/js/i18n.js`
- `promptBatchClear` / `wfBatchClear` を英語・日本語・中国語で追加
---
## 2026-06-04: (未リリース) — モデルBatchグループ登録UI(サムネイル/カード/テーブル・フィルター・一括解除)
### 概要
Models タブ(Checkpoint / Lora)の Batch グループへの登録・解除 UI を全ビューに追加。
お気に入り(★)と同じ操作感で、1クリックで登録/解除できる「B」ボタンをサムネイル・カード・テーブルの各ビューに配置。
フィルターボタン(B)でバッチ登録済みモデルのみ絞り込み表示、BC ボタンで一括解除が可能。
### 変更内容
#### `templates/index.html`
- ★フィルターボタンの右隣に **B** フィルターボタン(`wfm-models-batch-filter-btn`)を追加
- Select ボタンの右隣に **BC** ボタン(`wfm-models-batch-clear-btn`)を追加
#### `static/css/main.css`
- `.wfm-batch-btn` スタイルを追加
- 通常時: グレー (`var(--wfm-text-secondary)`)・opacity 0.5
- `.active` 時: 黄色 (`#f0c040`)・opacity 1
- サムネイルビュー: `position: absolute; top: 6px; left: 6px;`(プレビュー左上)
- カードビュー: `position: static; flex-shrink: 0;`(★ボタンの左隣)
- テーブルビュー: `position: static`
- `.wfm-table-td-batch` セル幅スタイルを追加
#### `static/js/models-tab.js`
**新規 state フィールド**
- `state.showBatchOnly: false` — Bフィルターの有効状態
**新規ヘルパー関数**
- `isInBatch(modelName)` — `state.modelGroups["Batch"]` に含まれるか判定
- `toggleBatch(modelName)` — バッチへの登録/解除トグル → `saveModelGroups()` でサーバー保存
- `clearBatchGroup()` — `state.modelGroups["Batch"] = []` で一括解除、Bフィルターも解除
**フィルター処理**
- `state.showBatchOnly` が true のとき `modelGroups["Batch"]` メンバーのみに絞り込む処理を追加(`showFavoritesOnly` の直後)
**renderThumbView**
- `batchClass` 変数を追加(active で黄色クラス付与)
- プレビュー画像エリア左上に `<button class="wfm-batch-btn">B</button>` を追加
- `.wfm-batch-btn` クリックで `toggleBatch()` を呼び出し
- selectMode のクリックガードに `.wfm-batch-btn` を追加
**renderCardView**
- 同様に `batchClass` を追加し ★ボタンの左に `<button class="wfm-batch-btn">B</button>` を追加
- イベントハンドラ・selectMode ガードを同様に追加
**renderTableView**
- 各行に `<td class="wfm-table-td-batch">B ボタン</td>` を右端に追加
- thead に `<th style="width:30px;">B</th>` を追加
- `.wfm-batch-btn` クリックイベントを各行にバインド
- selectMode のクリックガードに `.wfm-batch-btn` を追加
**イベントハンドラ**
- `wfm-models-batch-filter-btn` クリック → `state.showBatchOnly` トグル・`renderModelGrid()` 呼び出し
- `wfm-models-batch-clear-btn` クリック → `clearBatchGroup()` 呼び出し
#### `static/js/i18n.js`
- `modelsBatch` / `modelsBatchClear` を英語・日本語・中国語で追加
---
## 2026-06-04: (未リリース) — Batch予約グループ・Presets Save後リセット・グループフィルター種別絞り込み
### 概要
Workflow / Prompt / Models(Checkpoint・Lora)に「Batch」予約グループを追加。
予約グループはシステム側で自動作成され、ユーザーによる削除・リネームをブロックする。
合わせて Prompt タブの Presets で Save 後に選択が `--New Preset--` へリセットされるよう修正し、
Models タブのグループフィルタードロップダウンが現在選択中のモデル種別のグループのみ表示するよう改善。
### 変更内容
#### `static/js/models-tab.js`
**Batch 予約グループの自動作成(Checkpoint / Lora)**
- `RESERVED_GROUPS = ["Batch"]` / `BATCH_MODEL_TYPES = ["checkpoint", "lora"]` 定数を追加
- `loadModelsForCurrentType()` のキャッシュヒット時・フル読み込み時の両パスで、対象タイプに "Batch" グループが存在しなければ API 経由で自動作成
**削除・リネームのブロック**
- グループ削除ボタン・リネームボタンのイベントハンドラで `RESERVED_GROUPS` チェックを追加
- 予約グループを操作しようとした場合 `modelsGroupReserved` トーストを表示して処理を中断
**グループフィルター種別絞り込み**
- `renderGroupFilter()` を改修: 全タイプ横断表示から `state.activeModelType` のグループのみ表示するよう変更
- `[タイプラベル] グループ名` 形式を廃止し、グループ名のみを表示
#### `static/js/prompt-tab.js`
**Batch 予約グループの自動確保**
- `PROMPT_RESERVED_GROUPS = ["Batch"]` 定数を追加
- `loadAllPresets()` のクリーニング処理で予約グループを空でも削除しないよう修正
- クリーニング後に予約グループが存在しなければ `pmGroups["Batch"] = []` で確保し `saveGroups()` へ反映
**削除ブロック**
- グループ削除ボタンのイベントハンドラで `PROMPT_RESERVED_GROUPS` チェックを追加
**Save 後の Preset 選択リセット**
- Preset 保存(新規作成・更新どちらも)成功後に `pmSelectedId = null` / `presetSelect.value = ""` で `--New Preset--` へ戻す
- 旧: 新規作成後は保存した Preset が選択されたまま → 誤って上書きするリスクがあった
#### `static/js/workflow-tab.js`
**Batch 予約グループの自動作成**
- `WF_RESERVED_GROUPS = ["Batch"]` 定数を追加
- `groups.load()` に予約グループ確保ロジックを追加(存在しなければ LocalStorage へ即時保存)
**削除・リネームのブロック**
- `groups.deleteGroup()` / `groups.renameGroup()` に `WF_RESERVED_GROUPS` チェックを追加(`false` 返却で中断)
- 削除・リネームボタンのイベントハンドラにもフロントエンド側チェックを追加してトースト表示
#### `static/js/i18n.js`
- `modelsGroupReserved` を英語・日本語・中国語で追加(「予約済みグループは削除・リネーム不可」のメッセージ)
---
## 2026-05-31: v0.3.21 — CivitAI ホスト設定・Sample サブタブ・URL 修正・ヘルプ i18n 整備
### 概要
+13 -7
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.21-green)
![Version](https://img.shields.io/badge/version-0.3.22-green)
## Screenshots
@@ -30,7 +30,7 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
## Features
### Workflow Tab
- **Thumbnail / Card / Table views** — switch between view modes to browse your workflow library
- **Thumbnail / Table views** — switch between view modes to browse your workflow library
- **Thumbnail side panel** — preview workflow canvas snapshots in the side panel
- **Badge filtering** — filter by user-defined badges (free labels you assign to each workflow)
- **Search** — full-text search across workflow names and metadata
@@ -38,7 +38,7 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
- **Badge management** — add, rename, delete badges with custom colors shared with the Models tab (⚙ Badge button)
- **AI summary** — generate workflow descriptions using Ollama
- **Import / Export** — import workflows from files or clipboard, open in ComfyUI directly
- **Default view setting** — persist your preferred view mode (Thumbnail / Card / Table)
- **Default view setting** — persist your preferred view mode (Thumbnail / Table)
### Canvas Snapshot (v0.1.2)
- **One-click capture** — click the camera button in ComfyUI's top bar to snapshot the current workflow canvas
@@ -54,11 +54,11 @@ Browse, organize, and execute workflows directly from a dedicated studio interfa
- **Always-visible Raw JSON** — edit the API-format JSON directly from any tab with syntax highlighting; Apply button reloads the workflow; built-in **search bar** (always shown) finds all matches as you type with count display (`3/12`); navigate with ↑/↓ buttons or Enter / Shift+Enter; Escape or ✕ clears; current match highlighted in orange, other matches in yellow
- **One-click generation** — queue prompts to ComfyUI without leaving the studio
- **Seed control** — randomize, lock, or manually set seeds; seed input and mode selector stacked vertically for readability
- **Checkpoint Batch** — enable via checkbox in the right panel to activate sequential batch generation; Pause/Resume suspends processing between models; Stop aborts after the current generation; amber progress bar tracks per-model progress
- **Batch type selector** — check one of the column header checkboxes in the Batch Queue pane (Checkpoint / Lora / Prompt / Workflow) to activate that batch type; only one type can be active at a time; the Batch panel below Generate shows the active type, progress, and Pause/Resume/Stop controls
- **Batch tab** (v0.3.18) — dedicated 3-pane layout for assembling the batch queue:
- **Left pane** — file-tree checkpoint selection; Filter input to search; All / None buttons; initial state is all unchecked
- **Center pane** — group-based selection with inner tabs (Checkpoint | Lora | Prompt | Workflow); Checkpoint tab shows groups from the Models tab — check a group to add all its members, expand ▶ to select individual models; group membership always reflects the latest Models tab state
- **Right pane (Batch Queue)** — live preview combining file-tree and group selections with duplicates removed; total count shown at top
- **Center pane** — group-based selection with inner tabs (Checkpoint | Lora | Prompt | Workflow); Checkpoint/Lora groups come from the Models tab, Prompt groups from the Prompt tab, Workflow groups from the Workflow tab — check a group to add all its members, expand ▶ to select individually
- **Right pane (Batch Queue)** — shows items queued for each batch type; column headers (Checkpoint / Lora / Prompt / Workflow) each have a checkbox — check one to activate that batch type (radio behavior: only one at a time); count shown at top
- **UI-to-API conversion** — automatic conversion supporting subgraphs (nested workflows), COMBO types, and display-only node exclusion; improved analysis covers SDXL multi-hop CONDITIONING chains, CLIPTextEncodeSDXL, SDXLPromptStyler, KSamplerAdvanced, and more
- **Eagle integration** — auto-save generated images to [Eagle](https://eagle.cool/) with metadata
@@ -141,7 +141,7 @@ Requires the **[comfyui-image-feeder](https://github.com/ketle-man/comfyui-image
### Models Tab (v0.2.3)
- **Model Browser** — browse all installed ComfyUI models (Checkpoint, LoRA, VAE, ControlNet, UNET, TextEncoder, Hypernetwork, Embedding) with sub-tab switching
- **Thumbnail / Card / Table views** — switch between view modes with pagination (24 items per page)
- **Thumbnail / Table views** — switch between view modes with pagination (24 items per page)
- **Search & Filter** — full-text search, filter by tags, groups, and favorites
- **User-defined badges** — assign free-label badges to models; badge colors shared with the Workflow tab palette
- **Side panel tabs** — Info (file path display with click-to-copy, tags, memo), Groups management, CivitAI integration
@@ -279,6 +279,12 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
## Changelog
### v0.3.22
- **Card view removed** — Workflow tab and Models tab no longer offer Card view; Thumbnail and Table remain; if `"card"` was previously stored in localStorage it falls back to Thumbnail automatically
- **Batch type selector** — replaced the Checkpoint Batch toggle with per-type checkboxes on the Batch Queue column headers (Checkpoint / Lora / Prompt / Workflow); radio behavior ensures only one type is active at a time; the Batch panel below Generate repurposed as a status display showing the active type, amber progress bar, and Pause/Resume / Stop controls
- **4-type batch generation** — `_runBatchGenerate()` dispatches to Checkpoint (file-tree + group selection), Lora (group selection), Prompt (preset group items applied to positive/negative nodes), and Workflow (group selection, restores original workflow after batch); all types use the same generic `_runBatchLoop()` with pause/abort support
- **Help updated** — EN / JA / ZH strings updated for `helpWf1`, `helpModels2`, `helpGen11`, `helpGen13`, `helpGen14`
### v0.3.21
- **CivitAI Host setting** — new dropdown in Settings tab (CivitAI section): choose `civitai.com` (SFW only) or `civitai.red` (unrestricted); selection is saved to `settings.json` and synced to `localStorage` so the Models tab uses it immediately without extra server calls
- **CivitAI panel — Info / Sample sub-tabs** — the CivitAI side panel is split into two sub-tabs; Info tab contains model details and actions; Sample tab shows all sample images (count displayed in label); images open full-size in a new browser tab on click
+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.21"
version = "0.3.22"
license = "MIT"
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+79 -62
View File
@@ -290,6 +290,7 @@ body {
align-items: center;
justify-content: center;
overflow: hidden;
position: relative;
}
.wfm-card-thumb img {
@@ -1045,58 +1046,42 @@ body {
}
/* ============================================
Card View Mode (no thumbnail, compact)
Batch Button
============================================ */
.wfm-view-card {
grid-template-columns: repeat(auto-fill, 220px) !important;
grid-auto-rows: max-content !important;
gap: 8px !important;
justify-items: stretch !important;
align-items: start !important;
}
.wfm-view-card .wfm-card {
display: flex;
flex-direction: row;
align-items: center;
width: 220px !important;
min-width: 220px !important;
min-height: 56px;
}
.wfm-view-card .wfm-card-body {
flex: 1;
min-width: 0;
padding: 8px 10px;
}
.wfm-view-card .wfm-fav-btn {
flex-shrink: 0;
margin-right: 6px;
}
.wfm-view-card .wfm-card-title {
margin-bottom: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 12px;
}
.wfm-card-io {
font-size: 11px;
.wfm-batch-btn {
position: absolute;
top: 6px;
left: 6px;
background: none;
border: none;
color: var(--wfm-text-secondary);
margin-top: 4px;
font-size: 11px;
font-weight: bold;
cursor: pointer;
line-height: 1;
opacity: 0.5;
transition: opacity 0.15s, color 0.15s;
padding: 0 2px;
}
.wfm-card-tags {
display: flex;
gap: 4px;
flex-wrap: wrap;
margin-top: 4px;
.wfm-batch-btn:hover {
opacity: 1;
}
.wfm-batch-btn.active {
color: #f0c040;
opacity: 1;
}
.wfm-table-row .wfm-batch-btn,
.wfm-models-table-row .wfm-batch-btn {
position: static;
opacity: 0.7;
}
.wfm-tag {
font-size: 10px;
color: var(--wfm-primary);
@@ -1798,6 +1783,9 @@ body {
.wfm-pm-search {
padding: 8px;
flex-shrink: 0;
display: flex;
gap: 4px;
align-items: center;
}
.wfm-pm-list {
flex: 1;
@@ -1866,6 +1854,10 @@ body {
.wfm-pm-action-btn.fav-active {
color: #ffd700;
}
.wfm-pm-action-btn.batch-active {
color: #f0c040;
opacity: 1;
}
.wfm-pm-empty {
padding: 24px 16px;
text-align: center;
@@ -3634,14 +3626,6 @@ body {
border-color: var(--wfm-accent);
}
/* Model card (card view, no thumbnail) */
.wfm-model-card {
position: relative;
}
.wfm-model-card .wfm-card-body {
position: relative;
}
/* Badge: subdirectory (italic, muted) */
.wfm-badge-dir {
@@ -3822,12 +3806,6 @@ body {
opacity: 0.7;
}
/* Card view: fav and toggle are flex siblings */
.wfm-view-card .wfm-toggle-btn {
position: static;
flex-shrink: 0;
margin-right: 4px;
}
/* Table view toggle cell */
.wfm-table-td-toggle {
@@ -3840,6 +3818,11 @@ body {
opacity: 0.5;
}
.wfm-table-td-batch {
text-align: center;
width: 30px;
}
/* Disabled badge in card title */
.wfm-badge-disabled {
background: rgba(255, 107, 107, 0.2);
@@ -3877,7 +3860,6 @@ body {
content: "✓";
}
.wfm-view-thumb .wfm-model-card.wfm-card-checked,
.wfm-view-card .wfm-model-card.wfm-card-checked {
outline: 2px solid #6c8ef5;
outline-offset: -2px;
}
@@ -3927,7 +3909,7 @@ body {
.wfm-batch-pane:last-child { border-right: none; }
.wfm-batch-left { width: 240px; flex-shrink: 0; }
.wfm-batch-center { flex: 1; }
.wfm-batch-right { width: 210px; flex-shrink: 0; }
.wfm-batch-right { flex: 1.2; min-width: 320px; flex-shrink: 0; }
.wfm-batch-pane-header {
font-size: 11px;
font-weight: 600;
@@ -4002,9 +3984,44 @@ body {
border-bottom: 1px solid var(--wfm-border);
flex-shrink: 0;
}
.wfm-batch-queue-grid {
display: flex;
flex: 1;
overflow: hidden;
gap: 0;
}
.wfm-batch-queue-col {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
border-right: 1px solid var(--wfm-border);
min-width: 0;
}
.wfm-batch-queue-col:last-child { border-right: none; }
.wfm-batch-queue-col-header {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 10px;
font-weight: 600;
color: var(--wfm-text-secondary);
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 4px 6px 4px 8px;
border-bottom: 1px solid var(--wfm-border);
flex-shrink: 0;
}
.wfm-batch-type-cb {
width: 12px;
height: 12px;
cursor: pointer;
flex-shrink: 0;
accent-color: var(--wfm-primary);
}
.wfm-batch-preview-list { flex: 1; overflow-y: auto; padding: 2px 0; }
.wfm-batch-preview-item {
padding: 3px 10px;
padding: 3px 8px;
font-size: 11px;
color: var(--wfm-text-primary);
overflow: hidden;
+450 -75
View File
@@ -153,10 +153,11 @@ export async function loadWorkflowIntoEditor(workflow, filename) {
}
// ============================================
// Checkpoint Batch
// Batch (multi-type: Checkpoint / Lora / Prompt / Workflow)
// ============================================
const _ckptBatch = { aborted: false, paused: false, _resumeResolve: null };
let _activeBatchType = null; // "checkpoint" | "lora" | "prompt" | "workflow" | null
async function _waitIfPaused() {
if (!_ckptBatch.paused) return;
@@ -171,42 +172,93 @@ function _setPauseBtnState(paused) {
btn.style.color = paused ? "#fff" : "";
}
function _updateBatchTypeLabel(running = false) {
const el = document.getElementById("wfm-batch-type-label");
if (!el) return;
const labels = { checkpoint: "Checkpoint", lora: "Lora", prompt: "Prompt", workflow: "Workflow" };
if (_activeBatchType) {
el.textContent = labels[_activeBatchType];
el.style.color = running ? "var(--wfm-primary)" : "";
} else {
el.textContent = "—";
el.style.color = "";
}
}
// mode: "all" = 全選択, "some" = 一部選択, "none" = 全解除
const _ckptState = { mode: "none", selected: new Set() };
// グループ選択状態(中央ペイン)
// selectedGroups : グループ全体が選択済み(グループ名のSet)
// partialSelections: 部分選択 { groupName: Set<modelName> }
// → モデル一覧は常に _batchGroupState.groups から解決するため
// グループのメンバーが変わっても自動的に最新状態を反映できる
// partialSelections: 部分選択 { groupName: Set<memberValue> }
const _batchGroupState = {
// Checkpoint
groups: {},
selectedGroups: new Set(),
partialSelections: {},
// Lora
loraGroups: {},
loraSelectedGroups: new Set(),
loraPartialSelections: {},
// Prompt (グループ値はpresetId、表示はtitleで解決)
promptGroups: {},
promptPresets: [],
promptSelectedGroups: new Set(),
promptPartialSelections: {},
// Workflow
wfGroups: {},
wfSelectedGroups: new Set(),
wfPartialSelections: {},
};
// 中央ペインの選択から現在のグループメンバーを解決して返す
function _getSelectedGroupModels() {
// 汎用: groupsData/selectedGroups/partialSelectionsからメンバーSetを返す
function _getItemsFromGroupState(groupsData, selectedGroups, partialSelections) {
const result = new Set();
for (const [name, members] of Object.entries(_batchGroupState.groups)) {
if (_batchGroupState.selectedGroups.has(name)) {
for (const [name, members] of Object.entries(groupsData)) {
if (selectedGroups.has(name)) {
members.forEach((m) => result.add(m));
} else {
const partial = _batchGroupState.partialSelections[name];
const partial = partialSelections[name];
if (partial) partial.forEach((m) => { if (members.includes(m)) result.add(m); });
}
}
return result;
}
// グループの選択済みモデル数を返す(UIのカウント表示用)
function _getGroupSelCount(name) {
const members = _batchGroupState.groups[name] || [];
if (_batchGroupState.selectedGroups.has(name)) return members.length;
const partial = _batchGroupState.partialSelections[name];
// 中央ペインCheckpointグループの選択モデルSet
function _getSelectedGroupModels() {
return _getItemsFromGroupState(_batchGroupState.groups, _batchGroupState.selectedGroups, _batchGroupState.partialSelections);
}
// Loraグループの選択アイテムSet
function _getSelectedLoraGroupItems() {
return _getItemsFromGroupState(_batchGroupState.loraGroups, _batchGroupState.loraSelectedGroups, _batchGroupState.loraPartialSelections);
}
// Promptグループの選択プリセット配列 (idではなくpresetオブジェクト)
function _getSelectedPromptGroupItems() {
const ids = _getItemsFromGroupState(_batchGroupState.promptGroups, _batchGroupState.promptSelectedGroups, _batchGroupState.promptPartialSelections);
return [...ids].map((id) => _batchGroupState.promptPresets.find((p) => p.id === id)).filter(Boolean);
}
// Workflowグループの選択ファイル名Set
function _getSelectedWfGroupItems() {
return _getItemsFromGroupState(_batchGroupState.wfGroups, _batchGroupState.wfSelectedGroups, _batchGroupState.wfPartialSelections);
}
// グループの選択済みメンバー数(汎用)
function _getGroupSelCountFrom(name, groupsData, selectedGroups, partialSelections) {
const members = groupsData[name] || [];
if (selectedGroups.has(name)) return members.length;
const partial = partialSelections[name];
return partial ? members.filter((m) => partial.has(m)).length : 0;
}
// グループの選択済みモデル数を返す(Checkpoint用 UIカウント表示)
function _getGroupSelCount(name) {
return _getGroupSelCountFrom(name, _batchGroupState.groups, _batchGroupState.selectedGroups, _batchGroupState.partialSelections);
}
function _getSelectedCheckpoints() {
const all = comfyEditor.models.checkpoints || [];
// 左ペイン(ファイルツリー)選択
@@ -224,24 +276,57 @@ function _getSelectedCheckpoints() {
return result;
}
function _renderBatchPreview() {
const countEl = document.getElementById("wfm-batch-preview-count");
const listEl = document.getElementById("wfm-batch-preview-list");
const list = _getSelectedCheckpoints();
const n = list.length;
if (countEl) countEl.textContent = `${n} checkpoint${n !== 1 ? "s" : ""} queued`;
if (listEl) {
if (n === 0) {
listEl.innerHTML = `<p class="wfm-placeholder" style="font-size:11px;padding:12px;">No checkpoints selected</p>`;
return;
}
listEl.innerHTML = list.map((m, i) => {
const name = m.replace(/\\/g, "/").split("/").pop();
const safe = m.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
const safeName = name.replace(/&/g, "&amp;").replace(/</g, "&lt;");
return `<div class="wfm-batch-preview-item" title="${safe}">${i + 1}. ${safeName}</div>`;
}).join("");
function _renderQueueColumn(countId, listId, items, displayFn, singular, plural) {
const countEl = document.getElementById(countId);
const listEl = document.getElementById(listId);
const n = items.length;
if (countEl) countEl.textContent = `${n} ${n !== 1 ? plural : singular}`;
if (!listEl) return;
if (n === 0) {
listEl.innerHTML = `<p class="wfm-placeholder" style="font-size:11px;padding:8px 10px;">None selected</p>`;
return;
}
listEl.innerHTML = items.map((item, i) => {
const label = displayFn(item);
const tip = typeof item === "string" ? item.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;") : "";
const safeLabel = label.replace(/&/g, "&amp;").replace(/</g, "&lt;");
return `<div class="wfm-batch-preview-item" title="${tip}">${i + 1}. ${safeLabel}</div>`;
}).join("");
}
function _renderBatchPreview() {
// Checkpoint
const ckptList = _getSelectedCheckpoints();
_renderQueueColumn(
"wfm-batch-preview-count", "wfm-batch-preview-list",
ckptList,
(m) => m.replace(/\\/g, "/").split("/").pop(),
"checkpoint", "checkpoints"
);
// Lora
const loraList = [..._getSelectedLoraGroupItems()];
_renderQueueColumn(
"wfm-batch-lora-count", "wfm-batch-lora-list",
loraList,
(m) => m.replace(/\\/g, "/").split("/").pop(),
"lora", "loras"
);
// Prompt
const promptList = _getSelectedPromptGroupItems();
_renderQueueColumn(
"wfm-batch-prompt-count", "wfm-batch-prompt-list",
promptList,
(p) => p.name || p.id,
"prompt", "prompts"
);
// Workflow
const wfList = [..._getSelectedWfGroupItems()];
_renderQueueColumn(
"wfm-batch-wf-count", "wfm-batch-wf-list",
wfList,
(f) => f.replace(/\.json$/i, "").replace(/\\/g, "/").split("/").pop(),
"workflow", "workflows"
);
}
// モデルパスリストをフォルダ → [modelPath, ...] のMapに変換
@@ -549,8 +634,227 @@ function _renderBatchGroupList() {
}
}
// ============================================
// 汎用グループリストレンダリング
// displayFn: (memberValue) => 表示文字列
// ============================================
function _renderAnyGroupList(listEl, groupsData, selectedGroups, partialSelections, displayFn, onPreviewChange) {
if (!listEl) return;
const names = Object.keys(groupsData).sort();
if (names.length === 0) {
listEl.innerHTML = `<p class="wfm-placeholder" style="font-size:12px;padding:16px;">No groups defined.</p>`;
return;
}
listEl.innerHTML = "";
for (const name of names) {
const members = groupsData[name] || [];
const groupDiv = document.createElement("div");
groupDiv.className = "wfm-batch-group-item open";
const headerDiv = document.createElement("div");
headerDiv.className = "wfm-batch-group-header";
const cb = document.createElement("input");
cb.type = "checkbox";
const getSelCount = () => _getGroupSelCountFrom(name, groupsData, selectedGroups, partialSelections);
let selCount = getSelCount();
cb.checked = members.length > 0 && selCount === members.length;
cb.indeterminate = selCount > 0 && selCount < members.length;
const toggle = document.createElement("span");
toggle.className = "wfm-ckpt-folder-toggle";
toggle.textContent = "▶";
const nameSpan = document.createElement("span");
nameSpan.className = "wfm-batch-group-name";
nameSpan.textContent = name;
const countSpan = document.createElement("span");
countSpan.className = "wfm-batch-group-count";
countSpan.textContent = `${selCount}/${members.length}`;
const memberDiv = document.createElement("div");
memberDiv.className = "wfm-batch-group-members";
for (const m of members) {
const label = document.createElement("label");
label.className = "wfm-ckpt-item wfm-ckpt-item--indented";
const fileCb = document.createElement("input");
fileCb.type = "checkbox";
fileCb.value = m;
fileCb.checked = selectedGroups.has(name) || !!(partialSelections[name]?.has(m));
const fileSpan = document.createElement("span");
fileSpan.className = "wfm-ckpt-item-label";
fileSpan.textContent = displayFn(m);
fileSpan.title = m;
fileCb.addEventListener("change", () => {
if (selectedGroups.has(name)) {
selectedGroups.delete(name);
const partial = new Set(members);
partial.delete(m);
if (partial.size > 0) partialSelections[name] = partial;
} else {
if (!partialSelections[name]) partialSelections[name] = new Set();
if (fileCb.checked) partialSelections[name].add(m);
else partialSelections[name].delete(m);
if (members.every((x) => partialSelections[name].has(x))) {
selectedGroups.add(name);
delete partialSelections[name];
}
if (partialSelections[name]?.size === 0) delete partialSelections[name];
}
const sc = getSelCount();
cb.checked = sc === members.length && members.length > 0;
cb.indeterminate = sc > 0 && sc < members.length;
countSpan.textContent = `${sc}/${members.length}`;
onPreviewChange();
});
label.appendChild(fileCb);
label.appendChild(fileSpan);
memberDiv.appendChild(label);
}
cb.addEventListener("change", () => {
if (cb.checked) {
selectedGroups.add(name);
delete partialSelections[name];
} else {
selectedGroups.delete(name);
delete partialSelections[name];
}
memberDiv.querySelectorAll("input[type=checkbox]").forEach((c) => { c.checked = cb.checked; });
countSpan.textContent = `${cb.checked ? members.length : 0}/${members.length}`;
onPreviewChange();
});
[toggle, nameSpan].forEach((el) => {
el.addEventListener("click", () => groupDiv.classList.toggle("open"));
});
headerDiv.appendChild(cb);
headerDiv.appendChild(toggle);
headerDiv.appendChild(nameSpan);
headerDiv.appendChild(countSpan);
groupDiv.appendChild(headerDiv);
groupDiv.appendChild(memberDiv);
listEl.appendChild(groupDiv);
}
}
// ============================================
// Lora グループ
// ============================================
async function _loadBatchLoraGroups() {
try {
const res = await fetch("/api/wfm/models/groups?type=lora");
if (res.ok) _batchGroupState.loraGroups = await res.json();
else _batchGroupState.loraGroups = {};
} catch { _batchGroupState.loraGroups = {}; }
const currentNames = new Set(Object.keys(_batchGroupState.loraGroups));
for (const name of _batchGroupState.loraSelectedGroups) {
if (!currentNames.has(name)) _batchGroupState.loraSelectedGroups.delete(name);
}
for (const name of Object.keys(_batchGroupState.loraPartialSelections)) {
if (!currentNames.has(name)) delete _batchGroupState.loraPartialSelections[name];
}
_renderBatchLoraGroupList();
_renderBatchPreview();
}
function _renderBatchLoraGroupList() {
const el = document.getElementById("wfm-batch-lora-group-list");
_renderAnyGroupList(
el,
_batchGroupState.loraGroups,
_batchGroupState.loraSelectedGroups,
_batchGroupState.loraPartialSelections,
(m) => m.replace(/\\/g, "/").split("/").pop(),
_renderBatchPreview
);
}
// ============================================
// Prompt グループ
// ============================================
async function _loadPromptGroupsForBatch() {
try {
const res = await fetch("/api/wfm/prompts");
_batchGroupState.promptPresets = res.ok ? await res.json() : [];
} catch { _batchGroupState.promptPresets = []; }
try {
_batchGroupState.promptGroups = JSON.parse(localStorage.getItem("wfm_prompt_preset_groups") || "{}");
} catch { _batchGroupState.promptGroups = {}; }
const validIds = new Set(_batchGroupState.promptPresets.map((p) => p.id));
for (const g of Object.keys(_batchGroupState.promptGroups)) {
_batchGroupState.promptGroups[g] = (_batchGroupState.promptGroups[g] || []).filter((id) => validIds.has(id));
}
const currentNames = new Set(Object.keys(_batchGroupState.promptGroups));
for (const name of _batchGroupState.promptSelectedGroups) {
if (!currentNames.has(name)) _batchGroupState.promptSelectedGroups.delete(name);
}
for (const name of Object.keys(_batchGroupState.promptPartialSelections)) {
if (!currentNames.has(name)) delete _batchGroupState.promptPartialSelections[name];
}
_renderBatchPromptGroupList();
_renderBatchPreview();
}
function _renderBatchPromptGroupList() {
const el = document.getElementById("wfm-batch-prompt-group-list");
const presetsMap = new Map(_batchGroupState.promptPresets.map((p) => [p.id, p]));
_renderAnyGroupList(
el,
_batchGroupState.promptGroups,
_batchGroupState.promptSelectedGroups,
_batchGroupState.promptPartialSelections,
(id) => presetsMap.get(id)?.name || id,
_renderBatchPreview
);
}
// ============================================
// Workflow グループ
// ============================================
function _loadWorkflowGroupsForBatch() {
try {
_batchGroupState.wfGroups = JSON.parse(localStorage.getItem("wfm_groups") || "{}");
} catch { _batchGroupState.wfGroups = {}; }
const currentNames = new Set(Object.keys(_batchGroupState.wfGroups));
for (const name of _batchGroupState.wfSelectedGroups) {
if (!currentNames.has(name)) _batchGroupState.wfSelectedGroups.delete(name);
}
for (const name of Object.keys(_batchGroupState.wfPartialSelections)) {
if (!currentNames.has(name)) delete _batchGroupState.wfPartialSelections[name];
}
_renderBatchWfGroupList();
_renderBatchPreview();
}
function _renderBatchWfGroupList() {
const el = document.getElementById("wfm-batch-wf-group-list");
_renderAnyGroupList(
el,
_batchGroupState.wfGroups,
_batchGroupState.wfSelectedGroups,
_batchGroupState.wfPartialSelections,
(f) => f.replace(/\.json$/i, "").replace(/\\/g, "/").split("/").pop(),
_renderBatchPreview
);
}
function initBatchTab() {
// 内部タブ切り替え
// 内部タブ切り替え(タブ表示時に対応するグループを読み込む)
document.querySelectorAll(".wfm-batch-inner-tab").forEach((btn) => {
btn.addEventListener("click", () => {
document.querySelectorAll(".wfm-batch-inner-tab").forEach((b) => b.classList.remove("active"));
@@ -558,6 +862,10 @@ function initBatchTab() {
const tabId = btn.dataset.batchInner;
document.querySelectorAll(".wfm-batch-inner-content").forEach((c) => c.classList.remove("active"));
document.getElementById(`wfm-batch-inner-${tabId}`)?.classList.add("active");
if (tabId === "checkpoint") _loadBatchCheckpointGroups();
else if (tabId === "lora") _loadBatchLoraGroups();
else if (tabId === "prompt") _loadPromptGroupsForBatch();
else if (tabId === "workflow") _loadWorkflowGroupsForBatch();
});
});
@@ -578,20 +886,31 @@ function initBatchTab() {
_renderBatchPreview();
});
// Batch タブが表示されたときにグループを読み込む
// Batch タブが表示されたときに全グループを読み込む
document.querySelector('[data-subtab="batch"]')?.addEventListener("click", () => {
_rebuildCkptList();
_loadBatchCheckpointGroups();
_loadBatchLoraGroups();
_loadPromptGroupsForBatch();
_loadWorkflowGroupsForBatch();
_renderBatchPreview();
});
}
function initCheckpointBatch() {
const checkbox = document.getElementById("wfm-ckpt-batch-enabled");
const body = document.getElementById("wfm-ckpt-batch-body");
checkbox?.addEventListener("change", () => {
if (body) body.style.display = checkbox.checked ? "block" : "none";
// Batch type checkboxes — radio behavior (only one at a time)
document.querySelectorAll(".wfm-batch-type-cb").forEach((cb) => {
cb.addEventListener("change", () => {
if (cb.checked) {
_activeBatchType = cb.dataset.batchType;
document.querySelectorAll(".wfm-batch-type-cb").forEach((other) => {
if (other !== cb) other.checked = false;
});
} else {
_activeBatchType = null;
}
_updateBatchTypeLabel();
});
});
// Pause / Resume
@@ -688,39 +1007,26 @@ async function _coreGenerate(silent = false) {
// Batch generation loop
// ============================================
async function _runBatchGenerate() {
const ckptNodes = comfyUI.currentAnalysis?.checkpoint_nodes || [];
if (ckptNodes.length === 0) {
showToast("No checkpoint node found in workflow", "error");
return;
}
const list = _getSelectedCheckpoints();
if (list.length === 0) {
showToast("No checkpoints selected", "error");
return;
}
const batchProgress = document.getElementById("wfm-ckpt-batch-progress");
// 汎用バッチループ: items を順に applyFn(item) → _coreGenerate() で処理する
async function _runBatchLoop(items, applyFn, labelFn = (x) => String(x)) {
const batchProgress = document.getElementById("wfm-ckpt-batch-progress");
const batchCurrentName = document.getElementById("wfm-ckpt-batch-current-name");
const batchCount = document.getElementById("wfm-ckpt-batch-count");
const batchBar = document.getElementById("wfm-ckpt-batch-bar");
const progressText = document.getElementById("wfm-gen-progress-text");
const batchCount = document.getElementById("wfm-ckpt-batch-count");
const batchBar = document.getElementById("wfm-ckpt-batch-bar");
const progressText = document.getElementById("wfm-gen-progress-text");
const pauseBtn = document.getElementById("wfm-ckpt-batch-pause-btn");
if (batchProgress) batchProgress.style.display = "block";
const pauseBtn = document.getElementById("wfm-ckpt-batch-pause-btn");
if (pauseBtn) { pauseBtn.style.display = "block"; pauseBtn.disabled = false; }
_setPauseBtnState(false);
_updateBatchTypeLabel(true);
let completed = 0;
let failed = 0;
let completed = 0, failed = 0;
try {
for (let i = 0; i < list.length; i++) {
for (let i = 0; i < items.length; i++) {
if (_ckptBatch.aborted) break;
// 一時停止中は次のモデルへ進む前に待機
if (_ckptBatch.paused) {
if (batchCurrentName) batchCurrentName.textContent = "Paused...";
if (progressText) progressText.textContent = "Paused";
@@ -728,25 +1034,21 @@ async function _runBatchGenerate() {
await _waitIfPaused();
if (_ckptBatch.aborted) break;
const model = list[i];
if (batchCurrentName) batchCurrentName.textContent = model;
if (batchCount) batchCount.textContent = `${i + 1} / ${list.length}`;
if (batchBar) batchBar.style.width = `${((i / list.length) * 100).toFixed(1)}%`;
if (progressText) progressText.textContent = `[${i + 1}/${list.length}] Loading...`;
for (const node of ckptNodes) {
if (comfyUI.currentWorkflow?.[node.id]) {
comfyUI.currentWorkflow[node.id].inputs.ckpt_name = model;
}
}
const item = items[i];
const label = labelFn(item);
if (batchCurrentName) batchCurrentName.textContent = label;
if (batchCount) batchCount.textContent = `${i + 1} / ${items.length}`;
if (batchBar) batchBar.style.width = `${((i / items.length) * 100).toFixed(1)}%`;
if (progressText) progressText.textContent = `[${i + 1}/${items.length}] Loading...`;
try {
await applyFn(item);
await _coreGenerate(true);
completed++;
} catch (err) {
if (_ckptBatch.aborted) break;
failed++;
showToast(`[${i + 1}/${list.length}] Failed: ${err.message}`, "error");
showToast(`[${i + 1}/${items.length}] Failed: ${err.message}`, "error");
}
}
} finally {
@@ -757,6 +1059,7 @@ async function _runBatchGenerate() {
_ckptBatch._resumeResolve = null;
}
_setPauseBtnState(false);
_updateBatchTypeLabel(false);
}
if (batchBar) batchBar.style.width = "100%";
@@ -766,12 +1069,84 @@ async function _runBatchGenerate() {
showToast(`Batch stopped — ${completed} completed, ${failed} failed`, "info");
} else {
showToast(
`Batch complete: ${completed}/${list.length}${failed > 0 ? ` (${failed} failed)` : ""}`,
`Batch complete: ${completed}/${items.length}${failed > 0 ? ` (${failed} failed)` : ""}`,
failed > 0 ? "error" : "success"
);
}
}
// アクティブなバッチタイプに応じてバッチを実行するディスパッチャ
async function _runBatchGenerate() {
switch (_activeBatchType) {
case "checkpoint": {
const ckptNodes = comfyUI.currentAnalysis?.checkpoint_nodes || [];
if (ckptNodes.length === 0) { showToast("No checkpoint node found in workflow", "error"); return; }
const list = _getSelectedCheckpoints();
if (list.length === 0) { showToast("No checkpoints selected", "error"); return; }
await _runBatchLoop(list, (model) => {
for (const node of ckptNodes) {
if (comfyUI.currentWorkflow?.[node.id])
comfyUI.currentWorkflow[node.id].inputs.ckpt_name = model;
}
});
break;
}
case "lora": {
const loraNodes = comfyUI.currentAnalysis?.lora_nodes || [];
if (loraNodes.length === 0) { showToast("No LoRA node found in workflow", "error"); return; }
const list = [..._getSelectedLoraGroupItems()];
if (list.length === 0) { showToast("No LoRAs selected", "error"); return; }
await _runBatchLoop(list, (loraName) => {
for (const node of loraNodes) {
if (comfyUI.currentWorkflow?.[node.id])
comfyUI.currentWorkflow[node.id].inputs.lora_name = loraName;
}
}, (name) => name.replace(/\.[^.]+$/, ""));
break;
}
case "prompt": {
const positiveNodes = (comfyUI.currentAnalysis?.prompt_nodes || []).filter((n) => n.role === "positive");
const negativeNodes = (comfyUI.currentAnalysis?.prompt_nodes || []).filter((n) => n.role === "negative");
if (positiveNodes.length === 0 && negativeNodes.length === 0) {
showToast("No prompt node found in workflow", "error"); return;
}
// _getSelectedPromptGroupItems() はすでにプリセットオブジェクトの配列を返す
const list = _getSelectedPromptGroupItems();
if (list.length === 0) { showToast("No prompts selected", "error"); return; }
await _runBatchLoop(list, (preset) => {
for (const node of positiveNodes) {
if (comfyUI.currentWorkflow?.[node.id])
comfyUI.currentWorkflow[node.id].inputs[node.textKey || "text"] = preset.text || "";
}
for (const node of negativeNodes) {
if (comfyUI.currentWorkflow?.[node.id])
comfyUI.currentWorkflow[node.id].inputs[node.textKey || "text"] = preset.negText || "";
}
}, (preset) => preset.name || preset.id);
break;
}
case "workflow": {
const list = [..._getSelectedWfGroupItems()];
if (list.length === 0) { showToast("No workflows selected", "error"); return; }
const savedWorkflow = comfyUI.currentWorkflow ? JSON.stringify(comfyUI.currentWorkflow) : null;
const savedFilename = document.getElementById("wfm-gen-workflow-name")?.textContent || "";
try {
await _runBatchLoop(list, async (filename) => {
const resp = await fetch(`/api/wfm/workflows/${encodeURIComponent(filename)}`);
if (!resp.ok) throw new Error(`Failed to load: ${filename}`);
const data = await resp.json();
await loadWorkflowIntoEditor(data, filename);
}, (filename) => filename.replace(/\.json$/, ""));
} finally {
if (savedWorkflow) {
try { await loadWorkflowIntoEditor(JSON.parse(savedWorkflow), savedFilename); } catch {}
}
}
break;
}
}
}
// ============================================
// Generate entry point
// ============================================
@@ -794,7 +1169,7 @@ async function handleGenerate() {
_ckptBatch.paused = false;
_ckptBatch._resumeResolve = null;
const batchEnabled = document.getElementById("wfm-ckpt-batch-enabled")?.checked;
const batchEnabled = _activeBatchType !== null;
try {
if (batchEnabled) {
+30 -15
View File
@@ -240,6 +240,10 @@ const LANGUAGES = {
modelsBadges: "Badges",
modelsInfo: "Info",
modelsFavorite: "Favorite",
modelsBatch: "Batch",
modelsBatchClear: "Clear Batch",
promptBatchClear: "Cleared batch presets",
wfBatchClear: "Cleared batch workflows",
modelsMemo: "Memo",
modelsMemoPlaceholder: "Notes about this model...",
modelsSave: "Save",
@@ -273,6 +277,7 @@ const LANGUAGES = {
modelsGroupExists: "Group already exists",
modelsRenamePrompt: "Enter new group name:",
modelsDeleteGroupConfirm: "Delete group \"{name}\"?",
modelsGroupReserved: "This group is reserved and cannot be deleted or renamed.",
modelEnable: "Enable",
modelDisable: "Disable",
modelDisabled: "Disabled",
@@ -408,7 +413,7 @@ const LANGUAGES = {
helpAboutDesc: "A centralized control UI for managing ComfyUI workflow JSON files, generating images via API, assisting with prompt creation, and browsing/organizing nodes.",
helpAbout1: "Install via ComfyUI Manager or git clone to custom_nodes",
helpAbout2: "Launch from the Workflow Studio button in the ComfyUI toolbar, or open http://127.0.0.1:8188/wfm",
helpWf1: "Switch between Thumbnail, Card, and Table view modes",
helpWf1: "Switch between Thumbnail and Table view modes",
helpWf2: "Search, category filter, favorites filter, and group filter",
helpWf3: "Create, rename, delete groups and assign/remove workflows",
helpWf4: "Import JSON/PNG files via button or drag & drop",
@@ -425,10 +430,10 @@ const LANGUAGES = {
helpGen8: "Seed control: random, fixed, increment, decrement",
helpGen9: "Generate, progress display, stop, and view results",
helpGen10: "Eagle integration: auto-save generated images to Eagle",
helpGen11: "Checkpoint Batch toggle (right panel): enable/disable batch mode — when enabled, Generate runs through all queued checkpoints sequentially with Pause/Resume and Stop controls",
helpGen11: "Batch type selector: check one of the column header checkboxes in the Batch Queue pane (Checkpoint / Lora / Prompt / Workflow) to activate that batch type — only one type can be active at a time; the Batch panel below Generate shows the active type, progress, and Pause/Resume/Stop controls",
helpGen12: "Batch tab — 3-pane layout: Left pane (file tree) selects checkpoints by folder; use Filter to narrow the list, All/None buttons to select or clear all; initial state is all unchecked",
helpGen13: "Batch tab — Center pane: group-based selection with inner tabs (Checkpoint | Lora | Prompt | Workflow); Checkpoint tab shows groups defined in the Models tab — check a group header to select all its members, or expand ▶ to check individual models; group membership always reflects the current Models tab state",
helpGen14: "Batch tab — Right pane (Batch Queue): live preview of all checkpoints that will be processed, combining file-tree and group selections with duplicates removed; count shown at top",
helpGen13: "Batch tab — Center pane: group-based selection with inner tabs (Checkpoint | Lora | Prompt | Workflow); Checkpoint/Lora groups come from the Models tab, Prompt groups from the Prompt tab, Workflow groups from the Workflow tab — check a group header to select all its members, or expand ▶ to select individually",
helpGen14: "Batch tab — Right pane (Batch Queue): shows items queued for each batch type; column headers (Checkpoint / Lora / Prompt / Workflow) each have a checkbox — check one to activate that batch type (radio behavior: only one at a time); count shown at top",
helpFeederTitle: "GenerateUI Tab — Feeder subtab",
helpFeederDesc: "Requires the comfyui-image-feeder custom node. Controls ImageFeeder nodes and runs continuous generation loops over an image library stored in user/default/image-loop-data/.",
helpFeeder1: "Left pane — Node settings: select the target ImageFeeder node from the dropdown; edit all node parameters (Directory, Sort Mode, Index, Start/End Index, Batch Size, Seed, Use Selection); click Apply to write changes to the loaded workflow",
@@ -469,7 +474,7 @@ const LANGUAGES = {
helpNodes5: "Side panel: Details (class name, package, category, description, flags), I/O Spec (inputs/outputs with types and defaults), Groups management",
helpNodes6: "Node Sets: create reusable node collections with descriptions, tags, and link definitions between nodes",
helpModels1: "Browse installed models: Checkpoint, LoRA, VAE, ControlNet, UNET, TextEncoder, Hypernetwork, Embedding with sub-tab switching",
helpModels2: "Thumbnail, Card, and Table view modes with pagination",
helpModels2: "Thumbnail and Table view modes with pagination",
helpModels3: "Search, tag filter, group filter, favorites filter, and status filter (All / Enabled only / Disabled only)",
helpModels4: "Side panel: Info (file path, tags, memo), Groups management, CivitAI integration",
helpModels5: "CivitAI integration: fetch model info by SHA256 hash, batch fetch per model type; preview image is automatically downloaded and saved if none exists",
@@ -904,6 +909,10 @@ const LANGUAGES = {
modelsBadges: "バッジ",
modelsInfo: "情報",
modelsFavorite: "お気に入り",
modelsBatch: "バッチ",
modelsBatchClear: "バッチ一括解除",
promptBatchClear: "バッチプリセットを一括解除しました",
wfBatchClear: "バッチワークフローを一括解除しました",
modelsMemo: "メモ",
modelsMemoPlaceholder: "このモデルについてのメモ...",
modelsSave: "保存",
@@ -937,6 +946,7 @@ const LANGUAGES = {
modelsGroupExists: "同名のグループが既に存在します",
modelsRenamePrompt: "新しいグループ名を入力:",
modelsDeleteGroupConfirm: "グループ「{name}」を削除しますか?",
modelsGroupReserved: "このグループは予約済みのため削除・名前変更できません。",
modelEnable: "有効化",
modelDisable: "無効化",
modelDisabled: "無効",
@@ -1072,7 +1082,7 @@ const LANGUAGES = {
helpAboutDesc: "ComfyUIのワークフローJSONファイルの管理、API接続による画像生成、プロンプト作成支援、ノードの閲覧・整理を行う集中コントロールUIです。",
helpAbout1: "ComfyUIマネージャーからインストール、またはcustom_nodesフォルダへgit clone",
helpAbout2: "ComfyUIツールバーのWorkflow Studioボタンから起動、またはhttp://127.0.0.1:8188/wfmを開く",
helpWf1: "サムネイル / カード / テーブルの表示モード切り替え",
helpWf1: "サムネイル / テーブルの表示モード切り替え",
helpWf2: "テキスト検索、カテゴリフィルタ、お気に入りフィルタ、グループフィルタ",
helpWf3: "グループの作成・名前変更・削除、ワークフローの割り当て・解除",
helpWf4: "JSON/PNGファイルのインポート(ボタンまたはドラッグ&ドロップ)",
@@ -1089,10 +1099,10 @@ const LANGUAGES = {
helpGen8: "シード管理:ランダム / 固定 / 増加 / 減少",
helpGen9: "画像生成、進捗表示、生成停止、結果表示",
helpGen10: "Eagle連携:生成画像をEagleへ自動保存",
helpGen11: "Checkpoint Batchトグル(右パネル):バッチモードの有効/無効切り替え — 有効時はGenerateが全キューのチェックポイントを順次処理し、一時停止/再開・停止の操作が可能",
helpGen11: "バッチタイプ選択:Batchキュー右ペインのカラムヘッダーチェックボックス(Checkpoint / Lora / Prompt / Workflow)で実行タイプを選択 — 同時に1種類のみ有効;Generateボタン下のBatchパネルで有効タイプ・進捗・一時停止/再開・停止を操作可能",
helpGen12: "Batchタブ — 3ペインレイアウト:左ペイン(ファイルツリー)でフォルダ単位にチェックポイントを選択;フィルタで絞り込み、All/Noneボタンで一括選択・解除;初期状態は全てチェックなし",
helpGen13: "Batchタブ — 中央ペイン:グループ選択(Checkpoint | Lora | Prompt | Workflowの内部タブ);CheckpointタブはModelsタブで定義したグループを表示 — グループヘッダーにチェックで全メンバーを選択、▶で展開して個別選択も可能;グループ内容は常にModelsタブの状態を反映",
helpGen14: "Batchタブ — 右ペイン(バッチキュー):ファイルツリーとグループ選択を合算し重複を除いた処理予定チェックポイントをリアルタイムでプレビュー;上部に件数を表示",
helpGen13: "Batchタブ — 中央ペイン:グループ選択(Checkpoint | Lora | Prompt | Workflowの内部タブ);Checkpoint/LoraグループはModelsタブ、PromptグループはPromptタブ、WorkflowグループはWorkflowタブの定義を反映 — グループヘッダーにチェックで全メンバーを選択、▶で展開して個別選択も可能",
helpGen14: "Batchタブ — 右ペイン(バッチキュー):各バッチタイプのキュー項目を表示;カラムヘッダー(Checkpoint / Lora / Prompt / Workflow)のチェックボックスで実行タイプを選択(ラジオ動作:1種類のみ);上部に件数を表示",
helpFeederTitle: "GenerateUI Tab — Feeder サブタブ",
helpFeederDesc: "comfyui-image-feeder カスタムノードが必要です。ImageFeeder ノードを操作し、user/default/image-loop-data/ に保存された画像ライブラリを使って連続生成ループを実行します。",
helpFeeder1: "左ペイン — ノード設定:ドロップダウンで対象 ImageFeeder ノードを選択;Directory・Sort Mode・Index・Start/End Index・Batch Size・Seed・Use Selection の各パラメータを編集;Apply で読み込み済みワークフローに反映",
@@ -1133,7 +1143,7 @@ const LANGUAGES = {
helpNodes5: "サイドパネル:詳細(クラス名、パッケージ、カテゴリ、説明、フラグ)、I/O仕様(入出力の型・デフォルト値)、グループ管理",
helpNodes6: "ノードセット:再利用可能なノードコレクションの作成(説明、タグ、ノード間リンク定義付き)",
helpModels1: "インストール済みモデルの閲覧:Checkpoint、LoRA、VAE、ControlNet、UNET、TextEncoder、Hypernetwork、Embeddingをサブタブで切り替え",
helpModels2: "サムネイル / カード / テーブル表示モード切り替え(ページネーション付き)",
helpModels2: "サムネイル / テーブル表示モード切り替え(ページネーション付き)",
helpModels3: "検索、タグフィルタ、グループフィルタ、お気に入りフィルタ、ステータスフィルタ(すべて / 有効のみ / 無効のみ)",
helpModels4: "サイドパネル:基本情報(ファイルパス、タグ、メモ)、グループ管理、CivitAI連携",
helpModels5: "CivitAI連携:SHA256ハッシュでモデル情報取得、モデルタイプごとの一括取得;プレビュー画像がない場合は自動でダウンロード・保存",
@@ -1564,6 +1574,10 @@ const LANGUAGES = {
modelsBadges: "标签",
modelsInfo: "信息",
modelsFavorite: "收藏",
modelsBatch: "批次",
modelsBatchClear: "清空批次",
promptBatchClear: "已清空批次预设",
wfBatchClear: "已清空批次工作流",
modelsMemo: "备注",
modelsMemoPlaceholder: "关于此模型的备注...",
modelsSave: "保存",
@@ -1597,6 +1611,7 @@ const LANGUAGES = {
modelsGroupExists: "同名分组已存在",
modelsRenamePrompt: "输入新分组名称:",
modelsDeleteGroupConfirm: "删除分组「{name}」?",
modelsGroupReserved: "此分组为系统保留分组,无法删除或重命名。",
modelEnable: "启用",
modelDisable: "禁用",
modelDisabled: "已禁用",
@@ -1732,7 +1747,7 @@ const LANGUAGES = {
helpAboutDesc: "用于管理ComfyUI工作流JSON文件、通过API生成图片、辅助提示词创作、浏览和整理节点的集中控制UI。",
helpAbout1: "通过ComfyUI Manager安装,或git clone到custom_nodes文件夹",
helpAbout2: "从ComfyUI工具栏的Workflow Studio按钮启动,或打开http://127.0.0.1:8188/wfm",
helpWf1: "切换缩略图/卡片/表格视图模式",
helpWf1: "切换缩略图/表格视图模式",
helpWf2: "文本搜索、分类筛选、收藏筛选、分组筛选",
helpWf3: "创建、重命名、删除分组,分配/移除工作流",
helpWf4: "通过按钮或拖放导入JSON/PNG文件",
@@ -1749,10 +1764,10 @@ const LANGUAGES = {
helpGen8: "种子管理:随机/固定/递增/递减",
helpGen9: "生成图片、进度显示、停止生成、查看结果",
helpGen10: "Eagle集成:自动保存生成图片到Eagle",
helpGen11: "Checkpoint Batch开关(右侧面板):启用/禁用批量模式 — 启用后Generate将按顺序处理队列中的所有检查点,并提供暂停/继续和停止控制",
helpGen11: "批次类型选择:勾选批次队列右窗格列标题复选框(Checkpoint / Lora / Prompt / Workflow)激活对应批次类型 — 每次只能激活一种;Generate按钮下方的Batch面板显示当前类型、进度及暂停/继续/停止控制",
helpGen12: "Batch标签 — 3窗格布局:左窗格(文件树)按文件夹选择检查点;使用筛选器缩小列表,All/None按钮全选或清除;初始状态全部未勾选",
helpGen13: "Batch标签 — 中央窗格:基于组的选择(含Checkpoint | Lora | Prompt | Workflow内部标签);Checkpoint标签显示Models标签中定义的组 — 勾选组标题选中所有成员,▶展开后也可单独选择;组成员始终反映Models标签的当前状态",
helpGen14: "Batch标签 — 右窗格(批量队列):实时预览所有待处理的检查点(合并文件树和组选择并去重);顶部显示数量",
helpGen13: "Batch标签 — 中央窗格:基于组的选择(含Checkpoint | Lora | Prompt | Workflow内部标签);Checkpoint/Lora组来自Models标签,Prompt组来自Prompt标签,Workflow组来自Workflow标签 — 勾选组标题选中所有成员,▶展开后也可单独选择",
helpGen14: "Batch标签 — 右窗格(批量队列):显示各批次类型的队列项目;列标题(Checkpoint / Lora / Prompt / Workflow)各有复选框 — 勾选一个激活该类型(单选行为);顶部显示数量",
helpFeederTitle: "GenerateUI Tab — Feeder 子标签",
helpFeederDesc: "需要 comfyui-image-feeder 自定义节点。用于操控 ImageFeeder 节点,并对存储在 user/default/image-loop-data/ 中的图片库执行连续生成循环。",
helpFeeder1: "左侧面板 — 节点设置:从下拉框选择目标 ImageFeeder 节点;编辑所有节点参数(Directory、Sort Mode、Index、Start/End Index、Batch Size、Seed、Use Selection);点击 Apply 将更改写入当前工作流",
@@ -1793,7 +1808,7 @@ const LANGUAGES = {
helpNodes5: "侧面板:详情(类名、包、分类、描述、标志)、I/O规格(输入输出类型和默认值)、组管理",
helpNodes6: "节点集:创建可复用的节点集合(含描述、标签、节点间链接定义)",
helpModels1: "浏览已安装模型:Checkpoint、LoRA、VAE、ControlNet、UNET、TextEncoder、Hypernetwork、Embedding,通过子标签切换",
helpModels2: "缩略图、卡片和表格视图模式切换(带分页)",
helpModels2: "缩略图和表格视图模式切换(带分页)",
helpModels3: "搜索、标签筛选、分组筛选、收藏筛选、状态筛选(全部 / 仅启用 / 仅禁用)",
helpModels4: "侧面板:基本信息(文件路径、标签、备注)、分组管理、CivitAI集成",
helpModels5: "CivitAI集成:通过SHA256哈希获取模型信息,按模型类型批量获取;无预览图时自动下载并保存",
+93 -75
View File
@@ -8,6 +8,10 @@ import { t } from "./i18n.js";
import { comfyUI } from "./comfyui-client.js";
import { comfyEditor } from "./comfyui-editor.js";
// ── Constants ─────────────────────────────────────────────
const RESERVED_GROUPS = ["Batch"];
const BATCH_MODEL_TYPES = ["checkpoint", "lora"];
// ── State ─────────────────────────────────────────────────
const state = {
@@ -35,7 +39,8 @@ const state = {
groupFilter: "",
statusFilter: "all", // "all" | "enabled" | "disabled"
showFavoritesOnly: false,
viewMode: localStorage.getItem("wfm_models_view") || "thumb",
showBatchOnly: false,
viewMode: localStorage.getItem("wfm_models_view") === "table" ? "table" : "thumb",
activeModelType: "checkpoint",
selectedModel: null,
loaded: {},
@@ -554,6 +559,11 @@ function filterModels() {
});
}
if (state.showBatchOnly) {
const batchMembers = state.modelGroups["Batch"] || [];
models = models.filter((m) => batchMembers.includes(m));
}
if (state.tagFilter) {
models = models.filter((m) => {
const meta = state.modelMetadata[m];
@@ -740,17 +750,8 @@ function renderGroupFilter() {
const select = document.getElementById("wfm-models-group-filter");
if (!select) return;
// Collect groups across all types with type labels
const options = [];
const typeOrder = Object.keys(TYPE_LABELS);
typeOrder.forEach((type) => {
const groups = state.allModelGroups[type];
if (!groups) return;
const names = Object.keys(groups).sort();
names.forEach((g) => {
options.push({ type, name: g });
});
});
const groups = state.allModelGroups[state.activeModelType] || {};
const names = Object.keys(groups).sort();
const currentValue = state.groupFilter
? `${state.activeModelType}::${state.groupFilter}`
@@ -758,11 +759,10 @@ function renderGroupFilter() {
select.innerHTML =
`<option value="">${t("modelsAllGroups")}</option>` +
options.map(({ type, name }) => {
const typeLabel = TYPE_LABELS[type] || type;
const value = `${type}::${name}`;
names.map((name) => {
const value = `${state.activeModelType}::${name}`;
const isActive = value === currentValue;
return `<option value="${escapeHtml(value)}"${isActive ? " selected" : ""}>[${typeLabel}] ${escapeHtml(name)}</option>`;
return `<option value="${escapeHtml(value)}"${isActive ? " selected" : ""}>${escapeHtml(name)}</option>`;
}).join("");
}
@@ -829,8 +829,6 @@ function renderModelGrid() {
if (state.viewMode === "table") {
renderTableView(grid, filtered);
} else if (state.viewMode === "card") {
renderCardView(grid, filtered);
} else {
renderThumbView(grid, filtered);
}
@@ -848,6 +846,8 @@ function renderThumbView(grid, models) {
const tagsHtml = (meta.tags || []).map((tag) => `<span class="wfm-badge wfm-badge-sm">${escapeHtml(tag)}</span>`).join("");
const favStar = meta.favorite ? "\u2605" : "\u2606";
const favClass = meta.favorite ? "wfm-fav-btn active" : "wfm-fav-btn";
const inBatch = isInBatch(modelName);
const batchClass = inBatch ? "wfm-batch-btn active" : "wfm-batch-btn";
const card = document.createElement("div");
card.className = "wfm-card";
@@ -865,6 +865,7 @@ function renderThumbView(grid, models) {
<div class="wfm-card-title" title="${escapeHtml(modelName)}">${escapeHtml(getStem(name))}</div>
<div class="wfm-card-meta">${userBadges} ${tagsHtml}</div>
</div>
<button class="${batchClass}" title="${t("modelsBatch")}">B</button>
<button class="${favClass}" title="${t("modelsFavorite")}">${favStar}</button>
<button class="wfm-toggle-btn${disabled ? " wfm-toggle-disabled" : ""}" title="${disabled ? t("modelEnable") : t("modelDisable")}">${disabled ? "▶" : "⏸"}</button>`;
@@ -873,6 +874,10 @@ function renderThumbView(grid, models) {
const placeholder = card.querySelector(".wfm-card-thumb-placeholder");
loadPreviewImage(img, placeholder, modelName);
card.querySelector(".wfm-batch-btn").addEventListener("click", (e) => {
e.stopPropagation();
toggleBatch(modelName);
});
card.querySelector(".wfm-fav-btn").addEventListener("click", (e) => {
e.stopPropagation();
toggleFavorite(modelName);
@@ -888,7 +893,7 @@ function renderThumbView(grid, models) {
checkEl.className = "wfm-select-check" + (isChecked ? " checked" : "");
card.appendChild(checkEl);
card.addEventListener("click", (e) => {
if (e.target.closest(".wfm-fav-btn, .wfm-toggle-btn")) return;
if (e.target.closest(".wfm-batch-btn, .wfm-fav-btn, .wfm-toggle-btn")) return;
toggleModelSelection(modelName);
});
} else {
@@ -899,61 +904,6 @@ function renderThumbView(grid, models) {
});
}
// ── Card View (no thumbnail, compact) ─────────────────────
function renderCardView(grid, models) {
grid.innerHTML = "";
models.forEach((modelName) => {
const meta = state.modelMetadata[modelName] || {};
const { dir, name } = parseModelPath(modelName);
const ext = getExtension(name);
const disabled = isModelDisabled(modelName);
const userBadges = modelBadgesHtml(modelName);
const tagsHtml = (meta.tags || []).map((tag) => `<span class="wfm-badge wfm-badge-sm">${escapeHtml(tag)}</span>`).join("");
const favStar = meta.favorite ? "\u2605" : "\u2606";
const favClass = meta.favorite ? "wfm-fav-btn active" : "wfm-fav-btn";
const card = document.createElement("div");
card.className = "wfm-card wfm-model-card";
if (disabled) card.classList.add("wfm-model-disabled");
if (state.selectedModel === modelName) card.classList.add("wfm-card-selected");
card.dataset.modelName = modelName;
card.innerHTML = `
<div class="wfm-card-body">
<div class="wfm-card-title" title="${escapeHtml(modelName)}">${escapeHtml(name)}${disabled ? ` <span class="wfm-badge wfm-badge-disabled">${t("modelDisabled")}</span>` : ""}</div>
<div class="wfm-card-meta">
${userBadges} ${tagsHtml}
</div>
</div>
<button class="${favClass}" title="${t("modelsFavorite")}">${favStar}</button>
<button class="wfm-toggle-btn${disabled ? " wfm-toggle-disabled" : ""}" title="${disabled ? t("modelEnable") : t("modelDisable")}">${disabled ? "▶" : "⏸"}</button>`;
card.querySelector(".wfm-fav-btn").addEventListener("click", (e) => {
e.stopPropagation();
toggleFavorite(modelName);
});
card.querySelector(".wfm-toggle-btn").addEventListener("click", (e) => {
e.stopPropagation();
toggleModelEnable(modelName);
});
if (state.selectMode) {
const isChecked = state.selectedModels.has(modelName);
card.classList.toggle("wfm-card-checked", isChecked);
const checkEl = document.createElement("div");
checkEl.className = "wfm-select-check" + (isChecked ? " checked" : "");
card.appendChild(checkEl);
card.addEventListener("click", (e) => {
if (e.target.closest(".wfm-fav-btn, .wfm-toggle-btn")) return;
toggleModelSelection(modelName);
});
} else {
card.addEventListener("click", () => showSidePanel(modelName));
card.addEventListener("dblclick", (e) => { e.stopPropagation(); openDetailModal(modelName); });
}
grid.appendChild(card);
});
}
// ── Table View ────────────────────────────────────────────
@@ -966,6 +916,7 @@ function renderTableView(grid, models) {
const disabled = isModelDisabled(modelName);
const isChecked = state.selectMode && state.selectedModels.has(modelName);
const favIcon = meta.favorite ? "&#9733;" : "&#9734;";
const batchIcon = isInBatch(modelName) ? `<button class="wfm-batch-btn active" title="${t("modelsBatch")}">B</button>` : `<button class="wfm-batch-btn" title="${t("modelsBatch")}">B</button>`;
const tagsStr = (meta.tags || []).join(", ");
const memo = meta.memo || "";
const toggleLabel = disabled ? t("modelEnable") : t("modelDisable");
@@ -983,6 +934,7 @@ function renderTableView(grid, models) {
<td>${escapeHtml(tagsStr)}</td>
<td class="wfm-table-td-memo" title="${escapeHtml(memo)}">${escapeHtml(memo)}</td>
<td class="wfm-table-td-toggle"><button class="wfm-toggle-btn${disabled ? " wfm-toggle-disabled" : ""}" title="${toggleLabel}">${toggleIcon}</button></td>
<td class="wfm-table-td-batch">${batchIcon}</td>
</tr>`;
})
.join("");
@@ -998,6 +950,7 @@ function renderTableView(grid, models) {
<th>${t("modelsTags")}</th>
<th>${t("modelsMemo")}</th>
<th style="width:50px;"></th>
<th style="width:30px;">B</th>
</tr></thead><tbody>${rows}</tbody></table>`;
grid.querySelectorAll(".wfm-models-table-row").forEach((row) => {
@@ -1007,7 +960,7 @@ function renderTableView(grid, models) {
if (state.selectMode) {
row.addEventListener("click", (e) => {
if (e.target.closest(".wfm-models-table-fav, .wfm-toggle-btn")) return;
if (e.target.closest(".wfm-models-table-fav, .wfm-toggle-btn, .wfm-batch-btn")) return;
toggleModelSelection(mn);
});
} else {
@@ -1022,9 +975,45 @@ function renderTableView(grid, models) {
e.stopPropagation();
toggleModelEnable(mn);
});
row.querySelector(".wfm-batch-btn").addEventListener("click", (e) => {
e.stopPropagation();
toggleBatch(mn);
});
});
}
// ── Batch group helpers ───────────────────────────────────
function isInBatch(modelName) {
return (state.modelGroups["Batch"] || []).includes(modelName);
}
async function toggleBatch(modelName) {
const batch = state.modelGroups["Batch"] || [];
const idx = batch.indexOf(modelName);
if (idx >= 0) {
batch.splice(idx, 1);
} else {
batch.push(modelName);
}
state.modelGroups["Batch"] = batch;
state.allModelGroups[state.activeModelType] = state.modelGroups;
await saveModelGroups(state.modelGroups);
renderModelGrid();
}
async function clearBatchGroup() {
state.modelGroups["Batch"] = [];
state.allModelGroups[state.activeModelType] = state.modelGroups;
await saveModelGroups(state.modelGroups);
if (state.showBatchOnly) {
state.showBatchOnly = false;
document.getElementById("wfm-models-batch-filter-btn")?.classList.remove("active");
}
renderModelGrid();
showToast(t("modelsBatchClear"), "success");
}
// ── Favorite toggle ───────────────────────────────────────
async function toggleFavorite(modelName) {
@@ -1439,6 +1428,10 @@ function renderSideGroup(modelName) {
const sel = document.getElementById("wfm-models-group-manage-select");
const oldName = sel?.value;
if (!oldName) return;
if (RESERVED_GROUPS.includes(oldName)) {
showToast(t("modelsGroupReserved"), "warning");
return;
}
const newName = prompt(t("modelsRenamePrompt"), oldName);
if (!newName || newName === oldName) return;
if (state.modelGroups[newName]) {
@@ -1458,6 +1451,10 @@ function renderSideGroup(modelName) {
const sel = document.getElementById("wfm-models-group-manage-select");
const g = sel?.value;
if (!g) return;
if (RESERVED_GROUPS.includes(g)) {
showToast(t("modelsGroupReserved"), "warning");
return;
}
if (!confirm(t("modelsDeleteGroupConfirm").replace("{name}", g))) return;
delete state.modelGroups[g];
saveModelGroups(state.modelGroups).then(() => {
@@ -1728,6 +1725,10 @@ async function loadModelsForCurrentType() {
if (state.loaded[type] && state.modelsByType[type].length > 0) {
// Reload groups for this type (groups are per-type)
state.modelGroups = await fetchModelGroups();
if (BATCH_MODEL_TYPES.includes(type) && !state.modelGroups["Batch"]) {
state.modelGroups["Batch"] = [];
await saveModelGroups(state.modelGroups);
}
state.allModelGroups[type] = state.modelGroups;
renderTagFilter();
renderDirFilter();
@@ -1747,6 +1748,10 @@ async function loadModelsForCurrentType() {
]);
const disabledSet = new Set(Array.isArray(disabledList) ? disabledList : []);
state.disabledModels[type] = disabledSet;
if (BATCH_MODEL_TYPES.includes(type) && !groups["Batch"]) {
groups["Batch"] = [];
await saveModelGroups(groups);
}
state.modelGroups = groups;
state.allModelGroups[type] = groups;
@@ -1988,6 +1993,19 @@ export function initModelsTab() {
});
}
// Batch filter
document.getElementById("wfm-models-batch-filter-btn")?.addEventListener("click", () => {
state.showBatchOnly = !state.showBatchOnly;
document.getElementById("wfm-models-batch-filter-btn").classList.toggle("active", state.showBatchOnly);
state.currentPage = 0;
renderModelGrid();
});
// Batch clear
document.getElementById("wfm-models-batch-clear-btn")?.addEventListener("click", () => {
clearBatchGroup();
});
// View mode (thumb / card / table)
document.querySelectorAll("[data-models-view]").forEach((btn) => {
if (btn.dataset.modelsView === state.viewMode) {
+46 -8
View File
@@ -21,6 +21,7 @@ let pmSearchText = "";
let pmSelectedId = null; // currently selected preset id
let pmGroups = {}; // { groupName: [presetId, ...] }
const PM_GROUPS_KEY = "wfm_prompt_preset_groups";
const PROMPT_RESERVED_GROUPS = ["Batch"];
// ============================================
// Preset API helpers
@@ -118,11 +119,15 @@ async function loadAllPresets() {
pmGroups = JSON.parse(localStorage.getItem(PM_GROUPS_KEY) || "{}");
} catch { pmGroups = {}; }
// Clean stale entries from groups
// Clean stale entries from groups (preserve reserved groups even if empty)
const validIds = new Set(promptPresets.map(p => p.id));
for (const g of Object.keys(pmGroups)) {
pmGroups[g] = (pmGroups[g] || []).filter(id => validIds.has(id));
if (pmGroups[g].length === 0) delete pmGroups[g];
if (pmGroups[g].length === 0 && !PROMPT_RESERVED_GROUPS.includes(g)) delete pmGroups[g];
}
// Ensure reserved groups always exist
for (const g of PROMPT_RESERVED_GROUPS) {
if (!pmGroups[g]) pmGroups[g] = [];
}
saveGroups();
@@ -213,6 +218,25 @@ function matchesSearch(p) {
(p.tags || []).some(t => t.toLowerCase().includes(s));
}
function isInBatchPreset(id) {
return (pmGroups["Batch"] || []).includes(id);
}
function toggleBatchPreset(id) {
const batch = pmGroups["Batch"] || [];
const idx = batch.indexOf(id);
if (idx >= 0) { batch.splice(idx, 1); } else { batch.push(id); }
pmGroups["Batch"] = batch;
saveGroups();
}
function clearBatchPresets() {
pmGroups["Batch"] = [];
saveGroups();
renderPresetManager();
showToast(t("promptBatchClear"), "success");
}
function createPmItem(preset) {
const el = document.createElement("div");
el.className = "wfm-pm-item" + (pmSelectedId === preset.id ? " active" : "");
@@ -225,12 +249,15 @@ function createPmItem(preset) {
? `<span style="font-size:9px;color:var(--wfm-primary);margin-left:4px;">[${esc(preset.category)}]</span>`
: "";
const inBatch = isInBatchPreset(preset.id);
el.innerHTML = `
<div class="wfm-pm-item-body">
<div class="wfm-pm-item-name">${preset.favorite ? '<span style="color:#ffd700;">&#9733;</span> ' : ""}${esc(preset.name)}${catBadge}</div>
<div class="wfm-pm-item-sub">${esc(previewText)}</div>
</div>
<div class="wfm-pm-item-actions">
<button class="wfm-pm-action-btn pm-batch-btn${inBatch ? " batch-active" : ""}" title="Batch">B</button>
<button class="wfm-pm-action-btn pm-fav-btn${preset.favorite ? " fav-active" : ""}" title="Favorite">&#9733;</button>
<button class="wfm-pm-action-btn pm-del-btn" title="Delete" style="color:var(--wfm-danger);">&#10005;</button>
</div>
@@ -242,6 +269,13 @@ function createPmItem(preset) {
selectPresetInEditor(preset);
});
// Batch toggle
el.querySelector(".pm-batch-btn").addEventListener("click", (e) => {
e.stopPropagation();
toggleBatchPreset(preset.id);
renderPresetManager();
});
// Favorite toggle
el.querySelector(".pm-fav-btn").addEventListener("click", async (e) => {
e.stopPropagation();
@@ -977,18 +1011,14 @@ export function initPromptTab() {
});
if (created) {
promptPresets.push(created);
pmSelectedId = created.id;
showToast(t("presetSaved"), "success");
}
}
pmSelectedId = null;
renderPresetSelect();
renderPresetManager();
// Re-select
if (pmSelectedId && presetSelect) {
presetSelect.value = pmSelectedId;
}
if (presetSelect) presetSelect.value = "";
});
// Apply preset to GenerateUI
@@ -1059,6 +1089,10 @@ export function initPromptTab() {
showToast("Select a group first", "error");
return;
}
if (PROMPT_RESERVED_GROUPS.includes(groupName)) {
showToast(t("modelsGroupReserved"), "warning");
return;
}
if (!confirm(`Delete group "${groupName}"?`)) return;
delete pmGroups[groupName];
saveGroups();
@@ -1081,6 +1115,10 @@ export function initPromptTab() {
renderPresetManager();
});
document.getElementById("wfm-pm-batch-clear-btn")?.addEventListener("click", () => {
clearBatchPresets();
});
// ── Center column tab switching ──────────────────────────
document.querySelectorAll(".wfm-prompt-center-tab").forEach(btn => {
btn.addEventListener("click", () => {
+85 -18
View File
@@ -11,6 +11,11 @@ import { t, getSummaryPrompt } from "./i18n.js";
import { highlightJSON } from "./json-highlight.js";
import { openBadgeEditModal } from "./models-tab.js";
// ============================================
// Constants
// ============================================
const WF_RESERVED_GROUPS = ["Batch"];
// ============================================
// State
// ============================================
@@ -19,10 +24,11 @@ const state = {
workflows: [],
activeBadge: "ALL",
searchText: "",
viewMode: localStorage.getItem("wfm_default_view") || "thumb", // thumb | card | table
viewMode: localStorage.getItem("wfm_default_view") === "table" ? "table" : "thumb",
selectedWf: null,
groupFilter: "", // empty = all groups
currentPage: 0,
showBatchOnly: false,
};
@@ -92,6 +98,11 @@ const groups = {
} catch {
this._data = {};
}
let needsSave = false;
for (const g of WF_RESERVED_GROUPS) {
if (!this._data[g]) { this._data[g] = []; needsSave = true; }
}
if (needsSave) this.save();
return this._data;
},
save() {
@@ -117,11 +128,14 @@ const groups = {
},
deleteGroup(name) {
if (WF_RESERVED_GROUPS.includes(name)) return false;
delete this.data[name];
this.save();
return true;
},
renameGroup(oldName, newName) {
if (WF_RESERVED_GROUPS.includes(oldName)) return false;
if (!newName || this.data[newName] || !this.data[oldName]) return false;
this.data[newName] = this.data[oldName];
delete this.data[oldName];
@@ -154,6 +168,32 @@ const groups = {
},
};
// ============================================
// Batch helpers
// ============================================
function isInBatch(filename) {
return (groups.data["Batch"] || []).includes(filename);
}
function toggleBatch(filename) {
const batch = groups.data["Batch"] || [];
const idx = batch.indexOf(filename);
if (idx >= 0) { batch.splice(idx, 1); } else { batch.push(filename); }
groups.data["Batch"] = batch;
groups.save();
renderGrid();
}
function clearBatch() {
groups.data["Batch"] = [];
groups.save();
state.showBatchOnly = false;
renderModelFilters();
renderGrid();
showToast(t("wfBatchClear"), "success");
}
// ============================================
// API
// ============================================
@@ -250,6 +290,7 @@ function renderModelFilters() {
container.innerHTML = `
<button class="wfm-filter-btn ${state.activeBadge === "ALL" ? "active" : ""}" data-filter="ALL">ALL</button>
<button class="wfm-filter-btn ${state.activeBadge === "FAVORITE" ? "active" : ""}" data-filter="FAVORITE">&#9733;</button>
<button class="wfm-filter-btn wfm-wf-batch-filter-btn${state.showBatchOnly ? " active" : ""}">B</button>
${badges.map((b) => {
const color = palette[b] || "";
const style = color ? ` style="background:${color};color:#fff;"` : "";
@@ -259,6 +300,13 @@ function renderModelFilters() {
container.querySelectorAll(".wfm-filter-btn").forEach((btn) => {
btn.addEventListener("click", () => {
if (btn.classList.contains("wfm-wf-batch-filter-btn")) {
state.showBatchOnly = !state.showBatchOnly;
state.currentPage = 0;
renderModelFilters();
renderGrid();
return;
}
state.activeBadge = btn.dataset.filter;
state.currentPage = 0;
renderModelFilters();
@@ -278,6 +326,11 @@ function filterWorkflows() {
return false;
}
// Batch filter
if (state.showBatchOnly) {
if (!(groups.data["Batch"] || []).includes(wf.filename)) return false;
}
// Group filter
if (state.groupFilter) {
const grpFiles = groups.data[state.groupFilter] || [];
@@ -333,30 +386,24 @@ function renderGrid() {
card.dataset.filename = wf.filename;
const hasThumb = !!wf.thumbnail;
const badges = wfBadgesHtml(wf);
const tags = (wf.metadata.tags || []).map((t) => `<span class="wfm-tag">#${t}</span>`).join("");
const favStar = wf.metadata.favorite ? "\u2605" : "\u2606";
const favClass = wf.metadata.favorite ? "wfm-fav-btn active" : "wfm-fav-btn";
if (state.viewMode === "thumb") {
card.innerHTML = `
<div class="wfm-card-thumb">${hasThumb ? `<img src="${wf.thumbnail}" loading="lazy" />` : `<span class="wfm-card-thumb-placeholder">${t("noImage")}</span>`}</div>
card.innerHTML = `
<div class="wfm-card-thumb">
${hasThumb ? `<img src="${wf.thumbnail}" loading="lazy" />` : `<span class="wfm-card-thumb-placeholder">${t("noImage")}</span>`}
<button class="wfm-batch-btn${isInBatch(wf.filename) ? ' active' : ''}" title="Batch">B</button>
</div>
<div class="wfm-card-body">
<div class="wfm-card-title" title="${wf.filename}">${wf.filename.replace(/\.json$/, "")}</div>
<div class="wfm-card-meta">${badges}</div>
</div>
<button class="${favClass}" title="${t("favorite")}">${favStar}</button>`;
} else {
// Card view: no thumbnail, more meta info
const io = `P:${wf.analysis.inputs?.prompts || 0} I:${wf.analysis.inputs?.images || 0} → ${wf.analysis.outputs?.images || 0}`;
card.innerHTML = `
<div class="wfm-card-body">
<div class="wfm-card-title" title="${wf.filename}">${wf.filename.replace(/\.json$/, "")}</div>
<div class="wfm-card-meta">${badges}</div>
<div class="wfm-card-io">${io}</div>
<div class="wfm-card-tags">${tags}</div>
</div>
<button class="${favClass}" title="${t("favorite")}">${favStar}</button>`;
}
card.querySelector(".wfm-batch-btn")?.addEventListener("click", (e) => {
e.stopPropagation();
toggleBatch(wf.filename);
});
card.querySelector(".wfm-fav-btn")?.addEventListener("click", (e) => {
e.stopPropagation();
@@ -390,6 +437,7 @@ function renderTableView(grid, filtered) {
<th style="width:60px;">${t("tags")}</th>
<th class="wfm-table-th-memo">${t("memo")}</th>
<th class="wfm-table-th-summary">${t("summary")}</th>
<th style="width:30px;"></th>
</tr></thead>`;
const tbody = document.createElement("tbody");
@@ -414,7 +462,13 @@ function renderTableView(grid, filtered) {
<td class="wfm-table-td-io">${io}</td>
<td>${tags}</td>
<td class="wfm-table-td-memo" title="${(wf.metadata.memo || "").replace(/"/g, "&quot;")}">${wf.metadata.memo || ""}</td>
<td class="wfm-table-td-summary" title="${(wf.metadata.summary || "").replace(/"/g, "&quot;")}">${wf.metadata.summary || ""}</td>`;
<td class="wfm-table-td-summary" title="${(wf.metadata.summary || "").replace(/"/g, "&quot;")}">${wf.metadata.summary || ""}</td>
<td class="wfm-table-td-batch"><button class="wfm-batch-btn${isInBatch(wf.filename) ? ' active' : ''}" title="Batch">B</button></td>`;
tr.querySelector(".wfm-batch-btn")?.addEventListener("click", (e) => {
e.stopPropagation();
toggleBatch(wf.filename);
});
tr.querySelector(".wfm-fav-btn")?.addEventListener("click", (e) => {
e.stopPropagation();
@@ -656,6 +710,10 @@ function renderSideGroup(wf) {
el.querySelector("#wfm-grp-rename-btn")?.addEventListener("click", () => {
const oldName = el.querySelector("#wfm-grp-manage-sel")?.value;
if (!oldName) return;
if (WF_RESERVED_GROUPS.includes(oldName)) {
showToast(t("modelsGroupReserved"), "warning");
return;
}
const newName = prompt(`Rename group "${oldName}" to:`, oldName);
if (!newName || newName === oldName) return;
if (!groups.renameGroup(oldName, newName)) {
@@ -672,6 +730,10 @@ function renderSideGroup(wf) {
el.querySelector("#wfm-grp-delete-btn")?.addEventListener("click", () => {
const name = el.querySelector("#wfm-grp-manage-sel")?.value;
if (!name) return;
if (WF_RESERVED_GROUPS.includes(name)) {
showToast(t("modelsGroupReserved"), "warning");
return;
}
if (!confirm(`Delete group "${name}"?`)) return;
groups.deleteGroup(name);
if (state.groupFilter === name) {
@@ -1271,6 +1333,11 @@ export function initWorkflowTab() {
openBadgeEditModal(() => renderGrid());
});
// Toolbar: BC (batch clear) button
document.getElementById("wfm-wf-batch-clear-btn")?.addEventListener("click", () => {
clearBatch();
});
// Initial load
loadWorkflows();
}
+52 -15
View File
@@ -50,7 +50,6 @@
<button id="wfm-list-open-comfyui-btn" class="wfm-btn wfm-btn-sm" disabled title="Select a card first">Open in ComfyUI</button>
<div class="wfm-view-btns">
<button class="wfm-view-btn active" data-view="thumb" title="Thumbnail">&#8862;</button>
<button class="wfm-view-btn" data-view="card" title="Card">&#9776;</button>
<button class="wfm-view-btn" data-view="table" title="Table">&#8801;</button>
</div>
<button id="wfm-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh</button>
@@ -63,6 +62,7 @@
<button id="wfm-badge-settings-btn" class="wfm-btn wfm-btn-sm" title="View settings">&#9881;</button>
<div id="wfm-badge-settings-panel" class="wfm-badge-settings-panel" style="display:none;"></div>
</div>
<button id="wfm-wf-batch-clear-btn" class="wfm-btn wfm-btn-sm" title="Clear all batch workflows">BC</button>
</div>
</div>
<div class="wfm-workflow-area">
@@ -190,6 +190,7 @@
<!-- Row 2: Search / filter toolbar -->
<div id="wfm-models-toolbar" class="wfm-toolbar-row" style="gap:6px;flex-wrap:wrap;">
<button class="wfm-filter-btn" id="wfm-models-fav-btn" title="Favorites">&#9733;</button>
<button class="wfm-filter-btn" id="wfm-models-batch-filter-btn" title="Batch">B</button>
<input type="text" id="wfm-models-search" class="wfm-search-input" placeholder="Search models...">
<select id="wfm-models-tag-filter" class="wfm-select wfm-toolbar-select"><option value="">All Tags</option></select>
<select id="wfm-models-dir-filter" class="wfm-select wfm-toolbar-select"><option value="">All Folders</option></select>
@@ -201,7 +202,6 @@
</select>
<div class="wfm-view-btns">
<button class="wfm-view-btn active" data-models-view="thumb" title="Thumbnail">&#8862;</button>
<button class="wfm-view-btn" data-models-view="card" title="Card">&#9776;</button>
<button class="wfm-view-btn" data-models-view="table" title="Table">&#8801;</button>
</div>
<span id="wfm-models-count" class="wfm-nodes-count"></span>
@@ -210,6 +210,7 @@
<span id="wfm-models-civitai-progress" style="font-size:12px;color:var(--wfm-text-secondary);"></span>
<button id="wfm-models-badge-settings-btn" class="wfm-btn wfm-btn-sm" title="Badge settings">&#9881; Badge</button>
<button id="wfm-models-select-btn" class="wfm-btn wfm-btn-sm" title="Multi-select models">Select</button>
<button id="wfm-models-batch-clear-btn" class="wfm-btn wfm-btn-sm" title="Clear all batch entries">BC</button>
</div>
<!-- Bulk action bar (shown in select mode) -->
<div id="wfm-models-bulk-bar" class="wfm-bulk-bar" style="display:none;"></div>
@@ -341,21 +342,56 @@
<div id="wfm-batch-group-list" class="wfm-batch-group-list"></div>
</div>
<div id="wfm-batch-inner-lora" class="wfm-batch-inner-content">
<p class="wfm-placeholder" style="font-size:12px;margin:20px auto;">Coming soon</p>
<div class="wfm-batch-pane-header" style="border-top:none;">Groups</div>
<div id="wfm-batch-lora-group-list" class="wfm-batch-group-list"></div>
</div>
<div id="wfm-batch-inner-prompt" class="wfm-batch-inner-content">
<p class="wfm-placeholder" style="font-size:12px;margin:20px auto;">Coming soon</p>
<div class="wfm-batch-pane-header" style="border-top:none;">Groups</div>
<div id="wfm-batch-prompt-group-list" class="wfm-batch-group-list"></div>
</div>
<div id="wfm-batch-inner-workflow" class="wfm-batch-inner-content">
<p class="wfm-placeholder" style="font-size:12px;margin:20px auto;">Coming soon</p>
<div class="wfm-batch-pane-header" style="border-top:none;">Groups</div>
<div id="wfm-batch-wf-group-list" class="wfm-batch-group-list"></div>
</div>
</div>
<!-- Right pane: batch queue preview -->
<!-- Right pane: batch queue preview (4 columns) -->
<div class="wfm-batch-pane wfm-batch-right">
<div class="wfm-batch-pane-header">Batch Queue</div>
<div id="wfm-batch-preview-count" class="wfm-batch-count"></div>
<div id="wfm-batch-preview-list" class="wfm-batch-preview-list"></div>
<div class="wfm-batch-queue-grid">
<div class="wfm-batch-queue-col">
<div class="wfm-batch-queue-col-header">
<span>Checkpoint</span>
<input type="checkbox" class="wfm-batch-type-cb" data-batch-type="checkpoint" title="Checkpoint batch を有効にする">
</div>
<div id="wfm-batch-preview-count" class="wfm-batch-count"></div>
<div id="wfm-batch-preview-list" class="wfm-batch-preview-list"></div>
</div>
<div class="wfm-batch-queue-col">
<div class="wfm-batch-queue-col-header">
<span>Lora</span>
<input type="checkbox" class="wfm-batch-type-cb" data-batch-type="lora" title="Lora batch を有効にする">
</div>
<div id="wfm-batch-lora-count" class="wfm-batch-count"></div>
<div id="wfm-batch-lora-list" class="wfm-batch-preview-list"></div>
</div>
<div class="wfm-batch-queue-col">
<div class="wfm-batch-queue-col-header">
<span>Prompt</span>
<input type="checkbox" class="wfm-batch-type-cb" data-batch-type="prompt" title="Prompt batch を有効にする">
</div>
<div id="wfm-batch-prompt-count" class="wfm-batch-count"></div>
<div id="wfm-batch-prompt-list" class="wfm-batch-preview-list"></div>
</div>
<div class="wfm-batch-queue-col">
<div class="wfm-batch-queue-col-header">
<span>Workflow</span>
<input type="checkbox" class="wfm-batch-type-cb" data-batch-type="workflow" title="Workflow batch を有効にする">
</div>
<div id="wfm-batch-wf-count" class="wfm-batch-count"></div>
<div id="wfm-batch-wf-list" class="wfm-batch-preview-list"></div>
</div>
</div>
</div>
</div>
</div>
@@ -509,14 +545,14 @@
</div>
</div>
<!-- Checkpoint Batch Panel -->
<!-- Batch Status Panel -->
<div class="wfm-gen-panel" id="wfm-ckpt-batch-panel">
<div style="display:flex;align-items:center;gap:8px;">
<input type="checkbox" id="wfm-ckpt-batch-enabled" style="width:14px;height:14px;cursor:pointer;accent-color:var(--wfm-primary);">
<label for="wfm-ckpt-batch-enabled" style="font-weight:600;font-size:13px;cursor:pointer;">Checkpoint Batch</label>
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;">
<span style="font-weight:600;font-size:13px;">Batch</span>
<span id="wfm-batch-type-label" style="font-size:11px;color:var(--wfm-text-secondary);">—</span>
</div>
<div id="wfm-ckpt-batch-body" style="display:none;margin-top:8px;">
<div id="wfm-ckpt-batch-progress" style="display:none;">
<div id="wfm-ckpt-batch-body">
<div id="wfm-ckpt-batch-progress" style="display:none;margin-top:6px;">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;font-size:11px;">
<span id="wfm-ckpt-batch-current-name" style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:75%;color:var(--wfm-text-primary);"></span>
<span id="wfm-ckpt-batch-count" style="color:var(--wfm-text-secondary);white-space:nowrap;margin-left:8px;"></span>
@@ -659,7 +695,8 @@
<button class="wfm-pm-tab" data-pmtab="groups">Groups</button>
</div>
<div class="wfm-pm-search">
<input type="text" id="wfm-pm-search-input" class="wfm-input" placeholder="Search presets...">
<input type="text" id="wfm-pm-search-input" class="wfm-input" placeholder="Search presets..." style="flex:1;min-width:0;">
<button id="wfm-pm-batch-clear-btn" class="wfm-btn wfm-btn-sm" title="Clear all batch presets" style="flex-shrink:0;">BC</button>
</div>
<div id="wfm-pm-list" class="wfm-pm-list"></div>
</div>