Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f356826e9f | ||
|
|
003f3408fc |
@@ -2,6 +2,55 @@
|
||||
|
||||
---
|
||||
|
||||
## v0.3.89
|
||||
|
||||
### バグ修正: v0.3.88で追加したLab機能への実動作確認フィードバック3件を反映
|
||||
|
||||
v0.3.88で追加したLabタブのPromptセル拡張機能について、実際に触ったユーザーから3件の修正依頼を受けた。
|
||||
|
||||
**1. Get from Imageが任意のファイルを選ばせる仕様だった**: 当初はファイル選択ダイアログで別途画像を選ぶ実装だったが、「Labタブで現在読み込んでいる画像から取得したい」という指摘を受け、`_lab.sourceImageFilename`(IMAGE欄に既にドロップ・アップロード済みの画像)を`/view?filename=...&type=input`経由で取得し`File`オブジェクトへ変換した上で`extractAllMetadata()`にかける方式に変更。ファイル選択ダイアログ(隠し`<input type="file">`)は不要になったため削除。画像未読込の場合は既存の`labNoSourceImage`トーストで案内する。
|
||||
|
||||
**2. スタイル適用が`{prompt}`プレースホルダを置換していた**: `generate-tab.js`の`_applyNamedStyle()`と同じ「スタイルテンプレートの`{prompt}`を既存テキストで置換する」ロジックを流用していたが、「既存のプロンプトはクリアしないで追加したい。既存があればカンマ区切り、なければそのまま」という明確な要望を受け、`_applyStyleToText()`をプレースホルダ置換なしの単純追記(`既存 + ", " + style.prompt`、既存が空ならstyle.promptをそのまま)に書き換えた。GenerateUI本来のStyle機能(`_applyNamedStyle`)とは意図的に異なる仕様になったため、コード上にその旨のコメントを残した。
|
||||
|
||||
**3. GenerateUIタブ Modelサブタブの各フィルターにクリアボタンがなかった**: Checkpoint/VAE/Diffusion Model/ControlNet/Hypernetwork(`comfyui-editor.js`の`renderModelTab`、ループでフィルター入力を動的生成)とLora Single(`renderLoraPane`)のフィルター入力に、Models/Nodes/Workflow/Galleryタブの検索ボックスやLabタブのCheckpoint/VAEフィルターと同じ`setupSearchClearBtn()`(`util.js`)+`.wfm-search-wrap`/`.wfm-search-clear-btn`パターンでオーバーレイ✕クリアボタンを追加。`renderModelTab`は複数フィルターをループ生成するため、各入力に`id="wfm-model-${s.key}-filter"`/クリアボタンに`id="wfm-model-${s.key}-filter-clear"`を採番し、フィルター再構築処理を`input`イベントと`setupSearchClearBtn`のコールバックで共有する形にした。
|
||||
|
||||
**あわせてヘルプを更新**: Labサブタブのヘルプ(`helpLab8`、index.html+i18n.js日英中)を新しい挙動(Get from Imageの取得元、スタイルの追記方式)に合わせて修正。
|
||||
|
||||
**検証**: Kaptureで実ブラウザ確認 — GenerateUI Modelタブの各フィルター(Checkpoint/Lora)で入力→✕クリア→リスト復元、Labタブで画像未読込時のGet from Imageのエラートースト、既存Positiveテキストへのスタイル追記結果(`{prompt}`が置換されずそのまま末尾に追加され、既存テキストが先頭に保持されることを確認)。いずれもコンソールエラーなし(既存の無関係なOllama接続エラーを除く)。
|
||||
|
||||
**How to apply**: 新機能を実装した直後の「実際に触ってみた」フィードバックは、当初の設計判断(本実装ではEagle本来のUI流用や`{prompt}`置換の踏襲)を覆す具体的な仕様変更を伴うことが多い。既存の類似機能(ここでは`generate-tab.js`の`_applyNamedStyle`)のロジックをそのまま流用するのではなく、要望に応じて意図的に別実装へ分岐させてよい場面があることを踏まえ、分岐させた箇所には理由をコメントで残すこと。フィルター入力を動的ループで生成するコード(`renderModelTab`等)にクリアボタンを追加する際は、ループ内で一意なIDを採番し`setupSearchClearBtn`をループ内で呼び出す。
|
||||
|
||||
---
|
||||
|
||||
## v0.3.88
|
||||
|
||||
### 機能拡張: Labタブ Promptセルにスタイル適用・画像/GenerateUIからのプロンプト取得、Checkpoint/VAEフィルター、Plan JSONサブタブを追加
|
||||
|
||||
v0.3.87で追加したLabタブ(GenerateUI)に対するユーザーからの一連の改善要望をまとめて対応。
|
||||
|
||||
**Promptセル編集モーダルの拡張**:
|
||||
- **Get from GenerateUI**: 現在GenerateUIに読み込まれているワークフローの`comfyUI.currentAnalysis.prompt_nodes`からPositive/Negativeを直接取得
|
||||
- **Get from Image**: 画像/ワークフローJSONをドロップ/選択すると、Metadataタブの抽出ロジック(`metadata-tab.js`の`extractAllMetadata()`。新たに`export`して再利用)でプロンプトを抽出
|
||||
- **Style適用**: 当初はモーダル内に独自のスタイルドロップダウンを設けたが、ユーザーから「GenerateUIツールバー上部の`#wfm-style-enabled`チェックボックス/`#wfm-style-select`ドロップダウンをそのまま使えないか」と指摘を受け設計変更。モーダル内の選択UIを廃し、Applyボタンが常にツールバー側の現在値を読んで適用する方式にした(チェックボックスOFFまたは未選択ならエラートースト)。ボタンラベルにも選択中のスタイル名を動的表示(例:「Apply: cinematic-diva」)。プロンプトへのマージ処理自体は`generate-tab.js`の`_applyNamedStyle()`と同じ置換ルール(`{prompt}`プレースホルダ置換/ネガティブ追記)を、ワークフローではなく文字列に対して行う`_applyStyleToText()`として実装
|
||||
|
||||
**Checkpoint/VAEセルにフィルター機能追加**:
|
||||
- GenerateUIのModelサブタブ(`comfyui-editor.js`の`renderModelTab`)と同じ「Filter...」テキスト入力で`<select>`の候補を絞り込み
|
||||
- 続けて「オーバーレイ✕でクリア可能にしたい、Modelタブの各フィルタリング機能・Raw JSON検索と同様に」という要望を受け、Models/Nodes/Workflow/Gallery各タブの検索ボックスやRaw JSON検索と同じ`setupSearchClearBtn()`(`util.js`)+`.wfm-search-wrap`/`.wfm-search-clear-btn`(`main.css`)パターンを流用し、入力欄内に✕クリアボタンをオーバーレイ表示するよう変更
|
||||
|
||||
**Plan JSONサブタブ追加**:
|
||||
- Setting/Resultsに続く3つ目のサブタブとして新設。現在のLab状態(列のキーフレーム・Note・Batch数・画像連鎖設定・元画像・結果一覧)を、プランファイル保存時と同じ構造のJSONとして`json-highlight.js`の`syncJsonHighlight()`で構文ハイライト表示する
|
||||
- **Refresh**: Settingタブの現在値で再同期(未適用の編集は破棄)
|
||||
- **Apply to Setting**: テキストエリアの内容を`JSON.parse`し、Plan Load(`_loadPlanFromFile`/`_loadPlanFromServer`)と共通の`_applyPlanData(filename, data)`を呼んでSettingタブへ反映。不正なJSONの場合は`JSON.parse`の例外メッセージをそのままエラートーストに出し、状態は変更しない
|
||||
- 保存用のプランオブジェクト構築ロジックが`_savePlan()`内にインライン実装されていたのを`_buildPlanData(name)`として切り出し、Save・Plan JSON表示の双方から共用するようリファクタリング
|
||||
|
||||
**あわせてヘルプを更新**: Labサブタブのヘルプページ(`index.html`+`i18n.js`日英中+`app.js`の`helpIdMap`)に、Promptモーダルの追加ボタン群とPlan JSONサブタブの説明を追記。
|
||||
|
||||
**検証**: 各機能をKaptureで実ブラウザ確認 — Get from GenerateUI/Get from Imageでの実際のプロンプト取得、Style Apply(トップバーOFF時のエラートースト・ON時の`{prompt}`置換とネガティブ追記)、Checkpoint/VAEフィルターの絞り込みと✕クリア、Plan JSONの表示→編集→Apply→Setting反映、および不正JSON入力時のエラーハンドリング。いずれもコンソールエラーなし(既存の無関係なOllama接続エラーを除く)。
|
||||
|
||||
**How to apply**: 複数モジュールで使う汎用UI部品(`setupSearchClearBtn`、`extractAllMetadata`等)は積極的にexportして使い回すこと。「モーダル内に専用UIを新設する」より「既存のツールバー等の状態をそのまま参照する」方がユーザーにとって一貫性があり実装も軽い場合があるため、要望の意図が既存UIの流用にあるかどうかを都度確認する。プラン保存構造とJSONビュー表示は同じビルダー関数(`_buildPlanData`)を共有させ、二重管理を避ける。
|
||||
|
||||
---
|
||||
|
||||
## v0.3.87
|
||||
|
||||
### 追加機能: GenerateUIタブに実験的な「Lab」サブタブを追加(I2Iバッチ生成・キーフレーム方式)
|
||||
|
||||
@@ -22,7 +22,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
|
||||
- Built-in AI tools (translation and more)
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -128,15 +128,18 @@ Two independent modes selectable via **[Image Loop] / [Gallery]** toggle buttons
|
||||
- **After Gen modes** — Loop (wrap at end and continue indefinitely), Increment (stop automatically when last image is reached), Fixed (always use the same index)
|
||||
- **Run / Stop controls** — left pane Run / Stop buttons manage the generation loop; After Gen combo (loop / increment / fixed), ▶ Run, and ■ Stop widgets are also available directly on the WFS_GalleryFeeder node in the ComfyUI canvas (`gallery_feeder_extension.js`)
|
||||
|
||||
### Lab subtab (v0.3.87)
|
||||
### Lab subtab (v0.3.87 – v0.3.89)
|
||||
|
||||
An experimental I2I batch generator: runs the workflow currently loaded in GenerateUI N times, letting Checkpoint / VAE / Prompt / KSampler each change independently starting at a chosen iteration — unlike the Batch tab's single-axis queue, every column keeps its own list of change points. Never mutates the loaded workflow; every iteration runs on a fresh clone.
|
||||
|
||||
- **Setting / Results sub-panels** — Setting: image drop zone + 4 keyframe columns + run controls; Results: source image and up to 9 generated thumbnails (click to enlarge)
|
||||
- **Setting / Results / Plan JSON sub-panels** — Setting: image drop zone + 4 keyframe columns + run controls; Results: source image and up to 9 generated thumbnails (click to enlarge); Plan JSON: the current plan as raw editable JSON (v0.3.88)
|
||||
- **Per-column keyframes** — Checkpoint, VAE, Prompt, KSampler each hold an independent list of `{iteration, value}` keyframes; +/− per column adds/removes a keyframe (iteration #1 is fixed and can't be removed); click a cell to edit its value, the iteration it starts applying from, and a "revert to #1's setting" checkbox; the effective value at iteration N is the latest keyframe with iteration ≤ N, carried forward until the next one changes it
|
||||
- **Checkpoint / VAE cell filtering** (v0.3.88) — a Filter... box above the value dropdown narrows the list live, same as GenerateUI's Model tab; overlay ✕ clear button matches the Models/Nodes/Workflow/Gallery tab search boxes
|
||||
- **Prompt cell extras** (v0.3.88, refined in v0.3.89) — **Get from GenerateUI** fills Positive/Negative from the workflow currently loaded in GenerateUI; **Get from Image** extracts a prompt from the image currently loaded in Lab's own Image drop zone (same detection as the Metadata tab; no separate file picker); **Style** appends whichever style is currently selected in GenerateUI's own top-bar Style checkbox/dropdown to the Positive/Negative text below, comma-separated after any existing text — it never clears what's already there (Lab has no separate style picker of its own)
|
||||
- **Use generated image for next** — optional checkbox that chains iterations: from iteration 2 onward the previous iteration's first output image is fed back in as the I2I source instead of the original dropped image, using ComfyUI's `"name [type]"` annotated-filename reference (no re-upload needed)
|
||||
- **Plan files** — Plan Save (silently overwrites the loaded plan) / Save As (always asks for a new name) / Plan Clear; plans are stored as `<name>.json` in `user/default/Workflow-Studio/lab_plan/`, alongside an auto-generated `<name>.png` index image (a 3-per-row contact sheet of up to 9 result thumbnails)
|
||||
- **Plan Load** — same drag-and-drop / click-to-browse drop zone as the Image slot; drop a plan's `.json` (read directly in the browser) or its `.png` index-image thumbnail (fetches the matching `.json` by filename)
|
||||
- **Plan JSON tab** (v0.3.88) — view/edit the current plan as raw JSON (same shape saved to disk); Refresh re-reads it from the Setting tab, Apply to Setting parses your edits and writes them back into the Setting tab's columns/note/batch/chain-image/source-image/results — the same effect as loading that JSON as a plan file, without saving it first
|
||||
- **Eagle integration** — every image Lab generates is auto-saved to Eagle the same way as GenerateUI's own Generate button, if enabled in the Settings tab
|
||||
|
||||
### Prompt Tab
|
||||
@@ -422,6 +425,18 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
|
||||
|
||||
## Changelog
|
||||
|
||||
### v0.3.89
|
||||
|
||||
- **Lab tab — Get from Image now reads Lab's own loaded image** — instead of opening a separate file picker, it fetches the image already loaded in Lab's Image drop zone (`/view` on the uploaded input file) and extracts its embedded prompt metadata
|
||||
- **Lab tab — Style now always appends, never clears** — instead of substituting a `{prompt}` placeholder into the style template (as GenerateUI's own Style feature does), Lab's Style button appends the style's text after any existing Positive/Negative content with a comma, or uses it as-is if the field was empty
|
||||
- **GenerateUI Model tab — overlay ✕ clear buttons** — Checkpoint, VAE, Diffusion Model, ControlNet, Hypernetwork, and LoRA (Single) filter boxes now have the same overlay ✕ clear button as the Models/Nodes/Workflow/Gallery tab search boxes
|
||||
|
||||
### v0.3.88
|
||||
|
||||
- **Lab tab — Prompt cell extras** — Get from GenerateUI (fills Positive/Negative from the currently loaded workflow), Get from Image (extracts a prompt from a dropped/selected image or workflow JSON, reusing the Metadata tab's `extractAllMetadata()`), and Style (applies whichever style is currently selected in GenerateUI's own top-bar Style checkbox/dropdown — no separate style picker inside Lab)
|
||||
- **Lab tab — Checkpoint/VAE cell filtering** — a Filter... box narrows the dropdown live, same as GenerateUI's Model tab, with the same overlay ✕ clear button used by the Models/Nodes/Workflow/Gallery search boxes (`setupSearchClearBtn()`)
|
||||
- **Lab tab — new Plan JSON subtab** — view/edit the current plan as raw JSON (syntax highlighted, same shape as the saved file); Refresh re-syncs it from the Setting tab, Apply to Setting parses your edits and writes them back into the Setting tab's columns/note/batch/chain-image/source-image/results, the same as loading that JSON as a plan file without saving it first
|
||||
|
||||
### v0.3.87
|
||||
|
||||
- **New: GenerateUI — Lab subtab** — experimental I2I batch generation. Runs the workflow currently loaded in GenerateUI N times, with Checkpoint/VAE/Prompt/KSampler each independently overridable via a per-column list of keyframes (`{iteration, value}`) instead of the Batch tab's single shared axis; the effective value at iteration N carries forward from the latest keyframe ≤ N, and a "revert to #1" option reuses the baseline value. Every iteration runs on a cloned workflow, so the loaded workflow (and the Input/Model/Settings/Batch tabs) is never modified. Includes an optional "use generated image for next" chain mode (iteration 2+ feeds the previous output back in as the I2I source via ComfyUI's `"name [type]"` reference, no re-upload needed), Eagle auto-save integration, and Plan Save/Save As/Load (drag-and-drop `.json` or its `.png` index-image thumbnail) with plans stored under `user/default/Workflow-Studio/lab_plan/` alongside an auto-generated contact-sheet thumbnail (up to 9 result images, 3 per row).
|
||||
|
||||
+1
-1
@@ -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.87"
|
||||
version = "0.3.89"
|
||||
license = "MIT"
|
||||
requires-python = ">= 3.10"
|
||||
dependencies = ["jinja2"]
|
||||
|
||||
@@ -37,6 +37,14 @@
|
||||
|
||||
.wfm-lab-panel.active { display: flex; }
|
||||
|
||||
.wfm-lab-planjson-toolbar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid var(--wfm-border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.wfm-lab-pane-header {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
@@ -218,6 +226,13 @@
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.wfm-lab-modal-btnrow {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.wfm-lab-modal-inline > div {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
+2
-2
@@ -400,12 +400,12 @@ function applyI18nToHtml() {
|
||||
"wfm-help-lab-1": "helpLab1", "wfm-help-lab-2": "helpLab2",
|
||||
"wfm-help-lab-3": "helpLab3", "wfm-help-lab-4": "helpLab4",
|
||||
"wfm-help-lab-5": "helpLab5", "wfm-help-lab-6": "helpLab6",
|
||||
"wfm-help-lab-7": "helpLab7",
|
||||
"wfm-help-lab-7": "helpLab7", "wfm-help-lab-8": "helpLab8",
|
||||
"wfm-help-lab-card-plan-title": "helpLabCardPlanTitle",
|
||||
"wfm-help-lab-plan-1": "helpLabPlan1", "wfm-help-lab-plan-2": "helpLabPlan2",
|
||||
"wfm-help-lab-plan-3": "helpLabPlan3", "wfm-help-lab-plan-4": "helpLabPlan4",
|
||||
"wfm-help-lab-plan-5": "helpLabPlan5", "wfm-help-lab-plan-6": "helpLabPlan6",
|
||||
"wfm-help-lab-plan-7": "helpLabPlan7",
|
||||
"wfm-help-lab-plan-7": "helpLabPlan7", "wfm-help-lab-plan-8": "helpLabPlan8",
|
||||
"wfm-help-lab-card-results-title": "helpLabCardResultsTitle",
|
||||
"wfm-help-lab-results-1": "helpLabResults1", "wfm-help-lab-results-2": "helpLabResults2",
|
||||
"wfm-help-lab-results-3": "helpLabResults3",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { comfyUI } from "./comfyui-client.js";
|
||||
import { syncJsonHighlight } from "./json-highlight.js";
|
||||
import { t } from "./i18n.js";
|
||||
import { escapeHtml } from "./util.js";
|
||||
import { escapeHtml, setupSearchClearBtn } from "./util.js";
|
||||
|
||||
// ── Latent Image preset state ─────────────────────────────
|
||||
const _LATENT_PRESET_KEY = "wfm_latent_presets";
|
||||
@@ -541,7 +541,10 @@ export const comfyEditor = {
|
||||
return `
|
||||
<div class="wfm-form-group" style="border-bottom:1px solid var(--wfm-border);padding-bottom:12px;">
|
||||
<label>${s.label}</label>
|
||||
<input type="text" class="wfm-input wfm-model-filter" placeholder="Filter..." data-target="wfm-model-${s.key}" style="margin-bottom:4px;">
|
||||
<div class="wfm-search-wrap" style="margin-bottom:4px;width:100%;">
|
||||
<input type="text" class="wfm-input wfm-search-input wfm-model-filter" id="wfm-model-${s.key}-filter" placeholder="Filter..." data-target="wfm-model-${s.key}">
|
||||
<button type="button" class="wfm-search-clear-btn" id="wfm-model-${s.key}-filter-clear" title="Clear search">✕</button>
|
||||
</div>
|
||||
<select class="wfm-select ${isMissing ? "wfm-select-missing" : ""}" id="wfm-model-${s.key}" style="margin-bottom:4px;">
|
||||
${isMissing ? `<option value="${escapeHtml(currentVal)}" selected>⚠ ${escapeHtml(currentVal)} (${t("modelNotFound")})</option>` : ""}
|
||||
${models.map((m) => `<option value="${m}" ${m === currentVal ? "selected" : ""}>${m}</option>`).join("")}
|
||||
@@ -559,8 +562,8 @@ export const comfyEditor = {
|
||||
|
||||
// Filter inputs
|
||||
el.querySelectorAll(".wfm-model-filter").forEach((input) => {
|
||||
input.addEventListener("input", () => {
|
||||
const targetId = input.dataset.target;
|
||||
const targetId = input.dataset.target;
|
||||
const rebuild = () => {
|
||||
const select = document.getElementById(targetId);
|
||||
if (!select) return;
|
||||
const filter = input.value.toLowerCase();
|
||||
@@ -570,7 +573,9 @@ export const comfyEditor = {
|
||||
.filter((m) => m.toLowerCase().includes(filter))
|
||||
.map((m) => `<option value="${m}">${m}</option>`)
|
||||
.join("");
|
||||
});
|
||||
};
|
||||
input.addEventListener("input", rebuild);
|
||||
setupSearchClearBtn(input.id, `${input.id}-clear`, rebuild);
|
||||
});
|
||||
|
||||
// Apply buttons
|
||||
@@ -704,7 +709,10 @@ export const comfyEditor = {
|
||||
|
||||
<!-- Single tab -->
|
||||
<div class="wfm-lora-tab-content" id="wfm-lora-panel-single">
|
||||
<input type="text" class="wfm-input" id="wfm-lora-filter" placeholder="Filter...">
|
||||
<div class="wfm-search-wrap" style="width:100%;">
|
||||
<input type="text" class="wfm-input wfm-search-input" id="wfm-lora-filter" placeholder="Filter...">
|
||||
<button type="button" class="wfm-search-clear-btn" id="wfm-lora-filter-clear" title="Clear search">✕</button>
|
||||
</div>
|
||||
<select class="wfm-select" id="wfm-lora-select">
|
||||
${loras.map((m) => `<option value="${m}" ${m === currentVal ? "selected" : ""}>${m}</option>`).join("")}
|
||||
</select>
|
||||
@@ -804,8 +812,9 @@ export const comfyEditor = {
|
||||
}
|
||||
|
||||
// ── Single: filter ───────────────────────────────────
|
||||
document.getElementById("wfm-lora-filter")?.addEventListener("input", (e) => {
|
||||
const filter = e.target.value.toLowerCase();
|
||||
const loraFilterInput = document.getElementById("wfm-lora-filter");
|
||||
const rebuildLoraSingleList = () => {
|
||||
const filter = loraFilterInput?.value.toLowerCase() || "";
|
||||
const select = document.getElementById("wfm-lora-select");
|
||||
if (!select) return;
|
||||
select.innerHTML = loras
|
||||
@@ -813,7 +822,9 @@ export const comfyEditor = {
|
||||
.map((m) => `<option value="${m}">${m}</option>`)
|
||||
.join("");
|
||||
_refreshLoraSingleDynamic(metadata, civitaiCache);
|
||||
});
|
||||
};
|
||||
loraFilterInput?.addEventListener("input", rebuildLoraSingleList);
|
||||
setupSearchClearBtn("wfm-lora-filter", "wfm-lora-filter-clear", rebuildLoraSingleList);
|
||||
|
||||
// ── Single: update SYNTAX/TRIGGERS on model or strength change ──
|
||||
document.getElementById("wfm-lora-select")?.addEventListener("change", () => _refreshLoraSingleDynamic(metadata, civitaiCache));
|
||||
|
||||
@@ -241,6 +241,19 @@ const LANGUAGES = {
|
||||
labPlanLoadFailed: "Failed to load plan",
|
||||
labPlanInvalidFile: "Drop a .json plan file or its .png index image",
|
||||
labConfirmClear: "Clear all Lab settings (image, columns, note, results)?",
|
||||
labGetFromGenUI: "Get from GenerateUI",
|
||||
labGetFromImage: "Get from Image",
|
||||
labStyle: "Style",
|
||||
labApply: "Apply",
|
||||
labNoStyles: "No styles",
|
||||
labEnableStyleFirst: "Enable the Style checkbox and pick a style at the top of the GenerateUI tab first",
|
||||
labPlanJsonRefreshed: "Refreshed from the current Setting tab",
|
||||
labPlanJsonApplied: "Plan JSON applied to Setting",
|
||||
labPlanJsonInvalid: "Invalid JSON",
|
||||
labStyleApplied: "Style applied",
|
||||
labPromptFetched: "Prompt loaded",
|
||||
labNoPromptInImage: "No prompt found in that file",
|
||||
labMetadataExtractFailed: "Failed to read metadata",
|
||||
|
||||
connectedToComfyUI: "Connected to ComfyUI",
|
||||
failedToConnect: "Failed to connect",
|
||||
@@ -720,6 +733,7 @@ const LANGUAGES = {
|
||||
helpLab5: "Click a cell to edit it: iteration #1 sets the baseline value (leave it blank to keep the loaded workflow's own setting); iteration #2+ also lets you choose which iteration it starts applying from, plus a \"revert to #1's setting\" checkbox",
|
||||
helpLab6: "Effective value at iteration N: the latest keyframe with iteration ≤ N is used and carries forward until the next keyframe changes it; \"revert to #1\" reuses iteration #1's value (or the workflow default if #1 is blank) instead of specifying a new one",
|
||||
helpLab7: "Lab never edits the workflow shown in Input/Model/Settings — every iteration runs on a fresh clone of the loaded workflow, so keyframes here never affect the other subtabs",
|
||||
helpLab8: "Prompt cell editor extras: Get from GenerateUI fills Positive/Negative from the workflow currently loaded in GenerateUI; Get from Image extracts a prompt from the image currently loaded in Lab's own Image drop zone (same detection as the Metadata tab; no separate file picker); Style appends whichever style is currently selected in the Style checkbox/dropdown at the top of the GenerateUI toolbar to the Positive/Negative text below, comma-separated after any existing text (never clears it) — enable that checkbox and pick a style first, Lab doesn't have its own separate style picker",
|
||||
helpLabCardPlanTitle: "Setting subtab — Run & Plan files",
|
||||
helpLabPlan1: "Right pane — Batch: number of iterations to run; Note: free-text memo saved together with the plan",
|
||||
helpLabPlan2: "Run / Pause / Cancel: Run starts the batch loop; Pause/Resume freezes it between iterations; Cancel interrupts the current generation and stops the loop",
|
||||
@@ -728,6 +742,7 @@ const LANGUAGES = {
|
||||
helpLabPlan5: "Plan Clear resets the Setting tab to an empty plan (asks for confirmation first)",
|
||||
helpLabPlan6: "Plan files are stored in user/default/Workflow-Studio/lab_plan/ as <name>.json plus a <name>.png index image — a contact sheet of up to 9 result thumbnails (3 per row) generated automatically whenever a plan with results is saved",
|
||||
helpLabPlan7: "Eagle auto-save (configured in the Settings tab) applies to every image Lab generates, the same as GenerateUI's own Generate button",
|
||||
helpLabPlan8: "Plan JSON subtab: shows the current Setting tab's plan as raw JSON; Refresh re-reads it from the Setting tab (discarding any unapplied text edits), Apply to Setting parses your edits and writes them back into the Setting tab (columns, note, batch count, chain-image, source image, results) — the same effect as loading that JSON as a plan file, without needing to save it first",
|
||||
helpLabCardResultsTitle: "Results subtab",
|
||||
helpLabResults1: "Left pane shows the source image used for the run",
|
||||
helpLabResults2: "Center pane shows up to 9 generated images in generation order; click a thumbnail to view it enlarged",
|
||||
@@ -1373,6 +1388,19 @@ const LANGUAGES = {
|
||||
labPlanLoadFailed: "プランの読み込みに失敗しました",
|
||||
labPlanInvalidFile: "プランの.jsonファイル、またはそのインデックス画像(.png)をドロップしてください",
|
||||
labConfirmClear: "Labの設定(画像・列・メモ・結果)をすべてクリアしますか?",
|
||||
labGetFromGenUI: "GenerateUIから取得",
|
||||
labGetFromImage: "画像から取得",
|
||||
labStyle: "スタイル",
|
||||
labApply: "適用",
|
||||
labNoStyles: "スタイルがありません",
|
||||
labEnableStyleFirst: "先にGenerateUIタブ上部のStyleチェックボックスをオンにし、スタイルを選択してください",
|
||||
labPlanJsonRefreshed: "現在のSettingタブの内容で更新しました",
|
||||
labPlanJsonApplied: "Plan JSONをSettingに適用しました",
|
||||
labPlanJsonInvalid: "JSONが不正です",
|
||||
labStyleApplied: "スタイルを適用しました",
|
||||
labPromptFetched: "プロンプトを取得しました",
|
||||
labNoPromptInImage: "このファイルにはプロンプトが見つかりませんでした",
|
||||
labMetadataExtractFailed: "メタデータの読み取りに失敗しました",
|
||||
|
||||
connectedToComfyUI: "ComfyUIに接続しました",
|
||||
failedToConnect: "接続に失敗しました",
|
||||
@@ -1852,6 +1880,7 @@ const LANGUAGES = {
|
||||
helpLab5: "セルをクリックすると編集できます。1回目は基準となる設定値です(空欄のままにするとワークフロー本来の設定を使用)。2回目以降はさらに「何回目から適用するか」の指定と「1回目の設定に戻す」チェックボックスがあります",
|
||||
helpLab6: "N回目時点での実効値は、N以下で最も大きい回数目のキーフレームが次のキーフレームまで引き継がれます。「1回目に戻す」を使うと、新しい値を指定する代わりに1回目の値(空欄ならワークフロー本来の設定)がそのまま使われます",
|
||||
helpLab7: "LabはInput/Model/Settingsに表示されているワークフローを直接編集しません。各回の実行はワークフローの複製に対して行われるため、Labでのキーフレーム設定が他のサブタブに影響することはありません",
|
||||
helpLab8: "Promptセル編集モーダルの追加機能:「Get from GenerateUI」で現在GenerateUIに読み込まれているワークフローからPositive/Negativeを取得、「Get from Image」でLab左ペインのIMAGEに現在読み込まれている画像からプロンプトを抽出(Metadataタブと同じ検出ロジック。別途ファイル選択は不要)、「Style」でGenerateUIツールバー上部のStyleチェックボックス/ドロップダウンで現在選択されているスタイルを、既存のPositive/Negativeテキストを消さずにカンマ区切りで追記(先に上部でチェックボックスをオンにしスタイルを選択しておく必要あり。Lab独自のスタイル選択はありません)",
|
||||
helpLabCardPlanTitle: "Settingサブタブ — 実行とプランファイル",
|
||||
helpLabPlan1: "右ペイン — Batch:実行する回数。Note:プランと一緒に保存される自由記述のメモ",
|
||||
helpLabPlan2: "Run/Pause/Cancel:Runでバッチループを開始、Pause/Resumeで回と回の間を一時停止・再開、Cancelで現在の生成を中断してループを止めます",
|
||||
@@ -1860,6 +1889,7 @@ const LANGUAGES = {
|
||||
helpLabPlan5: "Plan ClearはSettingタブの内容を空のプランにリセットします(確認あり)",
|
||||
helpLabPlan6: "プランファイルは user/default/Workflow-Studio/lab_plan/ に <名前>.json として保存され、結果がある場合は最大9枚(1行3枚)のサムネイルを並べたインデックス画像 <名前>.png も自動生成されます",
|
||||
helpLabPlan7: "設定タブで構成したEagle自動保存は、GenerateUI本来のGenerateボタンと同様にLabで生成したすべての画像に適用されます",
|
||||
helpLabPlan8: "Plan JSONサブタブ:現在のSettingタブのプラン内容をそのままJSONで表示します。「Refresh」でSettingタブの現在の内容から再読込(未適用の編集は破棄)、「Apply to Setting」で編集内容を解析しSettingタブへ書き戻します(列・メモ・Batch数・画像連鎖・元画像・結果)。保存せずにそのままプランファイルとして読み込んだのと同じ効果があります",
|
||||
helpLabCardResultsTitle: "Resultsサブタブ",
|
||||
helpLabResults1: "左ペインには実行に使用した元画像が表示されます",
|
||||
helpLabResults2: "中央ペインには生成順に最大9枚の画像が表示されます。サムネイルをクリックすると拡大表示されます",
|
||||
@@ -2504,6 +2534,19 @@ const LANGUAGES = {
|
||||
labPlanLoadFailed: "方案加载失败",
|
||||
labPlanInvalidFile: "请拖入方案的.json文件或其索引图片(.png)",
|
||||
labConfirmClear: "确定要清除所有Lab设置(图片、列、备注、结果)吗?",
|
||||
labGetFromGenUI: "从GenerateUI获取",
|
||||
labGetFromImage: "从图片获取",
|
||||
labStyle: "风格",
|
||||
labApply: "应用",
|
||||
labNoStyles: "暂无风格",
|
||||
labEnableStyleFirst: "请先在GenerateUI标签页顶部勾选Style复选框并选择一个风格",
|
||||
labPlanJsonRefreshed: "已根据当前Setting标签页内容刷新",
|
||||
labPlanJsonApplied: "已将Plan JSON应用到Setting",
|
||||
labPlanJsonInvalid: "JSON格式无效",
|
||||
labStyleApplied: "已应用风格",
|
||||
labPromptFetched: "已获取提示词",
|
||||
labNoPromptInImage: "该文件中未找到提示词",
|
||||
labMetadataExtractFailed: "读取元数据失败",
|
||||
|
||||
connectedToComfyUI: "已连接到ComfyUI",
|
||||
failedToConnect: "连接失败",
|
||||
@@ -2983,6 +3026,7 @@ const LANGUAGES = {
|
||||
helpLab5: "点击单元格即可编辑:第1个关键帧设置基准值(留空则保持工作流本身的设置);第2个及以后的关键帧还可以选择从第几次开始应用,以及是否勾选\"恢复第1次的设置\"",
|
||||
helpLab6: "第N次迭代的实际生效值:使用迭代序号≤N中序号最大的关键帧,并一直延续到下一个关键帧改变它为止;勾选\"恢复第1次的设置\"时会直接复用第1次的值(若第1次为空则使用工作流默认值),而不是指定新值",
|
||||
helpLab7: "Lab不会修改Input/Model/Settings中显示的工作流——每次迭代都在加载工作流的一个副本上运行,因此这里的关键帧设置不会影响其他子标签",
|
||||
helpLab8: "Prompt单元格编辑弹窗的附加功能:「Get from GenerateUI」从GenerateUI当前加载的工作流中获取Positive/Negative;「Get from Image」从Lab左侧IMAGE区域当前加载的图片中提取提示词(与Metadata标签相同的检测逻辑,无需另外选择文件);「Style」会将GenerateUI工具栏顶部Style复选框/下拉菜单中当前选中的风格,以逗号分隔追加到下方的Positive/Negative文本之后(不会清空已有内容)——需先在顶部勾选复选框并选择风格,Lab没有自己独立的风格选择器",
|
||||
helpLabCardPlanTitle: "Setting子标签 — 运行与方案文件",
|
||||
helpLabPlan1: "右侧面板 — Batch:要运行的迭代次数;Note:与方案一起保存的自由备注",
|
||||
helpLabPlan2: "Run/Pause/Cancel:Run开始批量循环;Pause/Resume在各次迭代之间暂停/继续;Cancel会中断当前生成并停止循环",
|
||||
@@ -2991,6 +3035,7 @@ const LANGUAGES = {
|
||||
helpLabPlan5: "Plan Clear会将Setting标签重置为空方案(会先确认)",
|
||||
helpLabPlan6: "方案文件保存在 user/default/Workflow-Studio/lab_plan/ 下,命名为<名称>.json,若方案含有结果,还会自动生成<名称>.png索引图片——最多9张结果缩略图组成的联系表(每行3张)",
|
||||
helpLabPlan7: "设置标签页中配置的Eagle自动保存,会像GenerateUI自身的Generate按钮一样应用于Lab生成的每一张图片",
|
||||
helpLabPlan8: "Plan JSON子标签:以原始JSON形式显示当前Setting标签页的方案内容。「Refresh」会从Setting标签页重新读取(放弃尚未应用的编辑);「Apply to Setting」会解析你的编辑并写回Setting标签页(列、备注、Batch数量、图片链式生成、源图片、结果)——效果与直接将该JSON作为方案文件加载相同,无需先保存",
|
||||
helpLabCardResultsTitle: "Results子标签",
|
||||
helpLabResults1: "左侧面板显示本次运行使用的源图片",
|
||||
helpLabResults2: "中间面板按生成顺序显示最多9张生成图片;点击缩略图可放大查看",
|
||||
|
||||
+182
-10
@@ -12,7 +12,9 @@ import { comfyUI } from "./comfyui-client.js";
|
||||
import { comfyEditor } from "./comfyui-editor.js";
|
||||
import { showToast, openModal, closeModal } from "./app.js";
|
||||
import { t } from "./i18n.js";
|
||||
import { escapeHtml, getEagleSettings, saveToEagle } from "./util.js";
|
||||
import { escapeHtml, getEagleSettings, saveToEagle, setupSearchClearBtn } from "./util.js";
|
||||
import { extractAllMetadata } from "./metadata-tab.js";
|
||||
import { syncJsonHighlight } from "./json-highlight.js";
|
||||
|
||||
const COLUMN_KEYS = ["checkpoint", "vae", "prompt", "ksampler"];
|
||||
const MAX_RESULTS = 9;
|
||||
@@ -62,6 +64,7 @@ export function initLabTab() {
|
||||
_initColumnButtons();
|
||||
_initRunControls();
|
||||
_initPlanButtons();
|
||||
_initPlanJsonTab();
|
||||
_renderAllColumns();
|
||||
_renderResultsGrid();
|
||||
}
|
||||
@@ -144,11 +147,58 @@ function _initSubtabToggle() {
|
||||
btn.classList.add("active");
|
||||
document.getElementById("wfm-lab-panel-setting")?.classList.toggle("active", target === "setting");
|
||||
document.getElementById("wfm-lab-panel-results")?.classList.toggle("active", target === "results");
|
||||
document.getElementById("wfm-lab-panel-planjson")?.classList.toggle("active", target === "planjson");
|
||||
if (target === "results") _updateResultsSourceImage();
|
||||
if (target === "planjson") _syncLabJsonView();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function _initPlanJsonTab() {
|
||||
document.getElementById("wfm-lab-planjson-refresh")?.addEventListener("click", () => {
|
||||
_syncLabJsonView();
|
||||
showToast(t("labPlanJsonRefreshed"), "success");
|
||||
});
|
||||
|
||||
document.getElementById("wfm-lab-planjson-apply")?.addEventListener("click", () => {
|
||||
const editor = document.getElementById("wfm-lab-planjson-editor");
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(editor?.value || "{}");
|
||||
} catch (err) {
|
||||
showToast(`${t("labPlanJsonInvalid")}: ${err.message}`, "error");
|
||||
return;
|
||||
}
|
||||
_applyPlanData(_lab.planFilename, data);
|
||||
_syncLabJsonView();
|
||||
showToast(t("labPlanJsonApplied"), "success");
|
||||
});
|
||||
}
|
||||
|
||||
// Serializes the live Setting-tab state into the same shape saved to disk by
|
||||
// _savePlan(), for display/editing in the Plan JSON panel.
|
||||
function _buildPlanData(name) {
|
||||
return {
|
||||
name,
|
||||
note: _lab.note,
|
||||
batch_count: _lab.batchCount,
|
||||
chain_image: _lab.chainImage,
|
||||
source_image: _lab.sourceImageFilename,
|
||||
columns: _lab.columns,
|
||||
results: { images: _lab.results.images },
|
||||
};
|
||||
}
|
||||
|
||||
function _syncLabJsonView() {
|
||||
const editor = document.getElementById("wfm-lab-planjson-editor");
|
||||
const highlight = document.getElementById("wfm-lab-planjson-highlight");
|
||||
if (!editor) return;
|
||||
const name = _lab.planFilename ? _lab.planFilename.replace(/\.json$/i, "") : "";
|
||||
const json = JSON.stringify(_buildPlanData(name), null, 2);
|
||||
editor.value = json;
|
||||
syncJsonHighlight(highlight, json);
|
||||
}
|
||||
|
||||
function _initRunControls() {
|
||||
document.getElementById("wfm-lab-batch-count")?.addEventListener("change", (e) => {
|
||||
const v = parseInt(e.target.value, 10);
|
||||
@@ -282,6 +332,10 @@ function _openCellModal(col, idx) {
|
||||
valueFieldsHtml = `
|
||||
<div class="wfm-lab-modal-row">
|
||||
<label>${col === "checkpoint" ? "Checkpoint" : "VAE"}</label>
|
||||
<div class="wfm-search-wrap" style="margin-bottom:4px;width:100%;">
|
||||
<input type="text" id="wfm-lab-modal-value-filter" class="wfm-input wfm-search-input" placeholder="Filter...">
|
||||
<button type="button" class="wfm-search-clear-btn" id="wfm-lab-modal-value-filter-clear" title="Clear search">✕</button>
|
||||
</div>
|
||||
<select id="wfm-lab-modal-value" class="wfm-select">
|
||||
<option value="">${t("labUseWorkflowDefault")}</option>
|
||||
${options.map((m) => `<option value="${escapeHtml(m)}" ${m === kf.value ? "selected" : ""}>${escapeHtml(m)}</option>`).join("")}
|
||||
@@ -290,6 +344,10 @@ function _openCellModal(col, idx) {
|
||||
} else if (col === "prompt") {
|
||||
const v = kf.value || {};
|
||||
valueFieldsHtml = `
|
||||
<div class="wfm-lab-modal-btnrow">
|
||||
<button type="button" id="wfm-lab-modal-get-genui" class="wfm-btn wfm-btn-sm">${t("labGetFromGenUI")}</button>
|
||||
<button type="button" id="wfm-lab-modal-get-image" class="wfm-btn wfm-btn-sm">${t("labGetFromImage")}</button>
|
||||
</div>
|
||||
<div class="wfm-lab-modal-row">
|
||||
<label>Positive</label>
|
||||
<textarea id="wfm-lab-modal-positive" class="wfm-input" rows="3">${escapeHtml(v.positive || "")}</textarea>
|
||||
@@ -297,6 +355,10 @@ function _openCellModal(col, idx) {
|
||||
<div class="wfm-lab-modal-row">
|
||||
<label>Negative</label>
|
||||
<textarea id="wfm-lab-modal-negative" class="wfm-input" rows="3">${escapeHtml(v.negative || "")}</textarea>
|
||||
</div>
|
||||
<div class="wfm-lab-modal-row">
|
||||
<label>${t("labStyle")}</label>
|
||||
<button type="button" id="wfm-lab-modal-style-apply" class="wfm-btn wfm-btn-sm">${t("labApply")}</button>
|
||||
</div>`;
|
||||
} else if (col === "ksampler") {
|
||||
const v = kf.value || {};
|
||||
@@ -352,6 +414,8 @@ function _openCellModal(col, idx) {
|
||||
<button id="wfm-lab-modal-save" class="wfm-btn wfm-btn-primary">${t("save")}</button>
|
||||
</div>`;
|
||||
openModal(`${col} #${idx + 1}`, html);
|
||||
if (col === "prompt") _wireLabPromptModalExtras();
|
||||
if (col === "checkpoint" || col === "vae") _wireLabValueFilter(col);
|
||||
|
||||
const revertCb = document.getElementById("wfm-lab-modal-revert");
|
||||
const fieldsWrap = document.getElementById("wfm-lab-modal-fields");
|
||||
@@ -409,6 +473,122 @@ function _openCellModal(col, idx) {
|
||||
});
|
||||
}
|
||||
|
||||
// Merges a style ({prompt, negative_prompt}, from Workflow-Studio/style/*.json) into
|
||||
// plain positive/negative text. Unlike generate-tab.js's _applyNamedStyle() (which
|
||||
// substitutes a {prompt} placeholder into the style template for the main Generate
|
||||
// flow), Lab always appends: existing text is never cleared or reordered, the style's
|
||||
// text is just added after a comma (or used as-is if the field was empty).
|
||||
function _applyStyleToText(positive, negative, style) {
|
||||
const append = (existing, addition) => {
|
||||
if (!addition) return existing;
|
||||
return existing ? `${existing}, ${addition}` : addition;
|
||||
};
|
||||
return {
|
||||
positive: append(positive, style.prompt),
|
||||
negative: append(negative, style.negative_prompt),
|
||||
};
|
||||
}
|
||||
|
||||
// Filter box above the Checkpoint/VAE modal's <select>, same behavior as the
|
||||
// Model tab's filter inputs (comfyui-editor.js renderModelTab): rebuild the
|
||||
// option list on every keystroke, always keeping the "workflow default" option.
|
||||
// The overlay ✕ clear button reuses the same setupSearchClearBtn() helper as the
|
||||
// Models/Nodes/Workflow/Gallery tab search boxes and the Raw JSON search bar.
|
||||
function _wireLabValueFilter(col) {
|
||||
const filterInput = document.getElementById("wfm-lab-modal-value-filter");
|
||||
const select = document.getElementById("wfm-lab-modal-value");
|
||||
if (!filterInput || !select) return;
|
||||
const options = comfyEditor.models[col === "checkpoint" ? "checkpoints" : "vaes"] || [];
|
||||
|
||||
const applyFilter = () => {
|
||||
const filter = filterInput.value.toLowerCase();
|
||||
select.innerHTML = `<option value="">${t("labUseWorkflowDefault")}</option>` +
|
||||
options.filter((m) => m.toLowerCase().includes(filter))
|
||||
.map((m) => `<option value="${escapeHtml(m)}">${escapeHtml(m)}</option>`).join("");
|
||||
};
|
||||
|
||||
filterInput.addEventListener("input", applyFilter);
|
||||
setupSearchClearBtn("wfm-lab-modal-value-filter", "wfm-lab-modal-value-filter-clear", applyFilter);
|
||||
}
|
||||
|
||||
// Wires the Prompt-column modal's extra actions: fetch the live GenerateUI prompt,
|
||||
// extract a prompt from a dropped image/workflow file, and apply a saved Style.
|
||||
function _wireLabPromptModalExtras() {
|
||||
// Reuses the Style checkbox/dropdown already at the top of the GenerateUI toolbar
|
||||
// (populated by generate-tab.js's _loadStyles()) instead of duplicating a second
|
||||
// style picker inside this modal.
|
||||
const styleApplyBtn = document.getElementById("wfm-lab-modal-style-apply");
|
||||
const topStyleName = document.getElementById("wfm-style-select")?.value;
|
||||
const topStyleEnabled = !!document.getElementById("wfm-style-enabled")?.checked;
|
||||
if (styleApplyBtn) {
|
||||
styleApplyBtn.textContent = (topStyleEnabled && topStyleName) ? `${t("labApply")}: ${topStyleName}` : t("labApply");
|
||||
}
|
||||
|
||||
styleApplyBtn?.addEventListener("click", async () => {
|
||||
const enabled = !!document.getElementById("wfm-style-enabled")?.checked;
|
||||
const styleName = document.getElementById("wfm-style-select")?.value;
|
||||
if (!enabled || !styleName) {
|
||||
showToast(t("labEnableStyleFirst"), "error");
|
||||
return;
|
||||
}
|
||||
let styles = [];
|
||||
try {
|
||||
const res = await fetch("/api/wfm/styles");
|
||||
styles = res.ok ? await res.json() : [];
|
||||
} catch { styles = []; }
|
||||
const style = styles.find((s) => s.name === styleName);
|
||||
if (!style) { showToast(t("labNoStyles"), "error"); return; }
|
||||
|
||||
const posEl = document.getElementById("wfm-lab-modal-positive");
|
||||
const negEl = document.getElementById("wfm-lab-modal-negative");
|
||||
const merged = _applyStyleToText(posEl?.value || "", negEl?.value || "", style);
|
||||
if (posEl) posEl.value = merged.positive;
|
||||
if (negEl) negEl.value = merged.negative;
|
||||
showToast(t("labStyleApplied"), "success");
|
||||
});
|
||||
|
||||
document.getElementById("wfm-lab-modal-get-genui")?.addEventListener("click", () => {
|
||||
const analysis = comfyUI.currentAnalysis;
|
||||
if (!analysis) { showToast(t("labNoWorkflowLoaded"), "error"); return; }
|
||||
const posNode = analysis.prompt_nodes?.find((n) => n.role === "positive");
|
||||
const negNode = analysis.prompt_nodes?.find((n) => n.role === "negative");
|
||||
const posEl = document.getElementById("wfm-lab-modal-positive");
|
||||
const negEl = document.getElementById("wfm-lab-modal-negative");
|
||||
if (posEl) posEl.value = posNode?.text ?? "";
|
||||
if (negEl) negEl.value = negNode?.text ?? "";
|
||||
showToast(t("labPromptFetched"), "success");
|
||||
});
|
||||
|
||||
// Reads metadata from the image already loaded in Lab's own Image drop zone
|
||||
// (_lab.sourceImageFilename, already uploaded to ComfyUI's input folder) rather
|
||||
// than asking the user to pick a separate file.
|
||||
document.getElementById("wfm-lab-modal-get-image")?.addEventListener("click", async () => {
|
||||
if (!_lab.sourceImageFilename) {
|
||||
showToast(t("labNoSourceImage"), "error");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await fetch(`/view?filename=${encodeURIComponent(_lab.sourceImageFilename)}&type=input`);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
const blob = await res.blob();
|
||||
const file = new File([blob], _lab.sourceImageFilename, { type: blob.type || "image/png" });
|
||||
|
||||
const meta = await extractAllMetadata(file);
|
||||
if (!meta || (!meta.positives?.length && !meta.negatives?.length)) {
|
||||
showToast(t("labNoPromptInImage"), "error");
|
||||
return;
|
||||
}
|
||||
const posEl = document.getElementById("wfm-lab-modal-positive");
|
||||
const negEl = document.getElementById("wfm-lab-modal-negative");
|
||||
if (posEl && meta.positives?.[0]) posEl.value = meta.positives[0];
|
||||
if (negEl && meta.negatives?.[0]) negEl.value = meta.negatives[0];
|
||||
showToast(t("labPromptFetched"), "success");
|
||||
} catch (err) {
|
||||
showToast(`${t("labMetadataExtractFailed")}: ${err.message}`, "error");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Effective-value resolution & workflow build
|
||||
// ============================================
|
||||
@@ -670,15 +850,7 @@ async function _savePlan(filenameOverride, forceNewName = false) {
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: filename.replace(/\.json$/i, ""),
|
||||
note: _lab.note,
|
||||
batch_count: _lab.batchCount,
|
||||
chain_image: _lab.chainImage,
|
||||
source_image: _lab.sourceImageFilename,
|
||||
columns: _lab.columns,
|
||||
results: { images: _lab.results.images },
|
||||
};
|
||||
const data = _buildPlanData(filename.replace(/\.json$/i, ""));
|
||||
|
||||
let indexImageBase64 = null;
|
||||
try {
|
||||
|
||||
@@ -556,7 +556,7 @@ function parseFooocusMetadata(raw) {
|
||||
}
|
||||
|
||||
// ── Master extractAllMetadata ─────────────────────────────────
|
||||
async function extractAllMetadata(file) {
|
||||
export async function extractAllMetadata(file) {
|
||||
const name = file.name.toLowerCase();
|
||||
const isJSON = file.type === "application/json" || name.endsWith(".json");
|
||||
const isWebP = file.type === "image/webp" || name.endsWith(".webp");
|
||||
|
||||
@@ -508,6 +508,7 @@
|
||||
<div class="wfm-lab-subtab-nav">
|
||||
<button class="wfm-lab-subtab-btn active" data-lab-subtab="setting">Setting</button>
|
||||
<button class="wfm-lab-subtab-btn" data-lab-subtab="results">Results</button>
|
||||
<button class="wfm-lab-subtab-btn" data-lab-subtab="planjson">Plan JSON</button>
|
||||
</div>
|
||||
|
||||
<!-- Setting panel -->
|
||||
@@ -632,6 +633,18 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Plan JSON panel -->
|
||||
<div id="wfm-lab-panel-planjson" class="wfm-lab-panel">
|
||||
<div class="wfm-lab-planjson-toolbar">
|
||||
<button type="button" id="wfm-lab-planjson-refresh" class="wfm-btn wfm-btn-sm">Refresh</button>
|
||||
<button type="button" id="wfm-lab-planjson-apply" class="wfm-btn wfm-btn-primary wfm-btn-sm">Apply to Setting</button>
|
||||
</div>
|
||||
<div class="wfm-json-container">
|
||||
<pre id="wfm-lab-planjson-highlight" class="wfm-json-highlight"></pre>
|
||||
<textarea id="wfm-lab-planjson-editor" class="wfm-json-editor" spellcheck="false"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab: Feeder — full-width: settings(left) + library(center) -->
|
||||
@@ -1338,6 +1351,7 @@
|
||||
<li id="wfm-help-lab-5">Click a cell to edit it: iteration #1 sets the baseline value (leave it blank to keep the loaded workflow's own setting); iteration #2+ also lets you choose which iteration it starts applying from, plus a "revert to #1's setting" checkbox</li>
|
||||
<li id="wfm-help-lab-6">Effective value at iteration N: the latest keyframe with iteration ≤ N is used and carries forward until the next keyframe changes it; "revert to #1" reuses iteration #1's value (or the workflow default if #1 is blank) instead of specifying a new one</li>
|
||||
<li id="wfm-help-lab-7">Lab never edits the workflow shown in Input/Model/Settings — every iteration runs on a fresh clone of the loaded workflow, so keyframes here never affect the other subtabs</li>
|
||||
<li id="wfm-help-lab-8">Prompt cell editor extras: <b>Get from GenerateUI</b> fills Positive/Negative from the workflow currently loaded in GenerateUI; <b>Get from Image</b> extracts a prompt from the image currently loaded in Lab's own Image drop zone (same detection as the Metadata tab; no separate file picker); <b>Style</b> appends whichever style is currently selected in the Style checkbox/dropdown at the top of the GenerateUI toolbar to the Positive/Negative text below, comma-separated after any existing text (never clears it) — enable that checkbox and pick a style first, Lab doesn't have its own separate style picker</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1351,6 +1365,7 @@
|
||||
<li id="wfm-help-lab-plan-5">Plan Clear resets the Setting tab to an empty plan (asks for confirmation first)</li>
|
||||
<li id="wfm-help-lab-plan-6">Plan files are stored in <code>user/default/Workflow-Studio/lab_plan/</code> as <code><name>.json</code> plus a <code><name>.png</code> index image — a contact sheet of up to 9 result thumbnails (3 per row) generated automatically whenever a plan with results is saved</li>
|
||||
<li id="wfm-help-lab-plan-7">Eagle auto-save (configured in the Settings tab) applies to every image Lab generates, the same as GenerateUI's own Generate button</li>
|
||||
<li id="wfm-help-lab-plan-8">Plan JSON subtab: shows the current Setting tab's plan as raw JSON; <b>Refresh</b> re-reads it from the Setting tab (discarding any unapplied text edits), <b>Apply to Setting</b> parses your edits and writes them back into the Setting tab (columns, note, batch count, chain-image, source image, results) — the same effect as loading that JSON as a plan file, without needing to save it first</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user