Compare commits

...
2 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 4.6 be66dc3d5a feat: v0.3.56 — Style機能追加(GenerateUI ツールバー & Batchタブ)
- GenerateUI ツールバーに Style チェックボックス+ドロップダウンを追加
  - user/default/Workflow-Studio/style/*.json を自動読み込み
  - {prompt} プレースホルダー置換、negative_prompt 末尾連結
  - ワークフローコピーにのみ適用(currentWorkflow は変更しない)
- Batch左ペインに Style タブを追加(全スタイルのフラットリスト、All/None)
- Batch Queue に Style 列を追加(7列目)
- GET /api/wfm/styles エンドポイントを settings_routes.py に追加
- ヘルプ・README・DEVLOG 更新

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 19:02:44 +09:00
ketle-manandClaude Sonnet 4.6 5a3d69fe14 fix(generate-tab): Batch/Stack グループをバッチ実行UIに復元
v0.3.55 で誤って追加した RESERVED フィルターを削除。
Batch/Stack はグループ削除保護のための予約グループであり、
バッチ実行選択UIに表示され選択できることが正しい動作。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 22:56:53 +09:00
6 changed files with 306 additions and 31 deletions
+102 -1
View File
@@ -1,5 +1,106 @@
# DEVLOG - ComfyUI-Workflow-Studio
## 2026-06-26: v0.3.56 — Style機能追加(GenerateUI ツールバー & Batchタブ)
**変更ファイル**: `py/routes/settings_routes.py`, `static/js/generate-tab.js`, `templates/index.html`, `README.md`
### 概要
Fooocus形式(`{name, prompt, negative_prompt}`)のスタイルJSONを生成時に自動適用する機能を追加。`user/default/Workflow-Studio/style/` に置いた `*.json` ファイルをすべて読み込んでドロップダウンに表示し、ポジティブ/ネガティブプロンプトへ適用する。ワークフロー本体は変更せず生成ごとのコピーにのみ適用される。
---
### バックエンド
#### `py/routes/settings_routes.py`
- **`GET /api/wfm/styles`** を追加
- `DATA_DIR/style/*.json` をファイル名順に読み込み、各ファイルの配列を結合して返す
- ファイル読み込みに失敗した場合はその1ファイルをスキップしてログを出力(全体のエラーにはしない)
---
### フロントエンド
#### `static/js/generate-tab.js`
**スタイル管理**
- `_stylesData` — ロードしたスタイルオブジェクト配列(`{name, prompt?, negative_prompt?}`)
- `_batchStyleSelected` — Batchタブで選択中のスタイル名 Set
- `_batchStyleOverride` — Styleバッチ実行中に適用スタイルを一時的に上書きする変数(`null` のとき通常モード)
**追加関数**
| 関数 | 概要 |
|---|---|
| `_loadStyles()` | `/api/wfm/styles` を取得しドロップダウンとバッチリストを更新 |
| `_renderStyleDropdown()` | ツールバーの `#wfm-style-select` をスタイル名で再描画 |
| `_rebuildStyleList()` | `_buildSimpleGroupList` を使って左ペインのスタイル一覧を描画 |
| `_applyNamedStyle(workflow, style)` | プロンプトノードにスタイルを適用したワークフローのコピーを返す共通ロジック |
| `_applyStyleToWorkflow(workflow)` | バッチ上書きがあればそれを優先、なければツールバー設定を参照して `_applyNamedStyle` を呼ぶ |
**適用ロジック(`_applyNamedStyle`)**
- ポジティブノード: `style.prompt` に `{prompt}` が含まれる場合は置換、含まれない場合は `元のプロンプト, スタイルプロンプト` で連結
- ネガティブノード: `style.negative_prompt` を元のネガティブプロンプトの末尾に `, ` で連結
- ワークフローコピー(`JSON.parse(JSON.stringify(workflow))`)に対して操作するため、`comfyUI.currentWorkflow` は変更されない
**既存関数の変更**
- `_coreGenerate()`: ワイルドカード展開後に `_applyStyleToWorkflow()` を呼ぶよう変更(変数名 `workflowForGenerate` → `workflowExpanded` → `workflowForGenerate` の2段階に分割)
- `_updateBatchTypeLabel()`: `labels` マップに `style: "Style"` を追加
- `_renderBatchPreview()`: Style列の更新を追加(`wfm-batch-style-count` / `wfm-batch-style-preview-list`)
- `initBatchTab()`: Styleタブ切り替え時に `_rebuildStyleList()` を呼ぶよう追加、All/Noneボタン(`wfm-style-batch-select-all` / `wfm-style-batch-deselect-all`)のイベントリスナーを追加、Batchタブ表示時に `_rebuildStyleList()` を追加
- `initGenerateTab()`: 初期化時に `await _loadStyles()` を追加
- `_runBatchGenerate()`: `case "style"` を追加 — 選択スタイルを `_batchStyleOverride` にセットして `_runBatchLoop` を実行、finally で `_batchStyleOverride = null` にリセット
---
#### `templates/index.html`
**ツールバー(Styleセレクター)**
Reset Workflow ボタンの右隣に以下を追加:
- `<label id="wfm-style-label">` + `<input type="checkbox" id="wfm-style-enabled">` — Style の有効/無効チェックボックス
- `<select id="wfm-style-select">` — スタイルドロップダウン(`min-width:120px / max-width:220px`)
**Batchタブ左ペイン**
- `wfm-batch-left-tab-nav` に `<button data-left-tab="style">Style</button>` を追加
- `wfm-batch-left-style` コンテンツを追加(All/Noneボタン + `wfm-batch-style-list`)
**Batchタブ Batch Queue(右ペイン)**
- Style 列を追加(`wfm-batch-style-count` / `wfm-batch-style-preview-list` / `data-batch-type="style"` チェックボックス)
**ヘルプ**
- `wfm-help-gen-2`: ツールバーへのStyle追加とスタイルファイルパス・適用ロジックを追記
- `wfm-help-gen-12`: 左ペインのタブ数 3→4、Styleタブの説明を追記
- `wfm-help-gen-14`: Batch Queue の列数 6→7 に更新
- `wfm-help-gen-17`(新規): Styleバッチ専用の説明を追加
---
### スタイルファイル仕様
`user/default/Workflow-Studio/style/` 配下の任意の `*.json`(複数可)を配置する。各ファイルはオブジェクトの配列形式で、以下のフィールドを持つ:
```json
[
{
"name": "スタイル名",
"prompt": "スタイルプロンプト({prompt} プレースホルダー使用可)",
"negative_prompt": "ネガティブプロンプト"
}
]
```
`prompt` / `negative_prompt` はいずれも省略可能。Fooocusの `sdxl_styles_*.json` 形式をそのまま使用できる。
---
## 2026-06-25: v0.3.55 — グループ機能バグ修正(全タブ)
**変更ファイル**: `py/services/models_service.py`, `static/js/models-tab.js`, `static/js/generate-tab.js`, `static/js/prompt-tab.js`, `static/js/i18n.js`
@@ -24,7 +125,7 @@ Windows 環境で ComfyUI が返す Checkpoint/LoRA 名はバックスラッシ
#### `static/js/generate-tab.js`
- **Checkpoint/LoRA/Prompt/Workflow 全バッチグループ**: 予約グループ(Batch/Stack)が各バッチ実行選択UIに表示されていたのを除外
- **Checkpoint/LoRA/Prompt/Workflow 全バッチグループ**: v0.3.55 で誤って追加した予約グループ(Batch/Stack)除外フィルターを削除 → Batch/Stack グループはバッチ実行UIに表示され正常に選択可能
- **LoRA グループ**: API取得後にバックスラッシュ→フォワードスラッシュ正規化を追加(Checkpoint 修正と同等)
- **`batchComplete` トースト**: 英語ハードコード文字列を削除し `t("batchComplete", ...)` に変更
+11 -5
View File
@@ -18,7 +18,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- Built-in AI tools (translation and more)
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.3.55-green)
![Version](https://img.shields.io/badge/version-0.3.56-green)
## Screenshots
@@ -76,11 +76,12 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **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
- **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
- **Style selector** — checkbox and dropdown next to the Reset Workflow button; enable to apply a Fooocus-style JSON to positive and negative prompts at generation time; style files (`*.json`) are loaded from `user/default/Workflow-Studio/style/`; the style's `{prompt}` placeholder is replaced with the original prompt text, or the style is appended if no placeholder exists; `negative_prompt` is appended to the existing negative prompt; styles are applied to a per-generation copy and do not modify the loaded workflow
- **Batch type selector** — check one of the column header checkboxes in the Batch Queue pane (Checkpoint / Lora / Prompt / Workflow / Sampler / Scheduler / Style) 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
- **Left pane** — 4 tabs: **Checkpoints** (file-tree; Filter / All / None), **Sampler** (KSampler sampler list), **Scheduler** (KSampler scheduler list), **Style** (flat list of all styles from `Workflow-Studio/style/`; All / None buttons)
- **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
- **Right pane (Batch Queue)** — 7 columns: Checkpoint / Lora / Prompt / Workflow / Sampler / Scheduler / **Style**; each column header has an enable checkbox (radio behavior: only one at a time); count shown per column; Style batch applies each selected style sequentially to a workflow copy
- **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
@@ -350,6 +351,10 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
## Changelog
### v0.3.56
- **GenerateUI — Style selector** — new checkbox and dropdown next to the Reset Workflow button; when enabled, a Fooocus-style JSON style is applied to positive and negative prompts at generation time; style files (`*.json`) are read from `user/default/Workflow-Studio/style/`; multiple files are merged into a single list sorted by filename; the style's `{prompt}` placeholder is replaced with the original prompt text, otherwise the style text is appended; `negative_prompt` is appended to the existing negative prompt; styles are applied to a per-generation workflow copy and never modify the loaded workflow
- **Batch tab — Style batch** — new **Style** tab in the Batch left pane lists all styles loaded from the style directory (flat list with All / None buttons); select any combination, enable the **Style** column in Batch Queue, then Generate to run each selected style sequentially; Batch Queue expanded from 6 to 7 columns (Style added as the rightmost column)
### v0.3.55
- **Group feature — fix data loss on Windows (backslash/slash mismatch)** — on Windows, ComfyUI returns model paths with backslashes (`sub\model.safetensors`) while the backend normalized to forward slashes; this caused all subdir group members to be flagged as missing and deleted on save; fixed by normalizing both stored and scanned paths to forward slashes in `get_model_groups` and `save_model_groups`
- **Group feature — network drive protection** — if no model directories are accessible (e.g. external drive disconnected), the group cleanup step is now skipped entirely to prevent wiping all group memberships
@@ -357,7 +362,7 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
- **Group feature — RESERVED_GROUPS protection** — `bulkRemoveFromGroup` and `renderPmGroups` now prevent Batch/Stack reserved group keys from being deleted even when all members are removed
- **Group feature — stale groupFilter reset** — after deleting a group, `state.groupFilter` is automatically cleared if it pointed to the now-deleted group (previously showed 0 models)
- **Group feature — toggleGroupEnable partial failure** — only models listed in `data.ok` are updated client-side, preventing state divergence when some enable/disable calls fail
- **GenerateUI batch groups — exclude reserved groups** — Batch and Stack reserved groups no longer appear in the batch group selection UI for Checkpoint/LoRA/Prompt/Workflow
- **GenerateUI batch groups — restore Batch/Stack visibility** — reverts an incorrect filter that hid Batch and Stack groups from the batch group selection UI; these groups are now selectable for batch execution as intended
- **GenerateUI LoRA groups — path normalization** — backslash-to-slash normalization added after fetching LoRA groups from the API, matching the Checkpoint fix
- **Batch complete toast — i18n** — replaced hardcoded English toast with `t("batchComplete", ...)` supporting all 3 languages
- **Prompt tab migration — fix negText loss** — `migrateLocalStoragePresets` now correctly passes `negText` when calling `apiCreatePreset`, preventing negative prompts from being silently dropped during localStorage→API migration
@@ -839,3 +844,4 @@ MIT License
- [Pillow (PIL Fork)](https://python-pillow.org/) — server-side thumbnail generation (`data/thumb_cache/`)
- [ComfyUI-Gallery](https://github.com/PanicTitan/ComfyUI-Gallery) by PanicTitan — thumbnail grid UX reference
- [infinite-image-browsing](https://github.com/zanllp/sd-webui-infinite-image-browsing) by zanllp — thumbnail caching and index strategy reference
- [Fooocus](https://github.com/lllyasviel/Fooocus) by lllyasviel — style preset JSON format reference
+28
View File
@@ -36,6 +36,7 @@ def setup_routes(app: web.Application):
app.router.add_post("/api/wfm/settings/output-dir", handle_set_output_dir)
app.router.add_get("/api/wfm/settings/export", handle_export)
app.router.add_post("/api/wfm/settings/import", handle_import)
app.router.add_get("/api/wfm/styles", handle_get_styles)
async def handle_get(request: web.Request) -> web.Response:
@@ -241,3 +242,30 @@ async def handle_import(request: web.Request) -> web.Response:
except Exception as e:
logger.error("Error importing data: %s", e)
return web.json_response({"error": str(e)}, status=500)
def _load_styles() -> list:
"""Load all style JSON files from DATA_DIR/style/ directory."""
style_dir = DATA_DIR / "style"
styles = []
if not style_dir.is_dir():
return styles
for json_file in sorted(style_dir.glob("*.json")):
try:
with open(json_file, "r", encoding="utf-8") as f:
data = json.load(f)
if isinstance(data, list):
styles.extend(data)
except Exception as e:
logger.warning("Failed to load style file %s: %s", json_file.name, e)
return styles
async def handle_get_styles(request: web.Request) -> web.Response:
"""GET /api/wfm/styles - Get all styles from style directory."""
try:
styles = await asyncio.to_thread(_load_styles)
return web.json_response(styles)
except Exception as e:
logger.error("Error loading styles: %s", e)
return web.json_response({"error": str(e)}, status=500)
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-workflow-studio"
description = "A comprehensive workflow, asset management, and generation UI plugin for ComfyUI. Manage workflows, models, images, and prompts; batch generation and Image Feeder in the GenerateUI tab; library side panel with canvas drag & drop and AI tools."
version = "0.3.55"
version = "0.3.56"
license = "MIT"
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+139 -21
View File
@@ -287,7 +287,7 @@ function _setPauseBtnState(paused) {
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", sampler: "Sampler", scheduler: "Scheduler" };
const labels = { checkpoint: "Checkpoint", lora: "Lora", prompt: "Prompt", workflow: "Workflow", sampler: "Sampler", scheduler: "Scheduler", style: "Style" };
if (_activeBatchType) {
el.textContent = labels[_activeBatchType];
el.style.color = running ? "var(--wfm-primary)" : "";
@@ -457,6 +457,14 @@ function _renderBatchPreview() {
(s) => s,
"scheduler", "schedulers"
);
// Style
const styleList = _stylesData.filter((s) => _batchStyleSelected.has(s.name)).map((s) => s.name);
_renderQueueColumn(
"wfm-batch-style-count", "wfm-batch-style-preview-list",
styleList,
(s) => s,
"style", "styles"
);
}
// モデルパスリストをフォルダ → [modelPath, ...] のMapに変換
@@ -647,9 +655,7 @@ function _renderBatchGroupList() {
const el = document.getElementById("wfm-batch-group-list");
if (!el) return;
const groups = _batchGroupState.groups;
// Batch / Stack はモデルタブ専用の予約グループ — バッチ実行選択UIには表示しない
const RESERVED = new Set(["Batch", "Stack"]);
const names = Object.keys(groups).filter((n) => !RESERVED.has(n)).sort();
const names = Object.keys(groups).sort();
if (names.length === 0) {
el.innerHTML = `<p class="wfm-placeholder" style="font-size:12px;padding:16px;">No groups defined.<br>Create groups in the Models tab.</p>`;
@@ -908,14 +914,9 @@ async function _loadBatchLoraGroups() {
function _renderBatchLoraGroupList() {
const el = document.getElementById("wfm-batch-lora-group-list");
// Batch / Stack はモデルタブ専用 — バッチ実行UIには表示しない
const RESERVED = new Set(["Batch", "Stack"]);
const filtered = Object.fromEntries(
Object.entries(_batchGroupState.loraGroups).filter(([k]) => !RESERVED.has(k))
);
_renderAnyGroupList(
el,
filtered,
_batchGroupState.loraGroups,
_batchGroupState.loraSelectedGroups,
_batchGroupState.loraPartialSelections,
(m) => m.replace(/\\/g, "/").split("/").pop(),
@@ -953,13 +954,9 @@ async function _loadPromptGroupsForBatch() {
function _renderBatchPromptGroupList() {
const el = document.getElementById("wfm-batch-prompt-group-list");
const presetsMap = new Map(_batchGroupState.promptPresets.map((p) => [p.id, p]));
// "Batch" はPromptタブ専用の予約グループ — バッチ実行UIには表示しない
const filtered = Object.fromEntries(
Object.entries(_batchGroupState.promptGroups).filter(([k]) => k !== "Batch")
);
_renderAnyGroupList(
el,
filtered,
_batchGroupState.promptGroups,
_batchGroupState.promptSelectedGroups,
_batchGroupState.promptPartialSelections,
(id) => presetsMap.get(id)?.name || id,
@@ -987,13 +984,9 @@ function _loadWorkflowGroupsForBatch() {
function _renderBatchWfGroupList() {
const el = document.getElementById("wfm-batch-wf-group-list");
// "Batch" はWorkflowタブ専用の予約グループ — バッチ実行UIには表示しない
const filtered = Object.fromEntries(
Object.entries(_batchGroupState.wfGroups).filter(([k]) => k !== "Batch")
);
_renderAnyGroupList(
el,
filtered,
_batchGroupState.wfGroups,
_batchGroupState.wfSelectedGroups,
_batchGroupState.wfPartialSelections,
(f) => f.replace(/\.json$/i, "").replace(/\\/g, "/").split("/").pop(),
@@ -1113,6 +1106,7 @@ function initBatchTab() {
document.getElementById(`wfm-batch-left-${tabId}`)?.classList.add("active");
if (tabId === "sampler") _rebuildSamplerList();
else if (tabId === "scheduler") _rebuildSchedulerList();
else if (tabId === "style") _rebuildStyleList();
});
});
@@ -1172,6 +1166,18 @@ function initBatchTab() {
_renderBatchPreview();
});
// 全選択 / 全解除(左ペイン Style)
document.getElementById("wfm-style-batch-select-all")?.addEventListener("click", () => {
_stylesData.forEach((s) => _batchStyleSelected.add(s.name));
_rebuildStyleList();
_renderBatchPreview();
});
document.getElementById("wfm-style-batch-deselect-all")?.addEventListener("click", () => {
_batchStyleSelected.clear();
_rebuildStyleList();
_renderBatchPreview();
});
// Batch タブが表示されたときに全グループを読み込む
document.querySelector('[data-subtab="batch"]')?.addEventListener("click", () => {
_rebuildCkptList();
@@ -1179,6 +1185,7 @@ function initBatchTab() {
_loadBatchLoraGroups();
_loadPromptGroupsForBatch();
_loadWorkflowGroupsForBatch();
_rebuildStyleList();
_renderBatchPreview();
});
}
@@ -1215,6 +1222,101 @@ function initCheckpointBatch() {
});
}
// ============================================
// Style (Fooocus-style JSON from DATA_DIR/style/)
// ============================================
let _stylesData = [];
const _batchStyleSelected = new Set();
let _batchStyleOverride = null; // Style バッチ実行中に一時的にセット
async function _loadStyles() {
try {
const res = await fetch("/api/wfm/styles");
if (res.ok) _stylesData = await res.json();
else _stylesData = [];
} catch { _stylesData = []; }
_renderStyleDropdown();
_rebuildStyleList();
}
function _renderStyleDropdown() {
const sel = document.getElementById("wfm-style-select");
if (!sel) return;
sel.innerHTML = "";
if (_stylesData.length === 0) {
const opt = document.createElement("option");
opt.value = "";
opt.textContent = "No styles";
sel.appendChild(opt);
return;
}
for (const s of _stylesData) {
const opt = document.createElement("option");
opt.value = s.name;
opt.textContent = s.name;
sel.appendChild(opt);
}
}
function _rebuildStyleList() {
_buildSimpleGroupList(
document.getElementById("wfm-batch-style-list"),
_stylesData.map((s) => s.name),
_batchStyleSelected,
"No styles (place JSON files in Workflow-Studio/style/)"
);
}
function _applyNamedStyle(workflow, style) {
if (!style) return workflow;
const analysis = comfyUI.currentAnalysis;
if (!analysis) return workflow;
const positiveNodes = (analysis.prompt_nodes || []).filter((n) => n.role === "positive");
const negativeNodes = (analysis.prompt_nodes || []).filter((n) => n.role === "negative");
const result = JSON.parse(JSON.stringify(workflow));
if (style.prompt) {
for (const node of positiveNodes) {
const nodeData = result[node.id];
if (!nodeData) continue;
const key = node.textKey || "text";
const original = nodeData.inputs[key] || "";
nodeData.inputs[key] = style.prompt.includes("{prompt}")
? style.prompt.replace("{prompt}", original)
: original ? `${original}, ${style.prompt}` : style.prompt;
}
}
if (style.negative_prompt) {
for (const node of negativeNodes) {
const nodeData = result[node.id];
if (!nodeData) continue;
const key = node.textKey || "text";
const original = nodeData.inputs[key] || "";
nodeData.inputs[key] = original
? `${original}, ${style.negative_prompt}`
: style.negative_prompt;
}
}
return result;
}
function _applyStyleToWorkflow(workflow) {
// バッチ実行中は上書きスタイルを優先
if (_batchStyleOverride !== null) return _applyNamedStyle(workflow, _batchStyleOverride);
const enabled = document.getElementById("wfm-style-enabled")?.checked;
if (!enabled) return workflow;
const selectedName = document.getElementById("wfm-style-select")?.value;
if (!selectedName) return workflow;
const style = _stylesData.find((s) => s.name === selectedName);
return _applyNamedStyle(workflow, style || null);
}
// ============================================
// SPA-side wildcard expansion (A1111-style __name__ syntax)
// Applies to non-ImpactWildcard nodes only; ImpactWildcard* nodes expand server-side.
@@ -1307,7 +1409,8 @@ async function _coreGenerate(silent = false) {
if (progressBar) progressBar.style.width = "0%";
if (progressText) progressText.textContent = "Starting...";
const workflowForGenerate = await _expandWildcardsInWorkflow({ ...comfyUI.currentWorkflow });
const workflowExpanded = await _expandWildcardsInWorkflow({ ...comfyUI.currentWorkflow });
const workflowForGenerate = _applyStyleToWorkflow(workflowExpanded);
const { images, seed } = await comfyUI.generate(
workflowForGenerate,
{
@@ -1538,6 +1641,18 @@ async function _runBatchGenerate() {
});
break;
}
case "style": {
const list = _stylesData.filter((s) => _batchStyleSelected.has(s.name));
if (list.length === 0) { showToast(t("batchNoneSelected", "styles"), "error"); return; }
try {
await _runBatchLoop(list, (style) => {
_batchStyleOverride = style;
}, (s) => s.name);
} finally {
_batchStyleOverride = null;
}
break;
}
}
}
@@ -1854,6 +1969,9 @@ export async function initGenerateTab() {
// Feeder tab
await initFeederTab();
// Style dropdown
await _loadStyles();
// Auto-connect on init
const connected = await comfyUI.checkConnection();
updateStatus(connected);
+25 -3
View File
@@ -260,6 +260,11 @@
<button id="wfm-gen-connect-btn" class="wfm-btn wfm-btn-sm">Connect</button>
<button id="wfm-gen-model-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh Models</button>
<button id="wfm-gen-reset-workflow-btn" class="wfm-btn wfm-btn-sm">Reset Workflow</button>
<label id="wfm-style-label" style="display:flex;align-items:center;gap:4px;font-size:12px;cursor:pointer;white-space:nowrap;">
<input type="checkbox" id="wfm-style-enabled" style="cursor:pointer;">
Style
</label>
<select id="wfm-style-select" class="wfm-input" style="font-size:12px;padding:2px 6px;height:26px;min-width:120px;max-width:220px;"></select>
</div>
<div class="wfm-toolbar-right" style="display:flex;align-items:center;gap:8px;">
<span id="wfm-gen-wf-name" style="color:var(--wfm-text-secondary);font-size:13px;">No workflow loaded</span>
@@ -344,6 +349,7 @@
<button class="wfm-batch-left-tab active" data-left-tab="checkpoint">Checkpoints</button>
<button class="wfm-batch-left-tab" data-left-tab="sampler">Sampler</button>
<button class="wfm-batch-left-tab" data-left-tab="scheduler">Scheduler</button>
<button class="wfm-batch-left-tab" data-left-tab="style">Style</button>
</div>
<div id="wfm-batch-left-checkpoint" class="wfm-batch-left-content active">
<div class="wfm-batch-toolbar">
@@ -367,6 +373,13 @@
</div>
<div id="wfm-scheduler-list" class="wfm-batch-list"></div>
</div>
<div id="wfm-batch-left-style" class="wfm-batch-left-content">
<div class="wfm-batch-toolbar">
<button type="button" id="wfm-style-batch-select-all" class="wfm-btn wfm-btn-sm">All</button>
<button type="button" id="wfm-style-batch-deselect-all" class="wfm-btn wfm-btn-sm">None</button>
</div>
<div id="wfm-batch-style-list" class="wfm-batch-list"></div>
</div>
</div>
<!-- Center pane: group-based selection with inner tabs -->
@@ -447,6 +460,14 @@
<div id="wfm-batch-scheduler-count" class="wfm-batch-count"></div>
<div id="wfm-batch-scheduler-list" class="wfm-batch-preview-list"></div>
</div>
<div class="wfm-batch-queue-col">
<div class="wfm-batch-queue-col-header">
<span>Style</span>
<input type="checkbox" class="wfm-batch-type-cb" data-batch-type="style" title="Style batch を有効にする">
</div>
<div id="wfm-batch-style-count" class="wfm-batch-count"></div>
<div id="wfm-batch-style-preview-list" class="wfm-batch-preview-list"></div>
</div>
</div>
</div>
</div>
@@ -1037,7 +1058,7 @@
<h3>GenerateUI Tab</h3>
<ul>
<li id="wfm-help-gen-1">Connect/disconnect ComfyUI and check connection status</li>
<li id="wfm-help-gen-2">Load workflows from Workflow tab (App format .app.json not supported); Reset Workflow button re-reads the current workflow file from disk and reloads the editor; <b>Save</b> button (right end of the tab bar) saves the current workflow — including any edits made in the editor — as a new .json file to the Workflow tab; a filename dialog appears with the current workflow name as the default</li>
<li id="wfm-help-gen-2">Load workflows from Workflow tab (App format .app.json not supported); Reset Workflow button re-reads the current workflow file from disk and reloads the editor; <b>Save</b> button (right end of the tab bar) saves the current workflow — including any edits made in the editor — as a new .json file to the Workflow tab; a filename dialog appears with the current workflow name as the default; <b>Style</b> checkbox and dropdown (next to Reset Workflow): enable to apply a Fooocus-style JSON style to the positive and negative prompts at generation time — style files are loaded from <code>user/default/Workflow-Studio/style/*.json</code>; the style's <code>{prompt}</code> placeholder is replaced with the original prompt, or the style text is appended if no placeholder exists</li>
<li id="wfm-help-gen-3">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</li>
<li id="wfm-help-gen-4">Input tab: inner tabs — <b>Prompt</b> and <b>Image</b> (drag-and-drop upload); Prompt tab has Positive Prompt, Negative Prompt, and an <b>Embeddings</b> selector at the bottom — select a model, set Weight (default 1.0), then click <b>Paste</b> to insert <code>(embedding:Name:weight)</code> at the cursor position of the last focused textarea (defaults to Positive if neither is focused)</li>
<li id="wfm-help-gen-5">Model tab: Checkpoint, VAE, LoRA, ControlNet, UNET, TextEncoder, <b>Hypernetwork</b> (with Strength field) selectors with filter; LoRA Stack — Apply writes all active LoRAs to the target node and simultaneously inserts LoRA syntax and CivitAI trigger words into the Positive prompt; re-applying updates the prompt by removing inactive LoRAs and re-adding active ones</li>
@@ -1047,10 +1068,11 @@
<li id="wfm-help-gen-9">Generate, progress display, stop, and view results</li>
<li id="wfm-help-gen-10">Eagle integration: auto-save generated images to Eagle</li>
<li id="wfm-help-gen-11">Batch tab — enable one batch type at a time by checking the checkbox in the Batch Queue column header; Generate then runs through all queued items sequentially with Pause/Resume and Stop controls</li>
<li id="wfm-help-gen-12">Batch tab — Left pane has 3 tabs: <b>Checkpoints</b> (folder tree with Filter/All/None; (root) header checkbox selects all), <b>Sampler</b> (KSampler sampler_name list with (root) checkbox), <b>Scheduler</b> (KSampler scheduler list with (root) checkbox); All/None toolbar buttons also available for each tab</li>
<li id="wfm-help-gen-12">Batch tab — Left pane has 4 tabs: <b>Checkpoints</b> (folder tree with Filter/All/None; (root) header checkbox selects all), <b>Sampler</b> (KSampler sampler_name list with (root) checkbox), <b>Scheduler</b> (KSampler scheduler list with (root) checkbox), <b>Style</b> (flat list of all styles loaded from <code>Workflow-Studio/style/</code> with All/None buttons); All/None toolbar buttons available for each tab</li>
<li id="wfm-help-gen-13">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</li>
<li id="wfm-help-gen-14">Batch tab — Right pane (Batch Queue): 6 columns — Checkpoint, Lora, Prompt, Workflow, Sampler, Scheduler; each column has an enable checkbox; only one type active at a time; count shown per column</li>
<li id="wfm-help-gen-14">Batch tab — Right pane (Batch Queue): 7 columns — Checkpoint, Lora, Prompt, Workflow, Sampler, Scheduler, <b>Style</b>; each column has an enable checkbox; only one type active at a time; count shown per column</li>
<li id="wfm-help-gen-15">Sampler/Scheduler batch: select one or more samplers or schedulers from the left pane, enable the column in Batch Queue, then Generate to run each value through the KSampler node sequentially; sampler/scheduler lists are fetched from ComfyUI (requires connection)</li>
<li id="wfm-help-gen-17">Style batch: select styles in the left pane Style tab, enable the Style column in Batch Queue, then Generate — each selected style is applied in sequence to the positive and negative prompts; styles are applied to workflow copies so the loaded workflow is not modified; style files are re-read each time the page loads from <code>user/default/Workflow-Studio/style/*.json</code></li>
<li id="wfm-help-gen-16">SPA-side wildcard expansion (A1111-style): when prompt text in non-ImpactWildcard nodes (e.g. CLIPTextEncode) contains __name__ syntax, the SPA expands it at generation time by randomly picking a line from the matching file in the WFS wildcard folder; nested wildcards are re-expanded up to 5 passes; unresolved wildcards are passed through unchanged; ImpactWildcardEncode/Processor nodes are skipped (handled server-side by Impact Pack); works in both single and batch generation</li>
</ul>
</div>