Compare commits

...
10 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 5 7274017347 release: v0.5.4 — GenerateUIタブのLTX-2.5/Wan2.2対応 + VideoタブのLTX-2.5/Wan2.2対応・ハイライト表示 + RAW JSON検索の意図しない編集を修正
- GenerateUIタブ: LTX-2.5/Wan2.2ワークフローのPositive/Negative Prompt検出(LTXVDualCFGGuider/
  LTXVConditioning対応)とSettingsタブLatent Image検出(EmptyHunyuanLatentVideo/EmptyLTXVLatentVideo
  + Lengthフィールド)を追加、isVideoWorkflow()の動画タイムアウト判定も拡張
- Videoタブ: 該当項目のラベルをGenerateUI Modelタブと同じ色でハイライト表示する機能を追加
  (Wan2.2など操作不可な項目は非ハイライトのまま)
- 生成UIタブRAW JSON検索: ヒット箇所へのフォーカス/selectionRange設定を廃止し、ハイライト表示のみ
  に変更(検索直後のキー入力で意図せずJSONが編集される問題を修正)
- 別セッションでのVideoタブLTX-2.5/Wan2.2対応(サブグラフ入力labelベースの汎用検出)・MultiType
  ウィジェット脱落バグ修正・動画再生ボリューム保存設定、およびAI Assistant設定のUnsloth対応・
  Prompt/Tagger独立モーダル化・モデルアンロード機能を本リリースに統合
- ヘルプ(index.html/i18n.js 3言語/app.js helpIdMap)とREADME.md/DEVLOG.mdを更新

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 16:50:30 +09:00
ketle-manandClaude Sonnet 5 b94ab48ca4 AI Assistant設定をUnsloth対応+Prompt/Tagger独立モーダル化、モデルアンロード機能を追加
- Prompt AI/Tagger VLMにUnslothバックエンドを追加(サーバー側プロキシでAPIキー付与)
- Taggerタブ: Ollama直呼び出しを廃止しOllama/LM Studio/Lemonade/Unsloth共通のvlm_models/vlm_predictに統一、API URL直接入力欄を廃止
- 中央Settingsタブの「AI Assistant Settings」を廃止し、Prompt/Tagger各タブに⚙設定ボタン+モーダル(ai-settings-modal.js)を新設、それぞれ独立したlocalStorageキーで管理
- Thinking mode / Max tokens をPrompt/Tagger双方の生成呼び出しに反映(Tagger側はPython側のvlm_predictにも反映)
- Ollama/LM Studio/Lemonadeのモデルアンロード機能を追加(AI TOOL設定にもUnloadボタンを追加、Unslothは非対応として明示)
- ヘルプタブ(Prompt/Settings/AI TOOL/Tagger)の説明文を新仕様に合わせて更新(EN/JA/ZH)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 13:17:03 +09:00
ketle-manandClaude Sonnet 5 ed3512d269 ci: publish-node-actionのバージョンをSHA固定(サプライチェーン対策)
@mainの可変ブランチ参照はComfy-Org/publish-node-actionが更新された際に
挙動が変わりうるため、リリースタグ1.0.1のコミットSHAに固定する。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 10:24:53 +09:00
ketle-manandClaude Sonnet 5 9ed91e64f8 Video: LTX-2.5 / Wan2.2対応 + 動画音量の保存設定を追加
- VideoタブがLTX-2.5 (Text/Image/First&Last-Frame to Video) とWan2.2 (Text to
  Video) を検出・読み込み・生成できるよう汎用化。従来MiniMax H3専用だったノード
  検出/フォーム反映ロジックを、サブグラフが公開する入力のlabelベースで意味的に
  スロットを特定する方式に一般化した
- convertUiToApi(): object_infoの複合型宣言(例 "FLOAT,INT")がウィジェット名
  リストから丸ごと脱落し、後続ウィジェットの値がずれるバグを修正。
  LTXVEmptyLatentAudio.batch_sizeに誤った値が注入され動画生成が
  "Expected size 1 but got size 25" で失敗する原因だった
- Videoタブのminimax_test.json自動読み込みを廃止(同梱していないため)
- 動画再生ボリュームを設定タブに追加し、Video/Galleryの全プレーヤー間で
  保存・共有されるようにした(動画を切り替えるたびに最大音量へ戻る問題を解消)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 00:51:09 +09:00
ketle-manandClaude Sonnet 5 c0db7374b7 release: v0.5.3 — Labタブのワークフロー切替時の表示残留を修正 + Galleryタブ読み込み高速化・rootフォルダ自動展開 + READMEスクリーンショット刷新
- Labタブ: ワークフロー読み込み時、Labサブタブが既にアクティブでも
  Setting 1のライブ反映セルを再描画するよう修正(前ワークフローの表示残留を解消)
- Galleryタブ: フォルダスキャン時の不要なPath.resolve()呼び出しを除去し
  9,777枚のフォルダで7.5秒→0.14秒に高速化。os.walk()ベースの再帰スキャンも
  DirEntryベースに書き換え
- Galleryタブ: フォルダツリーのrootをデフォルト展開状態に変更
- README: スクリーンショット5件を削除、Video/Lab/AI TOOLタブの新規4枚を追加

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-28 16:08:24 +09:00
ketle-manandClaude Sonnet 5 cd4b721d51 release: v0.5.2 — GenerateUI/Labタブの動画ワークフロー対応 + VideoタブにFrame抽出/GIF変換機能 + データ管理監査とZIPフルバックアップ + Send to LI node統一
- GenerateUI/LabタブでMiniMax H3等のオールインワン動画ノードのプロンプト・画像を編集可能に(analyzeWorkflow拡張)、生成タイムアウト延長、動画結果プレビュー対応
- バグ修正: Lab index imageが真っ黒になる問題(動画は最終フレームを抽出して描画)
- バグ修正: Lab Ksampler列が動画ワークフローでも表示される問題(内部SamplerCustomAdvancedを編集対象から除外)
- Videoタブに Frame抽出(クライアント側canvas)/ アニメーションGIF変換(サーバー側PyAV+Pillow)を追加、Video Sourceパネルでプレビュー統合
- データ管理: civitai_cache.jsonのエクスポート漏れを修正、ZIP形式のフルバックアップ機能を新規実装(ai_skills/lab_plan/style/tagger.db対応、Zip Slip対策、デフォルトワークフロー/wildcardフォルダのオプトイン・復元除外)
- Image Edit/Galleryタブの画像送信ボタンを「Send to LI node」に統一し、Galleryタブにも追加
- Galleryタブの✕クリアボタンを表示形式切替ボタンの左隣に移動

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-28 13:27:12 +09:00
ketle-manandClaude Sonnet 5 46c789c492 release: v0.5.1 — mp4動画の埋め込みメタデータ対応 + Gallery Infoタブに寸法/再生時間表示 + MiniMax H3等オールインワン動画ノードのプロンプト抽出バグ修正
Gallery Prompt/JSONタブ・Metadataサブタブ・サイドパネルIタブの3箇所で、ComfyUIのSaveVideoがmp4のmoov/udta/metaに埋め込むworkflow/promptタグ(PNGのtEXtチャンクと同一キー名)を読み取れるようにした。バックエンドはPyAV、Metadataサブタブ/サイドパネルIタブはブラウザ側でMP4ボックス構造を直接パースする実装。副産物として、CLIPTextEncode系を介さず自ノードのprompt入力に直接テキストを持つ動画生成オールインワンノード(MiniMaxH3ImageToVideo等)のプロンプトが抽出できていなかったバグも修正。Gallery Infoタブには画像の幅×高さ・動画の再生時間の表示を追加。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-27 21:04:48 +09:00
ketle-man ede39ec715 release: v0.5.0 — mp4動画Gallery対応 + Videoタブ新設(MiniMax H3専用) + バグ修正: Galleryのタグ/メモが再起動後に消える
- Galleryタブでmp4動画の閲覧・再生・サムネイル生成(PyAV)に対応
- 新規Videoタブ(MiniMax H3専用、GenerateUIとは独立)を3ペイン構成で追加
  - first_frame/last_frameは両方optional、LoadImageノードの無いワークフローにも対応
  - Workflowタブから「Load in Video」で読み込み可能
- バグ修正: cleanup_stale_images()が非再帰スキャン時にサブフォルダ内画像/動画のメタデータを誤って全削除していた問題を修正
- バグ修正: Gallery側のタグ/メモ保存がサーバーエラーをサイレントに無視していた問題を修正
2026-08-27 14:46:09 +09:00
ketle-manandClaude Sonnet 5 ad3b380929 Save to Input(旧Send to ComfyUI)ボタンを削除
Send to Workflowと機能が重複していたため、Image Editタブの
「Save to Input」ボタン・uploadToComfyUI()を削除。ヘルプ・README・
i18n(日英中)を更新。次回リリース時にバージョンを上げて反映する。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 12:10:32 +09:00
ketle-manandClaude Sonnet 5 c589e562e4 release: v0.4.8 — LabにPromptグループ一括適用+キーフレーム並べ替え + デフォルトワークフロー上書き保存バグ修正 + StyleテーブルAdd to this file
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 12:16:06 +09:00
50 changed files with 3784 additions and 694 deletions
+1 -1
View File
@@ -17,6 +17,6 @@ jobs:
uses: actions/checkout@v4
- name: Publish Custom Node
uses: Comfy-Org/publish-node-action@main
uses: Comfy-Org/publish-node-action@d2366e7abb6ab16f3bb03e3520ae25c8cf749bc9 # 1.0.1
with:
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
+6
View File
@@ -2,6 +2,12 @@
Condensed version-by-version index of DEVLOG.md (each line: version + one-line summary of what changed and why). Full rationale, code details, and "How to apply" lessons live in the excluded DEVLOG.md itself; this index exists so graphify can extract a queryable semantic node per release without feeding the full log to the local Ollama model. Regenerate with `python tools/generate_doc_index.py devlog` whenever DEVLOG.md changes.
- **v0.5.4** — 機能追加: Video/GenerateUIタブのLTX-2.5・Wan2.2対応拡大 + AI Assistant設定のUnsloth対応・独立モーダル化・モデルアンロード機能
- **v0.5.3** — バグ修正: Labタブのワークフロー切替時に前の内容が残留 + Galleryタブの読み込み高速化・root自動展開 + READMEスクリーンショット刷新
- **v0.5.2** — 機能追加: GenerateUI/Labタブの動画ワークフロー対応 + VideoタブにFrame抽出/GIF変換機能 + データ管理監査とZIPフルバックアップ + Send to LI node統一
- **v0.5.1** — 機能追加: mp4動画の埋め込みメタデータ対応(Gallery Prompt/JSON・Metadataサブタブ・サイドパネルIタブ)+ Gallery Infoタブに寸法/再生時間表示 + MiniMax H3等オールインワン動画ノードのプロンプト抽出バグ修正
- **v0.5.0** — 機能追加: mp4動画Gallery対応 + Videoタブ新設(MiniMax H3専用) + バグ修正: Galleryのタグ/メモが再起動後に消える
- **v0.4.8** — 機能追加: LabタブにPromptグループ一括適用+キーフレーム並べ替え + バグ修正: デフォルトワークフローの上書き保存が反映されない + Styleテーブルの「このファイルへ追加」対応
- **v0.4.7** — 機能追加: Prompt Tab内部リファクタ + Gallery Promptタブ新設 + Send to Canvas改善 + Presetsソート
- **v0.4.6** — 機能追加: MetadataタブをGalleryタブへ統合 + Promptタブに一覧編集可能なTable表示を新設
- **v0.4.5** — 調査: トップバー保存ワークフローのRMBG不具合報告(原因なし) + バグ修正: LabタブModel列の無意味な空キーフレーム表示を解消
+164
View File
@@ -2,6 +2,170 @@
---
## v0.5.4
### 機能追加: Video/GenerateUIタブのLTX-2.5・Wan2.2対応拡大 + AI Assistant設定のUnsloth対応・独立モーダル化・モデルアンロード機能
複数セッションにまたがり実施された作業をまとめてリリース。Videoタブが従来MiniMax H3専用だった検出/生成ロジックをLTX-2.5・Wan2.2にも対応させ、続けて生成UIタブ側の解析ロジックにも同じ2ファミリーへの対応を追加した。並行してAI Assistant設定(Prompt/Tagger)をUnslothバックエンド対応・タブ別モーダル化・モデルアンロード機能へ刷新した。
**1. Videoタブ: LTX-2.5 / Wan2.2対応(ノード検出の汎用化)**: 従来MiniMax H3専用だったサブグラフ検出/フォーム反映ロジックを、サブグラフが公開する入力のlabel(無ければname)ベースで意味的にスロットを特定する方式に一般化した。MiniMax H3/LTX-2.5系は内部ノード型のプレフィックス(`LTXV*`等)で、Wan2.2は該当する固有ノード型を持たないためサブグラフ名自体("...(Wan2.2)"表記)で家系を判定する。これによりVideoタブの「Load in Video」からLTX-2.5のText/Image/First&Last-Frame to VideoワークフローとWan2.2のText to Videoワークフローも読み込み・生成できるようになった。同梱していない`minimax_test.json`の自動読み込みも廃止。
**2. バグ修正: convertUiToApi()のMultiTypeウィジェット脱落**: object_infoが複合型(例: `LTXVEmptyLatentAudio.frame_rate: "FLOAT,INT"`)を宣言している入力が、単純な完全一致判定(`upper === "INT" || ...`)に引っかからずウィジェット名/型リストから丸ごと脱落し、後続ウィジェットの値が1つずつずれる問題を発見・修正した。実際に`LTXVEmptyLatentAudio.batch_size`にframe_rateの値が誤って書き込まれ、動画生成が"Expected size 1 but got size 25"で失敗する原因になっていた。`_resolveWidgetType()`を新設し、カンマ区切りの型宣言から実際にウィジェットスロットを占める単一のスカラー型を解決するよう修正。
**3. 動画再生ボリュームの保存設定**: 動画を切り替えるたびに音量が最大へ戻ってしまう問題を解消するため、設定タブに音量設定を追加しVideo/Galleryタブの全プレーヤー間で保存・共有されるようにした。
**4. GenerateUIタブ: LTX-2.5 / Wan2.2対応(プロンプト検出・Latent Image・タイムアウト)**: Videoタブとは独立した解析経路(`analyzeWorkflow()`、フラット化済みAPI形式ワークフローを解析)側でも同じ2ファミリーの通常ワークフロー読み込みに対応させる作業。実機確認したところ、Model タブ(Checkpoint/VAE/Diffusion Model/Text Encoder/LoRA)は既存の`UNETLoader`/`CLIPLoader`/`VAELoader`ベースの汎用検出でWan2.2/LTX-2.5とも既に問題なく動作していたが、次の2点に不備を発見した。
- **Positive/Negative Prompt検出(LTX-2.5)**: LTX-2.5は`LTXVDualCFGGuider`(positive/negativeが同一の`LTXVConditioning`ノードの別出力スロットを指す)+ `LTXVConditioning`(自身のpositive/negative入力を介して実際のプロンプトソースへ分岐)という専用ノード構成を使うため、既存の`CFGGuider`/`InstructPixToPixConditioning`向けロール伝播ロジックでは拾えず、Positive/Negative Promptが空欄のままSaveVideoノードへのフォールバック表示になっていた。`LTXVDualCFGGuider`をロール伝播の起点に、`LTXVConditioning`を`InstructPixToPixConditioning`と同型の分岐伝播ノードとして追加し解決した。
- **Latent Image検出(Wan2.2・LTX-2.5共通)**: SettingsタブのLatent Imageセクションが`EmptyLatentImage`/`EmptySD3LatentImage`/`EmptyFlux2LatentImage`のみ対応しており、Wan2.2の`EmptyHunyuanLatentVideo`とLTX-2.5の`EmptyLTXVLatentVideo`が未対応で「No EmptyLatentImage node found」表示になっていた。両ノード型を追加し、動画特有の`length`(フレーム数)入力を編集するフィールドも新設した(Duration×FPSの数式ノードにリンクされ非リテラルなことが多いため、Width/Height同様「linked」表示にフォールバックする)。
- あわせて`isVideoWorkflow()`(生成タイムアウトを30分に延長する判定)を、`SaveVideo`/`CreateVideo`ノードや動画用latentノードの存在でも判定できるよう拡張した。従来はMiniMax H3のようなオールインワン`*ToVideo`ノードの有無でしか判定できず、LTX-2.5/Wan2.2は通常の静止画と同じ短いタイムアウトで打ち切られる恐れがあった。
**5. Videoタブ左パネルのハイライト表示**: GenerateUIのModelタブが持つ「ワークフローに実際に該当する項目のラベルをハイライト」する仕組み(`wfm-model-label-active`クラス、設定タブでカスタマイズ可能な共通色)をVideoタブの左パネルにも適用した。Prompt/Durationは常時、First Frame/Last Frameはサブグラフがそのスロットを公開している場合のみ、Aspect Ratio/Megapixels/MultipleはResolutionSelectorノードが存在する場合のみハイライトする — Wan2.2のように該当ノードがなく操作不可(disabled)な項目は、既存の無効化表示と矛盾しないよう非ハイライトのままにした。
**6. バグ修正: 生成UIタブRAW JSON検索がヒット箇所にカーソルを当てて不意に編集させてしまう**: 検索でヒットした際に`editor.focus()` + `setSelectionRange()`でテキストエリアへフォーカス・選択範囲を作っていたため、検索直後にキー入力すると選択範囲が上書きされ意図せずJSONが書き換わってしまう問題があった。ハイライト表示(`<mark>`によるオーバーレイ)とスクロール追従は維持しつつ、フォーカス移動と選択状態の作成のみを取りやめ、編集はユーザーが明示的にエディタをクリックした場合のみに限定した。
**7. AI Assistant設定: Unsloth対応・Prompt/Tagger独立モーダル化・モデルアンロード機能**: Prompt AI(Prompt タブ)とTagger VLM(Taggerタブ)にUnslothバックエンドを追加した(サーバー側プロキシでAPIキーを付与)。Taggerタブは従来Ollama直呼び出しだった実装を、Ollama/LM Studio/Lemonade/Unslothの4バックエンド共通の`vlm_models`/`vlm_predict`エンドポイントに統一し、API URL直接入力欄を廃止した。中央Settingsタブにあった単一の「AI Assistant Settings」パネルを廃止し、Prompt/Tagger各タブに⚙設定ボタン+専用モーダル(`ai-settings-modal.js`、Backend/Connection/Model/Generation/Unload/Saveの共通UIコンポーネント)を新設、それぞれ独立した`localStorage`キーで設定を持つように変更した(PromptとTaggerで異なるバックエンド/モデルを使い分けられる)。Thinking mode / Max tokensの設定をPrompt/Tagger双方の生成呼び出しに反映(Tagger側はPython側の`vlm_predict`にも反映)。Ollama(`keep_alive:0`)/LM Studio(`/api/v1/models/unload`)/Lemonade(`/api/v1/unload`)向けのモデルアンロード機能を追加し、AI TOOLタブの設定にもUnloadボタンを追加した(Unslothは対応する公式APIが無いため非対応として明示)。
**8. CI: publish-node-actionのバージョンをSHA固定**: `Comfy-Org/publish-node-action@main`という可変ブランチ参照は、アクション側が更新された際に挙動が変わりうるサプライチェーンリスクのため、リリースタグ1.0.1のコミットSHAに固定するよう`.github/workflows/publish.yml`を修正した([[project_registry_flagged_versions]]で追跡している過去のRegistry Banned/Flagged原因調査の一環)。
**ヘルプ・README更新**: `project_v0336_conventions`の慣習(index.html + i18n.js 3言語 + app.jsのhelpIdMapの3点セット)に従い、GenerateUIタブ(LTX-2.5/Wan2.2対応・RAW JSON検索の挙動)とVideoタブ(ハイライト色機能)のヘルプ本文を英語・日本語・中国語の3言語で追加・更新した(Prompt/Settings/AI TOOL/Taggerタブのヘルプは7番の対応セッション内で既に更新済み)。README.mdはWorkflowタブ(Load in Video対象の拡大)、GenerateUIタブ(MultiTypeバグ修正・LTX-2.5/Wan2.2対応)、Videoタブ(対応ファミリー拡大・ハイライト色・音量設定・見出しバージョン範囲更新)、Settingsタブ(AI Assistant Settings廃止の案内・音量設定・ハイライト色の共有先追記)、Prompt/Taggerタブ(AI Assistant設定のモーダル化・マルチバックエンド化)、AI TOOLタブ(モデルアンロード機能)を更新した。
**検証**: 全JS/Pythonファイルを`node --check`/`ast.parse()`で構文確認。GenerateUIタブのLTX-2.5/Wan2.2対応は、実機ブラウザ(Kapture)でwan22_test.json / ltx_25_test.jsonの2ワークフローを実際に生成UIタブへ読み込み、Positive/Negative Promptの実文表示・Latent Image欄(Width/Height/Batch Size/Length)の表示・ハイライト色の点灯状態をスクリーンショットで確認した。RAW JSON検索のフォーカス修正は、検索実行後にキー入力してもtextareaの値が変化しないことを実機で確認した。開発元gitリポジトリと実行時`custom_nodes`フォルダは別実体のため([[project_dev_deploy_sync]]参照)、変更ファイルを都度両フォルダへ同期しCRLF/LF差異を除いた`diff`で完全一致を確認した。
**How to apply**: `analyzeWorkflow()`のような中央解析関数はワークフロー「ファミリー」が増えるたびに、既存パターン(KSampler系のロール伝播、EmptyLatentImage系のlatentノード検出)と同型の分岐を追加していく設計で拡張できる — 逆に言えば、新しいノード構成(今回のLTXVDualCFGGuider/LTXVConditioningのような「複数出力を持つ1ノードがpositive/negativeを兼ねる」パターン)は`InstructPixToPixConditioning`のような既存の同型ケースを探して倣うと実装が速い。同じワークフローファミリーへの対応が複数タブ(Video/GenerateUI)にまたがる場合、検出ロジック自体は各タブの解析経路(Video: サブグラフを直接歩く、GenerateUI: フラット化済みAPI形式を解析)が別実装なので、片方を直しても他方は直らない — 「Videoタブでは動くのにGenerateUIでは動かない」という状況は、まさにこの二重実装のズレが原因だった。テキストエリアへの自動フォーカス/selectionRangeは、検索・ハイライトのような「見せるだけ」の操作と「編集を許可する」操作を暗黙に混同させるため、ハイライト表示に徹する機能ではフォーカス移動自体を避けるのが安全。
関連: [[project_v050_video_tab]], [[project_dev_deploy_sync]], [[project_v0336_conventions]], [[project_registry_flagged_versions]]
---
## v0.5.3
### バグ修正: Labタブのワークフロー切替時に前の内容が残留 + Galleryタブの読み込み高速化・root自動展開 + READMEスクリーンショット刷新
ユーザーからの複数のバグ報告・改善要望を1セッションで順に対応した作業。
**1. バグ修正: Labタブで起動時デフォルトワークフロー読み込み後に別ワークフローを読み込むと前の内容が残る**: 「別のワークフローを読み込んだ。一部以前のワークフローの内容が残ったまま表示される(クリックするか他のタブから戻ると消える)」との報告。Labタブの「Setting 1」列(Checkpoint/LoRA/VAE/Prompt/KSampler)はGenerateUIの現在の読み込み内容をライブ反映する仕組みだが、その再描画(`refreshLabLiveDefaults()`)は「サブタブをLabに切り替えたとき」の一箇所(`generate-tab.js`のサブタブクリックハンドラ)でしかトリガーされていなかった。Labタブを既に開いた状態で別のワークフローを読み込んだ場合、`loadWorkflowIntoEditor()`側では再描画が一切呼ばれず、前のワークフローの表示がそのまま残っていた。「セルをクリックしたり他のタブから戻ると直る」という報告内容は、それらの操作がたまたま再描画をトリガーしていたことの裏返しだった。`loadWorkflowIntoEditor()`の末尾で、現在アクティブなサブタブがLabの場合は`refreshLabLiveDefaults()`を追加で呼ぶよう修正。
**2. 改善: Galleryタブの生成後の更新が遅い**: 「生成後の画像表示に更新して読み直すのに時間がかかる」との報告。実データ(Output先の`Text2Img`フォルダ、画像9,777枚)で`_scan_folder()`を実測したところ**7.5秒**かかっており、原因を切り分けたところ`entry.stat(follow_symlinks=True)`と、各ファイルごとに呼んでいた`Path(entry.path).resolve()`の2箇所がボトルネックと判明。特に`resolve()`の再解決が支配的で、これだけで1ファイルあたり約0.7ms×9,777件のファイルシステム往復が発生していた。`_scan_folder()`の呼び出し元(`list_images()`/`_bg_index_folder()`)は既にフォルダ自体を`Path(folder_path).resolve()`済みで渡しているため、`entry.path`は既に絶対パスであり、エントリ単位での再`resolve()`は不要だった。`entry.is_file()`/`entry.stat()`を`follow_symlinks=False`に変更し、パス生成も`entry.path.replace("\\", "/")`に簡略化(出力フォルダにシンボリックリンクの画像が置かれる想定はないため安全と判断)。同じ理由で`os.walk()`ベースだった`_scan_folder_recursive()`(ImagePrompt/Style Catalog用の再帰スキャン)も、`os.scandir()`を自前で再帰しDirEntryベースでstatする実装に書き換えた。実測で9,777枚のフォルダに対する`list_images()`全体が0.14秒(コールド)/0.08秒(フォルダキャッシュ温存時)まで短縮(約50倍高速化)。
**3. 改善: Galleryフォルダツリーのrootをデフォルト展開状態に**: 上記の高速化を受けて「rootフォルダはデフォルトで展開状態で表示したい」との要望。フォルダスキャンが軽くなったことでサブフォルダの内容もすぐ確認できるようになった一方、`renderTreeNode()`はrootも他のノードと同じく初期状態は折りたたみ(▶)だったため気付きにくかった。root(`isRoot`)の場合のみ、ツリー構築時に矢印を展開済み(▼)にし子ノードを即座にレンダリングするよう`gallery-tab.js`を修正。
**4. READMEスクリーンショット刷新**: 「以下のスクリーンショットは削除したい」との依頼でGenUI Feeder / GenUI LoRA Stack / Models Multi-select Menu / Tagger Tab / Customizeの5件をREADME.mdの表と`docs/`実ファイルの両方から削除(残った項目は2列レイアウトに詰め直し)。続けてVideo Tab・Lab Tab(2枚)・AI TOOL Tabの新規スクリーンショット計4枚をユーザーが`docs/`に配置し、READMEの表に追加した。
**検証**: JS/Pythonとも`node --check`/`ast.parse()`で構文確認。Gallery高速化は開発元リポジトリの`GalleryService`を実データ(実際の`Text2Img`フォルダ、9,777枚)に対してvenv Pythonから直接呼び出し、修正前後の`_scan_folder()`/`list_images()`の実行時間をベンチマークして改善を数値で確認(7.5秒→0.063秒、`list_images()`全体は0.14秒)。返却されるパス文字列が修正前と同じ絶対パス形式であることも確認済み。開発元gitリポジトリと実行時`custom_nodes`フォルダは別実体のため([[project_dev_deploy_sync]]参照)、変更・削除した全ファイル(`generate-tab.js`, `gallery_service.py`, `gallery-tab.js`, `README.md`, `docs/`配下の画像)を都度両フォルダへ同期し`diff`/存在確認で完全一致を確認、Pythonファイル変更のため`__pycache__`もクリア。全項目ともユーザー自身の実機確認で解消・反映を確認済み。
**How to apply**: あるタブ/サブタブの表示を「別の場所(GenerateUI本体など)の現在の状態をライブ反映する」設計にする場合、再描画のトリガーを「そのタブへの切替」1箇所だけに置くと、切替を経由しない別の更新経路(今回はワークフロー読み込み)で表示が古いまま取り残される。ライブ反映される値の更新元(今回は`loadWorkflowIntoEditor()`)側でも、現在表示中のタブを見て能動的に再描画を呼ぶ必要がある。パフォーマンス調査では「体感で重い処理」を分解して各行を実測するまで真犯人を決め打ちしない方がよい — 今回も当初`follow_symlinks=True`のstat呼び出しを主因と想定したが、実測すると`Path.resolve()`の方が支配的だった。Windows上で大量ファイルを扱う`os.scandir()`ループでは、`entry.path`が既に呼び出し元でresolve済みのフォルダ配下の絶対パスであることを踏まえ、エントリ単位での`resolve()`/`follow_symlinks=True`はファイル数に比例した無視できないコストになり得るため避ける。バックエンドの表示速度を改善した際は、それに応じてフロントエンドのデフォルトUI状態(今回は折りたたみ初期状態)も見直す価値がある — 「遅いから畳んでおく」という妥協がボトルネック解消後も残ったままになりがち。
関連: [[project_dev_deploy_sync]]
---
## v0.5.2
### 機能追加: GenerateUI/Labタブの動画ワークフロー対応 + VideoタブにFrame抽出/GIF変換機能 + データ管理監査とZIPフルバックアップ + Send to LI node統一
v0.5.0/v0.5.1で専用Videoタブを整備したMiniMax H3動画生成ワークフローを、GenerateUI/Labタブ本体でも扱えるようにする要望を起点に着手。1セッションで複数の要望・バグ報告・監査依頼を順に実装した一連の作業。
**1. GenerateUI/Labタブの動画ワークフロー対応**: 「MiniMax H3の動画生成ワークフローを生成UIタブ、Labタブでも生成できるようにしたい」との要望。実際には`comfyWorkflow.convertUiToApi()`+`comfyUI.generate()`が既に汎用的で生成自体は動いていたが、`analyzeWorkflow()`が`MiniMaxH3ImageToVideo`のようなCLIPTextEncodeを介さないオールインワン動画ノードのpromptを検出できず、GenerateUIのInput>Promptタブが空になっていた。クラス名が`ImageToVideo`/`TextToVideo`を含み`inputs.prompt`が文字列のノードを汎用的に拾う分岐を追加(`metadata-tab.js`/`node_sets_menu.js`に既にあったプロンプト抽出と同じ判定パターン)。GenerateUIとLabタブは共に同じ`comfyUI.currentAnalysis`を参照する設計だったため、この一箇所の修正でPromptタブとLabのキーフレーム書き込みの両方が動画ワークフローに対応した。画像(first_frame)は既存のLoadImage検出がそのまま拾う。あわせて、動画生成は静止画より大幅に時間がかかるため`comfyWorkflow.isVideoWorkflow(analysis)`ヘルパーを新設し、動画ワークフロー検出時はGenerateUI/Labとも生成タイムアウトを30分に延長。GenerateUIの結果プレビューは`<img>`固定だったため動画結果が正しく表示できなかった問題も、`<video>`要素を追加し出力ファイルの拡張子で出し分けるよう修正した。
**2. バグ修正: Labタブのindex imageが真っ黒になる**: 実機確認で発覚。コンタクトシート生成(`_buildIndexImageDataUrl`)が各結果を`<img>`要素として読み込もうとしており、mp4は画像として読み込めず失敗、そのセルはcanvasの黒背景がそのまま残っていた。動画結果は既存のchain image機能で使っていた最終フレーム抽出ロジック(`extractLastFrameBlob`、`<video>`+`<canvas>`でクライアント側完結)を再利用してフレームを取り出してから描画するよう修正。
**3. バグ修正: LabタブKsampler列が動画ワークフローでも表示される**: 「Model同様に該当ノードがなければ非表示にしたい」との要望に対し当初`sampler_nodes.length > 0`で判定したが、実機確認で「まだ表示される」との報告。原因はMiniMax H3のサブグラフ内部に実際に`SamplerCustomAdvanced`が配線されており(内部プリセットの一部で、ユーザーが調整すべきものではない)、単純な有無判定では引っかからなかったこと。判定を`comfyWorkflow.isVideoWorkflow(analysis)`ベースに切り替え、動画ワークフロー全体ではKsampler列自体を常に非表示にするよう修正した。
**4. Videoタブ拡張: Frame抽出 / アニメーションGIF変換**: Eagleプラグイン(video-to-frame, video2gif)を参考に要望された2機能。Eagle版はNode.js+ffmpegバイナリ直接呼び出しの実装だったため、ComfyUI-Workflow-Studioの構成(Python/aiohttpバックエンド)に合わせて設計し直した。フレーム抽出は`<video>`+`<canvas>`でブラウザ完結(サーバー往復・追加依存なし)。GIF変換はユーザー確認の上サーバー側実装を選択:PyAV(デコード)+ Pillow(GIFエンコード)— どちらもComfyUI本体が既に要求している依存のため、ffmpegバイナリや新規ライブラリの追加インストールは不要。`py/services/video_service.py` / `py/routes/video_routes.py`を新規追加し、`folder_paths.get_save_image_path()`でComfyUI標準の自動採番保存パターンをそのまま踏襲。合成テスト動画(PyAVで生成)を使いvenv環境でデコード→GIFエンコードの実処理を検証済み。
- あわせてVideoタブの中央パネルを再設計:「結果」見出し/「まだ結果がありません」表示を廃止し、生成結果とドロップされた任意のローカル動画を同じプレビュー枠に統合、横に**Video Source**ドロップ/クリック選択エリア(Clearボタン付き)を新設。右パネルの「Properties」プレースホルダーを**Frame**/**GIF**の2タブに置き換え。生成結果に限らず任意の動画に対してFrame/GIF機能が使える設計にした。
**5. データ管理の監査とZIPフルバックアップ機能の新規実装**: 「設定のデータ管理を現在のバージョンで対応できているか確認してほしい」との依頼を受け、既存の`_DATA_FILES`(単一JSONバンドル方式)と実際のデータディレクトリを突き合わせ監査。**`civitai_cache.json`(3.6MB、CivitAI連携キャッシュ)がエクスポート対象から漏れていた**ことを発見し即修正。また、ヘルプが謳う「export all plugin data」に反し、フォルダ形式のデータ(`ai_skills/`、`lab_plan/`、`style/`)とSQLite DB(`tagger.db`)が単一JSONバンドル方式では原理的に扱えず完全に対象外になっていた点をユーザーに報告、ZIP形式のフルバックアップ機能を新規実装する方針で合意。`DATA_DIR`配下を丸ごとZIP化する`GET /api/wfm/settings/export-full`/`POST /api/wfm/settings/import-full`を追加(一時ファイル系`gmic_temp`/`thumb_cache`と、他custom_node(comfyui-impact-pack)へのシンボリックリンクである`wildcard/`のみ除外、`settings.json`はAPIキーを除外してから含める)。復元側はZip Slip対策(`../`等でDATA_DIR外に書き込もうとするエントリは`relative_to()`チェックでスキップ)を実装し、悪意あるZIPでの検証済み。
- 追加要望「デフォルトワークフローフォルダー(`user/default/workflows`)とwildcardフォルダー(`comfyui-impact-pack/wildcards`)もオプションでバックアップに含めたいが、インポートは除外し手動対応としたい」に対応:エクスポート画面にオプトインのチェックボックスを2つ追加、有効時はZIP内に`_external/`プレフィックスで格納し、復元処理は`_external/`配下のエントリを常にスキップする実装にした(他プラグイン/ComfyUI本体が管理する領域を自動上書きしないため)。実データ(ワークフロー535件・wildcard 34件)で検証済み。
**6. Send to LI node機能をGalleryタブにも追加 + ボタン名統一**: Image Editタブに既にあった「選択画像をComfyUIキャンバス上の選択中ノードのimageウィジェットへ送る」機能(`window.opener.wfmSendImageToSelectedNode`、`node_sets_menu.js`で定義されたクロスウィンドウ橋渡し)を、Galleryタブの選択画像にも使えるよう追加。Galleryの画像は任意のフォルダにあり得るため、既存の「Send GenUI Image」と異なりLoadImageノードの有無に依存せず、`/upload/image`でinputフォルダへアップロードしてからファイル名を書き込む方式にした。あわせてImage Edit側の既存ボタン名「Send to Workflow」を「Send to LI node」に統一(トースト文言・コメント・ヘルプも合わせて更新)。
**7. Galleryタブ ✕クリアボタンの位置移動**: 「表示形式切替ボタン左隣に移動したい」との要望どおり、`wfm-gallery-clear-filters-btn`をSort selectとView切替ボタンの間から、View切替ボタン(Thumbnail/Table)の左隣へ移動。
**ヘルプ・README更新**: `project_v0336_conventions`の慣習(index.html + i18n.js 3言語 + app.jsのhelpIdMapの3点セット)に従い、Video Tab(Video Source/Frame/GIFの3項目)、Lab subtab(Ksampler非表示・chain image動画対応の項目文言修正)、Settings(Data Managementのフルバックアップ・オプション外部フォルダの2項目)、Gallery Tab(Send to LI nodeボタンの項目)のヘルプ本文を英語・日本語・中国語の3言語で追加・更新。README.mdはVideo Tab(Frame/GIFタブ、Video Sourceパネル)、GenerateUI Tab(動画ワークフロー対応)、Lab subtab(動画ワークフロー対応・chain image動画対応、バージョン見出し範囲更新)、Settings Tab(Data Management更新)、Gallery Tab(Send to LI node・✕クリアボタン位置)、Image Edit Tab(ボタン名統一)を更新。
**検証**: 全JS/Pythonファイルを`node --check`/`ast.parse()`で構文確認。GIF変換・フルバックアップZIP・Zip Slipガードはvenv Python環境で実データ・合成テストデータに対する実処理検証を実施(PyAVで生成した合成テスト動画のフレーム抽出→Pillow GIFエンコード、実際のデータディレクトリ(civitai_cache.json含む36ファイル・約2.6MB)のZIP化、悪意あるパストラバーサルZIPでのスキップ確認、外部フォルダオプション有効時のワークフロー535件・wildcard 34件の`_external/`格納とインポート時全skipの確認)。開発元gitリポジトリと実行時`custom_nodes`フォルダは別実体のため([[project_dev_deploy_sync]]参照)、変更・新規ファイルを都度両フォルダへ同期し改行コード差異を除いた`diff`で完全一致を確認、Pythonファイル追加時は`__pycache__`を都度クリア。動画ワークフロー対応・Labバグ修正・Videoタブ新機能・Send to LI node機能はユーザー自身の実機確認で動作を確認済み。
**How to apply**: `analyzeWorkflow()`のような中央解析関数に新しいノードパターンの検出を1箇所追加するだけで、それを参照する複数タブ(GenerateUI/Lab)に同時に効果が及ぶ設計は、機能追加のコストを大きく下げる — 逆に言えば、新しいワークフロータイプに対応する際はまずこの中央解析関数を疑うべき。「該当ノードが無ければ列を非表示にする」系の判定は、`sampler_nodes.length`のような表面的なノード種別の有無だけでなく、そのノードが「ユーザーが調整すべき設定」を表しているか(動画生成モデル内部に固定配線されたサンプラーのように、単に存在するだけでは判定材料にならない場合がある)を意識する必要がある。「all plugin data」のような謳い文句を持つ機能は、実装が実際にその範囲をカバーしているか定期的に実データと突き合わせて監査する価値がある — 今回`civitai_cache.json`の漏れは3.6MBというサイズながら発見されていなかった。
関連: [[project_v050_video_tab]], [[project_v051_mp4_metadata]], [[project_dev_deploy_sync]], [[project_v0336_conventions]]
---
## v0.5.1
### 機能追加: mp4動画の埋め込みメタデータ対応(Gallery Prompt/JSON・Metadataサブタブ・サイドパネルIタブ)+ Gallery Infoタブに寸法/再生時間表示 + MiniMax H3等オールインワン動画ノードのプロンプト抽出バグ修正
v0.5.0で追加したmp4 Gallery対応(一覧・サムネイル・再生のみ)に続き、「ギャラリータブでmp4のメタデータのプロンプトを表示できるようにしたい。メタデータタブでもプロンプト、表示可能ならモデル等も表示させたい。またInfoタブで画像サイズ、再生時間も表示したい」との要望を起点に着手。Eagleでmp4のプロンプト/Steps/Sampler/Seed/Modelが見えている実例(MiniMax H3で生成した`.mp4`)を手がかりに、ComfyUIの`SaveVideo`がmp4にどう埋め込んでいるかを`ffprobe`/実PyAVで直接確認した上で実装した。
**1. 埋め込み形式の実地調査**: `ffprobe -show_format`で対象mp4を調べたところ、PNGのtEXtチャンクと全く同じキー名(`workflow`=UI形式寄りの内容、`prompt`=API形式)でJSON文字列がコンテナレベルのformatタグとして書き込まれていた。バイト単位で追うと`moov > udta > meta > (hdlr, keys, ilst)`という、iTunes系メタデータ(`mdta`名前空間の`keys`/`ilst`)の構造になっており、FFmpegの`movflags=+use_metadata_tags`相当の書き込み方だと判明。ComfyUI側は`comfy_api/latest/_input_impl/video_types.py`の`write_output_metadata()`がPyAV経由で`container.metadata[key] = json文字列`する実装。
**2. バックエンド(`py/services/gallery_service.py`)**: 既存の`serve_thumbnail()`が動画フレーム抽出に使っていた`av`(PyAV)依存を再利用し、`_read_mp4_metadata()`(`container.metadata`からタグ辞書を取得)と`_read_media_dimensions()`(画像はPillowの`Image.size`、動画はPyAVの`stream.width/height`+`container.duration`)を追加。`get_image_metadata()`・`_extract_embedded_workflow()`にmp4分岐を追加し、既存のPNG向けワークフロー抽出ロジック(`workflow`/`prompt`優先順位の切り替え)をそのままmp4にも適用した。venv Pythonで`GalleryService`を直接呼び出すE2E検証、および実mp4に対する`ffprobe`/PyAVの値の突き合わせ(幅高さ608×352, 再生時間3.042秒, workflow/promptタグ長一致)で正しさを確認済み。
**3. Galleryタブ Infoサブタブ**: 幅×高さ(画像)または再生時間(動画)を表示する行を追加(`gallery-tab.js` `renderDimensionInfo()`)。既存のPrompt/JSONタブは`extract_workflow_from_metadata`系のAPIをそのまま叩いているため、バックエンド対応だけでmp4でも自動的に動くようになった。
**4. Metadataサブタブ(Iタブ、`metadata-tab.js`)とサイドパネルIタブ(`web/comfyui/node_sets_menu.js`)**: どちらもドラッグ&ドロップされたFile自体(サーバー未経由のバイト列)を直接パースする設計のため、MP4のボックス構造(`moov→udta→meta→keys/ilst`)をブラウザ上で直接読む`readMP4MetaTags()`/`_readMP4MetaTags()`をゼロから実装(`findMP4Box`でサイズ/タイプ解決→ `keys`ボックスからキー名一覧 → `ilst`ボックスの`data`アトムから値を取り出し名前に対応付け)。Node.jsで実mp4のバイト列に対して単体テストし、`workflow`/`prompt`タグの内容がPyAV/`ffprobe`の結果と完全一致することを確認した。サイドパネルIタブは`metadata-tab.js`と同一ロジックを保持する独立した複製実装(ComfyUIネイティブ拡張のため別ファイル)のため、同じ変更を両方に適用。
**5. バグ発見・修正: オールインワン動画ノードのプロンプトが抽出されない**: 上記の実装後、実際のMiniMax H3出力mp4でPromptタブを確認したところ「プロンプトなし」と表示される問題を発見。原因は`MiniMaxH3ImageToVideo`のような、`CLIPTextEncode`系ノードを介さずノード自身の`prompt`入力に直接テキストを持つ「動画生成オールインワンノード」を、既存の`isTextEncoderNode()`判定(クラス名に`TextEncode`を含むかで判定)が拾えていなかったこと。`extractPromptsAPI()`(`metadata-tab.js`・`node_sets_menu.js`の両方)に、クラス名が`ImageToVideo`/`TextToVideo`を含み`inputs.prompt`が文字列のノードをtextMapへ直接投入する分岐を追加して解決(positive/negativeの区別が無いノードのため、フォールバックの`texts`バケットに載る)。
**6. ヘルプ更新**: Gallery Tab(Infoタブの寸法/再生時間表示、Formats行のMP4追加)、Metadata Tab(Supported Formatsカード)、Workflow Studio Library / Iタブ(サイドパネル)のヘルプ本文を英語・日本語・中国語の3言語(`i18n.js`)+ `templates/index.html`で更新。
**検証**: Python側は`GalleryService`をvenv Pythonで直接呼び出すE2Eテストと実mp4への`ffprobe`/PyAVでの突き合わせ、JS側のMP4パーサーとプロンプト抽出ロジックはNode.jsで実バイト列/実JSONに対する単体テストで検証。開発元gitリポジトリと実行時`custom_nodes`フォルダは別実体のため([[project_dev_deploy_sync]]参照)、変更ファイル(`gallery_service.py`, `gallery-tab.js`, `metadata-tab.js`, `node_sets_menu.js`, `i18n.js`, `templates/index.html`, `README.md`, `pyproject.toml`)を両フォルダへ同期し改行コード差異を除いた`diff`で完全一致を確認。ComfyUI実機でのブラウザ操作確認はユーザー側で実施済み(Gallery Prompt/JSON表示、サイドパネルIタブとも問題なしとの回答)。
関連: [[project_v050_video_tab]]
---
## v0.5.0
### 機能追加: mp4動画Gallery対応 + Videoタブ新設(MiniMax H3専用) + バグ修正: Galleryのタグ/メモが再起動後に消える
動画生成ワークフロー対応の第一弾。「1. 動画ファイルmp4対応 2. 動画生成に対応していきたい。まずはminimax_H3動画生成ワークフローに対応させたい」との要望を起点に、実機フィードバックを重ねながら仕上げた一連の作業。ブランチ`feature/mp4-video-gallery-and-video-tab`で実施。
**1. Galleryタブのmp4動画対応**: `.mp4`を`IMAGE_EXTENSIONS`に追加し、一覧・お気に入り・タグ・グループ・移動・削除・エクスポートなど既存の画像操作全てにmp4も対象として乗るようにした。サムネイルはPillowで開けないため、PyAV (`av`) で先頭フレームを抽出しJPEGとしてディスクキャッシュする専用ロジックを追加(ComfyUI本体が既に`av>=17.0.0`を要求しており追加インストール不要。未導入環境ではサムネイル生成のみ失敗しプレースホルダー表示にフォールバックする設計)。フロントエンドは詳細パネル・lightbox・Compareビューで拡張子に応じて`<img>`/`<video controls>`を出し分け、サムネイルグリッドには▶バッジを重ねて動画であることを示す。
**2. 新規Videoタブ(MiniMax H3専用、GenerateUIタブとは完全に独立)**: `C:\Users\...\ComfyUI_5\user\default\workflows\minimax_test.json`をリファレンスに、first_frame/last_frame/prompt/aspect_ratio/megapixels/multiple/duration/noise_seedのフォームを持つ新規タブ`video-tab.js`を作成。モデル選択(UNet/CLIP/VAE/Audio VAE)はワークフローの既定値に固定し編集不可とした(ユーザー確認済み)。`comfyWorkflow.convertUiToApi()`が既にサブグラフのflatten処理を内蔵していたため、Videoタブ独自のグラフ→プロンプト変換は不要で、生成そのものは既存の`comfyUI.generate()`をそのまま再利用できた(ComfyUI本体の`SaveVideo`/`PreviewVideo`が`{"images":[...], "animated":true}`という画像と同じレスポンス形式で動画を返すため)。
**3. 実機フィードバックへの追随(ボタン配置・色・レイアウト)**: 一連の実機確認を経て、(a) Galleryの詳細パネルのダウンロードオーバーレイが動画の再生コントロール操作をブロックするため廃止し、Taggerボタン右隣に常時表示の「Download」ボタン(識別しやすいようオレンジ色)を新設、「Load GenUI」ボタンは「GenUI」に短縮、(b) Workflowタブのモーダルにあった「生成UIに読み込み」「Videoに読み込み」「キャンバスへ送る」の3ボタンを廃止し、一覧選択時のサイドパネルツールバー(生成UIに読み込みの右隣に新規追加した「Videoに読み込み」)へ統合、(c) Videoタブの結果パネルの位置・サイズを繰り返し調整 — 最終的に**3ペイン構成**(左:フォーム/中央:プレビュー+将来の編集機能用プレースホルダー/右:将来のプロパティ機能用プレースホルダー)に落ち着いた。各ペインを独立したflexカラムにしたことで、中央の生成結果の高さがどれだけ変わっても左右のペインの位置が動かなくなる(`max-height`だけで高さを抑えていた前段の実装では、動画のコントロールバー分だけ実高さが伸び、下のフォームパネルを押し下げてしまっていた)。Kapture経由で実際のブラウザDOM(`getBoundingClientRect()`)とスクリーンショットを直接確認しながら調整した。
**4. First Frame/Last Frameを両方optionalに、LoadImageノードが無いワークフローにも対応**: 「First Frameなしでも動作させたい(ノードをバイパスで処理)。またノードのないワークフローにも対応させたい」との要望。`minimax_test1.json`(first_frame/last_frame双方とも未接続、対応するLoadImageノードがトップレベルに存在しない構成)を新たに確認し、`locateMiniMaxNodes()`のLoadImageノード必須チェックを撤廃。first_frame未指定時はリンクなしのまま実行(バイパス)し、画像が指定された場合のみその場でLoadImageノードを動的に注入する設計に変更(ノードID/リンクIDはclone内の実際の最大値+1で採番するため重複の心配がない)。first_frameスロットにもlast_frameと同様のClearボタンを追加した。
**5. バグ修正: mp4のタグ/メモがComfyUI再起動後に消える**: 「タグ、メモadd、保存操作はできるが記録されていない。画像ファイルもできていない。エラー表示はなし、ブラウザもなし」との報告を受け、`comfyui_8189.log`を直接確認したところ`Cleaned up 189 stale metadata entries from ...\Text2Img`という決定的なログを発見。**根本原因**: `cleanup_stale_images()`は「現在表示中のフォルダ配下」のメタデータキーを全階層(サブフォルダ含む)対象にstale判定するが、Galleryがルートフォルダを非再帰スキャンした場合、`existing_paths`(現在のファイル一覧)にはルート直下のファイルしか含まれない。Videoタブで生成した動画は`SaveVideo`の`filename_prefix`設定で`video/MiniMax_H3/`というサブフォルダに保存されるため、ルートフォルダを開くたびに「サブフォルダ内ファイルは非再帰スキャンには映らない→存在しないと誤判定→メタデータ削除」が発生し、189件ものタグ/メモ/お気に入り情報が消えていた。`cleanup_stale_images()`に`recursive`引数を追加し、非再帰スキャン時はfolder_path直下のみを対象にするよう修正(`gallery_service.py`の`list_images()`から`recursive`をそのまま伝播)。既に削除済みのデータはバックアップが無く復元不可能だった旨をユーザーに伝えた。
- 副次的に発見したフロントエンドのバグも合わせて修正: `saveMetaField()`がサーバーのレスポンス(`{"ok": bool}`)を一切チェックせず常に成功したかのようにローカル状態を楽観的更新していたため、サーバー側で保存が拒否されてもUI上はエラーなく成功したように見えてしまう作りになっていた。レスポンスの`ok`フィールドを検証し失敗時は例外を投げるよう変更、`addTag`/`removeTag`/メモ保存ハンドラは戻り値を見て成功時のみローカル状態を更新するよう修正した。保険的措置として`save_image_meta`(バックエンド)の保存キーも`get_image_metadata`と同じ`resolve()`後のパスに統一した。
**ヘルプ・README更新**: `project_v0336_conventions`の慣習(index.html + i18n.js 3言語 + app.jsのhelpIdMapの3点セット)に従い、新規Video Tabヘルプページを追加。README.mdはバージョンバッジ更新、Workflow Tab(サイドパネルツールバーの3ボタン構成)、Gallery Tab(Downloadボタンの新配置・mp4対応・GenUIボタンへの改名)、新規Video Tabセクション(3ペイン構成・optional First/Last Frame・ノードなしワークフロー対応)を追加した。
**検証**: 全JS/Pythonファイルを`node --check`/`ast.parse()`で構文確認。開発元gitリポジトリと実行時`custom_nodes`フォルダは別実体のため([[project_dev_deploy_sync]]参照)、変更した全11ファイルを都度同期しmd5ハッシュ比較で完全一致を確認、Pythonファイル変更時は`__pycache__`を全クリア。Kapture(ブラウザDevTools連携)で実際のブラウザに接続し、DOM要素の`getComputedStyle()`/`getBoundingClientRect()`とスクリーンショットで3ペインレイアウトの実測検証、生成後状態はダミー画像をDOMに直接注入して左右ペインが動かないことを確認。mp4のGallery表示・再生、タグ/メモ保存とComfyUI再起動後の永続性、Workflowタブの新規ボタン導線はユーザー自身の実機で確認済み。
**How to apply**: サーバーAPIが常にHTTP 200を返し成否をレスポンスボディの`ok`フィールドで表す設計(このプロジェクト全体で頻出するパターン)では、呼び出し側で必ずそのフィールドをチェックする — でないと「操作はできるがエラーも出ず、実は保存されていない」というサイレント障害が発生し得る。複数のパネルを横並びに配置するレイアウトで「あるパネルの内容量に応じて他のパネルの位置がずれる」不具合が出た場合、`max-height`のような上限指定では実コンテンツが小さいときに縮んでしまい根本解決にならない — 各パネルを独立したflexカラムに分離し、パネル間で高さを共有させない構造にするのが確実。「フォルダ配下」を対象にした一括処理(今回のstale cleanup)を書く際は、その処理が使う「現在のファイル一覧」がフォルダの全階層をカバーしているか(非再帰スキャンならサブフォルダは含まれない)を必ず確認し、範囲の不一致がないか意識する。ブラウザで実際に何が起きているか切り分けが必要な場面では、コードを読むだけでなくKapture等でDOMの実測値を直接取得するのが最も確実。
関連: [[project_dev_deploy_sync]], [[project_v0336_conventions]]
---
## v0.4.8
### 機能追加: LabタブにPromptグループ一括適用+キーフレーム並べ替え + バグ修正: デフォルトワークフローの上書き保存が反映されない + Styleテーブルの「このファイルへ追加」対応
ユーザーからの複数の要望・不具合報告を1セッションで順に実装した一連の作業。
**1. LabタブPrompt列に「PG」ボタン — Promptタブのグループをキーフレームへ一括変換**: 「生成UIタブのLabのプロンプトにプロンプトタブのグループを使用できるようにしたい。'PG'ボタンを配置、モーダルでプロンプトのグループを選択、決定するとプロンプトのキーフレームが#1から自動で作成されます(#1は上書き)」との要望。`prompt-presets.js`の`pmGroups`(グループ名→プリセットID配列)を参照する`getPresetsInGroup()`を新設してexportし、`lab-tab.js`側にPresetManagerの一覧UI(`.wfm-pm-item`)を再利用したグループ選択モーダルを実装。選択→適用で`_lab.columns.prompt`をグループ内プリセット順に#1から全置換(#1は上書き、以降は#2,#3...)する。グループのプリセット数がBatch数を超える場合はBatch数を自動引き上げ(Batch入力欄自体の上限50でキャップ)、それでも収まらない分は既存の「Batchを超えたキーフレーム」警告トースト(`_warnIfKeyframesExceedBatch`)をそのまま再利用して通知する形にした。
**2. Lab: Model/Prompt/KSampler キーフレームの並べ替え**: 続けて「モデル、プロンプト、Ksamplerそれぞれでキーフレームの順変更を可能にしたい。キーフレームのモーダル展開をWクリックに変更しシングルクリックでキーフレームを選択、PGボタン左隣に上下ボタンを設置し操作可能にしたい」との要望。キーフレームセルのクリック挙動を分離し、シングルクリックは選択状態(列ごとに`_selectedIdx[col]`で管理、青枠でハイライト)、ダブルクリックで従来の編集モーダルを開くように変更。各列ヘッダーに▲/▼ボタンを追加し(Promptは要望通りPGボタンの左隣)、選択中のキーフレームと隣接するキーフレームの`atIteration`を入れ替えることで並び順を変更する実装にした。キーフレーム#1(ベースライン — GenerateUIのライブ値を表示する特別な行)は移動不可、かつ他のキーフレームが#1の位置に入れ替わることもないよう制約した。Prompt Group適用・Plan読込・Plan Clearなど列を丸ごと置き換える操作では選択状態を自動リセットするようにし、配列外を指す不整合を防いだ。
**3. バグ修正: デフォルトワークフローに設定した状態で同名上書き保存すると変更が反映されない**: 「生成UIタブで読み込んだデフォルトワークフローのモデルを変更しワークフローを同名で上書き保存した。ワークフロータブでJSONでモデルが変更していることを確認。ブラウザハード再読み込みを行うと以前のモデルが表示される」との不具合報告(スクリーンショット添付、旧モデル名がインストール済みモデルの一覧に無く「見つかりません」警告が出ている状態)。調査の結果、「デフォルトワークフローに設定」機能(`workflow-tab.js`)は設定した時点のワークフローJSON全体を`localStorage`(`wfm_settings.defaultWorkflowData`)へスナップショットとして保存し、起動時の自動読込(`generate-tab.js`)はこのスナップショットを読む仕様であることが判明。GenerateUIタブでの同名上書き保存はファイル自体は更新するが、このスナップショットまでは更新していなかったため、リロードのたびに保存前の古い内容が復活していた。`saveCurrentWorkflow()`の保存成功後処理に、保存したファイル名が現在の`defaultWorkflow`と一致する場合は`defaultWorkflowData`も同時に更新する処理を追加して修正した。
**4. Prompt Tab Tableビュー Styleタブに「+ Add to this file」対応**: 「プロンプトタブ、テーブルのスタイルにForm同様に既存のjsonファイルに追加する方法が欲しい(custom.json以外の場合)。該当jsonのスタイルを選択状態で+ Add to this fileボタンで追加できるようにしたい」との要望。Formタブのスタイルマネージャー(`prompt-styles.js`)には既にこの機能があったが、Tableビュー(`prompt-table.js`)の新規スタイル作成は常に`custom.json`固定(`styleApiCreate(..., null)`)だった。行選択が1件かつそのスタイルの`file`が`custom.json`以外の場合のみ有効化される「+ Add to this file」ボタンをツールバーに追加し、クリックすると保存先ファイルを保持したまま空の新規行を追加(File列に保存前からバッジ表示)、保存時に`styleApiCreate(name, pos, neg, pendingNewStyleFile)`で対象ファイルへ追記する実装にした。バックエンド(`settings_routes.py`)は元々`file`パラメータでの追記に対応済みだったため、フロントエンドの導線を追加するだけで実現できた。
**ヘルプ・README更新**: `project_v0336_conventions`の慣習(index.html + i18n.js 3言語 + app.jsのhelpIdMapの3点セット)に従い、Lab subtab(Setting/Columnsカードへ選択・並べ替えとPGボタンの説明2項目)とPrompt Tab(Table Viewカードへ「+ Add to this file」の説明1項目)を追加。README.mdはGenerateUI Tab(Saveボタン説明にデフォルトワークフロースナップショット修正の注記)、Lab subtab(見出しのバージョン範囲をv0.4.8へ更新、選択/並べ替えとPGボタンの新規項目)、Prompt Tab(Styleテーブルの項目に「+ Add to this file」のTableビュー対応を追記)を更新した。
**検証**: 全JSファイルを`node --check`で構文確認。開発元gitリポジトリと実行時`custom_nodes`フォルダは別実体のため([[project_dev_deploy_sync]]参照)、変更ファイルごとに改行コード(CRLF/LF)の一致を確認してから同期し、都度`diff`で完全一致を検証した。デフォルトワークフローのバグ修正はユーザー自身の実機(GenerateUIでの上書き保存→ハード再読み込み)で確認済み。PGボタン・キーフレーム並べ替え・Styleの「+ Add to this file」もユーザー自身の実機確認で動作を確認済み。
**How to apply**: 開発元リポジトリと実行時`custom_nodes`フォルダへの同期前には必ず`file`コマンドで両ファイルの改行コードが一致しているか確認する(過去に一部ファイルだけLF化していた事例があるため — [[project_dev_deploy_sync]]参照)。一致していれば単純な`cp`で安全にデプロイでき、`diff`で完全一致を最終確認する。キーフレームや行の「並べ替え」機能を実装する際、内部的にソート順を保持する配列(今回は`atIteration`昇順)に対しては、配列そのものの並べ替えではなく「隣接要素同士でソートキーの値を交換する」実装にすると、他のロジック(`_resolveKeyframe`等)が前提とする「配列は常にソート済み」という不変条件を崩さずに済む。
関連: [[project_dev_deploy_sync]], [[project_v0336_conventions]]
---
## v0.4.7
### 機能追加: Prompt Tab内部リファクタ + Gallery Promptタブ新設 + Send to Canvas改善 + Presetsソート
+13 -10
View File
@@ -26,33 +26,33 @@ 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.4.7-green)
![Version](https://img.shields.io/badge/version-0.5.4-green)
## Features (tab -> feature names)
### Workflow Tab
Thumbnail / Table views, Thumbnail side panel, Badge filtering, Search, Side panel tabs, Badge management, AI summary, Import / Export, Default view setting, Search clear (✕), Clear all filters (✕ Clear)
Thumbnail / Table views, Thumbnail side panel, Badge filtering, Search, Side panel tabs, Badge management, AI summary, Import / Export, Side panel toolbar buttons, Default view setting, Search clear (✕), Clear all filters (✕ Clear)
### Canvas Snapshot (v0.1.2)
One-click capture, Auto-save as thumbnail, Embedded workflow metadata, Auto-import
### GenerateUI Tab (v0.3.5)
6-tab layout, Save button, Input tab, Model tab, Settings tab, Always-visible Raw JSON, Bypass/Mute node handling, One-click generation, Seed control, Style selector, Create Catalog / Catalog buttons, Batch type selector, Batch tab, UI-to-API conversion, Eagle integration
6-tab layout, Save button, Input tab, Model tab, Settings tab, Always-visible Raw JSON, Bypass/Mute node handling, One-click generation, Seed control, Style selector, Create Catalog / Catalog buttons, Batch type selector, Batch tab, UI-to-API conversion, Video workflow support, Eagle integration
### Feeder subtab (v0.3.5 / v0.3.42)
ImageFeeder node control, Image library, Selection management, Presets, Continuous Run loop, Index sync, Seed, WFS_GalleryFeeder node, Node & group selector, Image grid, After Gen modes, Run / Stop controls
### Lab subtab (v0.3.87 – v0.4.5)
Setting / Results / Plan JSON sub-panels, Per-column keyframes, Model column — Checkpoint / LoRA Single / VAE, Empty state when no matching node exists, Wildcards, Prompt cell extras, Keyframe #1 live-reflect, Bypass checkbox, LoRA node bypass & prompt injection, T2I workflow support, Use generated image for next, Workflow recall, Plan files, Plan Load, Plan JSON tab, Save index image to Output on Run, Index images are self-contained plan files, Eagle integration
### Lab subtab (v0.3.87 – v0.5.2)
Setting / Results / Plan JSON sub-panels, Per-column keyframes, Model column — Checkpoint / LoRA Single / VAE, Empty state when no matching node exists, Wildcards, Prompt cell extras, Keyframe #1 live-reflect, Bypass checkbox, LoRA node bypass & prompt injection, T2I workflow support, Use generated image for next, Workflow recall, Plan files, Plan Load, Plan JSON tab, Save index image to Output on Run, Index images are self-contained plan files, Eagle integration, Select vs. edit, and keyframe reordering, PG — apply a Prompt tab preset group, Video workflow support, Use generated image for next, now video-aware
### Prompt Tab
3-column layout, AI chat assistant, Image attachment, Translation, Prompt presets, Preset Manager, Group management, Clipboard copy, GenUI Set, Wildcard/Style tab bar, Wildcard input toolbar, Wildcard file manager, Style manager, Form / Table toggle, Table view — Presets / Presets Group / Wildcards / Style
### Settings Tab
2-column layout, Collapsible sections, Theme selection, Theme customization, Workflows directory, Gallery output directory, Eagle connection, Ollama connection, CivitAI Host, CivitAI API Key, Default workflow, Default Checkpoint, Data Management, Text Size, RAW JSON Colors, GenerateUI Model Tab Highlight, Wildcard Integration, G'MIC-Qt Integration, Language
2-column layout, Collapsible sections, Theme selection, Theme customization, Workflows directory, Gallery output directory, Eagle connection, CivitAI Host, CivitAI API Key, Default workflow, Default Checkpoint, Video Playback Volume, Data Management, Text Size, RAW JSON Colors, GenerateUI Model Tab Highlight, Wildcard Integration, G'MIC-Qt Integration, Language
### Gallery Tab (v0.3.44)
Output / ImagePrompt / Style_Catalog / Metadata sub-tabs, Image browser, Folder tree root label, Thumbnail / Table views, Folder management, File operations, Download, Multi-select, Image Compare, Prompt search, Server-side filtering, Group management, Thumbnail F button, Favorites, Detail panel, Prompt tab, Workflow viewer, Load GenUI button, Image Edit button, Send GenUI Image button, Send CC button, Search clear (✕), Clear all filters (✕ Clear), Workflow auto-save, Output folder configurable, SVG file support, Performance
Output / ImagePrompt / Style_Catalog / Metadata sub-tabs, Image browser, Folder tree root label, Thumbnail / Table views, Folder management, File operations, Download, MP4 video support, MP4 embedded metadata, Info tab: dimensions & duration, Multi-select, Image Compare, Prompt search, Server-side filtering, Group management, Thumbnail F button, Favorites, Detail panel, Prompt tab, Workflow viewer, GenUI button, Image Edit button, Send GenUI Image button, Send to LI node button, Send CC button, Search clear (✕), Clear all filters (✕ Clear), Workflow auto-save, Output folder configurable, SVG file support, Performance
### ImagePrompt Gallery subtab (v0.3.94, renamed from Style/Prompt in v0.3.95)
Visual prompt library, 3-column layout, Prompt builder (right pane), Plain-text prompt storage, ponyxlWildcardsVault format support, Seed data importer
@@ -61,7 +61,7 @@ Visual prompt library, 3-column layout, Prompt builder (right pane), Plain-text
Visual Style picker, 3-column layout, Positive/Negative panel, Select as Style button, Load in GenerateUI / Open in Metadata Tab buttons, Double-click to enlarge
### Metadata Gallery subtab (v0.3.8, moved from a top-level tab in v0.4.6)
Now inside Gallery, 3-column layout, File drop, Model extraction, LoRA extraction, Prompt extraction, Prompt actions, Format support, Format note
Now inside Gallery, 3-column layout, File drop, MP4 embedded metadata, Model extraction, LoRA extraction, Prompt extraction, Prompt actions, Format support, Format note
### Nodes Tab (v0.1.7)
Node Browser, Search & Filter, Package badges, Node detail panel, Node Sets, Right-click context menu, Multi-select, Search clear (✕), Clear all filters (✕ Clear)
@@ -70,13 +70,16 @@ Node Browser, Search & Filter, Package badges, Node detail panel, Node Sets, Rig
Model Browser, Thumbnail / Table views, Table column sort, Search & Filter, User-defined badges, Side panel tabs, CivitAI integration, CivitAI panel — Info / Sample sub-tabs, CivitAI panel states, Batch CivitAI fetch, Detail modal, GenUI Model button, Group management, Table view memo, Preview images, Enable / Disable models, Multi-select & bulk operations, Search clear (✕), Clear all filters (✕ Clear)
### Tagger Tab (v0.3.38)
3 sub-tabs, Model support, Threshold sliders, Ollama VLM, Single tab, Single output options, Batch tab, DB tab, Dependencies
3 sub-tabs, Model support, Threshold sliders, VLM tagging, Single tab, Single output options, Batch tab, DB tab, Dependencies
### Image Edit Tab (v0.3.65)
Layer-based image editor, Loading images, New button, Tools, Layer panel, Layer lock, Text quality, Export, Canvas navigation, Undo / Redo
### Video Tab (v0.5.0 – v0.5.4)
Dedicated video generation UI, independent of GenerateUI, 3-pane layout, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, Preview frame + Video Source panel, Frame tab, GIF tab, Playback volume
### AI TOOL Tab (v0.3.14)
4-pane layout, Translation pane, Chat pane, Chat pane — image generation via Tool Calling, Chat pane — generate_image extra parameters, TOOLS pane (VLM), TOOLS pane — shared Chat attachment, TOOLS pane (Wildcards), Chat pane — image-to-image (I2I), Chat pane — SVG generation, no ComfyUI workflow involved, Chat pane — Skills, Settings pane, Unsloth backend, Settings pane — Chat Image Generation, Settings pane — Chat I2I Generation, Settings pane — Generation, Settings shared, Backend support, URL security, Lemonade's other endpoints (not integrated)
4-pane layout, Translation pane, Chat pane, Chat pane — image generation via Tool Calling, Chat pane — generate_image extra parameters, TOOLS pane (VLM), TOOLS pane — shared Chat attachment, TOOLS pane (Wildcards), Chat pane — image-to-image (I2I), Chat pane — SVG generation, no ComfyUI workflow involved, Chat pane — Skills, Settings pane, Unsloth backend, Settings pane — Chat Image Generation, Settings pane — Chat I2I Generation, Settings pane — Generation, Model unload, Settings shared, Backend support, URL security, Lemonade's other endpoints (not integrated)
### Workflow Studio Library (ComfyUI Side Panel) (v0.3.9)
Tab layout (W / N / P / M / I / A), W — Workflows tab, N — Nodes tab, M — Models tab, P — Prompts tab, I — Information tab, A — AI TOOL tab, Drag & drop workflows, Drag & drop nodes, Drag & drop prompts, Send to Canvas, Copy prompts, Double-click, Search, ⚙ Theme settings
+65 -32
View File
@@ -22,7 +22,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.4.7-green)
![Version](https://img.shields.io/badge/version-0.5.4-green)
## Screenshots
@@ -30,29 +30,25 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
| :-------------------------------------: | :---------------------------------: |
| ![Workflow Tab](docs/1_workflowtab.png) | ![Models Tab](docs/2_modelstab.png) |
| Prompt Input Assistance | Gen UI Feeder |
| :----------------------------------------------------------: | :---------------------------------------: |
| ![Prompt Input Assistance](docs/3_PromptInputAssistance.png) | ![Gen UI Feeder](docs/4_GenUI_feeder.png) |
| Prompt Input Assistance | GenUI Batch |
| :----------------------------------------------------------: | :-------------------------------------: |
| ![Prompt Input Assistance](docs/3_PromptInputAssistance.png) | ![GenUI Batch](docs/10_GenUI_Batch.png) |
| GenUI LoRA Stack | GenUI Batch |
| :---------------------------------------------: | :-------------------------------------: |
| ![GenUI LoRA Stack](docs/9_GenUI_LoraStack.png) | ![GenUI Batch](docs/10_GenUI_Batch.png) |
| Models Multi-select Menu | Top Bar |
| :-----------------------------------------------------------: | :---------------------------: |
| ![Models Multi-select Menu](docs/11_multiple_select_menu.png) | ![Top Bar](docs/5_topbar.png) |
| Top Bar | Image Edit Tab |
| :----------------------------: | :--------------------------------------: |
| ![Top Bar](docs/5_topbar.png) | ![Image Edit Tab](docs/13_ImageEdit.png) |
| WS Library | Library Information |
| :----------------------------------: | :---------------------------------------------------: |
| ![WS Library](docs/6_ws_library.png) | ![Library Information](docs/7_library_Infomation.png) |
| Tagger Tab | Image Edit Tab |
| :-------------------------------: | :--------------------------------------: |
| ![Tagger Tab](docs/12_Tagger.png) | ![Image Edit Tab](docs/13_ImageEdit.png) |
| Video Tab | AI TOOL Tab |
| :----------------------------------: | :--------------------------------------: |
| ![Video Tab](docs/14_videotab.png) | ![AI TOOL Tab](docs/17_aitooltab.png) |
| Customize | |
| :--------------------------------: | :-: |
| ![Customize](docs/8_Customize.png) | |
| Lab Tab | Lab Index Image |
| :--------------------------------: | :------------------------------------------: |
| ![Lab Tab](docs/15_labtab.png) | ![Lab Index Image](docs/16_lab_index.png) |
---
@@ -69,6 +65,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **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; **Send to Canvas** button sends the selected workflow directly to the ComfyUI canvas (UI and API formats both supported)
- **Side panel toolbar buttons** (v0.5.0) — selecting a card shows three buttons in the top toolbar: **Load in GenerateUI**, **Load in Video** (loads a MiniMax H3 Image-to-Video, LTX-2.5 (Text/Image/First&Last-Frame to Video), or Wan2.2 (Text to Video) workflow into the Video tab (LTX-2.5/Wan2.2 support: v0.5.4); shows an error toast for workflows that don't contain a supported node), and **Send to Canvas**; the detail modal's duplicate copies of these three buttons were removed in favor of this single toolbar location
- **Default view setting** — persist your preferred view mode (Thumbnail / Table)
- **Search clear (✕)** — inline ✕ button appears inside the search box whenever text is entered; click to clear immediately
- **Clear all filters (✕ Clear)** — rightmost toolbar button; resets search text, group filter, and badge filter (ALL) in one click
@@ -90,6 +87,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **6-tab layout** — Input / Model / Settings / Feeder / Batch / **Lab** tabs; Input, Model, and Settings each include a Raw JSON column on the right for instant preview and direct editing
- **Save button** — located at the right end of the subtab row; opens a filename dialog (default: current workflow name) and saves the current workflow as a `.json` file to the Workflow tab via the import API; hidden while the Batch or Lab subtab is active (v0.4.6), since those work on workflow copies / their own Plan files rather than the currently loaded workflow
- **Default-workflow snapshot fix** (v0.4.8) — overwriting the loaded workflow under a filename that's currently set as the auto-load **Default workflow** (Settings tab, see below) now also refreshes that cached snapshot; previously only the file on disk was updated, so the old (pre-edit) version — including any checkpoint no longer installed — kept reappearing after every page reload until the default was re-set by hand
- **Input tab** — Prompt and Image inner tabs (drag-and-drop upload); Prompt tab shows Positive Prompt and Negative Prompt textareas, plus an **Embeddings selector** at the bottom (Filter + Select + Weight input + Paste button); Paste inserts `(embedding:Name:weight)` at the cursor position of the last focused textarea (defaults to Positive when neither is focused); Raw JSON (540px) in the right column
- **Revert button** (v0.3.70) — a ↺ button next to each Apply button reverts the textarea to the node's currently applied value (the reverse of Apply)
- **Emphasis weight editing** (v0.3.70) — select text (or just place the cursor on a word/parenthesis block) and press Ctrl+↑/↓ to adjust `(text:weight)` by ±0.05, A1111/native-ComfyUI style; parentheses are removed automatically when the weight returns to 1.0
@@ -115,6 +113,9 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **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
- **Lora batch prompt sync** (v0.3.69) — for each selected LoRA, its syntax (`<lora:name:strength_model:strength_clip>`) and CivitAI trained words are automatically appended to the Positive prompt (rebuilt from the original prompt each time, not accumulated), then restored to the pre-batch state when the batch completes or is stopped; if a selected LoRA is not yet recognized by ComfyUI's model list, a warning toast suggests a Refresh or restart
- **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 Guider-based "Advanced Sampling" workflows (`SamplerCustomAdvanced`/`SamplerCustom` + `CFGGuider`/`DualCFGGuider`/`BasicGuider` + `RandomNoise` + `KSamplerSelect` + `*Scheduler` — Flux.2 Klein, LongCat, Boogu, HiDream E1, etc.)
- **MultiType widget-value bug fix** (v0.5.4) — a node input declaring a comma-joined MultiType (e.g. LTX-2.5's `LTXVEmptyLatentAudio.frame_rate: "FLOAT,INT"`) was silently dropped from the widget list instead of being recognized as a scalar widget, which shifted every subsequent widget's value onto the wrong input (surfaced as `LTXVEmptyLatentAudio.batch_size` receiving `frame_rate`'s value and video generation failing with "Expected size 1 but got size 25")
- **Video workflow support** (v0.5.2) — loading a MiniMax H3 (or other all-in-one video-generation) workflow now works from GenerateUI too, not just the dedicated Video tab: the Input tab's Prompt field picks up its `prompt` widget, the Image tab picks up its LoadImage-based `first_frame` the same way any other I2I workflow does, and generation runs with a longer timeout since video generation takes much longer than a still image; the result preview shows the generated mp4 inline (`<video>`) instead of trying to render it as an image
- **LTX-2.5 / Wan2.2 support** (v0.5.4) — these follow ComfyUI's regular node-graph pattern rather than an all-in-one node, so they needed their own detection: Positive/Negative Prompt now traces through LTX-2.5's `LTXVDualCFGGuider`/`LTXVConditioning` nodes to the actual prompt text, and the Settings tab's Latent Image section recognizes Wan2.2's `EmptyHunyuanLatentVideo` and LTX-2.5's `EmptyLTXVLatentVideo` (width/height/batch size, plus an added **Length (frames)** field) instead of showing "No EmptyLatentImage node found"; the extended generation timeout now also triggers off a `SaveVideo`/`CreateVideo` node anywhere in the graph, not just an all-in-one node
- **Eagle integration** — auto-save generated images to [Eagle](https://eagle.cool/) with metadata
</details>
@@ -148,7 +149,7 @@ Two independent modes selectable via **[Image Loop] / [Gallery]** toggle buttons
</details>
<details>
<summary><h3>Lab subtab (v0.3.87 – v0.4.5)</h3></summary>
<summary><h3>Lab subtab (v0.3.87 – v0.5.2)</h3></summary>
An experimental batch generator: runs the workflow currently loaded in GenerateUI N times, letting Model (Checkpoint/LoRA Single/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. Works with both I2I and T2I workflows (v0.3.90).
@@ -170,6 +171,10 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Save index image to Output on Run** (v0.3.90, on by default since v0.3.93) — checkbox in the run controls; when checked, every completed Run also builds the same contact-sheet index image used for Plan files and saves it directly into ComfyUI's own Output folder as `Lab_index_<counter>_.png` (auto-numbered like a normal generated image, right alongside the images that Run just generated); independent of Plan Save, which always writes its own copy next to the plan file regardless of this checkbox; saved with the plan as `save_index_on_run`
- **Index images are self-contained plan files** (v0.3.91) — every index-image PNG, whether from Plan Save/Save As or from Save index image to Output on Run, carries the entire plan embedded directly in the file as a PNG `wfm_lab_plan` chunk; this is what lets the Output-folder copy above work as a Plan Load source even though it has no matching `.json` anywhere
- **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; the Output-folder index image above is included too (v0.3.90) once saved
- **Select vs. edit, and keyframe reordering** (v0.4.8) — a single click on a keyframe cell now only selects it (blue outline); double-click to open its edit modal as before. Each column's header (Model / Prompt / KSampler) also gets **▲ / ▼** buttons that swap the selected keyframe with its immediate neighbor, reordering keyframes without retyping them; keyframe #1 (the live-reflecting baseline) can never move, and nothing can be swapped into its slot
- **PG — apply a Prompt tab preset group** (v0.4.8) — a **PG** button on the Prompt column header opens a picker for the Prompt tab's Table-view preset groups (the same groups the Batch tab's checklist uses); choosing one replaces the entire Prompt column with one keyframe per preset in that group's order, starting at #1 (#1 is overwritten, not appended after). If the group has more presets than the current Batch count, Batch count is raised automatically to fit (capped at 50, the Batch input's own limit); anything still beyond that shows the existing "keyframes beyond Batch count" warning instead of being dropped
- **Video workflow support** (v0.5.2) — loading a MiniMax H3 (or other all-in-one video-generation) workflow into GenerateUI and running Lab now works end to end: the Prompt column writes to its `prompt` widget, the KSampler column auto-hides (same "no matching node" treatment as Model sub-columns) since the sampler wired internally is a fixed part of the model's own preset rather than something meant to be tuned per keyframe, the Results grid plays mp4 results inline, and the contact-sheet index image draws each video result's last frame instead of failing silently onto a black square
- **Use generated image for next, now video-aware** (v0.5.2) — when a Run's output is a video, the "Use generated image for next" chain extracts its last frame client-side (canvas) and uploads it as the next iteration's source image, instead of trying to feed the raw mp4 into a LoadImage node
</details>
@@ -177,7 +182,8 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
<summary><h3>Prompt Tab</h3></summary>
- **3-column layout** — AI Assistant (left), Presets/Preset Manager tab-panel (center), Wildcard/Style support (right)
- **AI chat assistant** — powered by [Ollama](https://ollama.com/), generate and refine prompts interactively
- **AI chat assistant** — generate and refine prompts interactively using Ollama, LM Studio, Lemonade, or Unsloth (multi-backend: v0.5.4)
- **⚙ Settings modal** (v0.5.4) — replaces the old central Settings-tab panel; opens a dedicated modal (Backend / Connection / Model / Generation / Unload / Save) scoped to this tab only, saved under its own `localStorage` key so it stays independent of the Tagger tab's VLM settings; **Thinking mode** and **Max tokens** apply to every chat request, and an **Unload** button frees the selected model from Ollama/LM Studio/Lemonade (Unsloth has no such API and is shown as unsupported)
- **Image attachment** — attach reference images for vision-capable models
- **Translation** — JA/EN/ZH translation buttons for multilingual prompt creation
- **Prompt presets** — save/load reusable prompt templates (positive & negative) with category support
@@ -204,6 +210,7 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Presets Group table** — create, rename, and delete groups, with each group's members shown as removable badges; the reserved **Batch** group is not listed here — it's managed entirely through the Presets table's B column and BC button instead
- **Wildcards table** — same files as the Form tab's Wildcard file manager above; editing the File path or the Ext dropdown renames the file (saves the content under the new name, then removes the old file)
- **Style table** — same styles as the Form tab's Style manager above, editable inline the same way as Presets
- **+ Add to this file** (v0.4.8) — select exactly one row whose File badge isn't `custom.json` to enable this toolbar button, bringing the Form tab's same-file-add capability (above) to the Table view too; it adds a blank row targeting that same file (shown as a badge in the File column even before saving); custom.json entries and multi-row selections leave it disabled — use the regular + New Style button for those instead
</details>
@@ -217,15 +224,17 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Workflows directory** — configure which folder to scan for workflows
- **Gallery output directory** — configure which output folder the Gallery tab scans for images
- **Eagle connection** — set Eagle API endpoint for auto-save
- **Ollama connection** — configure Ollama server URL
- **CivitAI Host** — choose which site opens when clicking a model link: `civitai.com` (SFW only) or `civitai.red` (unrestricted); saved to `settings.json` and synced to `localStorage` for the Models tab to use without extra fetches
- **CivitAI API Key** — optional Bearer token for authenticated CivitAI access; stored in `settings.json` (excluded from data exports); environment variable `CIVITAI_API_KEY` takes priority if set
- **Default workflow** — set a workflow to auto-load on startup
- **Default Checkpoint** (v0.3.73) — optional checkbox to force every checkpoint loader node's model to a chosen default whenever a workflow is loaded into GenerateUI; a safeguard against generation errors or garbled images from a stale/mismatched checkpoint saved in the workflow file
- **Data Management** — export all plugin data (settings, metadata, prompts, etc.) to a single JSON file; import to restore data (useful when migrating or reinstalling); API keys are excluded from exports for security
- ~~AI Assistant Settings~~ (removed in v0.5.4) — the central Ollama backend/URL/model panel that used to live here was replaced by a ⚙ Settings button + modal directly in the Prompt tab and the Tagger tab, each with its own independent configuration (backend, URL, model, Thinking mode, Max tokens, and a model Unload button) — see those tabs below; the AI TOOL tab's own Settings pane is unaffected
- **Video Playback Volume** (v0.5.4) — the video preview's volume is remembered here and shared across every video player in the plugin (Video tab, Gallery tab), instead of resetting to maximum whenever a different video is opened
- **Data Management** — export core settings/metadata/prompts/CivitAI cache to a single JSON file; import to restore data (useful when migrating or reinstalling); API keys are excluded from exports for security
- **Full Backup (ZIP)** (v0.5.2) — additionally covers what the JSON bundle can't represent: folder-based data (AI Skills, Lab Plans, Style presets) and the Tagger SQLite database; two opt-in checkboxes can also include ComfyUI's default workflows folder (`user/default/workflows`) and the Impact Pack's wildcard folder in the export — both of those are export-only and stored under an `_external/` prefix in the ZIP that Restore always skips, since auto-overwriting files a different plugin/ComfyUI core manages would be unsafe; copy them back by hand if needed. Restoring overwrites existing files; restart ComfyUI afterward for either restore path
- **Text Size** — one slider (10–28 px) adjusts font size for all prompt and chat textareas at once: Generate UI positive/negative prompts, AI Assistant chat input, Preset prompts, Wildcard prompt and file editor, and Metadata prompt full preview; takes effect immediately and saved with Save Settings
- **RAW JSON Colors** — customize the 6 syntax highlight colors for the Raw JSON editor in Generate UI: Default Text (base), Name/Scheduler (yellow), Title (pink), Width/Height (green), Prompt/Text (cyan), Image/File (red); changes apply immediately on color pick; Reset Defaults restores the original scheme; saved to `localStorage` under `wfm_settings.jsonColors` and applied on startup
- **GenerateUI Model Tab Highlight** (v0.3.98) — pick the color used to mark Checkpoint/VAE/Diffusion Model/Text Encoder/ControlNet/Hypernetwork labels and the LoRA column header in GenerateUI's Model tab when the loaded workflow actually contains that type of node; default bright green; changes apply immediately, Reset Defaults restores it; saved to `localStorage` under `wfm_settings.modelTabActiveColor`
- **GenerateUI Model Tab Highlight** (v0.3.98) — pick the color used to mark Checkpoint/VAE/Diffusion Model/Text Encoder/ControlNet/Hypernetwork labels and the LoRA column header in GenerateUI's Model tab when the loaded workflow actually contains that type of node; default bright green; changes apply immediately, Reset Defaults restores it; saved to `localStorage` under `wfm_settings.modelTabActiveColor`; the same color and mechanism also drives the Video tab's field highlighting (v0.5.4, see above)
- **Wildcard Integration** — link the WFS wildcard directory to ComfyUI-Impact-Pack's `wildcards/` directory (directory junction on Windows, symlink on other OS); existing WFS wildcard files are automatically migrated; requires [ComfyUI-Impact-Pack](https://github.com/ltdrdata/ComfyUI-Impact-Pack)
- **G'MIC-Qt Integration** — set the path to `gmic_qt.exe` for the Image Edit Filter tool; download G'MIC-Qt Standalone from `gmic.eu/download.html` (Windows: `gmic_qt-win64.zip`), extract anywhere, then enter the full path to `gmic_qt.exe` and click Save
- **Language** — English / Japanese / Chinese
@@ -241,7 +250,10 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Thumbnail / Table views** — switch view modes; Favorites column shown leftmost in Table view
- **Folder management** — create subfolders ("+ New") or delete the selected folder with all contents ("Del") from the folder tree header
- **File operations** — move or delete individual images from the detail panel's Info tab; bulk Move To..., Export, and Delete File from the multi-select bar
- **Download** — hover over the image preview in the detail panel to reveal a download icon (⬇); click to download the single image
- **Download** (v0.5.0) — a dedicated orange **Download** button in the detail panel's action-button row (next to Tagger); replaces the old preview-image hover overlay, which blocked video playback controls
- **MP4 video support** (v0.5.0) — `.mp4` files are browsable, previewable (detail panel with native `<video controls>`, lightbox, and Compare), and included in favorites/tags/groups/move/delete/export alongside images; server-side thumbnails are generated from the first video frame via PyAV (falls back to a placeholder if PyAV/ffmpeg decoding isn't available); a small ▶ badge overlays video thumbnails in the grid
- **MP4 embedded metadata** (v0.5.1) — the Prompt and JSON tabs now also work for `.mp4` files: reads the `workflow`/`prompt` container tags ComfyUI's `SaveVideo` writes into the mp4 (via PyAV server-side), including all-in-one video-generation nodes that carry their prompt directly on a `prompt` input rather than a separate `CLIPTextEncode`-style node (e.g. `MiniMaxH3ImageToVideo`)
- **Info tab: dimensions & duration** (v0.5.1) — the detail panel's Info tab now also shows image dimensions (width×height) or video duration, in addition to filename, size, date, tags, and memo
- **Multi-select** — Ctrl+click to select multiple images; Bulk Bar appears for batch operations: select group → "Add to Group" / "Remove from Group"; Favorite All / Unfavorite All; Compare (2–4 images); Move To...; **Export** (downloads all selected images as a ZIP file); Delete File
- **Image Compare** — select 2–4 images with Ctrl+click, then click "Compare" in the Bulk Bar to open a side-by-side lightbox; grid adapts to the number of selected images
- **Prompt search** — text search covers filename, tags, memo, and prompt text (A1111 `parameters` field cached on first detail panel open)
@@ -252,12 +264,13 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Detail panel** — view filename, path, tags, groups, and metadata in a slide-out panel; four tabs — **Info** / **JSON** / **Groups** / **Prompt**
- **Prompt tab** (v0.4.7) — selected by default (the most frequently checked piece of info shouldn't need an extra click); lists every positive/negative prompt candidate found in the embedded workflow with POS/NEG badges, reusing the exact same list→click→full-text UI as the Metadata tab; extracts from the API-format embedding when available rather than the UI-format one, since a workflow with independent top-level and subgraph sampling chains (e.g. Krea-2) can otherwise have some of its prompts missed
- **Workflow viewer** — Metadata tab displays workflow JSON from PNG embedded data (`prompt` / `workflow` keys) or from workflow saved by the Generate UI tab; **Copy & Send Canvas** button copies the JSON to the clipboard and sends the workflow directly to the ComfyUI canvas (UI and API formats both supported)
- **Load GenUI button** — loads the embedded ComfyUI workflow from the selected image directly into the GenerateUI tab; shows a warning toast if no workflow is embedded or the format is unsupported; Metadata button is styled green, Load GenUI button uses the primary accent color
- **GenUI button** (renamed from "Load GenUI" in v0.5.0 for readability) — loads the embedded ComfyUI workflow from the selected image directly into the GenerateUI tab; shows a warning toast if no workflow is embedded or the format is unsupported; Metadata button is styled green, GenUI button uses the primary accent color
- **Image Edit button** — toolbar button; sends the selected image directly to the Image Edit tab as the base layer
- **Send GenUI Image button** — toolbar button (next to Image Edit); uploads the selected image to ComfyUI and sets it as the input for the first LoadImage node in the GenerateUI tab; automatically switches to GenerateUI → Input → Image; requires a workflow with at least one LoadImage node to be loaded
- **Send to LI node button** (v0.5.2) — toolbar button (next to Send GenUI Image); uploads the selected image and writes its filename into the `image` widget of the node currently selected on the ComfyUI canvas (falling back to the first LoadImage-type node found) — same destination and cross-window bridge as the Image Edit tab's **Send to LI node** button (renamed from "Send to Workflow" in this same release), so both entry points now share one consistent name; requires Workflow Studio to have been opened from ComfyUI's top menu button
- **Send CC button** (v0.3.69) — toolbar button, shown only when this Gallery tab is embedded as an iframe inside ComfyUI Comic Creator (a separate custom node); sends the selected image directly into Comic Creator's currently selected panel/overlay
- **Search clear (✕)** — inline ✕ button appears inside the search box whenever text is entered; click to clear immediately
- **Clear all filters (✕ Clear)** — rightmost toolbar button; resets search text, tag filter, group filter, and favorites filter in one click (sort order is preserved)
- **Clear all filters (✕ Clear)** — toolbar button next to the view-mode (Thumbnail/Table) switch (v0.5.2, moved from the toolbar's rightmost position so it sits with the other display-affecting controls); resets search text, tag filter, group filter, and favorites filter in one click (sort order is preserved)
- **Workflow auto-save** — images generated from the Generate UI tab have their workflow automatically saved to gallery metadata
- **Output folder configurable** — set the scanned output folder from Settings tab
- **SVG file support** (v0.3.77) — `.svg` files are browsable, previewable (detail panel and lightbox), and included in favorites/tags/groups/move/delete/export alongside raster formats; served as-is with no rasterized thumbnail, since `<img>` scales vector graphics natively at any size
@@ -294,13 +307,14 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Now inside Gallery** (v0.4.6) — this used to be its own top-level tab; it's now the fourth Gallery sub-tab, to the right of Style_Catalog — everything below works exactly the same as before
- **3-column layout** — Drop zone (left) | Model info (center) | LoRA + Prompt (right)
- **File drop** — drop a ComfyUI-generated PNG / WebP or workflow JSON onto the drop zone (or click to open a file picker); PNG/WebP images are shown as a preview
- **File drop** — drop a ComfyUI-generated PNG / WebP / MP4 or workflow JSON onto the drop zone (or click to open a file picker); PNG/WebP images are shown as a preview
- **MP4 embedded metadata** (v0.5.1) — reads the `workflow`/`prompt` container tags ComfyUI's `SaveVideo` writes into the mp4's `moov/udta/meta` box (parsed client-side, no server round-trip); also recognizes all-in-one video-generation nodes that carry their prompt directly on a `prompt` input instead of a separate `CLIPTextEncode`-style node (e.g. `MiniMaxH3ImageToVideo`)
- **Model extraction** — automatically extracts Checkpoint, VAE, Diffusion Model, and Text Encoder names from the workflow; supports both standard and subgraph-based workflows (Flux.2 Dev/Klein, Qwen-Image-Edit/2511/Layered, Z-Image Base/Turbo, Ernie Image, WAN2.2, Mage-Flow, LongCat, Boogu, HiDream E1, FireRed, Krea-2 Turbo); node types covered: UNETLoader, UnetLoaderGGUF, UNETLoaderGGUF (e.g. HiDream GGUF), CLIPLoader, DualCLIPLoader, TripleCLIPLoader, QuadrupleCLIPLoader (e.g. HiDream 4-CLIP)
- **LoRA extraction** — lists all LoRA models with `strength_model / strength_clip` values
- **Prompt extraction** — lists prompts with POS / NEG badges when positive/negative can be determined; when distinction is not possible (e.g. `SamplerCustomAdvanced`, intermediate nodes, cross-level connections), prompts are shown without a badge as plain **Text**; click any entry to view the full text below
- **CLIP Text Encode edit+ support** (v0.3.92) — `CLIPTextEncodeEditPlus` nodes are resolved using the same RAW / EDIT / front / back combination rule as the node itself, correctly merging the linked `text1` (e.g. a Lora Manager's trigger words) with the editable `text_edit` field instead of showing only one side
- **Prompt actions** — Copy to clipboard, **GenUI:P/N** (set GenerateUI positive/negative prompt), **Prompt:P/N** (set Prompt tab preset positive/negative)
- **Format support** — ComfyUI PNG/WebP/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Ernie Image / WAN2.2 / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Krea-2 Turbo subgraph workflows), SD WebUI, SD Forge, Fooocus
- **Format support** — ComfyUI PNG/WebP/MP4/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Ernie Image / WAN2.2 / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Krea-2 Turbo subgraph workflows), SD WebUI, SD Forge, Fooocus
- **Format note** — supported formats and covered model types are always shown in the left column
</details>
@@ -354,10 +368,11 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **3 sub-tabs** — Single / Batch / DB for single-image tagging, folder batch processing, and tag database management
- **Model support** — WD Tagger (ONNX, NCHW/NHWC auto-detect), SwinV2 (ONNX), DeepDanbooru (.h5, requires TensorFlow); place each model in its own subfolder under `ComfyUI/models/tagger/<model-name>/` containing the `.onnx` + `selected_tags.csv` (or `.h5` + label file)
- **Threshold sliders** — General threshold (default 0.35) and Character threshold for `character:` prefix tags (default 0.85); sliders update the display value in real time
- **Ollama VLM** — optional vision model alongside WD Tagger; set API URL and select model (↻ to refresh list); results from both models are merged into one comma-separated tag string
- **VLM tagging** (v0.3.38, multi-backend: v0.5.4) — optional vision model alongside WD Tagger, running on Ollama, LM Studio, Lemonade, or Unsloth through the same unified backend used by the Prompt tab; results from both models are merged into one comma-separated tag string
- **⚙ Settings modal** (v0.5.4) — a Settings button (Single and Batch tabs) opens the same modal component as the Prompt tab's AI Assistant (Backend / Connection / Model / Generation / Unload), but saved under its own `localStorage` key so Tagger's VLM backend/model choice is independent of the Prompt tab's; **Thinking mode** and **Max tokens** apply to VLM requests too, and the **Unload** button frees the selected model (Ollama/LM Studio/Lemonade; Unsloth unsupported) — replaces the old Tagger-only direct Ollama URL/model fields
- **Single tab** — drag & drop an image onto the preview area or click Upload; Gallery detail panel **Tagger** button opens the selected image directly here
- **Single output options** — (1) **GenUI:P** — appends tags to the GenerateUI tab's positive prompt and immediately applies to the loaded workflow; (2) **Send to Prompt** — appends tags to the Prompt tab's positive textarea; (3) **Save to Gallery** — saves tags to Gallery image metadata (requires image opened from Gallery); (4) **Write to File** — embeds tags into JPEG EXIF (`ImageDescription`) or PNG `tEXt` chunk (`Tags` key), other formats get a `.tags.json` sidecar; (5) **Save to DB** — stores in internal SQLite database
- **Batch tab** — enter a folder path, configure WD Tagger and Ollama settings; output options: **Save to DB** (default on), **Write to File** (EXIF/PNG metadata), **Write .txt** (creates `<filename>.txt` alongside each image with all tags); real-time progress bar and log; Stop cancels after the current image
- **Batch tab** — enter a folder path, configure WD Tagger thresholds and (via the same ⚙ Settings modal as Single) the VLM backend; output options: **Save to DB** (default on), **Write to File** (EXIF/PNG metadata), **Write .txt** (creates `<filename>.txt` alongside each image with all tags); real-time progress bar and log; Stop cancels after the current image
- **DB tab** — searchable SQLite database of all tagged images; click a row to open the edit panel and modify WD Tags / VLM Tags; Save updates the record, Delete removes it; Export CSV downloads all records
- **Dependencies** — install into ComfyUI's embedded Python: `python_embedded\python.exe -m pip install -r requirements.txt`; for GPU inference use `onnxruntime-gpu`; TensorFlow (DeepDanbooru) is optional and commented out in `requirements.txt`
@@ -374,7 +389,7 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Draw** — freehand brush; options: color, brush size, blend mode; paints directly onto the active draw layer while all other layers remain visible; brush cursor shown as a size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
- **Text** — click to place; configure font, size, bold/italic, align, and color; placed as an exact-size text layer sized to the measured bounding box; double-click to re-edit
- **Shape** — drag to draw geometric shapes (Rect / Ellipse / Line / FreeLine); options: shape type, Rounded toggle (Rect/Ellipse), Fill color, Stroke color + width, Opacity; each committed shape becomes an independent draw layer; Stroke None hidden for Line/FreeLine (stroke always active)
- **Mask** — 7 sub-tools for painting masks onto a dedicated mask layer; click **M** in the Layers header to add a mask layer (Mask tool activates automatically); clicking a mask layer in the list also switches to the Mask tool; **Tool Options bar**: sub-tool buttons (Paint / Color / Alpha / Text / Vector / Shape / SAM3), Invert checkbox, Overlay color picker (default red), Blur slider (0–50 px); the overlay is only shown for the currently active mask layer, other mask layers stay hidden until selected (v0.3.70); SAM3 requires Mask Editor One (disabled when not installed); Color / Alpha / Text / Vector / Shape work without Mask Editor One; **Properties pane — Paint**: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); **MASK EDITOR ONE section** (Paint sub-tool, visible when installed): Select opens the ABR stamp-brush library; ✕ clears back to Circle; when an image brush is active, Hardness is disabled and Spacing (5–100%), Angle (0–359°), Sz Jitter (0–100%), Rot. Jitter (on/off) appear; **Edit in Mask Editor One →** (v0.4.0) — sends the current canvas composite (plus the active mask layer's content, if one is selected) to a MaskEditorOne node on the ComfyUI canvas — the currently selected node if it is one, otherwise the first MaskEditorOne node found in the graph (same selection logic as **Send to Workflow**) — and opens its full interactive editor (paint, SAM3, BiRefNet, shapes, etc.) in the ComfyUI browser tab; clicking Apply there imports the result back here as a new mask layer; requires Workflow Studio to have been launched from ComfyUI's top-menu button and at least one MaskEditorOne node to exist on the ComfyUI canvas; **Properties pane — Color**: click canvas to flood-select pixels by color similarity; Mode (Add / Subtract), Tolerance (0–255), Feather % (0–100); **Properties pane — Alpha**: extract the active layer's transparency as a mask; Threshold, Invert checkbox, Extract Alpha button; **Properties pane — Text**: click canvas to open a stamp overlay — enter text, set Font / Size / Bold / Italic / Align / Mode (Add / Erase), Stamp or Ctrl+Enter to apply; multi-line supported; **Properties pane — Vector**: click to add Catmull-Rom spline points; Enter (or click first point) closes and fills the polygon; Backspace removes the last point; Esc resets; Mode (Add / Erase); **Properties pane — Shape**: drag to draw Rect or Ellipse; hold Shift for square/circle; blue dashed outline preview while dragging; Mode (Add / Erase); **Properties pane — SAM3**: enter a text prompt, set Max candidates (3/6/9/12), click Segment; select candidate thumbnails (multi-select), Apply Selected (N) applies with current Mode; **Mask layer A/S operation**: A/S toggle — Add (green) composites normally, Subtract (red) cuts the mask from below; **✂ clipping mask button** clips the layer below to the painted area; brush cursor shown as size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
- **Mask** — 7 sub-tools for painting masks onto a dedicated mask layer; click **M** in the Layers header to add a mask layer (Mask tool activates automatically); clicking a mask layer in the list also switches to the Mask tool; **Tool Options bar**: sub-tool buttons (Paint / Color / Alpha / Text / Vector / Shape / SAM3), Invert checkbox, Overlay color picker (default red), Blur slider (0–50 px); the overlay is only shown for the currently active mask layer, other mask layers stay hidden until selected (v0.3.70); SAM3 requires Mask Editor One (disabled when not installed); Color / Alpha / Text / Vector / Shape work without Mask Editor One; **Properties pane — Paint**: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); **MASK EDITOR ONE section** (Paint sub-tool, visible when installed): Select opens the ABR stamp-brush library; ✕ clears back to Circle; when an image brush is active, Hardness is disabled and Spacing (5–100%), Angle (0–359°), Sz Jitter (0–100%), Rot. Jitter (on/off) appear; **Edit in Mask Editor One →** (v0.4.0) — sends the current canvas composite (plus the active mask layer's content, if one is selected) to a MaskEditorOne node on the ComfyUI canvas — the currently selected node if it is one, otherwise the first MaskEditorOne node found in the graph (same selection logic as **Send to LI node**) — and opens its full interactive editor (paint, SAM3, BiRefNet, shapes, etc.) in the ComfyUI browser tab; clicking Apply there imports the result back here as a new mask layer; requires Workflow Studio to have been launched from ComfyUI's top-menu button and at least one MaskEditorOne node to exist on the ComfyUI canvas; **Properties pane — Color**: click canvas to flood-select pixels by color similarity; Mode (Add / Subtract), Tolerance (0–255), Feather % (0–100); **Properties pane — Alpha**: extract the active layer's transparency as a mask; Threshold, Invert checkbox, Extract Alpha button; **Properties pane — Text**: click canvas to open a stamp overlay — enter text, set Font / Size / Bold / Italic / Align / Mode (Add / Erase), Stamp or Ctrl+Enter to apply; multi-line supported; **Properties pane — Vector**: click to add Catmull-Rom spline points; Enter (or click first point) closes and fills the polygon; Backspace removes the last point; Esc resets; Mode (Add / Erase); **Properties pane — Shape**: drag to draw Rect or Ellipse; hold Shift for square/circle; blue dashed outline preview while dragging; Mode (Add / Erase); **Properties pane — SAM3**: enter a text prompt, set Max candidates (3/6/9/12), click Segment; select candidate thumbnails (multi-select), Apply Selected (N) applies with current Mode; **Mask layer A/S operation**: A/S toggle — Add (green) composites normally, Subtract (red) cuts the mask from below; **✂ clipping mask button** clips the layer below to the painted area; brush cursor shown as size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
- **Blur** — **Whole Blur**: Gaussian blur to the entire active layer with intensity slider (1–50 px); **Whole Mosaic**: pixelation mosaic with block-size slider (5–100 px); **Rect Blur / Rect Mosaic**: enable the toggle then drag a rectangle on the canvas to apply blur or mosaic to that region only (blue preview for blur, orange for mosaic); Rect Blur and Rect Mosaic are mutually exclusive; all operations support Undo
- **BG Remove** — remove the background from the active layer; **Lightweight (@imgly)**: runs entirely in the browser via CDN (no server required; ~40 MB model downloaded on first use); **BiRefNet**: high-quality removal via Mask Editor One's Python backend (requires Mask Editor One installed and `birefnet.safetensors` in `ComfyUI/models/background_removal/`); **New Layer** option (default on) adds the result as a new layer above the original; when off, replaces the active layer in-place
- **Filter (G'MIC)** — apply G'MIC-Qt filter effects to the active image layer; click **Edit with G'MIC** to launch G'MIC-Qt GUI; select a filter and click OK — a "G'MIC-Qt filter output" window appears; close it to save the result back as the active layer; requires G'MIC-Qt Standalone installed and path configured in Settings → G'MIC-Qt Executable Path
@@ -382,12 +397,28 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Layer panel** — layer list with visibility (👁/🚫), lock (🔒/🔓), and clipping-mask (✂) toggles; opacity slider; type icons (🖼 image / T text / ✏ draw / ⬚ mask); Layer 1 is automatically locked on first image load
- **Layer lock** — locked layers show an orange bounding box and 🔒 icon on the canvas; move/resize/rotate are disabled while locked; click the 🔓 button in the layer row to unlock
- **Text quality** — text layers are rendered at their measured bounding-box size; resizing with the Select tool regenerates the canvas at the new display resolution so text stays sharp
- **Export** — Save PNG (download composite locally); **Save to Gallery** (saves to Gallery root folder with a timestamped default name `wfs-image-YYYYMMDDHHmmss`); **Save to Input** (uploads to ComfyUI input folder for use in Load Image nodes); **Send to Workflow** (v0.4.0) — uploads the same way, then writes the resulting filename directly into the `image` widget of the node currently selected on the ComfyUI canvas (falls back to the first LoadImage-type node found); requires Workflow Studio to have been launched from ComfyUI's top-menu button so the ComfyUI tab is reachable
- **Export** — Save PNG (download composite locally); **Save to Gallery** (saves to Gallery root folder with a timestamped default name `wfs-image-YYYYMMDDHHmmss`); **Send to LI node** (renamed from "Send to Workflow" in v0.5.2) — uploads to ComfyUI's input folder via `/upload/image`, then writes the resulting filename directly into the `image` widget of the node currently selected on the ComfyUI canvas (falls back to the first LoadImage-type node found); requires Workflow Studio to have been launched from ComfyUI's top-menu button so the ComfyUI tab is reachable; the Gallery tab's toolbar has the same button (v0.5.2, see Gallery Tab below) so a selected Gallery image can be sent the same way without going through Image Edit first
- **Canvas navigation** — scroll-wheel zoom, Space + drag to pan; zoom indicator in the bottom bar
- **Undo / Redo** — Ctrl+Z / Ctrl+Y (or toolbar buttons); keyboard shortcuts: V (Select), B (Draw), T (Text), S (Shape), Delete (remove selected layer when 2+ exist)
</details>
<details>
<summary><h3>Video Tab (v0.5.0 – v0.5.4)</h3></summary>
- **Dedicated video generation UI, independent of GenerateUI** — a purpose-built tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows (LTX-2.5/Wan2.2: v0.5.4); does not share state with the GenerateUI tab, and model selection (UNet/CLIP/VAE/Audio VAE) is fixed to the loaded workflow's own defaults rather than editable here
- **3-pane layout** — left: form (First Frame / Last Frame / Prompt / Aspect Ratio / Megapixels / Multiple / Duration / Noise Seed / Generate); center: preview frame + Video Source panel, plus an Editing pane reserved for future video-editing tools; right: **Frame** / **GIF** property tabs (v0.5.2, see below)
- **First Frame / Last Frame are both optional** — leaving First Frame empty runs the workflow text-only (the node is simply left unconnected — a "bypass"); workflows that don't even include a LoadImage node for First Frame are supported out of the box (Wan2.2's Text-to-Video graph has neither slot at all), and a LoadImage node is only injected into the graph on the fly if an image is actually supplied
- **Semantic node lookup, not hardcoded IDs** (generalized in v0.5.4) — detects which of the three families is loaded from its subgraph's internal node types (or, for Wan2.2, the subgraph's own name — it has no distinctive internal node type), then locates its Resolution Selector and LoadImage node(s) by the subgraph's *public input label* (`prompt`, `duration`, `width`, `first_frame`, `last_frame`) rather than a fixed slot index — so it keeps working even though the three families expose those inputs under different internal names; a workflow no longer needs to match any bundled reference file's exact node IDs, and no fallback test workflow is auto-loaded on tab open
- **Field highlight color** (v0.5.4) — Prompt / Duration / First Frame / Last Frame / Aspect Ratio / Megapixels / Multiple labels turn the same highlight color as the GenerateUI Model tab (shared setting, customizable in the Settings tab — see below) when the loaded workflow actually exposes that field; e.g. a Wan2.2 workflow (no Resolution Selector node) leaves Aspect Ratio / Megapixels / Multiple unhighlighted since those controls are disabled
- **Load in Video** (Workflow tab) — load any workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, or a Wan2.2 Text-to-Video node straight into this tab from the Workflow tab's side-panel toolbar (next to Load in GenerateUI); unsupported workflows show an error toast instead of loading
- **Preview frame + Video Source panel** (v0.5.2, replaces the old Result panel) — the center pane's preview shows either a just-generated video or one loaded independently of generation; a **Video Source** drop zone next to it accepts any local video file (drag-and-drop or click to pick), with a **Clear** button to reset back to empty — the Frame/GIF tools below work on whatever is currently shown here, generated or not; generated results are still saved to Gallery metadata (embedded workflow JSON) automatically, so the Gallery tab's Workflow/Prompt panels work on generated videos the same way they do for images
- **Frame tab** (v0.5.2) — captures the preview video's current playback position as a still frame: play/seek to the position you want, click **Capture Frame** (client-side canvas, no server round-trip), then **Save to Output** to write it as a PNG into ComfyUI's own Output folder (auto-numbered, same pattern as other generated images)
- **GIF tab** (v0.5.2) — converts the preview video to an animated GIF; set Start/End (seconds), FPS, and an optional Max Width, then **Convert to GIF** — the server decodes the video (PyAV) and encodes an animated GIF (Pillow), both dependencies ComfyUI itself already requires, so no ffmpeg binary or extra install is needed; the result is saved into ComfyUI's Output folder and previewed inline
- **Playback volume** (v0.5.4) — the preview player's volume is saved to the Settings tab and shared across every video player in the plugin (Video tab, Gallery tab), so it no longer resets to maximum each time a different video is opened
</details>
<details>
<summary><h3>AI TOOL Tab (v0.3.14)</h3></summary>
@@ -408,6 +439,7 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Settings pane — Chat Image Generation** (v0.3.73) — "Use dedicated workflow" checkbox lets Chat-triggered image generation use a saved workflow of your choice instead of the one currently loaded in GenerateUI, without disturbing what's shown there (same pattern as Image Edit's Inpaint dedicated workflow)
- **Settings pane — Chat I2I Generation** (v0.3.74) — same "Use dedicated workflow" pattern as above, but for image-to-image generation when an image is attached; independent of the text-to-image dedicated workflow setting
- **Settings pane — Generation** (v0.3.98) — **Thinking mode** toggle (off by default; sends Ollama's `think` flag, and regardless of backend, any `<think>...</think>` block is stripped from the output when off so reasoning models don't clutter Translation/Chat/TOOLS results) and **Max tokens** (Ollama: `options.num_predict`; LM Studio/Lemonade/Unsloth: `max_tokens`; `0` = unlimited)
- **Model unload** (v0.5.4) — an Unload button next to the model selector frees VRAM/memory by unloading the currently selected model from Ollama (`keep_alive:0` via `/api/generate`, the officially documented method — Ollama has no dedicated unload endpoint), LM Studio (`/api/v1/models/unload`), or Lemonade (`/api/v1/unload`); Unsloth exposes no equivalent API and the button is disabled for that backend
- **Settings shared** — settings saved to `localStorage` under `wfm_ai_settings`; shared with the Library panel's AI TOOL tab so configuration is consistent across both interfaces
- **Backend support** — Ollama (`/api/generate` for text, `/api/chat` for conversations, `/api/tags` for model list); LM Studio and Lemonade via the OpenAI-compatible API directly from the browser (`/v1/chat/completions`, `/v1/models`); Unsloth via the same OpenAI-compatible API but relayed through a server-side proxy that attaches the `Authorization: Bearer` header; VLM images sent as base64 (`images:[]` for Ollama, `image_url` content block for LM Studio/Lemonade/Unsloth)
- **URL security** — backend URL validated via `new URL()` to enforce `http://` or `https://` scheme
@@ -425,7 +457,8 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Package sub-tab** — dropdown to filter nodes by custom node package name
- **M — Models tab** — browse installed models (All / ★ Favorites / Groups / By Type sub-tabs); LoRA groups show an **All N LoRAs** item — drag to canvas to place a `Lora Loader (LoraManager)` node with all LoRAs pre-loaded
- **P — Prompts tab** — browse prompt presets with All / ★ Favorites / Categories sub-tabs; **Groups sub-tab** (row 2) — view presets by group (shared with the Batch tab's `wfm_prompt_preset_groups`)
- **I — Information tab** — drop a ComfyUI-generated PNG/WebP or workflow JSON in the side panel to view its metadata; detects LoRAs from `LoraLoader`, `LoraLoaderModelOnly`, and `Lora Loader (LoraManager)` nodes (API format supported); supports `UnetLoaderGGUF` and `QuadrupleCLIPLoader` node types; preview area fixed at 110px
- **I — Information tab** — drop a ComfyUI-generated PNG/WebP/MP4 or workflow JSON in the side panel to view its metadata; detects LoRAs from `LoraLoader`, `LoraLoaderModelOnly`, and `Lora Loader (LoraManager)` nodes (API format supported); supports `UnetLoaderGGUF` and `QuadrupleCLIPLoader` node types; preview area fixed at 110px
- **MP4 embedded metadata** (v0.5.1) — reads the `workflow`/`prompt` container tags ComfyUI's `SaveVideo` writes into the mp4's `moov/udta/meta` box, parsed entirely client-side (same box-walking logic as the Gallery tab's Metadata sub-tab); also recognizes all-in-one video-generation nodes that carry their prompt directly on a `prompt` input rather than a separate `CLIPTextEncode`-style node (e.g. `MiniMaxH3ImageToVideo`)
- **A — AI TOOL tab** — Translation, Chat, TOOLS, and Settings sub-tabs powered by Ollama, LM Studio, Lemonade, or Unsloth; Chat supports multi-turn conversations (full history sent each turn); TOOLS includes VLM image analysis and wildcard generation; settings (backend, URL, model) shared with the SPA AI TOOL tab via `localStorage`
- **model sub-tab** — Checkpoint, VAE, Diffusion Model, and Text Encoder; drag items to canvas to place the corresponding loader node (Checkpoint → `CheckpointLoaderSimple`, VAE → `VAELoader`, Diffusion Model → `UNETLoader`, Text Encoder → `CLIPLoader`); double-click also places at canvas center
- **lora sub-tab** — detects LoRAs from `LoraLoader`, `LoraLoaderModelOnly`, and `Lora Loader (LoraManager)` nodes (API format `inputs.loras.__value__` supported); shows `strength_model / strength_clip` values; drag individual LoRA to place `LoraLoader`; **Multiple LORA** section (appears for 1+ LoRAs) drags all LoRAs into a single `Lora Loader (LoraManager)` node with LoRA syntax pre-filled
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

+152
View File
@@ -1,8 +1,11 @@
"""Settings API routes."""
import asyncio
import io
import json
import logging
import shutil
import zipfile
from pathlib import Path
from aiohttp import web
@@ -24,6 +27,7 @@ _DATA_FILES = [
"model_metadata.json",
"gallery_metadata.json",
"tagger_settings.json",
"civitai_cache.json",
]
@@ -37,6 +41,8 @@ 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/settings/export-full", handle_export_full)
app.router.add_post("/api/wfm/settings/import-full", handle_import_full)
app.router.add_get("/api/wfm/styles", handle_get_styles)
app.router.add_post("/api/wfm/styles", handle_create_style)
app.router.add_put("/api/wfm/styles/{name}", handle_update_style)
@@ -248,6 +254,152 @@ async def handle_import(request: web.Request) -> web.Response:
return web.json_response({"error": str(e)}, status=500)
# Full-backup (ZIP) export/import: unlike the flat _DATA_FILES JSON bundle above, this
# covers the whole DATA_DIR — directory-shaped data (ai_skills/, lab_plan/, style/) and
# the SQLite tagger.db that the JSON bundle can't represent. Excludes transient/cache
# dirs, and wildcard/ specifically because it's typically a symlink into a *different*
# custom_node's folder (comfyui-impact-pack) rather than this plugin's own data.
_FULL_BACKUP_EXCLUDE_NAMES = {"gmic_temp", "thumb_cache", "wildcard"}
def _add_file_to_zip(zf: zipfile.ZipFile, path: Path, base: Path):
rel = str(path.relative_to(base)).replace("\\", "/")
if path.name == "settings.json":
# Same API-key scrubbing as the JSON-bundle export — fall through to a raw
# copy if the file turns out to be unreadable/corrupt rather than skipping it.
try:
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
data = {k: v for k, v in data.items() if k not in _SETTINGS_EXPORT_EXCLUDE}
zf.writestr(rel, json.dumps(data, ensure_ascii=False, indent=2))
return
except Exception:
pass
zf.write(path, rel)
# Two folders this plugin doesn't own but users often want backed up alongside their
# own data: ComfyUI's own default workflows dir, and the Impact Pack's wildcard
# library (a separate custom_node — the plugin's own wildcard/ is usually just a
# symlink into this same folder, see _FULL_BACKUP_EXCLUDE_NAMES above). Opt-in only
# (see handle_export_full's include_workflows/include_wildcard query params), and
# stored under an "_external/" prefix so _apply_full_backup_zip can recognize and
# skip them on restore — see that function's docstring for why.
def _default_workflows_dir() -> Path:
from ..config import COMFYUI_ROOT
return COMFYUI_ROOT / "user" / "default" / "workflows"
def _impact_pack_wildcard_dir() -> Path:
from ..config import COMFYUI_ROOT
return COMFYUI_ROOT / "custom_nodes" / "comfyui-impact-pack" / "wildcards"
def _add_external_dir_to_zip(zf: zipfile.ZipFile, src_dir: Path, zip_prefix: str):
if not src_dir.is_dir() or src_dir.is_symlink():
return
for path in src_dir.rglob("*"):
if path.is_dir() or path.is_symlink():
continue
rel = f"{zip_prefix}/{path.relative_to(src_dir)}".replace("\\", "/")
zf.write(path, rel)
def _build_full_backup_zip(include_workflows: bool = False, include_wildcard: bool = False) -> bytes:
"""Zips everything under DATA_DIR except the excluded names above. Walks
top-level entries first so an excluded symlinked directory (wildcard/) is never
even opened, rather than filtering after a recursive walk has already followed it.
Optionally also includes the two external folders above under "_external/"."""
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as zf:
for top in sorted(DATA_DIR.iterdir()):
if top.name in _FULL_BACKUP_EXCLUDE_NAMES or top.is_symlink():
continue
if top.is_file():
_add_file_to_zip(zf, top, DATA_DIR)
elif top.is_dir():
for path in top.rglob("*"):
if path.is_dir() or path.is_symlink():
continue
_add_file_to_zip(zf, path, DATA_DIR)
if include_workflows:
_add_external_dir_to_zip(zf, _default_workflows_dir(), "_external/default_workflows")
if include_wildcard:
_add_external_dir_to_zip(zf, _impact_pack_wildcard_dir(), "_external/wildcard")
return buf.getvalue()
def _apply_full_backup_zip(zip_bytes: bytes) -> dict:
"""Extracts a full-backup ZIP into DATA_DIR, overwriting existing files. Guards
against Zip Slip (entries whose path resolves outside DATA_DIR via '..' or an
absolute path) by checking each entry before writing it.
Entries under "_external/" (default workflows dir, Impact Pack wildcards — see
_build_full_backup_zip) are always skipped here rather than restored: they live
outside DATA_DIR and are managed by ComfyUI core / a different custom_node, so
auto-restoring them could silently overwrite files this plugin doesn't own. They
stay in the ZIP for the user to copy back manually if they want them."""
summary = {"extracted": [], "skipped": []}
DATA_DIR.mkdir(parents=True, exist_ok=True)
base = DATA_DIR.resolve()
with zipfile.ZipFile(io.BytesIO(zip_bytes)) as zf:
for info in zf.infolist():
if info.is_dir():
continue
if info.filename.startswith("_external/"):
summary["skipped"].append(info.filename)
continue
target = (base / info.filename).resolve()
try:
target.relative_to(base)
except ValueError:
summary["skipped"].append(info.filename)
continue
target.parent.mkdir(parents=True, exist_ok=True)
with zf.open(info) as src, open(target, "wb") as dst:
shutil.copyfileobj(src, dst)
summary["extracted"].append(info.filename)
return summary
async def handle_export_full(request: web.Request) -> web.Response:
"""GET /api/wfm/settings/export-full - Download a ZIP of the entire data
directory, including data the flat JSON bundle (handle_export) can't represent.
Optional query params include_workflows=1 / include_wildcard=1 additionally bundle
ComfyUI's default workflows dir / the Impact Pack's wildcard dir (see
_build_full_backup_zip) — both restore-excluded, export-only, manual-copy-back."""
try:
include_workflows = request.rel_url.query.get("include_workflows") == "1"
include_wildcard = request.rel_url.query.get("include_wildcard") == "1"
zip_bytes = await asyncio.to_thread(_build_full_backup_zip, include_workflows, include_wildcard)
return web.Response(
body=zip_bytes,
content_type="application/zip",
headers={"Content-Disposition": 'attachment; filename="wfm-full-backup.zip"'},
)
except Exception as e:
logger.error("Error building full backup: %s", e)
return web.json_response({"error": str(e)}, status=500)
async def handle_import_full(request: web.Request) -> web.Response:
"""POST /api/wfm/settings/import-full - Upload and restore a full-backup ZIP."""
try:
reader = await request.multipart()
field = await reader.next()
if field is None or field.name != "file":
return web.json_response({"error": "file field required"}, status=400)
zip_bytes = await field.read(decode=False)
summary = await asyncio.to_thread(_apply_full_backup_zip, zip_bytes)
return web.json_response({"status": "ok", **summary})
except zipfile.BadZipFile:
return web.json_response({"error": "Not a valid ZIP file"}, status=400)
except Exception as e:
logger.error("Error importing full backup: %s", e)
return web.json_response({"error": str(e)}, status=500)
def _style_files() -> list:
style_dir = DATA_DIR / "style"
if not style_dir.is_dir():
+14 -7
View File
@@ -18,8 +18,8 @@ _db = TaggerDbService(TAGGER_DB_FILE)
def setup_routes(app: web.Application):
app.router.add_get("/wfm/tagger/models", handle_models)
app.router.add_post("/wfm/tagger/predict", handle_predict)
app.router.add_get("/wfm/tagger/ollama/models", handle_ollama_models)
app.router.add_post("/wfm/tagger/ollama/predict", handle_ollama_predict)
app.router.add_get("/wfm/tagger/vlm/models", handle_vlm_models)
app.router.add_post("/wfm/tagger/vlm/predict", handle_vlm_predict)
app.router.add_post("/wfm/tagger/batch/start", handle_batch_start)
app.router.add_get("/wfm/tagger/batch/status", handle_batch_status)
app.router.add_post("/wfm/tagger/batch/stop", handle_batch_stop)
@@ -61,25 +61,29 @@ async def handle_predict(request: web.Request) -> web.Response:
return web.json_response({"error": str(e)}, status=500)
async def handle_ollama_models(request: web.Request) -> web.Response:
async def handle_vlm_models(request: web.Request) -> web.Response:
backend = request.rel_url.query.get("backend", "ollama")
api_url = request.rel_url.query.get("api_url", "http://127.0.0.1:11434")
try:
models = await asyncio.to_thread(_svc.ollama_models, api_url)
models = await asyncio.to_thread(_svc.vlm_models, backend, api_url)
return web.json_response({"models": models})
except Exception as e:
return web.json_response({"error": str(e)}, status=500)
async def handle_ollama_predict(request: web.Request) -> web.Response:
async def handle_vlm_predict(request: web.Request) -> web.Response:
try:
body = await request.json()
result = await asyncio.to_thread(
_svc.ollama_predict,
_svc.vlm_predict,
body.get("image_b64", ""),
body.get("backend", "ollama"),
body.get("api_url", "http://127.0.0.1:11434"),
body.get("model", ""),
body.get("prompt", ""),
int(body.get("max_tags", 40)),
bool(body.get("thinking_mode", False)),
int(body.get("max_tokens", 0)),
)
return web.json_response(result)
except Exception as e:
@@ -96,7 +100,8 @@ async def handle_batch_start(request: web.Request) -> web.Response:
float(body.get("threshold", 0.35)),
float(body.get("char_threshold", 0.85)),
bool(body.get("use_ollama", False)),
body.get("ollama_api", "http://127.0.0.1:11434"),
body.get("vlm_backend", "ollama"),
body.get("vlm_api_url", "http://127.0.0.1:11434"),
body.get("ollama_model", ""),
body.get("ollama_prompt", ""),
int(body.get("ollama_max_tags", 40)),
@@ -104,6 +109,8 @@ async def handle_batch_start(request: web.Request) -> web.Response:
bool(body.get("write_file", False)),
bool(body.get("write_txt", False)),
_db,
bool(body.get("thinking_mode", False)),
int(body.get("max_tokens", 0)),
)
return web.json_response(result)
except Exception as e:
+59
View File
@@ -0,0 +1,59 @@
"""Video tab utility API routes: last-frame capture, animated GIF conversion."""
import asyncio
import logging
from aiohttp import web
from ..services.video_service import VideoService
logger = logging.getLogger(__name__)
_service = VideoService()
def setup_routes(app: web.Application):
app.router.add_post("/api/wfm/video/frame/save-to-output", handle_save_frame)
app.router.add_post("/api/wfm/video/to-gif", handle_to_gif)
async def handle_save_frame(request: web.Request) -> web.Response:
try:
body = await request.json()
image_base64 = body.get("image_base64", "")
if not image_base64:
return web.json_response({"error": "image_base64 required"}, status=400)
result = await asyncio.to_thread(_service.save_frame_to_output, image_base64)
return web.json_response({"status": "ok", **result})
except Exception as e:
logger.error("Error saving video frame to output: %s", e)
return web.json_response({"error": str(e)}, status=500)
async def handle_to_gif(request: web.Request) -> web.Response:
try:
body = await request.json()
filename = body.get("filename", "")
subfolder = body.get("subfolder", "")
type_ = body.get("type", "output")
start_time = float(body.get("start_time") or 0)
end_time_raw = body.get("end_time")
end_time = float(end_time_raw) if end_time_raw not in (None, "") else None
fps = float(body.get("fps") or 10)
max_width_raw = body.get("max_width")
max_width = int(max_width_raw) if max_width_raw not in (None, "") else None
if not filename:
return web.json_response({"error": "filename required"}, status=400)
result = await asyncio.to_thread(
_service.convert_to_gif, filename, subfolder, type_, start_time, end_time, fps, max_width
)
return web.json_response({"status": "ok", **result})
except FileNotFoundError as e:
return web.json_response({"error": str(e)}, status=404)
except ValueError as e:
return web.json_response({"error": str(e)}, status=400)
except Exception as e:
logger.error("Error converting video to GIF: %s", e)
return web.json_response({"error": str(e)}, status=500)
+18 -2
View File
@@ -191,17 +191,33 @@ class GalleryMetadataStore:
return self._save_to_disk()
return True
def cleanup_stale_images(self, folder_path: str, existing_paths: set) -> int:
def cleanup_stale_images(self, folder_path: str, existing_paths: set, recursive: bool = True) -> int:
"""folder_path 配下の存在しないファイルのメタデータを削除する。
existing_paths: そのフォルダの現在のファイルパス集合(_normalize_path 済み)
recursive: False の場合、folder_path 直下のファイルのみを対象にする。
呼び出し元(list_images)が非recursiveスキャン(フォルダ直下のみ列挙)の
結果を existing_paths として渡してくる場合、サブフォルダ内のファイルは
existing_paths に含まれない。それにもかかわらず対象範囲を「folder_path配下
全階層」のままにすると、サブフォルダ内画像のメタデータ(tags/memo等)を
"存在しない"と誤判定して全削除してしまう(実際に発生した不具合: サブフォルダ
に動画を保存する運用で、ルートフォルダを非recursiveで開くたびに
サブフォルダ内の全メタデータが失われていた)。
"""
folder_key = self._normalize_path(folder_path)
if not folder_key.endswith("/"):
folder_key += "/"
def _in_scope(key: str) -> bool:
if not key.startswith(folder_key):
return False
if recursive:
return True
return "/" not in key[len(folder_key):]
with self._lock:
stale = [
key for key in self._data["images"]
if key.startswith(folder_key) and key not in existing_paths
if _in_scope(key) and key not in existing_paths
]
if not stale:
return 0
+128 -31
View File
@@ -16,8 +16,8 @@ from typing import Any
logger = logging.getLogger(__name__)
# サポートする画像拡張子
IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".webp", ".gif", ".svg"}
# サポートする画像拡張子(.mp4は動画だがGalleryでは静止画と同じ一覧・配信経路を共有する)
IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".webp", ".gif", ".svg", ".mp4"}
# data URL の MIME タイプ -> 拡張子(save_image_to_gallery / save_image_to_folder共用)
_SAVE_EXT_BY_MIME = {
@@ -312,15 +312,22 @@ class GalleryService:
try:
with os.scandir(folder) as it:
for entry in it:
if not entry.is_file(follow_symlinks=True):
# follow_symlinks=True forces stat() to make an extra syscall per file
# to resolve the link target even for plain files. Output folders don't
# contain symlinked images, so False is safe and much cheaper.
if not entry.is_file(follow_symlinks=False):
continue
if Path(entry.name).suffix.lower() not in IMAGE_EXTENSIONS:
continue
try:
st = entry.stat(follow_symlinks=True)
st = entry.stat(follow_symlinks=False)
# entry.path is already absolute+resolved because callers always
# pass in an already-resolved `folder`. Re-resolving it here via
# Path(entry.path).resolve() costs an extra filesystem round-trip
# per file — on a 9786-file folder that alone was 6.7s vs 0.07s.
entries.append((
entry.name,
str(Path(entry.path).resolve()).replace("\\", "/"),
entry.path.replace("\\", "/"),
st.st_size,
st.st_mtime,
))
@@ -333,30 +340,45 @@ class GalleryService:
return entries
def _scan_folder_recursive(self, folder: Path) -> list[tuple[str, str, int, float]]:
"""os.walk() でフォルダ配下を再帰的に列挙する(サブフォルダの画像も含む)。
"""フォルダ配下を再帰的に列挙する(サブフォルダの画像も含む)。
ImagePrompt/Style Catalogギャラリーのように深い階層に画像が置かれるケース用。
キャッシュはしない(フォルダ数が少なく、都度スキャンしても軽い想定)。
os.walk()はDirEntryを介さずPath.stat()(follow_symlinks=True相当)を呼ぶため、
_scan_folder()と同じ理由でフォルダ内ファイル数に対して極端に遅くなる。
os.scandir()を自前で再帰し、follow_symlinks=Falseでstatする。
"""
entries = []
try:
for root, dirs, files in os.walk(folder):
dirs[:] = [d for d in dirs if not d.startswith(".")]
for name in files:
if Path(name).suffix.lower() not in IMAGE_EXTENSIONS:
continue
full = Path(root) / name
try:
st = full.stat()
entries.append((
name,
str(full.resolve()).replace("\\", "/"),
st.st_size,
st.st_mtime,
))
except OSError:
continue
except PermissionError:
pass
def _walk(d):
try:
with os.scandir(d) as it:
dir_entries = list(it)
except (PermissionError, OSError):
return
for entry in dir_entries:
if entry.is_dir(follow_symlinks=False):
if not entry.name.startswith("."):
_walk(entry.path)
continue
if not entry.is_file(follow_symlinks=False):
continue
if Path(entry.name).suffix.lower() not in IMAGE_EXTENSIONS:
continue
try:
st = entry.stat(follow_symlinks=False)
# entry.path is already absolute since the top-level `folder` passed
# in by callers is always pre-resolved — see _scan_folder() for why
# re-resolving per file here would be costly.
entries.append((
entry.name,
entry.path.replace("\\", "/"),
st.st_size,
st.st_mtime,
))
except OSError:
continue
_walk(folder)
return entries
def list_images(
@@ -385,9 +407,12 @@ class GalleryService:
# os.scandir() でファイル情報を一括取得(stat()の個別呼び出しを排除)
raw_entries = self._scan_folder_recursive(folder) if recursive else self._scan_folder(folder)
# 孤立メタデータを自動クリーンアップ(移動・削除されたファイルの残骸を除去)
# 孤立メタデータを自動クリーンアップ(移動・削除されたファイルの残骸を除去)。
# recursive=False(非再帰スキャン)の場合、existing_pathsにはfolder直下の
# ファイルしか含まれないため、cleanup側にもrecursive=Falseを伝えて対象範囲を
# 直下のみに限定する(でないとサブフォルダ内ファイルのメタデータを誤削除する)。
existing_paths = {abs_path for _, abs_path, _, _ in raw_entries}
self.metadata_store.cleanup_stale_images(str(folder), existing_paths)
self.metadata_store.cleanup_stale_images(str(folder), existing_paths, recursive=recursive)
results = []
for name, abs_path, size, mtime in raw_entries:
@@ -584,7 +609,10 @@ class GalleryService:
embedded = self._read_png_metadata(path)
elif ext in {".jpg", ".jpeg"}:
embedded = self._read_jpeg_metadata(path)
elif ext == ".mp4":
embedded = self._read_mp4_metadata(path)
dims = self._read_media_dimensions(path, ext)
saved = self.metadata_store.get(str(path))
# workflow キーを除く文字列フィールドをプロンプトキャッシュとして保存(検索用)
@@ -603,6 +631,9 @@ class GalleryService:
"mtime": stat.st_mtime,
"ext": ext,
"embedded": embedded,
"width": dims["width"],
"height": dims["height"],
"duration": dims["duration"],
"favorite": saved.get("favorite", False),
"tags": saved.get("tags", []),
"memo": saved.get("memo", ""),
@@ -682,8 +713,43 @@ class GalleryService:
logger.debug("JPEG metadata read error: %s", e)
return result
def _read_mp4_metadata(self, path: Path) -> dict:
"""MP4コンテナのformat-levelメタデータタグ(workflow/prompt等)をPyAVで抽出する。
ComfyUIのSaveVideoはPNGのtEXtチャンクと同じキー名(workflow=UI形式, prompt=API形式)で
moov/udta/meta(mdta)にJSON文字列を書き込む。"""
result = {}
try:
import av
with av.open(str(path)) as container:
for k, v in (container.metadata or {}).items():
result[k] = v
except Exception as e:
logger.debug("MP4 metadata read error: %s", e)
return result
def _read_media_dimensions(self, path: Path, ext: str) -> dict:
"""画像は幅高さ、動画は幅高さ+再生時間(秒)を返す。取得できない項目はNone。"""
info: dict = {"width": None, "height": None, "duration": None}
try:
if ext == ".mp4":
import av
with av.open(str(path)) as container:
if container.streams.video:
stream = container.streams.video[0]
info["width"] = stream.width
info["height"] = stream.height
if container.duration:
info["duration"] = container.duration / 1_000_000
elif ext != ".svg":
from PIL import Image
with Image.open(path) as img:
info["width"], info["height"] = img.size
except Exception as e:
logger.debug("dimension read error for %s: %s", path, e)
return info
def _extract_embedded_workflow(self, image_path: str, prefer: str = "workflow") -> dict | None:
"""埋め込みワークフローを抽出する(PNG[workflow]/PNG[prompt]の優先順位を選べる)。
"""埋め込みワークフローを抽出する(PNG/MP4の[workflow]/[prompt]の優先順位を選べる)。
prefer="workflow": UI形式(ノード位置・グループ等を保持)優先。GenerateUIへの
ロードやJSON表示などエディタ復元が必要な用途向け。
@@ -696,8 +762,14 @@ class GalleryService:
if not self._check_path_allowed(path):
return None
if path.suffix.lower() == ".png":
ext = path.suffix.lower()
embedded = None
if ext == ".png":
embedded = self._read_png_metadata(path)
elif ext == ".mp4":
embedded = self._read_mp4_metadata(path)
if embedded:
key_groups = (("workflow", "Workflow"), ("prompt", "Prompt"))
if prefer == "prompt":
key_groups = tuple(reversed(key_groups))
@@ -729,9 +801,14 @@ class GalleryService:
# ──────────────────────────────────────────────────────────────
def save_image_meta(self, image_path: str, data: dict) -> bool:
if not self._check_path_allowed(Path(image_path).resolve()):
resolved = Path(image_path).resolve()
if not self._check_path_allowed(resolved):
logger.warning("save_image_meta: path not allowed: %s", resolved)
return False
return self.metadata_store.save(image_path, data)
# get_image_metadata() 側は resolve() 済みパスをキーにして取得するため、
# ここでも resolve() 後の文字列で統一して保存する(キー不一致による
# 「保存はできるが表示されない」というサイレントな食い違いを防ぐ)。
return self.metadata_store.save(str(resolved), data)
def toggle_favorite(self, image_path: str) -> bool:
if not self._check_path_allowed(Path(image_path).resolve()):
@@ -934,6 +1011,8 @@ class GalleryService:
ディスクキャッシュがあればそれを返し、なければPillowで生成して保存する。
GIFはアニメーション保持のため元ファイルをそのまま返す。
Pillowが使えない場合は元ファイルにフォールバック。
MP4はPillowで開けないためPyAVで先頭フレームを抽出しJPEGとしてキャッシュする
(元ファイルへのフォールバックはできないため、失敗時はNoneを返す)。
"""
p = Path(image_path).resolve()
if not p.is_file():
@@ -966,6 +1045,24 @@ class GalleryService:
if thumb_path.exists():
return thumb_path
# MP4は動画のためPillowで開けない。PyAV(av)で先頭フレームを抽出しJPEGとしてキャッシュする。
# avが未導入/デコード失敗の場合、元mp4ファイルは<img>的な経路に渡せないため
# (GIF/SVGと違い元ファイルへフォールバックできない) Noneを返しプレースホルダー表示に委ねる。
if p.suffix.lower() == ".mp4":
try:
import av
from PIL import Image
with av.open(str(p)) as container:
stream = container.streams.video[0]
frame = next(container.decode(stream))
img = frame.to_image().convert("RGB")
img.thumbnail((width, width), Image.LANCZOS)
img.save(thumb_path, "JPEG", quality=85, optimize=True)
return thumb_path
except Exception as e:
logger.warning("serve_thumbnail: mp4 frame extraction failed for %s: %s", p, e)
return None
try:
from PIL import Image
with Image.open(p) as img:
+97 -25
View File
@@ -5,6 +5,8 @@ import csv
import io
import json
import logging
import os
import re
import tempfile
import threading
import urllib.request
@@ -223,39 +225,107 @@ class TaggerService:
tags.append(label.replace("character:", ""))
return tags
# ── Ollama VLM ────────────────────────────────────────────
# ── VLM Tagging (Ollama / LM Studio / Lemonade / Unsloth) ──
def ollama_models(self, api_url: str) -> list:
@staticmethod
def _unsloth_api_key() -> Optional[str]:
"""UNSLOTH_API_KEY を環境変数(.env)から取得。Unslothはローカルでも常に必須。"""
return os.environ.get("UNSLOTH_API_KEY", "").strip() or None
@staticmethod
def _strip_thinking_tags(text: str) -> str:
text = re.sub(r"<think>[\s\S]*?</think>", "", text, flags=re.IGNORECASE)
text = re.sub(r"<thinking>[\s\S]*?</thinking>", "", text, flags=re.IGNORECASE)
return text.strip()
def vlm_models(self, backend: str, api_url: str) -> list:
backend = (backend or "ollama").lower()
try:
req = urllib.request.Request(api_url.rstrip("/") + "/api/tags")
if backend == "ollama":
req = urllib.request.Request(api_url.rstrip("/") + "/api/tags")
with urllib.request.urlopen(req, timeout=5) as resp:
data = json.loads(resp.read().decode("utf-8"))
return sorted(m["name"] for m in data.get("models", []))
headers = {}
if backend == "unsloth":
key = self._unsloth_api_key()
if not key:
logger.error("vlm_models: UNSLOTH_API_KEY is not set")
return []
headers["Authorization"] = f"Bearer {key}"
req = urllib.request.Request(api_url.rstrip("/") + "/v1/models", headers=headers)
with urllib.request.urlopen(req, timeout=5) as resp:
data = json.loads(resp.read().decode("utf-8"))
return sorted(m["name"] for m in data.get("models", []))
return sorted(m["id"] for m in data.get("data", []))
except Exception as e:
logger.error("ollama_models: %s", e)
logger.error("vlm_models: %s", e)
return []
def ollama_predict(self, image_b64: str, api_url: str, model: str, prompt: str, max_tags: int = 40) -> dict:
payload = json.dumps({
"model": model,
"messages": [{"role": "user", "content": prompt, "images": [image_b64]}],
"stream": False,
"options": {"temperature": 0.7, "num_ctx": 4096},
}).encode("utf-8")
def vlm_predict(self, image_b64: str, backend: str, api_url: str, model: str, prompt: str, max_tags: int = 40,
thinking_mode: bool = False, max_tokens: int = 0) -> dict:
backend = (backend or "ollama").lower()
try:
req = urllib.request.Request(
api_url.rstrip("/") + "/api/chat",
data=payload,
headers={"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req, timeout=180) as resp:
data = json.loads(resp.read().decode("utf-8"))
content = data.get("message", {}).get("content", "")
if backend == "ollama":
body = {
"model": model,
"messages": [{"role": "user", "content": prompt, "images": [image_b64]}],
"stream": False,
"think": bool(thinking_mode),
"options": {"temperature": 0.7, "num_ctx": 4096},
}
if max_tokens > 0:
body["options"]["num_predict"] = max_tokens
payload = json.dumps(body).encode("utf-8")
req = urllib.request.Request(
api_url.rstrip("/") + "/api/chat",
data=payload,
headers={"Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(req, timeout=180) as resp:
data = json.loads(resp.read().decode("utf-8"))
content = data.get("message", {}).get("content", "")
else:
headers = {"Content-Type": "application/json"}
if backend == "unsloth":
key = self._unsloth_api_key()
if not key:
return {"error": "UNSLOTH_API_KEY is not set. Copy .env.example to .env in the "
"plugin folder, fill in the key, and restart ComfyUI."}
headers["Authorization"] = f"Bearer {key}"
body = {
"model": model,
"messages": [{"role": "user", "content": [
{"type": "text", "text": prompt},
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_b64}"}},
]}],
"stream": False,
}
if max_tokens > 0:
body["max_tokens"] = max_tokens
payload = json.dumps(body).encode("utf-8")
req = urllib.request.Request(
api_url.rstrip("/") + "/v1/chat/completions",
data=payload,
headers=headers,
method="POST",
)
with urllib.request.urlopen(req, timeout=180) as resp:
data = json.loads(resp.read().decode("utf-8"))
message = data.get("choices", [{}])[0].get("message", {})
content = message.get("content", "")
# Unslothはreasoningを別フィールドで返すため<think>タグに畳んで統一的に扱う
reasoning = message.get("reasoning_content")
if reasoning:
content = f"<think>{reasoning}</think>{content}"
if not thinking_mode:
content = self._strip_thinking_tags(content)
tags = [t.strip() for t in content.split(",") if t.strip()][:max_tags]
return {"tags": ", ".join(tags), "count": len(tags)}
except Exception as e:
logger.error("ollama_predict: %s", e)
logger.error("vlm_predict: %s", e)
return {"error": str(e)}
# ── ファイルメタデータ書込 ────────────────────────────────
@@ -334,8 +404,9 @@ class TaggerService:
self._batch_state["stop"] = True
def batch_start(self, folder: str, model_name: str, threshold: float, char_threshold: float,
use_ollama: bool, ollama_api: str, ollama_model: str, ollama_prompt: str,
ollama_max_tags: int, save_db: bool, write_file: bool, write_txt: bool, db_service) -> dict:
use_ollama: bool, vlm_backend: str, vlm_api_url: str, ollama_model: str, ollama_prompt: str,
ollama_max_tags: int, save_db: bool, write_file: bool, write_txt: bool, db_service,
thinking_mode: bool = False, max_tokens: int = 0) -> dict:
if self._batch_state["running"]:
return {"error": "Batch already running"}
folder_path = Path(folder)
@@ -370,7 +441,8 @@ class TaggerService:
vlm_tags = ""
if use_ollama and ollama_model:
res2 = self.ollama_predict(b64, ollama_api, ollama_model, ollama_prompt, ollama_max_tags)
res2 = self.vlm_predict(b64, vlm_backend, vlm_api_url, ollama_model, ollama_prompt, ollama_max_tags,
thinking_mode, max_tokens)
vlm_tags = res2.get("tags", "")
all_tags = ", ".join(filter(None, [interrogator_tags, vlm_tags]))
+127
View File
@@ -0,0 +1,127 @@
"""Video tab utilities: last-frame capture and animated GIF conversion.
Runs entirely on dependencies ComfyUI itself already requires — PyAV for
decoding (ComfyUI core already needs av>=17.0.0) and Pillow for GIF encoding
— so no ffmpeg binary and no new pip installs, unlike a typical ffmpeg-based
implementation (e.g. Eagle's video2gif/video-to-frame plugins).
"""
import base64
import logging
from pathlib import Path
logger = logging.getLogger(__name__)
try:
from PIL import Image
_RESAMPLE = getattr(getattr(Image, "Resampling", Image), "LANCZOS")
except Exception: # pragma: no cover - Pillow is a hard ComfyUI dependency
_RESAMPLE = None
class VideoService:
def _resolve_media_path(self, filename: str, subfolder: str, type_: str) -> Path:
"""Resolves a ComfyUI-style {filename, subfolder, type} reference to an
absolute path, guarding against path traversal outside the matching
input/output/temp directory."""
import folder_paths # type: ignore
base_dir = folder_paths.get_directory_by_type(type_)
if not base_dir:
raise ValueError(f"Invalid type: {type_}")
base = Path(base_dir).resolve()
target = (base / (subfolder or "") / filename).resolve()
try:
target.relative_to(base)
except ValueError:
raise ValueError("Access denied: path outside allowed directory")
if not target.is_file():
raise FileNotFoundError(f"File not found: {filename}")
return target
def save_frame_to_output(self, image_base64: str, filename_prefix: str = "video/Frame") -> dict:
"""Saves a client-captured video frame (PNG data URL) into ComfyUI's own
output folder — same auto-numbered pattern as Lab's index-image save
(see LabPlanService.save_index_image_to_output)."""
import folder_paths # type: ignore
b64 = image_base64
if "," in b64 and b64.strip().lower().startswith("data:"):
b64 = b64.split(",", 1)[1]
image_bytes = base64.b64decode(b64)
output_dir = folder_paths.get_output_directory()
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(filename_prefix, output_dir)
save_name = f"{filename}_{counter:05}_.png"
save_path = Path(full_output_folder) / save_name
save_path.write_bytes(image_bytes)
return {"filename": save_name, "subfolder": subfolder}
def convert_to_gif(
self,
filename: str,
subfolder: str,
type_: str,
start_time: float = 0.0,
end_time=None,
fps: float = 10.0,
max_width=None,
filename_prefix: str = "video/GIF",
) -> dict:
"""Decodes the given video (PyAV), samples it down to `fps`, optionally
downscales to `max_width`, and encodes the result as an animated GIF
(Pillow) into ComfyUI's own output folder."""
import av # type: ignore
import folder_paths # type: ignore
if _RESAMPLE is None:
raise RuntimeError("Pillow is not available")
src_path = self._resolve_media_path(filename, subfolder, type_)
fps = max(0.1, float(fps))
container = av.open(str(src_path))
try:
stream = container.streams.video[0]
source_fps = float(stream.average_rate) if stream.average_rate else 24.0
step = max(1, round(source_fps / fps))
pil_frames = []
idx = 0
for frame in container.decode(stream):
t = float(frame.pts * stream.time_base) if frame.pts is not None else None
if t is not None:
if t < start_time:
idx += 1
continue
if end_time is not None and t > end_time:
break
if idx % step == 0:
im = frame.to_image()
if max_width and im.width > max_width:
ratio = max_width / im.width
im = im.resize((max_width, max(1, round(im.height * ratio))), _RESAMPLE)
pil_frames.append(im.convert("RGB"))
idx += 1
finally:
container.close()
if not pil_frames:
raise ValueError("No frames found in the specified range")
output_dir = folder_paths.get_output_directory()
full_output_folder, out_filename, counter, out_subfolder, _ = folder_paths.get_save_image_path(filename_prefix, output_dir)
save_name = f"{out_filename}_{counter:05}_.gif"
save_path = Path(full_output_folder) / save_name
duration_ms = max(20, round(1000 / fps))
pil_frames[0].save(
save_path,
format="GIF",
save_all=True,
append_images=pil_frames[1:],
duration=duration_ms,
loop=0,
optimize=True,
)
return {"filename": save_name, "subfolder": out_subfolder, "frame_count": len(pil_frames)}
+2 -1
View File
@@ -80,7 +80,7 @@ class WorkflowStudio:
app.router.add_get("/wfm", serve_index_page)
# API routes
from .routes import workflow_routes, settings_routes, ollama_routes, unsloth_routes, eagle_routes, nodes_routes, prompts_routes, models_routes, gallery_routes, wildcard_routes, tagger_routes, gmic_routes, skill_routes, lab_routes
from .routes import workflow_routes, settings_routes, ollama_routes, unsloth_routes, eagle_routes, nodes_routes, prompts_routes, models_routes, gallery_routes, wildcard_routes, tagger_routes, gmic_routes, skill_routes, lab_routes, video_routes
workflow_routes.setup_routes(app)
settings_routes.setup_routes(app)
@@ -96,5 +96,6 @@ class WorkflowStudio:
gmic_routes.setup_routes(app)
skill_routes.setup_routes(app)
lab_routes.setup_routes(app)
video_routes.setup_routes(app)
logger.info("Workflow Studio: Routes registered successfully")
+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.4.7"
version = "0.5.4"
license = "MIT"
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+7
View File
@@ -22,3 +22,10 @@ piexif>=1.1.3
# -- Required to load UNSLOTH_API_KEY from a local .env file (Unsloth backend, AI TOOL tab) --
python-dotenv>=1.0,<2.0
# -- MP4 thumbnail generation (Gallery tab) --
# Uses PyAV (av) to decode the first frame. ComfyUI core already requires av>=17.0.0,
# so it is normally pre-installed in python_embeded and no action is needed here.
# If missing, mp4 thumbnail generation simply fails and falls back to a placeholder
# (Gallery itself keeps working). Not pinned here on purpose — see torch note above.
# av>=17.0.0
+28 -37
View File
@@ -290,6 +290,24 @@
color: #38bdf8;
}
/* 動画ファイル(mp4)の再生アイコンバッジ(サムネイル中央) */
.wfm-gallery-thumb-video-badge {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 36px;
height: 36px;
border-radius: 50%;
background: rgba(0,0,0,0.55);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
pointer-events: none;
}
/* テーブルビューのお気に入りボタン */
.wfm-gallery-table-fav-btn {
background: none;
@@ -465,43 +483,6 @@
cursor: pointer;
}
.wfm-gallery-preview-overlay {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
display: flex;
align-items: center;
justify-content: center;
opacity: 0;
transition: opacity 0.2s;
}
.wfm-gallery-preview-wrapper:hover .wfm-gallery-preview-overlay {
opacity: 1;
}
.wfm-gallery-download-btn {
background: var(--wfm-accent, #4f8ef7);
border: none;
border-radius: 50%;
width: 40px;
height: 40px;
font-size: 20px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
transition: background 0.2s;
}
.wfm-gallery-download-btn:hover {
background: var(--wfm-accent-hover, #3f7fe7);
}
/* タブコンテンツ */
.wfm-gallery-detail-tab-content {
flex: 1;
@@ -836,6 +817,16 @@
border-color: #6a4de0;
}
.wfm-gallery-action-btn-orange {
background: #f59e0b;
border-color: #f59e0b;
color: #1a1a2e;
}
.wfm-gallery-action-btn-orange:hover {
background: #d97f06;
border-color: #d97f06;
}
/* ── ファイル操作ボタン (詳細パネル) ─────────────────────────── */
.wfm-gallery-file-actions {
+7
View File
@@ -280,6 +280,13 @@
color: var(--wfm-danger);
}
/* Single-click selection target for the column header's up/down reorder buttons —
layered as a box-shadow (not border-color) so it never conflicts with the
revert/live/bypassed/node-bypassed border-color signaling above. */
.wfm-lab-cell.wfm-lab-cell-selected {
box-shadow: 0 0 0 2px var(--wfm-primary);
}
.wfm-lab-cell-applied {
margin-top: 3px;
padding-top: 3px;
+185
View File
@@ -0,0 +1,185 @@
/* =============================================
Video Tab (MiniMax H3専用・GenerateUIタブとは独立)
3ペイン構成: 左=フォーム / 中央=プレビュー+編集 / 右=プロパティ
各ペインは独立したカラムとして高さ100%を占め、内部でスクロールする。
中央ペインのコンテンツ量(生成結果の有無・動画の縦横比)が変わっても
左右のペインの位置が動かないよう、意図的に高さを共有させない構造にしている。
============================================= */
#wfm-tab-video {
padding: 0;
overflow: hidden;
}
.wfm-video-layout {
display: flex;
flex-direction: row;
height: 100%;
overflow: hidden;
}
/* ── 左ペイン: フォーム ── */
.wfm-video-form-panel {
width: 380px;
flex: none;
display: flex;
flex-direction: column;
gap: 10px;
padding: 16px;
overflow-y: auto;
border-right: 1px solid var(--wfm-border);
}
.wfm-video-form-panel label {
display: block;
font-size: 12px;
color: var(--wfm-text-secondary);
margin-bottom: 4px;
}
.wfm-video-header {
display: flex;
flex-direction: column;
gap: 2px;
margin-bottom: 4px;
}
.wfm-video-header h3 {
margin: 0;
}
.wfm-video-wf-name {
color: var(--wfm-text-secondary);
font-size: 13px;
}
.wfm-video-frame-slots {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.wfm-video-frame-slot {
display: flex;
flex-direction: column;
}
.wfm-video-resolution-row {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 10px;
align-items: end;
}
.wfm-video-seed-randomize-wrap {
display: flex;
align-items: center;
padding-bottom: 6px;
}
/* ── 中央ペイン: プレビュー + 編集 ── */
.wfm-video-center-panel {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
overflow-y: auto;
padding: 16px;
gap: 16px;
border-right: 1px solid var(--wfm-border);
}
/* 生成結果 or ソース選択エリアで読み込んだ動画を横並びで表示する行。
プレビュー枠が主役、ソースパネルは選択UIのみの固定幅。 */
.wfm-video-preview-row {
flex: none;
display: flex;
flex-direction: row;
gap: 16px;
}
.wfm-video-preview-frame {
flex: 1;
min-width: 0;
min-height: 260px;
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed var(--wfm-border);
border-radius: 6px;
background: var(--wfm-bg-hover, #111);
}
.wfm-video-preview-el {
max-width: 100%;
max-height: 60vh;
border-radius: 6px;
}
.wfm-video-source-panel {
width: 220px;
flex: none;
display: flex;
flex-direction: column;
}
.wfm-video-pane-header {
font-weight: 600;
margin-bottom: 4px;
}
.wfm-video-prop-hint {
font-size: 12px;
color: var(--wfm-text-secondary);
margin: 0 0 8px 0;
}
/* 将来の動画編集機能(トリミング等)用のプレースホルダー領域 */
.wfm-video-edit-panel {
flex: 1;
min-height: 160px;
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed var(--wfm-border);
border-radius: 6px;
color: var(--wfm-text-secondary);
font-size: 13px;
}
/* ── 右ペイン: プロパティ (Frame抽出 / GIF変換タブ) ── */
.wfm-video-properties-panel {
width: 240px;
flex: none;
padding: 16px;
overflow-y: auto;
}
.wfm-video-prop-tabnav {
display: flex;
gap: 4px;
margin-bottom: 12px;
border-bottom: 1px solid var(--wfm-border);
}
.wfm-video-prop-tab {
flex: 1;
background: none;
border: none;
padding: 6px 4px;
cursor: pointer;
color: var(--wfm-text-secondary);
border-bottom: 2px solid transparent;
font-size: 13px;
}
.wfm-video-prop-tab.active {
color: var(--wfm-text);
border-bottom-color: var(--wfm-primary);
}
.wfm-video-prop-content {
display: flex;
flex-direction: column;
gap: 6px;
}
+205
View File
@@ -0,0 +1,205 @@
/**
* Shared AI backend settings modal (Backend / Connection / Model / Generation / Unload / Save).
* Used by the Prompt tab and Tagger tab, each with its own localStorage key so their
* settings stay independent — mirrors the AI TOOL tab's own settings pane (ai-tab.js).
*/
import { openModal, closeModal, showToast } from "./app.js";
import { t } from "./i18n.js";
import { readJsonStorage, getAiBackendDefaultUrl, unslothProxy, unloadAiModel } from "./util.js";
function loadCfg(storageKey) {
return readJsonStorage(storageKey);
}
function saveCfg(storageKey, patch) {
const data = { ...loadCfg(storageKey), ...patch };
localStorage.setItem(storageKey, JSON.stringify(data));
return data;
}
// 保存済み設定を {backend, url, model, thinkingMode, maxTokens} の形で返す
export function getAiBackendConfig(storageKey) {
const s = loadCfg(storageKey);
const backend = s.backend || "ollama";
const url = (s.backendUrl || getAiBackendDefaultUrl(backend)).replace(/\/$/, "");
return {
backend,
url,
model: s.model || "",
thinkingMode: !!s.thinkingMode,
maxTokens: Math.max(0, parseInt(s.maxTokens, 10) || 0),
};
}
function isValidBackendUrl(url) {
try {
const u = new URL(url);
return u.protocol === "http:" || u.protocol === "https:";
} catch {
return false;
}
}
async function fetchBackendModels(url, backend) {
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).models?.map(m => m.name) || [];
} else if (backend === "unsloth") {
const data = await unslothProxy(url, "/v1/models", "GET");
return (data.data || []).map(m => m.id);
} else {
const res = await fetch(`${url}/v1/models`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return ((await res.json()).data || []).map(m => m.id);
}
}
/**
* @param {string} storageKey localStorage key holding {backend, backendUrl, model, thinkingMode, maxTokens}
* @param {string} title modal title
* @param {() => void} [onSaved] called after Save persists the config (e.g. to refresh a status label)
*/
export function openAiBackendSettingsModal(storageKey, title, onSaved) {
const saved = loadCfg(storageKey);
const backend = saved.backend || "ollama";
const html = `
<div class="wfm-ai-settings-container">
<div class="wfm-ai-settings-section">
<div class="wfm-ai-settings-title">${t("aiSettingsBackend")}</div>
<div class="wfm-ai-backend-row">
${[["ollama", "Ollama"], ["lmstudio", "LM Studio"], ["lemonade", "Lemonade"], ["unsloth", "Unsloth"]].map(([v, label]) => `
<label class="wfm-ai-radio-label">
<input type="radio" name="wfm-aism-backend" value="${v}" ${v === backend ? "checked" : ""}> ${label}
</label>`).join("")}
</div>
</div>
<div class="wfm-ai-settings-section">
<div class="wfm-ai-settings-title">${t("aiSettingsConnection")}</div>
<div class="wfm-ai-settings-row">
<label class="wfm-ai-label">URL</label>
<input type="text" id="wfm-aism-url" class="wfm-input wfm-ai-url-input" value="${saved.backendUrl || getAiBackendDefaultUrl(backend)}">
</div>
<div class="wfm-ai-settings-row">
<button id="wfm-aism-test-btn" class="wfm-btn">${t("aiSettingsTestBtn")}</button>
<button id="wfm-aism-unload-btn" class="wfm-btn">${t("aiUnloadModel")}</button>
</div>
<div class="wfm-ai-settings-row">
<span id="wfm-aism-test-result" class="wfm-ai-test-result"></span>
</div>
</div>
<div class="wfm-ai-settings-section">
<div class="wfm-ai-settings-title">${t("aiSettingsModelSection")}</div>
<div class="wfm-ai-settings-row">
<select id="wfm-aism-model" class="wfm-select wfm-ai-model-select">
<option value="">${t("selectModel")}</option>
</select>
<button id="wfm-aism-refresh-btn" class="wfm-btn">${t("aiSettingsRefreshBtn")}</button>
</div>
</div>
<div class="wfm-ai-settings-section">
<div class="wfm-ai-settings-title">${t("aiSettingsGenerationTitle")}</div>
<div class="wfm-ai-settings-row">
<label class="wfm-ai-label" style="display:flex;align-items:center;gap:6px;cursor:pointer;">
<input type="checkbox" id="wfm-aism-thinking"> ${t("aiSettingsThinkingMode")}
</label>
</div>
<div class="wfm-ai-settings-row">
<label class="wfm-ai-label">${t("aiSettingsMaxTokens")}</label>
<input type="number" id="wfm-aism-max-tokens" class="wfm-input" min="0" step="1" placeholder="${t("aiSettingsMaxTokensPlaceholder")}">
</div>
</div>
<div class="wfm-ai-settings-section">
<button id="wfm-aism-save-btn" class="wfm-btn wfm-btn-primary">${t("aiSettingsSaveBtn")}</button>
</div>
</div>`;
openModal(title, html);
const urlInput = document.getElementById("wfm-aism-url");
const modelSelect = document.getElementById("wfm-aism-model");
const thinkingCheckbox = document.getElementById("wfm-aism-thinking");
const maxTokensInput = document.getElementById("wfm-aism-max-tokens");
const testResultEl = document.getElementById("wfm-aism-test-result");
thinkingCheckbox.checked = !!saved.thinkingMode;
if (saved.maxTokens) maxTokensInput.value = saved.maxTokens;
function currentBackend() {
return document.querySelector("input[name='wfm-aism-backend']:checked")?.value || "ollama";
}
async function populateModels(selectedModel) {
const url = urlInput.value.trim();
try {
const models = await fetchBackendModels(url, currentBackend());
modelSelect.innerHTML = models.length
? models.map(name => `<option value="${name}" ${name === selectedModel ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
} catch {
modelSelect.innerHTML = `<option value="">${t("noModelsFound")}</option>`;
}
}
populateModels(saved.model || "");
document.querySelectorAll("input[name='wfm-aism-backend']").forEach(r => {
r.addEventListener("change", () => {
urlInput.value = getAiBackendDefaultUrl(r.value);
testResultEl.textContent = "";
});
});
document.getElementById("wfm-aism-refresh-btn")?.addEventListener("click", () => populateModels(modelSelect.value));
document.getElementById("wfm-aism-test-btn")?.addEventListener("click", async () => {
const url = urlInput.value.trim();
if (!isValidBackendUrl(url)) {
testResultEl.textContent = t("aiToastInvalidUrlInput");
testResultEl.className = "wfm-ai-test-result wfm-ai-status-error";
return;
}
testResultEl.textContent = t("aiStatusConnecting");
testResultEl.className = "wfm-ai-test-result wfm-ai-status-working";
try {
const models = await fetchBackendModels(url, currentBackend());
testResultEl.textContent = `${t("aiStatusConnectOk")} (${models.length} ${t("aiModels")})`;
testResultEl.className = "wfm-ai-test-result wfm-ai-status-ok";
await populateModels(modelSelect.value);
} catch (err) {
testResultEl.textContent = `${t("aiStatusConnectFail")}${err.message}`;
testResultEl.className = "wfm-ai-test-result wfm-ai-status-error";
}
});
document.getElementById("wfm-aism-unload-btn")?.addEventListener("click", async () => {
const url = urlInput.value.trim();
const model = modelSelect.value;
if (!model) { showToast(t("aiUnloadNoModel"), "error"); return; }
try {
await unloadAiModel(url, currentBackend(), model);
showToast(t("aiUnloadDone"), "success");
} catch (err) {
showToast(err.message === "UNSUPPORTED" ? t("aiUnloadUnsupported") : t("aiUnloadFailed") + err.message, "error");
}
});
document.getElementById("wfm-aism-save-btn")?.addEventListener("click", () => {
const url = urlInput.value.trim();
if (url && !isValidBackendUrl(url)) {
showToast(t("aiToastInvalidUrl"), "error");
return;
}
saveCfg(storageKey, {
backend: currentBackend(),
backendUrl: url,
model: modelSelect.value,
thinkingMode: !!thinkingCheckbox.checked,
maxTokens: Math.max(0, parseInt(maxTokensInput.value, 10) || 0),
});
showToast(t("aiToastSettingsSaved"), "success");
closeModal();
if (onSaved) onSaved();
});
}
+15 -1
View File
@@ -5,7 +5,7 @@
import { showToast } from "./app.js";
import { t } from "./i18n.js";
import { readJsonStorage, getAiBackendDefaultUrl, escapeHtml } from "./util.js";
import { readJsonStorage, getAiBackendDefaultUrl, escapeHtml, unloadAiModel } from "./util.js";
import { comfyUI } from "./comfyui-client.js";
import { comfyEditor } from "./comfyui-editor.js";
import { comfyWorkflow } from "./comfyui-workflow.js";
@@ -456,6 +456,20 @@ function initSettingsTab() {
}
});
// Unload model
document.getElementById("wfm-ai-unload-btn")?.addEventListener("click", async () => {
const backend = document.querySelector("input[name='wfm-ai-backend']:checked")?.value || "ollama";
const url = urlInput?.value?.trim() || "";
const model = document.getElementById("wfm-ai-model-select")?.value || "";
if (!model) { showToast(t("aiUnloadNoModel"), "error"); return; }
try {
await unloadAiModel(url, backend, model);
showToast(t("aiUnloadDone"), "success");
} catch (err) {
showToast(err.message === "UNSUPPORTED" ? t("aiUnloadUnsupported") : t("aiUnloadFailed") + err.message, "error");
}
});
// Model refresh
document.getElementById("wfm-ai-model-refresh-btn")?.addEventListener("click", () => refreshModels());
+23 -7
View File
@@ -112,7 +112,7 @@ function initTabs() {
function applyI18nToHtml() {
// Tab labels
const tabMap = { workflow: "tabWorkflow", nodes: "tabNodes", models: "tabModels", generate: "tabGenerate", prompt: "tabPrompt", gallery: "tabGallery", "image-edit": "tabImageEdit", settings: "tabSettings", help: "tabHelp", ai: "tabAi", tagger: "tabTagger" };
const tabMap = { workflow: "tabWorkflow", nodes: "tabNodes", models: "tabModels", generate: "tabGenerate", prompt: "tabPrompt", gallery: "tabGallery", "image-edit": "tabImageEdit", video: "tabVideo", settings: "tabSettings", help: "tabHelp", ai: "tabAi", tagger: "tabTagger" };
document.querySelectorAll(".wfm-tab").forEach((tab) => {
const key = tabMap[tab.dataset.tab];
if (key) tab.textContent = t(key);
@@ -134,6 +134,12 @@ function applyI18nToHtml() {
if (listLoadBtn.disabled) listLoadBtn.title = t("selectCardFirst");
}
const listLoadVideoBtn = document.getElementById("wfm-list-load-video-btn");
if (listLoadVideoBtn) {
listLoadVideoBtn.textContent = t("loadInVideo");
if (listLoadVideoBtn.disabled) listLoadVideoBtn.title = t("selectCardFirst");
}
const listOpenComfyBtn = document.getElementById("wfm-list-open-comfyui-btn");
if (listOpenComfyBtn) {
listOpenComfyBtn.textContent = t("sendToCanvas");
@@ -313,10 +319,8 @@ function applyI18nToHtml() {
if (assistantHeader) assistantHeader.textContent = t("assistantSubtab");
const presetsHeader = document.querySelector(".wfm-prompt-split-right .wfm-prompt-split-header");
if (presetsHeader) presetsHeader.textContent = t("presetsSubtab");
const ollamaRefreshBtn = document.getElementById("wfm-ollama-refresh-btn");
if (ollamaRefreshBtn) ollamaRefreshBtn.textContent = t("refresh");
const ollamaTestBtn = document.getElementById("wfm-ollama-test-btn");
if (ollamaTestBtn) ollamaTestBtn.textContent = t("test");
const ollamaSettingsBtn = document.getElementById("wfm-ollama-settings-btn");
if (ollamaSettingsBtn) ollamaSettingsBtn.title = t("settings");
const ollamaAttachBtn = document.getElementById("wfm-ollama-attach-btn");
if (ollamaAttachBtn) ollamaAttachBtn.textContent = t("attachImage");
const ollamaClearBtn = document.getElementById("wfm-ollama-clear-btn");
@@ -481,6 +485,7 @@ function applyI18nToHtml() {
"wfm-help-gen-28": "helpGen28",
"wfm-help-gen-29": "helpGen29",
"wfm-help-gen-30": "helpGen30",
"wfm-help-gen-31": "helpGen31",
"wfm-help-feeder-title": "helpFeederTitle",
"wfm-help-feeder-desc": "helpFeederDesc",
"wfm-help-feeder-imgloop-title": "helpFeederImgloopTitle",
@@ -507,6 +512,7 @@ function applyI18nToHtml() {
"wfm-help-lab-13": "helpLab13", "wfm-help-lab-14": "helpLab14",
"wfm-help-lab-15": "helpLab15",
"wfm-help-lab-16": "helpLab16", "wfm-help-lab-17": "helpLab17",
"wfm-help-lab-18": "helpLab18", "wfm-help-lab-19": "helpLab19",
"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",
@@ -534,6 +540,7 @@ function applyI18nToHtml() {
"wfm-help-prompt-20": "helpPrompt20", "wfm-help-prompt-21": "helpPrompt21",
"wfm-help-prompt-22": "helpPrompt22", "wfm-help-prompt-23": "helpPrompt23",
"wfm-help-prompt-24": "helpPrompt24", "wfm-help-prompt-25": "helpPrompt25",
"wfm-help-prompt-26": "helpPrompt26",
"wfm-help-settings-1": "helpSettings1", "wfm-help-settings-2": "helpSettings2",
"wfm-help-settings-3": "helpSettings3", "wfm-help-settings-4": "helpSettings4",
"wfm-help-settings-5": "helpSettings5", "wfm-help-settings-6": "helpSettings6",
@@ -541,6 +548,7 @@ function applyI18nToHtml() {
"wfm-help-settings-9": "helpSettings9", "wfm-help-settings-10": "helpSettings10",
"wfm-help-settings-11": "helpSettings11", "wfm-help-settings-12": "helpSettings12",
"wfm-help-settings-13": "helpSettings13", "wfm-help-settings-14": "helpSettings14",
"wfm-help-settings-15": "helpSettings15", "wfm-help-settings-16": "helpSettings16",
"wfm-help-nodes-1": "helpNodes1", "wfm-help-nodes-2": "helpNodes2",
"wfm-help-nodes-3": "helpNodes3", "wfm-help-nodes-4": "helpNodes4",
"wfm-help-nodes-5": "helpNodes5", "wfm-help-nodes-6": "helpNodes6",
@@ -560,7 +568,7 @@ function applyI18nToHtml() {
"wfm-help-gallery-11": "helpGallery11", "wfm-help-gallery-12": "helpGallery12",
"wfm-help-gallery-13": "helpGallery13", "wfm-help-gallery-14": "helpGallery14",
"wfm-help-gallery-15": "helpGallery15", "wfm-help-gallery-16": "helpGallery16",
"wfm-help-gallery-17": "helpGallery17",
"wfm-help-gallery-17": "helpGallery17", "wfm-help-gallery-27": "helpGallery27",
"wfm-help-gallery-18": "helpGallery18", "wfm-help-gallery-19": "helpGallery19",
"wfm-help-gallery-20": "helpGallery20", "wfm-help-gallery-21": "helpGallery21",
"wfm-help-gallery-22": "helpGallery22", "wfm-help-gallery-23": "helpGallery23",
@@ -613,7 +621,7 @@ function applyI18nToHtml() {
"wfm-help-imageedit-12": "helpImageEdit12", "wfm-help-imageedit-13": "helpImageEdit13",
"wfm-help-imageedit-14": "helpImageEdit14", "wfm-help-imageedit-15": "helpImageEdit15",
"wfm-help-imageedit-16": "helpImageEdit16", "wfm-help-imageedit-17": "helpImageEdit17",
"wfm-help-imageedit-18": "helpImageEdit18", "wfm-help-imageedit-19": "helpImageEdit19",
"wfm-help-imageedit-18": "helpImageEdit18",
"wfm-help-imageedit-19b": "helpImageEdit19b",
"wfm-help-imageedit-20": "helpImageEdit20", "wfm-help-imageedit-21": "helpImageEdit21",
"wfm-help-imageedit-22": "helpImageEdit22", "wfm-help-imageedit-23": "helpImageEdit23",
@@ -722,6 +730,12 @@ function applyI18nToHtml() {
"wfm-help-trouble-card-connection-title": "helpTroubleCardConnection",
"wfm-help-trouble-card-workflow-title": "helpTroubleCardWorkflow",
"wfm-help-trouble-card-tagger-title": "helpTroubleCardTagger",
"wfm-help-video-title": "helpVideoTitle",
"wfm-help-video-desc": "helpVideoDesc",
"wfm-help-video-1": "helpVideo1", "wfm-help-video-2": "helpVideo2",
"wfm-help-video-3": "helpVideo3", "wfm-help-video-4": "helpVideo4",
"wfm-help-video-5": "helpVideo5", "wfm-help-video-6": "helpVideo6",
"wfm-help-video-7": "helpVideo7", "wfm-help-video-8": "helpVideo8",
};
for (const [id, key] of Object.entries(helpIdMap)) {
const el = document.getElementById(id);
@@ -812,6 +826,7 @@ import { initMetadataTab } from "./metadata-tab.js";
import { initAiTab } from "./ai-tab.js";
import { initTaggerTab } from "./tagger-tab.js";
import { imageEditTab } from "./image-edit-tab.js";
import { initVideoTab } from "./video-tab.js";
// Apply saved theme immediately to prevent flash of default theme
applyTheme(getSavedTheme());
@@ -863,6 +878,7 @@ document.addEventListener("DOMContentLoaded", () => {
initAiTab();
initTaggerTab();
imageEditTab.init();
initVideoTab();
console.log("Workflow Studio: App initialized");
});
+8
View File
@@ -1446,6 +1446,12 @@ export const comfyEditor = {
<label>Batch Size</label>
<input type="number" class="wfm-input" id="wfm-settings-batch" value="${latent.batch_size ?? 1}" min="1" max="64">
</div>
${latent.isVideoLatent ? `
<div class="wfm-form-group">
<label>Length (frames)</label>
<input type="number" class="wfm-input" id="wfm-settings-latent-length" value="${latent.length ?? ""}" placeholder="${latent.length === undefined ? "linked" : ""}" step="1" min="1">
</div>
` : ""}
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-latent-apply">Apply</button>
${latent.width === undefined || latent.height === undefined ? `<p class="wfm-placeholder" style="margin-top:6px;">Width/Height is linked to another node (e.g. auto-follows the input image) — leave blank to keep it linked.</p>` : ""}
<div style="margin-top:10px;border-top:1px solid var(--wfm-border);padding-top:10px;">
@@ -1502,6 +1508,8 @@ export const comfyEditor = {
if (wEl?.value !== "") inputs.width = parseInt(wEl.value) || 512;
if (hEl?.value !== "") inputs.height = parseInt(hEl.value) || 512;
inputs.batch_size = parseInt(document.getElementById("wfm-settings-batch")?.value) || 1;
const lenEl = document.getElementById("wfm-settings-latent-length");
if (lenEl && lenEl.value !== "") inputs.length = parseInt(lenEl.value) || 1;
_syncRawJson();
});
+93 -35
View File
@@ -75,6 +75,35 @@ async function _loadObjectInfo() {
* Get ordered widget (non-link) input names for a node class from object_info.
* These correspond to widgets_values in UI-format nodes.
*/
// Scalar widget types object_info can declare for a required/optional input.
const _WIDGET_TYPE_SET = new Set(["INT", "FLOAT", "STRING", "BOOLEAN", "COMBO", "COMFY_DYNAMICCOMBO_V3"]);
/**
* Resolve a possibly-compound object_info type spec (e.g. LTXVEmptyLatentAudio's frame_rate:
* "FLOAT,INT", a MultiType declaration meaning "widget defaults to FLOAT but also accepts an INT
* link") down to the single scalar widget type it actually occupies a widgets_values slot as.
* Preferring the explicit widgetType hint some MultiType specs carry, else the first comma-
* separated segment. Returns null for link-only types (MODEL, CLIP, LATENT, etc.) or arrays that
* aren't combo option lists.
*
* Without this, a plain `upper === "INT" || ...` exact-match check silently drops any
* comma-joined MultiType widget from the name/type lists entirely — which corrupts every widget
* declared after it in the node's schema order in _simulateWidgetValues (see its own docstring),
* exactly the class of bug that produced e.g. LTXVEmptyLatentAudio's batch_size reading
* frame_rate's stale value instead of its own.
*/
function _resolveWidgetType(type, spec) {
if (Array.isArray(type)) return "COMBO";
if (typeof type !== "string") return null;
const explicit = spec?.[1]?.widgetType;
if (typeof explicit === "string" && _WIDGET_TYPE_SET.has(explicit.toUpperCase())) return explicit.toUpperCase();
for (const part of type.split(",")) {
const upper = part.trim().toUpperCase();
if (_WIDGET_TYPE_SET.has(upper)) return upper;
}
return null;
}
function _getWidgetInputNames(objectInfo, classType) {
const info = objectInfo[classType];
if (!info) return [];
@@ -89,31 +118,16 @@ function _getWidgetInputNames(objectInfo, classType) {
// (e.g. CLIPTextEncodeEditPlus's text1/text2). Never has a widgets_values entry.
if (Array.isArray(spec) && spec[1]?.forceInput) continue;
// Link types are strings like "MODEL", "CLIP", "CONDITIONING", "LATENT", "IMAGE", etc.
// Widget types are: "INT", "FLOAT", "STRING", "BOOLEAN", or an array of choices
if (Array.isArray(type)) {
// Combo/enum widget
names.push(name);
} else if (typeof type === "string") {
const upper = type.toUpperCase();
if (upper === "INT" || upper === "FLOAT" || upper === "STRING" || upper === "BOOLEAN" || upper === "COMBO" || upper === "COMFY_DYNAMICCOMBO_V3") {
names.push(name);
}
// Other uppercase types (MODEL, CLIP, etc.) are link inputs, skip
}
// Widget types are: "INT", "FLOAT", "STRING", "BOOLEAN", an array of choices, or a
// comma-joined MultiType union of those (e.g. "FLOAT,INT") — see _resolveWidgetType.
if (_resolveWidgetType(type, spec)) names.push(name);
}
// Optional inputs that are widgets
for (const [name, spec] of Object.entries(optional)) {
const type = Array.isArray(spec) ? spec[0] : spec;
if (Array.isArray(spec) && spec[1]?.forceInput) continue;
if (Array.isArray(type)) {
names.push(name);
} else if (typeof type === "string") {
const upper = type.toUpperCase();
if (upper === "INT" || upper === "FLOAT" || upper === "STRING" || upper === "BOOLEAN" || upper === "COMFY_DYNAMICCOMBO_V3") {
names.push(name);
}
}
if (_resolveWidgetType(type, spec)) names.push(name);
}
return names;
@@ -133,26 +147,14 @@ function _getWidgetInputTypes(objectInfo, classType) {
for (const [name, spec] of Object.entries(required)) {
const type = Array.isArray(spec) ? spec[0] : spec;
if (Array.isArray(spec) && spec[1]?.forceInput) continue;
if (Array.isArray(type)) {
types.push("COMBO");
} else if (typeof type === "string") {
const upper = type.toUpperCase();
if (upper === "INT" || upper === "FLOAT" || upper === "STRING" || upper === "BOOLEAN" || upper === "COMBO" || upper === "COMFY_DYNAMICCOMBO_V3") {
types.push(upper);
}
}
const resolved = _resolveWidgetType(type, spec);
if (resolved) types.push(resolved);
}
for (const [name, spec] of Object.entries(optional)) {
const type = Array.isArray(spec) ? spec[0] : spec;
if (Array.isArray(spec) && spec[1]?.forceInput) continue;
if (Array.isArray(type)) {
types.push("COMBO");
} else if (typeof type === "string") {
const upper = type.toUpperCase();
if (upper === "INT" || upper === "FLOAT" || upper === "STRING" || upper === "BOOLEAN" || upper === "COMBO" || upper === "COMFY_DYNAMICCOMBO_V3") {
types.push(upper);
}
}
const resolved = _resolveWidgetType(type, spec);
if (resolved) types.push(resolved);
}
return types;
}
@@ -962,6 +964,14 @@ export const comfyWorkflow = {
if (Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
// LTXVDualCFGGuider (LTX-2.5's video+audio guider) — positive/negative both
// commonly point at the *same* LTXVConditioning node (different output slots),
// so this only seeds the role on that node; LTXVConditioning below splits it
// back out per-slot onto its own positive/negative inputs.
if (ct === "LTXVDualCFGGuider") {
if (Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
}
// === Pass 1b: Expand refs through CONDITIONING graph (BFS, 5 iterations) ===
@@ -1038,6 +1048,13 @@ export const comfyWorkflow = {
if (isPos && Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (isNeg && Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
// LTXVConditioning (LTX-2.5) — same shape as InstructPixToPixConditioning:
// separate positive/negative inputs feeding separate outputs consumed by
// LTXVDualCFGGuider, so each role must route only to its own input.
if (ct === "LTXVConditioning") {
if (isPos && Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (isNeg && Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
// ComfySwitchNode ("If/Else Switch", on_false/on_true/switch) — used by Ernie
// Image's prompt-enhancement toggle to pick between the raw PrimitiveStringMultiline
// text and an LLM-generated (TextGenerate) rewrite. The rewrite can't be known
@@ -1336,6 +1353,19 @@ export const comfyWorkflow = {
});
}
// Video all-in-one nodes (e.g. MiniMaxH3ImageToVideo) — hold their own "prompt"
// widget directly instead of going through a separate CLIPTextEncode, and have
// no negative counterpart. Matched generically by class name (ImageToVideo /
// TextToVideo) rather than a fixed list so future models sharing this pattern
// (WAN, HunyuanVideo, etc.) work without a code change — same detection metadata-tab.js
// and node_sets_menu.js already use for prompt extraction (see extractPromptsAPI).
if ((ct.includes("ImageToVideo") || ct.includes("TextToVideo")) && typeof inputs.prompt === "string") {
result.prompt_nodes.push({
id, type: ct, title, role: "positive",
text: inputs.prompt, textKey: "prompt",
});
}
// --- Latent nodes ---
// EmptyFlux2LatentImage (Flux.2 templates) often has width/height wired to a
// GetImageSize node (auto-follows the reference image) rather than a direct number —
@@ -1350,6 +1380,21 @@ export const comfyWorkflow = {
});
}
// Video latent nodes (Wan2.2's EmptyHunyuanLatentVideo, LTX-2.5's
// EmptyLTXVLatentVideo) — same width/height/batch_size shape as EmptyLatentImage
// plus a frame-count "length" input, usually linked to a duration*fps expression
// (see video-tab.js's own Wan2.2/LTX-2.5 handling) rather than a literal number —
// left undefined in that case so the settings-tab UI shows "linked".
if (ct === "EmptyHunyuanLatentVideo" || ct === "EmptyLTXVLatentVideo") {
result.latent_nodes.push({
id, type: ct, title, isVideoLatent: true,
width: typeof inputs.width === "number" ? inputs.width : undefined,
height: typeof inputs.height === "number" ? inputs.height : undefined,
batch_size: inputs.batch_size,
length: typeof inputs.length === "number" ? inputs.length : undefined,
});
}
// ResolutionSelector (ComfyUI core, comfy_extras.nodes_resolution): typically
// feeds an EmptyLatentImage's width/height rather than being a latent node
// itself. aspect_ratio is a fixed-choice COMBO (e.g. "3:2 (Photo)") — its exact
@@ -1519,6 +1564,19 @@ export const comfyWorkflow = {
return result;
},
// True if this analysis found a video all-in-one node (see analyzeWorkflow's
// ImageToVideo/TextToVideo prompt_nodes branch). Callers use this to pick a longer
// generation timeout (video generation runs far longer than a still image) — see
// generate-tab.js _coreGenerate and lab-tab.js _runLabBatch.
isVideoWorkflow(analysis) {
if ((analysis?.prompt_nodes || []).some((n) => /ImageToVideo|TextToVideo/.test(n.type))) return true;
// LTX-2.5/Wan2.2: no all-in-one *ToVideo node — detected instead via their
// EmptyHunyuanLatentVideo/EmptyLTXVLatentVideo latent node (see analyzeWorkflow)
// or a SaveVideo/CreateVideo node anywhere in the flattened graph.
if ((analysis?.latent_nodes || []).some((n) => n.isVideoLatent)) return true;
return (analysis?.all_nodes || []).some((n) => n.type === "SaveVideo" || n.type === "CreateVideo");
},
applyParams(workflow, params) {
for (const [key, value] of Object.entries(params)) {
// Parse key format: nodeId.paramName
+125 -16
View File
@@ -14,6 +14,7 @@ import { comfyEditor } from "./comfyui-editor.js";
import { callLLM, loadAiSettings, isValidBackendUrl } from "./ai-tab.js";
import { initImagePromptTab, activateImagePromptTab } from "./image-prompt-tab.js";
import { initStyleCatalogTab, activateStyleCatalogTab } from "./style-catalog-tab.js";
import { applyStoredVideoVolume } from "./settings-tab.js";
// ── 定数 ─────────────────────────────────────────────────────
@@ -46,6 +47,13 @@ const API = {
export const FEEDER_GROUP = "__Feeder__";
// 拡張子から動画ファイル(mp4)かどうかを判定する。
// 一覧アイテムは path/filename、詳細メタ(get_image_metadata)は ext フィールドを持つため両対応。
function isVideoFile(img) {
const source = img?.ext || img?.filename || img?.path || "";
return source.toLowerCase().endsWith(".mp4");
}
// ComfyUI Comic Creater からiframe越しに画像を受け取り、Generate UIのImage入力スロットへ直接セットする(I2I連携)。
// Comic Creater側の「I2Iへ送る」ボタンから
// iframe.contentWindow._wfmReceiveImageForI2I(blob, name, workflowData?, workflowFilename?) として呼ばれる。
@@ -253,6 +261,13 @@ function formatDate(mtime) {
return new Date(mtime * 1000).toLocaleString();
}
function formatDuration(seconds) {
const total = Math.round(seconds);
const m = Math.floor(total / 60);
const s = total % 60;
return `${m}:${String(s).padStart(2, "0")}`;
}
async function openImageInMetadataTab(img) {
try {
const res = await fetch(API.serveImage(img.path));
@@ -453,6 +468,16 @@ function renderTreeNode(node, container, depth, isRoot) {
container.appendChild(item);
container.appendChild(childContainer);
// root フォルダはデフォルトで展開状態にする(フォルダスキャン高速化により
// サブフォルダの内容もすぐ確認できるようになったため、折りたたみ初期状態だと
// 気付きにくい)
if (isRoot) {
arrow.dataset.expanded = "true";
arrow.textContent = "▼";
childContainer.style.display = "";
node.children.forEach(child => renderTreeNode(child, childContainer, depth + 1, false));
}
} else {
container.appendChild(item);
}
@@ -578,6 +603,14 @@ function createThumbCard(img) {
};
card.appendChild(imgEl);
// 動画ファイルは再生アイコンバッジを重ねて表示(サムネイル自体は先頭フレームのJPEG)
if (isVideoFile(img)) {
const playBadge = document.createElement("div");
playBadge.className = "wfm-gallery-thumb-video-badge";
playBadge.textContent = "▶";
card.appendChild(playBadge);
}
// お気に入りトグルボタン(カード右上)
const favBtn = document.createElement("button");
favBtn.className = `wfm-gallery-thumb-fav-btn${img.favorite ? " active" : ""}`;
@@ -877,18 +910,20 @@ async function loadImageDetail(img) {
if (moveBtn) moveBtn.disabled = false;
if (delBtn) delBtn.disabled = false;
// プレビュー
// プレビュー(mp4は<video controls>、それ以外は<img>)
const preview = document.getElementById("wfm-gallery-detail-preview");
const isVideo = isVideoFile(img);
const mediaHtml = isVideo
? `<video src="${API.serveImage(img.path)}" class="wfm-gallery-detail-img" controls title="Double-click to enlarge"></video>`
: `<img src="${API.serveImage(img.path)}" class="wfm-gallery-detail-img" alt="${escapeHtml(img.filename)}" title="Double-click to enlarge">`;
preview.innerHTML = `
<div class="wfm-gallery-preview-wrapper">
<img src="${API.serveImage(img.path)}" class="wfm-gallery-detail-img" alt="${escapeHtml(img.filename)}" title="Double-click to enlarge">
<div class="wfm-gallery-preview-overlay">
<button class="wfm-gallery-download-btn" title="Download image">⬇</button>
</div>
${mediaHtml}
</div>
`;
preview.querySelector("img").addEventListener("dblclick", () => openLightbox(img));
preview.querySelector(".wfm-gallery-download-btn").addEventListener("click", () => downloadImage(img));
const previewMediaEl = preview.querySelector(isVideo ? "video" : "img");
previewMediaEl.addEventListener("dblclick", () => openLightbox(img));
if (isVideo) applyStoredVideoVolume(previewMediaEl);
// ファイル名
document.getElementById("wfm-gallery-detail-filename").textContent = img.filename;
@@ -914,6 +949,7 @@ async function loadImageDetail(img) {
renderWorkflowJson(state.embeddedWorkflow);
_updateCopyCanvasBtn();
renderImagePromptSection(metaRes.image_prompt);
renderDimensionInfo(metaRes);
// Promptタブは prompt_workflow (API形式優先) を使う。トップレベルとサブグラフに
// 独立した複数系統を持つワークフローでは workflow (UI形式) からの抽出だと
// トップレベル系統しか拾えないことがあるため(Metadataタブと同じ優先順位に揃える)。
@@ -922,6 +958,7 @@ async function loadImageDetail(img) {
renderWorkflowJson(null);
_updateCopyCanvasBtn();
renderImagePromptSection(null);
renderDimensionInfo(null);
renderPromptTab(null);
}
@@ -929,6 +966,15 @@ async function loadImageDetail(img) {
renderDetailGroup(img);
}
function renderDimensionInfo(metaRes) {
const el = document.getElementById("wfm-gallery-info-dim");
if (!el) return;
const parts = [];
if (metaRes?.width && metaRes?.height) parts.push(`${metaRes.width}×${metaRes.height}`);
if (metaRes?.duration) parts.push(formatDuration(metaRes.duration));
el.textContent = parts.length ? parts.join(" · ") : "";
}
function renderImagePromptSection(imagePrompt) {
const section = document.getElementById("wfm-gallery-image-prompt-section");
const text = document.getElementById("wfm-gallery-image-prompt-text");
@@ -1014,7 +1060,8 @@ async function addTag(tag) {
const tags = [...(state.selectedImage.tags || [])];
if (tags.includes(tag.trim())) return;
tags.push(tag.trim());
await saveMetaField({ tags });
const ok = await saveMetaField({ tags });
if (!ok) return;
state.selectedImage.tags = tags;
renderTagsDisplay(tags);
updateTagFilter(state.images);
@@ -1023,24 +1070,38 @@ async function addTag(tag) {
async function removeTag(tag) {
if (!state.selectedImage) return;
const tags = (state.selectedImage.tags || []).filter(t => t !== tag);
await saveMetaField({ tags });
const ok = await saveMetaField({ tags });
if (!ok) return;
state.selectedImage.tags = tags;
renderTagsDisplay(tags);
updateTagFilter(state.images);
}
// 戻り値: 保存が実際にサーバーへ永続化されたか(true/false)。呼び出し元はこれを見て
// ローカル状態(state.selectedImage等)の更新可否を判断すること — でないと、サーバーが
// 保存を拒否した場合にもUI上は成功したように見えてしまう(リロードすると消える不具合の原因)。
async function saveMetaField(fields) {
if (!state.selectedImage) return;
if (!state.selectedImage) return false;
try {
await fetch(API.saveImageMeta, {
const res = await fetch(API.saveImageMeta, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: state.selectedImage.path, ...fields }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const json = await res.json();
// サーバー側は常にHTTP 200を返し、成否は body.ok (bool) で表す設計
// (gallery_routes.py save_image_meta)。ここをチェックしないと、
// 許可パス外などでサーバーが保存を拒否してもUI上は成功したように見えてしまう。
if (json.error || json.ok === false) {
throw new Error(json.error || "Save rejected by server");
}
const idx = state.images.findIndex(i => i.path === state.selectedImage.path);
if (idx >= 0) Object.assign(state.images[idx], fields);
return true;
} catch (e) {
showToast(t("saveFailed", e.message), "error");
return false;
}
}
@@ -1583,9 +1644,12 @@ async function bulkSetFavorite(favoriteValue) {
function openLightbox(img) {
const overlay = document.createElement("div");
overlay.className = "wfm-gallery-lightbox";
const mediaHtml = isVideoFile(img)
? `<video src="${API.serveImage(img.path)}" class="wfm-gallery-lightbox-img" controls autoplay></video>`
: `<img src="${API.serveImage(img.path)}" class="wfm-gallery-lightbox-img" alt="${escapeHtml(img.filename)}">`;
overlay.innerHTML = `
<div class="wfm-gallery-lightbox-inner">
<img src="${API.serveImage(img.path)}" class="wfm-gallery-lightbox-img" alt="${escapeHtml(img.filename)}">
${mediaHtml}
<div class="wfm-gallery-lightbox-footer">${escapeHtml(img.filename)}</div>
<button class="wfm-gallery-lightbox-close">&times;</button>
</div>
@@ -1596,6 +1660,7 @@ function openLightbox(img) {
}
});
document.body.appendChild(overlay);
if (isVideoFile(img)) applyStoredVideoVolume(overlay.querySelector("video"));
}
// ── 画像比較ライトボックス ─────────────────────────────────────
@@ -1607,12 +1672,17 @@ function openCompare(paths) {
const overlay = document.createElement("div");
overlay.className = "wfm-gallery-lightbox wfm-lightbox-compare";
const itemsHtml = imgs.map(img => `
const itemsHtml = imgs.map(img => {
const mediaHtml = isVideoFile(img)
? `<video src="${API.serveImage(img.path)}" class="wfm-lightbox-compare-img" controls></video>`
: `<img src="${API.serveImage(img.path)}" class="wfm-lightbox-compare-img" alt="${escapeHtml(img.filename)}" loading="lazy">`;
return `
<div class="wfm-lightbox-compare-item">
<img src="${API.serveImage(img.path)}" class="wfm-lightbox-compare-img" alt="${escapeHtml(img.filename)}" loading="lazy">
${mediaHtml}
<div class="wfm-lightbox-compare-label">${escapeHtml(img.filename)}</div>
</div>
`).join("");
`;
}).join("");
overlay.innerHTML = `
<div class="wfm-lightbox-compare-inner">
@@ -1626,6 +1696,7 @@ function openCompare(paths) {
}
});
document.body.appendChild(overlay);
overlay.querySelectorAll("video").forEach(applyStoredVideoVolume);
}
// ── outputパス取得 ────────────────────────────────────────────
@@ -1751,6 +1822,34 @@ function bindEvents() {
}
});
// 選択画像をComfyUIキャンバス上で選択中のノード(LoadImage系)のimageウィジェットへ送信。
// Image Editタブの「Send to LI node」と同じ橋渡し(window.opener.wfmSendImageToSelectedNode、
// node_sets_menu.js側で定義)を使う。Galleryの画像はGalleryルート配下の任意フォルダにあり得るため、
// GenUI送信と違いLoadImageノードの有無に依存しない — /upload/imageでinputフォルダへ
// アップロードしてから、そのファイル名を書き込む。
document.getElementById("wfm-gallery-send-li-node-btn")?.addEventListener("click", async () => {
if (!state.selectedImage) {
showToast(t("gallerySelectImageFirst"), "info");
return;
}
if (!window.opener || typeof window.opener.wfmSendImageToSelectedNode !== "function") {
showToast(t("sendToLiNodeNoOpener"), "error");
return;
}
try {
const res = await fetch(API.serveImage(state.selectedImage.path));
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const blob = await res.blob();
const file = new File([blob], state.selectedImage.filename || "gallery-image.png", { type: blob.type || "image/png" });
const result = await comfyUI.uploadImage(file, file.name);
const filename = result.subfolder ? `${result.subfolder}/${result.name}` : result.name;
window.opener.wfmSendImageToSelectedNode(filename);
showToast(t("sendToLiNodeSuccess", filename), "success");
} catch (e) {
showToast(t("errorWithMsg", e.message), "error");
}
});
// 選択画像を ComfyUI Comic Creator の選択コマ/オーバーレイへ送信
// (ComfyUI Comic CreaterからこのGalleryタブがiframe埋め込みされている場合のみ表示・動作する)
const sendCcBtn = document.getElementById("wfm-gallery-send-cc-btn");
@@ -1884,7 +1983,7 @@ function bindEvents() {
// メモ保存
document.getElementById("wfm-gallery-memo-save-btn")?.addEventListener("click", () => {
const memo = document.getElementById("wfm-gallery-memo").value;
saveMetaField({ memo }).then(() => showToast(t("memoSaved"), "success"));
saveMetaField({ memo }).then((ok) => { if (ok) showToast(t("memoSaved"), "success"); });
});
// ワークフローコピー&キャンバスへ送る
@@ -2017,6 +2116,16 @@ function bindEvents() {
openImageInTaggerTab(state.selectedImage);
});
// Downloadボタン: プレビューのオーバーレイだと動画の再生コントロール操作を妨げるため、
// アクションボタン行に常時表示のボタンとして配置している
document.getElementById("wfm-gallery-download-btn")?.addEventListener("click", () => {
if (!state.selectedImage) {
showToast(t("gallerySelectImageFirst"), "error");
return;
}
downloadImage(state.selectedImage);
});
// Load in GenerateUI ボタン: 埋め込みワークフローをGenerateUIタブに読み込む
document.getElementById("wfm-gallery-load-genui-btn")?.addEventListener("click", async () => {
if (!state.selectedImage) {
+50 -11
View File
@@ -11,6 +11,7 @@ import { syncJsonHighlight, syncScroll } from "./json-highlight.js";
import { initFeederTab, refreshFeederNodeList } from "./feeder-tab.js";
import { initLabTab, refreshLabLiveDefaults } from "./lab-tab.js";
import { getSettings, readJsonStorage, escapeHtml, getEagleSettings, saveToEagle } from "./util.js";
import { isVideoFilename } from "./video-utils.js";
// ============================================
// Gallery Metadata - ワークフロー保存
@@ -164,6 +165,17 @@ async function saveCurrentWorkflow() {
nameEl.dataset.filename = filename;
}
}
// このファイル名が「デフォルトワークフロー」(workflow-tab.jsの「デフォルトに設定」で
// localStorageにスナップショットされたAPI形式JSON、ページ起動時に自動読込される)に
// 一致する場合、保存内容と食い違ったまま残らないようスナップショットも更新する。
// 更新しないと、ここで上書き保存しても次回リロード時に古いモデル等が復活する。
const settings = getSettings();
if (settings.defaultWorkflow === filename) {
settings.defaultWorkflowData = workflow;
localStorage.setItem("wfm_settings", JSON.stringify(settings));
}
showToast(t("savedAs", filename), "success");
} catch (err) {
showToast(t("saveFailed", err.message), "error");
@@ -281,6 +293,13 @@ export async function loadWorkflowIntoEditor(workflow, filename) {
refreshFeederNodeList();
// Lab subtab may already be the active one (e.g. it was active when this workflow
// was loaded) — the subtab-click handler that normally triggers this refresh never
// fires in that case, leaving Setting 1's live-reflected cells showing the previous
// workflow until the user clicks a cell or revisits the subtab.
const activeSubtab = document.querySelector(".wfm-gen-subtab-btn.active")?.dataset.subtab;
if (activeSubtab === "lab") refreshLabLiveDefaults();
if (ckptWarning) {
showToast(ckptWarning, "error");
} else {
@@ -1447,6 +1466,7 @@ async function _coreGenerate(silent = false, workflowOverride = null, genOptions
const progressBar = document.getElementById("wfm-gen-progress-bar");
const progressText = document.getElementById("wfm-gen-progress-text");
const resultImg = document.getElementById("wfm-gen-result-img");
const resultVideo = document.getElementById("wfm-gen-result-video");
const resultThumbs = document.getElementById("wfm-gen-result-thumbs");
// genOptions.seedValue lets a caller (e.g. AI TOOL Chat's generate_image tool)
@@ -1464,11 +1484,16 @@ async function _coreGenerate(silent = false, workflowOverride = null, genOptions
const baseWorkflow = workflowOverride || comfyUI.currentWorkflow;
const workflowStyled = _applyStyleToWorkflow({ ...baseWorkflow });
const workflowForGenerate = await _expandWildcardsInWorkflow(workflowStyled);
// Video workflows (e.g. MiniMax H3) run far longer than a still image — use a longer
// timeout so a multi-minute generation doesn't get force-rejected mid-run (see
// comfyWorkflow.isVideoWorkflow and video-tab.js's own 30-minute timeout).
const isVideo = comfyWorkflow.isVideoWorkflow(comfyUI.currentAnalysis);
const { images, seed, svgOutputs } = await comfyUI.generate(
workflowForGenerate,
{
seedMode,
seedValue,
timeoutMs: isVideo ? 30 * 60 * 1000 : undefined,
onProgress: (pct) => {
if (progressBar) progressBar.style.width = `${(pct * 100).toFixed(1)}%`;
if (progressText) progressText.textContent = `${(pct * 100).toFixed(0)}%`;
@@ -1514,23 +1539,36 @@ async function _coreGenerate(silent = false, workflowOverride = null, genOptions
});
}
} else if (outputImages.length > 0) {
// Video outputs (SaveVideo/PreviewVideo, e.g. MiniMax H3) come back through the
// same {"images":[...]} shape as still images — dispatch to <video> vs <img>
// per-item by extension rather than assuming the whole batch is one media type.
const showMedia = (blob, filename) => {
const url = URL.createObjectURL(blob);
if (isVideoFilename(filename)) {
if (resultVideo) { resultVideo.src = url; resultVideo.style.display = "block"; }
if (resultImg) resultImg.style.display = "none";
} else {
if (resultImg) { resultImg.src = url; resultImg.style.display = "block"; }
if (resultVideo) { resultVideo.pause(); resultVideo.style.display = "none"; }
}
};
const blob = await comfyUI.getImageBlob(outputImages[0]);
const url = URL.createObjectURL(blob);
if (resultImg) {
resultImg.src = url;
resultImg.style.display = "block";
}
showMedia(blob, outputImages[0].filename);
if (resultThumbs && outputImages.length > 1) {
resultThumbs.innerHTML = "";
for (let i = 0; i < outputImages.length; i++) {
const b = i === 0 ? blob : await comfyUI.getImageBlob(outputImages[i]);
const u = i === 0 ? url : URL.createObjectURL(b);
const thumb = document.createElement("img");
const filename = outputImages[i].filename;
const u = URL.createObjectURL(b);
const isVid = isVideoFilename(filename);
const thumb = document.createElement(isVid ? "video" : "img");
thumb.src = u;
if (isVid) thumb.muted = true;
thumb.className = `wfm-gen-thumb ${i === 0 ? "active" : ""}`;
thumb.addEventListener("click", () => {
resultImg.src = u;
showMedia(b, filename);
resultThumbs.querySelectorAll(".wfm-gen-thumb").forEach((t) => t.classList.remove("active"));
thumb.classList.add("active");
});
@@ -2253,10 +2291,11 @@ export async function initGenerateTab() {
});
searchOverlay.innerHTML = html + "\n";
// Scroll editor to current match
// Scroll editor to current match. フォーカス/selectionRangeは意図的に設定しない
// (テキストエリアにカーソルが当たった状態になり、検索直後のキー入力が選択範囲を
// 上書きして不意にJSONを編集してしまうため)。ハイライトはsearchOverlayの<mark>
// 表示のみで行い、編集はユーザーが明示的にエディタをクリックした場合に限る。
const pos = matchPositions[currentMatchIndex];
editor.focus();
editor.setSelectionRange(pos, pos + term.length);
const lineNum = (text.slice(0, pos).match(/\n/g) || []).length;
const lineH = parseFloat(getComputedStyle(editor).lineHeight) || 18;
editor.scrollTop = Math.max(0, lineH * lineNum - editor.clientHeight / 2);
+312 -57
View File
@@ -256,6 +256,7 @@ const LANGUAGES = {
labNoWorkflowLoaded: "Load a workflow into GenerateUI first",
labNoSourceImage: "Drop a source image first",
labNoResultsYet: "No results yet",
labLastFrameExtractFailed: (msg) => `Failed to extract last frame from generated video: ${msg}`,
labResultPreview: "Preview",
labEnterPlanName: "Plan name:",
labPlanSaved: "Plan saved",
@@ -287,6 +288,15 @@ const LANGUAGES = {
labT2IImageIgnored: "T2I mode is on — image upload is not needed and was skipped",
labIndexImageSaved: (filename) => `Index image saved to Output: ${filename}`,
labIndexImageSaveFailed: "Failed to save the index image to Output",
labPromptGroupBtnTitle: "Apply a Prompt Group",
labPromptGroupModalTitle: "Prompt Group",
labPromptGroupEmpty: "No groups yet. Create groups in the Prompt tab's group panel.",
labPromptGroupCount: (n) => `${n} preset(s)`,
labPromptGroupSelectFirst: "Select a group first",
labPromptGroupNoPresets: "This group has no presets",
labPromptGroupApplied: (name, n) => `Applied "${name}" (${n} keyframes) to Prompt`,
labPromptGroupBatchRaised: (n) => `Batch count raised to ${n} to fit the group`,
labSelectKeyframeFirst: "Select a keyframe first",
// -- GenerateUI Input tab: Image sub-panel placeholder --
i2iPlaceholderTitle: "Placeholder Image",
@@ -319,6 +329,8 @@ const LANGUAGES = {
textSizeLabel: "Text Size",
textSizeTextarea: "Prompt / Chat Textarea",
textSizeHint: "Applies to: Generate UI prompts, AI Assistant chat, Preset prompts, Wildcard textarea, Metadata prompt preview",
videoVolumeLabel: "Video Volume",
videoVolumeHint: "Applies to: Video tab preview, Gallery detail/lightbox/compare video players — the level you set here (or adjust via any video's own controls) carries over to the next video opened anywhere in the app.",
jsonColorsSection: "RAW JSON Colors",
jsonColorBase: "Base text",
jsonColorYellow: "Names / Scheduler",
@@ -567,6 +579,8 @@ const LANGUAGES = {
gallerySelectImageFirst: "Please select an image first",
galleryNoLoadImageNode: "No LoadImage node in current workflow",
gallerySentGenUI: "Sent to GenerateUI Image tab",
sendToLiNodeNoOpener: "Open Workflow Studio from ComfyUI's top menu to use this feature",
sendToLiNodeSuccess: (filename) => `Sent "${filename}" to LI node`,
galleryCCNotAvailable: "Open this Gallery from ComfyUI Comic Creator to use Send CC",
gallerySentCC: "Sent to ComfyUI Comic Creator",
galleryNoEmbeddedWorkflow: "No ComfyUI workflow embedded in this image.",
@@ -634,7 +648,7 @@ const LANGUAGES = {
taggerThreshold: "Threshold",
taggerCharThreshold: "Char Thr.",
taggerGenerateTags: "Generate Tags",
taggerOllamaEnable: "Ollama VLM",
taggerOllamaEnable: "VLM Tagging",
taggerOllamaUrl: "API URL",
taggerOllamaModel: "Model",
taggerOllamaPrompt: "Prompt",
@@ -703,6 +717,12 @@ const LANGUAGES = {
aiSettingsInputLang: "Input",
aiSettingsOutputLang: "Output",
aiSettingsSaveBtn: "Save Settings",
aiUnloadModel: "Unload Model",
aiUnloading: "Unloading...",
aiUnloadDone: "Model unloaded",
aiUnloadFailed: "Unload failed: ",
aiUnloadUnsupported: "This backend does not support unloading via API",
aiUnloadNoModel: "Select a model first",
aiToastNoText: "Please enter text",
aiToastNoModel: "Please select a model in the Settings tab",
aiToastInvalidUrl: "URL must start with http:// or https://",
@@ -773,7 +793,8 @@ const LANGUAGES = {
helpGen5: "Model tab: Checkpoint, VAE, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — type and device selectors; DualCLIP shows two clip selectors) are always shown; ControlNet and Hypernetwork (with Strength field) are collapsed by default since they're used less often — click their header to expand; LoRA (Single/Stack tabs) has its own column to the right; all selectors have a 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",
helpGen28: "Model tab — Highlight color: the label of each model type (Checkpoint, VAE, Diffusion Model, Text Encoder, ControlNet, Hypernetwork) and the LoRA column header turn a distinct color (default bright green) when the loaded workflow actually contains that type of node; this stays visible even while ControlNet/Hypernetwork are collapsed, so you can tell at a glance whether they're in use without expanding them; the color is customizable in the Settings tab",
helpGen6: "Settings tab: KSampler and Latent Image side by side, each at 50% width",
helpGen7: "Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow; if the loaded workflow has Bypass or Mute nodes, a note listing them appears above the search bar (Bypass nodes are excluded with their wires reconnected around them; Mute nodes are excluded with no reconnection, matching ComfyUI itself)",
helpGen31: "LTX-2.5 and Wan2.2 video workflows also work when loaded as regular workflows in this tab (not just the dedicated Video tab): Positive/Negative Prompt detection follows LTX-2.5's LTXVDualCFGGuider / LTXVConditioning nodes to find the actual prompt text, and the Settings tab's Latent Image section recognizes Wan2.2's EmptyHunyuanLatentVideo and LTX-2.5's EmptyLTXVLatentVideo nodes (with an added Length (frames) field) instead of showing \"No EmptyLatentImage node found\"; generating from these workflows also gets the same extended timeout as MiniMax H3 video generations",
helpGen7: "Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow; if the loaded workflow has Bypass or Mute nodes, a note listing them appears above the search bar (Bypass nodes are excluded with their wires reconnected around them; Mute nodes are excluded with no reconnection, matching ComfyUI itself); the search bar highlights matches and scrolls to them without moving the cursor into the editor, so typing right after a search can't accidentally overwrite the JSON — click into the editor first to actually edit",
helpGen8: "Seed control: random, fixed, increment, decrement",
helpGen9: "Generate, progress display, stop, and view results",
helpGen10: "Eagle integration: auto-save generated images to Eagle (SVG output supported too — both the standard SaveSVGNode and comfyui-tosvg's Save SVG String node)",
@@ -835,6 +856,8 @@ const LANGUAGES = {
helpLab15: "Checkpoint / LoRA / VAE each carry forward independently, the same effective-value rule as every other column (see above): a keyframe in one never resets the other two to the workflow default. A field left blank in the edit modal shows \"(inherits: ...)\" as its placeholder instead of \"(workflow default)\" when an earlier keyframe in that same list already set something, so it's clear what actually applies. \"Revert to #1's setting\" and Bypass — like +/- — only ever affect whichever ONE of the three is currently selected by the C/L/V toggle, never the other two",
helpLab16: "Bypass LoRA node checkbox (LoRA keyframe's own edit modal only): forces that keyframe's strength_model/strength_clip to 0 at apply-time, standing in for ComfyUI's own node Bypass (mode:4) — the workflow used here is already converted to API format, which has no mode concept, so zeroing strength is the behavioral equivalent. Disables the strength fields while checked; independent of the row-level Bypass checkbox above (see helpLab13), which skips the whole row instead of touching the node",
helpLab17: "Apply LoRA syntax + trigger words to Positive prompt checkbox (LoRA column only): when checked, appends <lora:name:strengthModel:strengthClip> plus that LoRA's cached CivitAI trigger words to the Positive prompt, comma-separated, at apply-time — the same format GenerateUI's own Model tab Apply button writes. Switching keyframes (a different LoRA, this checkbox turned off, or the row Bypassed) always strips exactly what the previous iteration injected before adding anything new, so a batch never accumulates every LoRA it has used. Disabled automatically while Bypass LoRA node is checked",
helpLab18: "A single click on a keyframe cell selects it (blue outline) instead of opening it — double-click to open the edit modal as before. Each column's header (Model / Prompt / Ksampler) also has ▲ / ▼ buttons that swap the selected keyframe with its immediate neighbor to reorder them without retyping anything; keyframe #1 (the baseline) can never move, and nothing can be swapped into its slot",
helpLab19: "Prompt column header's PG button: pick one of the Prompt tab's preset groups (Table view's Presets Group, the same groups used by the Batch tab's checklist) and replace the entire Prompt column with one keyframe per preset in that group's order, starting at #1 (#1 is overwritten, not appended after). If the group has more presets than the current Batch count, Batch count is raised automatically to fit (capped at 50, the Batch input's own limit); anything still beyond that shows the usual \"keyframes beyond Batch count\" warning instead of being silently dropped",
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",
@@ -853,7 +876,7 @@ const LANGUAGES = {
helpLabResults3: "Loading a saved plan restores its Results grid from the image list recorded in the plan file",
helpSearchPlaceholder: "Search help...",
helpPrompt1: "AI assistant (Ollama / LM Studio / Lemonade): model selection, chat for prompt consultation, image attachment (vision models); backend and URL configured in Settings tab",
helpPrompt1: "AI assistant (Ollama / LM Studio / Lemonade / Unsloth): chat for prompt consultation, image attachment (vision models); click the ⚙ Settings button to choose backend, connection URL, model, Thinking mode, Max tokens, and unload the loaded model — settings are independent from the AI TOOL and Tagger tabs",
helpPrompt2: "Apply AI responses to GenerateUI prompts",
helpPrompt3: "Translation: JA\u2194EN, ZH\u2194EN",
helpPrompt4: "Preset management: create, edit, positive/negative prompt clipboard copy (PP/NP)",
@@ -878,14 +901,17 @@ const LANGUAGES = {
helpPrompt23: "Wildcards table — same files as the Form tab's Wildcard file manager; editing the File path or the Ext dropdown renames the file (saves the content under the new name, then removes the old file)",
helpPrompt24: "Style table — same styles as the Form tab's Style manager, editable inline the same way as Presets",
helpPrompt25: "Presets table toolbar — the ★ and B sort buttons (next to the search box) bring favorited / batch-selected presets to the top of the list; both can be enabled together (★ takes priority, B breaks ties), and everything else keeps its original relative order",
helpPrompt26: "Style table toolbar — select exactly one row whose File badge isn't custom.json to enable + Add to this file: it adds a blank row targeting that same file (shown as a badge in the File column even before saving) — the same capability as the Form tab's Style manager (see above); custom.json entries and multi-row selections leave the button disabled, use the regular + New Style button for those instead",
helpSettings1: "UI language and summary language",
helpSettings2: "Theme selection (13 presets) with customization: color overrides, background patterns (stripes, polka dot, checkerboard, SVG tiling), and font selection (16 Google Fonts including Japanese display fonts)",
helpSettings3: "Workflow data folder path",
helpSettings4: "ComfyUI connection URL and test",
helpSettings5: "AI Assistant (Prompt Tab): backend (Ollama / LM Studio / Lemonade), API URL, default model, and connection test",
helpSettings5: "AI Assistant settings have moved out of this tab — the Prompt tab, Tagger tab, and AI TOOL tab each have their own ⚙ Settings button (backend, URL, model, Thinking mode, Max tokens, unload model), saved independently",
helpSettings6: "Default workflow setting",
helpSettings7: "Eagle integration URL and auto-save toggle",
helpSettings8: "Data Management: export all plugin data (settings, metadata, prompts, etc.) to a JSON file, or import to restore. After importing, restart ComfyUI.",
helpSettings8: "Data Management: export core settings, metadata, and prompts to a JSON file, or import to restore. After importing, restart ComfyUI.",
helpSettings15: "Full Backup (ZIP): unlike the JSON export above, also includes folder-based data (AI Skills, Lab Plans, Style presets) and the Tagger database — everything the JSON export can't represent. Restoring overwrites existing files; restart ComfyUI afterward.",
helpSettings16: "Two opt-in checkboxes above the Full Backup buttons additionally include ComfyUI's default workflows folder and the Impact Pack's wildcard folder in the export — both export-only, never restored automatically; copy the ZIP's _external/ folder back by hand if you want them.",
helpSettings9: "All sections are collapsible accordion panels",
helpSettings10: "Wildcard Integration: link WFS wildcard dir to ComfyUI-Impact-Pack wildcards (directory junction on Windows / symlink on other OS); existing files migrated automatically",
helpSettings11: "Text Size: one slider (10–28 px) adjusts font size for all prompt and chat textareas at once — Generate UI positive/negative prompts, AI Assistant chat input, Preset positive/negative, Wildcard prompt and file editor, and Metadata prompt full preview; takes effect immediately and saved with Save Settings",
@@ -918,17 +944,18 @@ const LANGUAGES = {
helpGallery4: "Toolbar filters: favorites (★), text search (filename / tag / prompt), tag filter, group filter, sort by date/name",
helpGallery5: "Folder tree: click to load images, expand with ▶; '+ New' creates a subfolder inside the selected folder, 'Del' deletes it with all contents",
helpGallery6: "Multi-select: Ctrl+click to toggle individual images; Shift+click to range-select from the last clicked item — bulk bar: select group → 'Add to Group' / 'Remove from Group'; 'Favorite All' / 'Unfavorite All'; 'Compare' (2–4 images); 'Move To...'; 'Delete File'",
helpGallery7: "Detail panel — Info tab: filename, size, date, tags (add/remove), memo; 'Move To...' moves the image to another folder, 'Delete File' removes it permanently",
helpGallery7: "Detail panel — Info tab: filename, size, dimensions (image width×height) or video duration, date, tags (add/remove), memo; 'Move To...' moves the image to another folder, 'Delete File' removes it permanently",
helpGallery8: "Detail panel — JSON tab: displays workflow JSON from PNG embedded data (prompt / workflow keys) or from metadata saved by the Generate UI tab; 'Copy & Send Canvas' button copies to clipboard and sends the workflow directly to the ComfyUI canvas (requires Workflow Studio to be opened from the ComfyUI toolbar; UI-format only falls back to title drag if opened from a bookmark)",
helpGallery9: "Detail panel — Groups tab: create, assign, remove, rename, and delete groups per image",
helpGallery10: "Workflow auto-save: images generated in the Generate UI tab automatically have their workflow saved to gallery metadata and shown in the JSON tab",
helpGallery11: "Supports PNG (tEXt/iTXt), JPEG, WebP, GIF; workflow extraction reads ComfyUI prompt and workflow keys embedded in PNG metadata",
helpGallery11: "Supports PNG (tEXt/iTXt), JPEG, WebP, GIF, MP4; workflow extraction reads ComfyUI prompt/workflow keys embedded in PNG metadata or in MP4 container tags (as written by SaveVideo, e.g. MiniMax H3 output)",
helpGallery12: "Metadata button (green, in the detail panel tab bar): opens the selected image in the Metadata tab for full embedded-data inspection; Alt+click on any image thumbnail has the same effect",
helpGallery13: "Load GenUI button (blue, in the detail panel tab bar): loads the embedded ComfyUI workflow from the selected image directly into the GenerateUI tab and switches to it; shows a warning toast if no workflow is embedded or the format is not supported",
helpGallery14: "Tagger button (purple, in the detail panel action row): opens the selected image directly in the Tagger tab's Single mode for instant tagging",
helpGallery15: "F button (cyan overlay, top-left of each thumbnail): toggle the image in/out of the __Feeder__ group with a single click; cyan and always visible when in group, visible on hover only when not; quickly queue images for the Feeder tab Gallery mode",
helpGallery16: "Image Edit button (toolbar, next to Refresh): sends the currently selected image to the Image Edit tab; if layers already exist the image is added as a new layer scaled to fit the canvas, otherwise it becomes Layer 1",
helpGallery17: "Send GenUI Image button (toolbar, next to Image Edit): uploads the selected image to ComfyUI and sets it as the input for the first LoadImage node in the GenerateUI tab; automatically switches to GenerateUI → Input → Image; requires a workflow with at least one LoadImage node to be loaded first",
helpGallery27: "Send to LI node button (toolbar, next to Send GenUI Image): uploads the selected image and writes its filename into the image widget of the currently selected node on the ComfyUI canvas (falling back to the first LoadImage-type node found) — same destination as Image Edit tab's Send to LI node; requires Workflow Studio to have been opened from ComfyUI's top menu button",
helpGallery18: "Second sub-tab next to Output (top of the Gallery tab) for browsing a visual prompt library — manages the ws_image_prompt folder inside the ComfyUI output directory (created automatically)",
helpGallery19: "Same 3-column layout: folder tree (left) | thumbnails (center) | prompt builder (right). Click a thumbnail to preview it and its prompt text — this does not add it to the prompt yet",
helpGallery20: "\"+ Add\" appends the previewed image's prompt as a chip under \"Selected Prompts\"; chips can be removed individually (×) or all at once (\"Clear All\"); \"Save\" edits and persists the prompt text for that image",
@@ -941,13 +968,13 @@ const LANGUAGES = {
// -- Tagger Tab --
helpTaggerTitle: "Tagger Tab",
helpTagger1: "Automatic image tagging using WD Tagger (ONNX), SwinV2, DeepDanbooru (.h5), and Ollama VLM — 3 sub-tabs: Single / Batch / DB",
helpTagger1: "Automatic image tagging using WD Tagger (ONNX), SwinV2, DeepDanbooru (.h5), and VLM (Ollama / LM Studio / Lemonade / Unsloth) — 3 sub-tabs: Single / Batch / DB",
helpTagger2: "Model placement: put each model in its own subfolder under ComfyUI/models/tagger/<model-name>/; the folder must contain a .onnx file + selected_tags.csv (or .h5 + label file for DeepDanbooru)",
helpTagger3: "Single tab: drag & drop an image onto the preview area, or click Upload to pick a file; the Tagger button in the Gallery detail panel opens the selected image directly here",
helpTagger4: "Threshold slider: minimum confidence score for general tags (default 0.35); Character Threshold: separate threshold for character: prefix tags (default 0.85)",
helpTagger5: "Ollama VLM: enable the checkbox to run a vision model alongside WD Tagger; set API URL, select model (click ↻ to refresh), and customize the prompt; results from both models are merged",
helpTagger5: "VLM Tagging: enable the checkbox to run a vision model alongside WD Tagger; click the ⚙ Settings button to choose backend (Ollama / LM Studio / Lemonade / Unsloth), URL, model, Thinking mode, Max tokens, and unload the model — independent from the Prompt tab's own AI settings; customize the prompt and Max Tags inline; results from both models are merged",
helpTagger6: "Result tags can be sent to: (1) GenUI:P — appended to the GenerateUI tab's positive prompt textarea and applied to the loaded workflow immediately; (2) Send to Prompt — appended to the Prompt tab's positive textarea; (3) Save to Gallery — saved to Gallery image metadata (requires image opened from Gallery); (4) Write to File — embedded into JPEG EXIF (ImageDescription) or PNG tEXt (Tags key); (5) Save to DB — stored in the internal SQLite database",
helpTagger7: "Batch tab: enter a folder path, configure WD Tagger and Ollama settings; output options: Save to DB (default on), Write to File (EXIF/PNG metadata), Write .txt (creates <filename>.txt alongside each image); click Start Batch to process all images in the folder; progress bar and log are updated in real time; Stop cancels after the current image",
helpTagger7: "Batch tab: enter a folder path, configure WD Tagger and enable VLM tagging (uses the same ⚙ Settings as the Single tab); output options: Save to DB (default on), Write to File (EXIF/PNG metadata), Write .txt (creates <filename>.txt alongside each image); click Start Batch to process all images in the folder; progress bar and log are updated in real time; Stop cancels after the current image",
helpTagger8: "DB tab: searchable database of all tagged images; click a row to open the edit panel and modify WD Tags / VLM Tags; Save updates the record, Delete removes it; Export CSV downloads all records as a CSV file",
helpTagger9: "Install dependencies into ComfyUI's embedded Python: python_embeded\\python.exe -m pip install -r requirements.txt; for GPU ONNX inference install onnxruntime-gpu instead of onnxruntime; TensorFlow (for DeepDanbooru) is commented out by default due to size",
@@ -964,7 +991,7 @@ const LANGUAGES = {
helpSidepanel10: "Search within each sub-tab to quickly find items",
helpSidepanel11: "Models tab: All / ★ Favorites / Groups / By Type sub-tabs; Prompts tab: All / ★ Favorites / Categories sub-tabs + Groups sub-tab (row 2); Models Groups — LoRA groups show an \"All N LoRAs\" item to drag all into a single Lora Loader (LoraManager) node",
helpSidepanel12: "⚙ Theme button (header): customize panel background, sub-header background, text, border, and secondary text colors — changes are saved to localStorage and applied on next open",
helpSidepanel13: "I tab (Information): drop a ComfyUI PNG/WebP/JSON to inspect model, LoRA, and prompt metadata in the side panel — sub-tabs: model / lora / Prompts; supports UnetLoaderGGUF, QuadrupleCLIPLoader, and Lora Loader (LoraManager) node types",
helpSidepanel13: "I tab (Information): drop a ComfyUI PNG/WebP/MP4/JSON to inspect model, LoRA, and prompt metadata in the side panel — sub-tabs: model / lora / Prompts; supports UnetLoaderGGUF, QuadrupleCLIPLoader, and Lora Loader (LoraManager) node types; MP4 reads the workflow/prompt tags embedded by SaveVideo, including all-in-one video nodes like MiniMax H3 ImageToVideo",
helpSidepanel14: "Information tab — drag items to canvas: model sub-tab places the loader node (Checkpoint → CheckpointLoaderSimple, VAE → VAELoader, Diffusion Model → UNETLoader, Text Encoder → CLIPLoader); double-click also places at canvas center",
helpSidepanel15: "Information tab — LoRA sub-tab: detects LoRAs from LoraLoader, LoraLoaderModelOnly, and Lora Loader (LoraManager) nodes (API format supported); drag individual LoRA to place LoraLoader; \"Multiple LORA\" section places all LoRAs in a single Lora Loader (LoraManager) node with LoRA syntax pre-filled; Prompts sub-tab: drag a prompt to place CLIPTextEncode node with text pre-filled; click prompt to view full text and copy",
helpSidepanel16: "A tab (AI Tools): Translation, Chat, TOOLS, and Settings sub-tabs powered by Ollama, LM Studio, Lemonade, or Unsloth; Chat supports multi-turn conversations; TOOLS includes VLM image analysis and wildcard generation; settings shared with the SPA AI TOOL tab via localStorage",
@@ -974,7 +1001,7 @@ const LANGUAGES = {
helpAi2: "Translation pane: translate between Japanese, English, Chinese, or Free language using Ollama, LM Studio, Lemonade, or Unsloth; ⇄ swap button swaps both language selectors and text content; selections are saved automatically",
helpAi3: "Chat pane: multi-turn conversation with the LLM; Enter to send a message, Shift+Enter for a newline; Clear button resets the conversation history; if the model supports tool calling and asks for an image (\"generate a cat picture\", etc.) it will run generation on the workflow currently loaded in GenerateUI and show the result inline; the \"Allow image generation\" checkbox in the pane header toggles this on/off; if an image is attached (dropped in the TOOLS pane) it is sent to the LLM as vision input and, when generate_image is called, used as the base for image-to-image generation instead of text-to-image; generate_image also accepts optional generation parameters the model can fill in from the request — steps, cfg, sampler_name, scheduler, denoise, seed, width, height, batch_size (number of images produced in that one call), and aspect_ratio (a ratio preset like \"3:2\", applied only if the workflow has a Resolution Selector node feeding width/height — ignored otherwise); anything the model doesn't supply keeps whatever the loaded workflow already has set; models verified to work well for tool calling and vision: Gemma 4:e4b, Qwen 3.5:9b, Ministral 3:3b (Ollama)",
helpAi4: "TOOLS pane — VLM: drop an image (PNG/JPG/WebP) and select a task (Describe Image, Create Prompt, Create Tags), click Run; or select \"Create wildcards\", enter a category name and count to generate plain-text entries one per line; the dropped image is also shared with the Chat pane as its attachment (shown there and used for image-to-image generation) until cleared with the ✕ button",
helpAi6: "Settings pane: choose backend (Ollama / LM Studio / Lemonade / Unsloth), set API URL, test connection, select model; Unsloth always requires an API key even for local access — set UNSLOTH_API_KEY in a .env file in the plugin folder (copy .env.example) and restart ComfyUI, the key is read server-side and never sent to the browser; Unsloth also requires \"Auto model switching (OpenAI API)\" to be turned ON in the Unsloth Desktop app itself (its own Settings screen) — without it, requests fail with HTTP 404 unless a model was already manually loaded in the Unsloth Studio UI; Unsloth reasoning models return their thinking in a separate reasoning_content field rather than inline <think> tags, so a low Max tokens can make the model spend its whole budget reasoning and return an empty reply — increase Max tokens (2048+) if replies come back blank; Generation section — Thinking mode toggle (off by default; Ollama receives a think flag, and regardless of backend any <think>...</think> block is stripped from the output when off, so reasoning models don't clutter Translation/Chat/TOOLS results) and Max tokens (Ollama: num_predict, LM Studio/Lemonade/Unsloth: max_tokens; 0 = unlimited); configure Free language names; Chat Image Generation section lets you enable a dedicated workflow for Chat-triggered text-to-image generation instead of the one currently loaded in GenerateUI; Chat I2I Generation section is the same but for image-to-image generation when an image is attached; settings are shared with the Library panel's A tab via localStorage",
helpAi6: "Settings pane: choose backend (Ollama / LM Studio / Lemonade / Unsloth), set API URL, test connection, select model, and use the Unload Model button (next to Test connection) to free the loaded model from VRAM/memory — Ollama uses keep_alive:0, LM Studio uses /api/v1/models/unload, Lemonade uses /api/v1/unload; Unsloth has no unload API, so this shows an unsupported message for it; Unsloth always requires an API key even for local access — set UNSLOTH_API_KEY in a .env file in the plugin folder (copy .env.example) and restart ComfyUI, the key is read server-side and never sent to the browser; Unsloth also requires \"Auto model switching (OpenAI API)\" to be turned ON in the Unsloth Desktop app itself (its own Settings screen) — without it, requests fail with HTTP 404 unless a model was already manually loaded in the Unsloth Studio UI; Unsloth reasoning models return their thinking in a separate reasoning_content field rather than inline <think> tags, so a low Max tokens can make the model spend its whole budget reasoning and return an empty reply — increase Max tokens (2048+) if replies come back blank; Generation section — Thinking mode toggle (off by default; Ollama receives a think flag, and regardless of backend any <think>...</think> block is stripped from the output when off, so reasoning models don't clutter Translation/Chat/TOOLS results) and Max tokens (Ollama: num_predict, LM Studio/Lemonade/Unsloth: max_tokens; 0 = unlimited); configure Free language names; Chat Image Generation section lets you enable a dedicated workflow for Chat-triggered text-to-image generation instead of the one currently loaded in GenerateUI; Chat I2I Generation section is the same but for image-to-image generation when an image is attached; settings are shared with the Library panel's A tab via localStorage",
helpAi7: "Chat pane — SVG: the LLM can also produce SVG graphics directly as text, with no ComfyUI workflow involved; ask it to draw something in SVG and, if the reply contains SVG code, it is rendered inline as a preview with a \"Save to Gallery\" button that writes it as a .svg file to the Gallery tab's output folder; this does not use tool calling, so it works with any model regardless of tool-calling support",
helpAi8: "Chat pane — Skills: pick a skill from the dropdown above the message list to prepend its instructions to the conversation as a system prompt (not shown in the visible chat log); use the pencil button to open the skill manager and create, edit, or delete .md skill files, stored in user/default/Workflow-Studio/ai_skills/; a file's first line block between --- markers can define name/description shown in the dropdown; two starter skills are included by default: \"SVG Icon Generator\" (decomposes the subject into parts before drawing, for more recognizable SVG output) and \"Skill Creator\" (interviews you conversationally and drafts a new skill file, ready to save); when a reply contains a ```skill code block, a \"Save as new skill\" button appears below it that opens the manager with the draft pre-filled",
helpAi9: "Tips for writing your own skills: give a clear frontmatter name/description so it reads well in the dropdown and tooltip; state the exact output format you want and, if there is a deliverable to extract later (like SVG or another skill file), wrap it in a distinctive fenced code block; write concrete, imperative instructions rather than vague ones - smaller local models follow explicit rules and a short worked example far better than general guidance; state hard constraints (forbidden content, security, length limits) explicitly rather than assuming they are implied; when in doubt, select the \"Skill Creator\" skill in the dropdown and describe what you want - it will interview you and draft the file for you",
@@ -1069,8 +1096,7 @@ const LANGUAGES = {
helpImageEditExportTitle: "Export & Navigation",
helpImageEdit17: "Save PNG: composites all visible layers and downloads the result as a PNG file",
helpImageEdit18: "Save to Gallery: prompts for a filename (default: wfs-image-YYYYMMDDHHmmss) and saves the composite PNG directly to the Gallery root folder (configured in Settings > Gallery Output Folder); requires the Gallery tab to have been opened at least once to set the root",
helpImageEdit19: "Save to Input: uploads the composite PNG to ComfyUI's input folder via /upload/image, making it selectable in Load Image nodes",
helpImageEdit19b: "Send to Workflow: uploads the composite PNG (same as Save to Input) and additionally writes the resulting filename into the image widget of the currently selected node in the ComfyUI graph, falling back to the first LoadImage-type node found; requires Workflow Studio to have been opened from ComfyUI's top menu button so the ComfyUI tab is reachable",
helpImageEdit19b: "Send to LI node: uploads the composite PNG to ComfyUI's input folder via /upload/image and writes the resulting filename into the image widget of the currently selected node in the ComfyUI graph, falling back to the first LoadImage-type node found; requires Workflow Studio to have been opened from ComfyUI's top menu button so the ComfyUI tab is reachable",
helpImageEdit20: "Canvas navigation: scroll wheel to zoom, Space + drag to pan",
helpImageEdit21: "Undo / Redo: Ctrl+Z / Ctrl+Y (or toolbar buttons ↩ ↪)",
helpImageEditKbdTitle: "Image Edit Keyboard Shortcuts",
@@ -1192,13 +1218,20 @@ const LANGUAGES = {
eagleUrl: "Eagle URL",
eagleAutoSave: "Auto-save generated images to Eagle",
dataManagement: "Data Management",
dataManagementHint: "Export all plugin data (settings, metadata, prompts, etc.) to a JSON file, or import a previously exported file to restore data. After importing, restart ComfyUI to apply changes.",
dataManagementHint: "Export core settings, metadata, and prompts to a JSON file, or import a previously exported file to restore them. After importing, restart ComfyUI to apply changes.",
exportData: "Export",
importData: "Import",
exportSuccess: "Export complete",
exportError: "Export failed",
importSuccess: "Import complete",
importError: "Import failed",
exportFullBackup: "Full Backup (ZIP)",
importFullBackup: "Restore Full Backup (ZIP)",
fullBackupHint: "Full Backup (ZIP) additionally includes folder-based data (AI Skills, Lab Plans, Style presets) and the Tagger database — everything the JSON export above can't represent. Restoring overwrites existing files; restart ComfyUI afterward.",
fullBackupFilesUnit: "files",
fullBackupIncludeWorkflows: "Include default workflows folder (user/default/workflows)",
fullBackupIncludeWildcard: "Include Impact Pack wildcard folder (if present)",
fullBackupExternalHint: "These are export-only — restoring a backup never touches them; copy the _external/ folder back manually if needed.",
saveSettings: "Save Settings",
settingsSaved: "Settings saved",
ollamaSaved: "AI Assistant settings saved",
@@ -1267,8 +1300,8 @@ const LANGUAGES = {
metaSectionTe: "Text Encoder",
metaSectionLora: "LoRA",
metaSectionPrompt: "Prompt",
metaDropMain: "Drop image / JSON",
metaDropSub: "PNG · WebP · JSON",
metaDropMain: "Drop image / video / JSON",
metaDropSub: "PNG · WebP · MP4 · JSON",
metaParsing: "Parsing...",
metaFileTooLarge: "File too large (max 50 MB)",
metaNoMetadata: "No metadata found",
@@ -1278,7 +1311,7 @@ const LANGUAGES = {
metaPromptText: "Text",
metaSelectPrompt: "Select a prompt above to view full text...",
metaFormatNoteTitle: "Supported formats",
metaFmtComfyui: "ComfyUI — PNG / WebP / JSON",
metaFmtComfyui: "ComfyUI — PNG / WebP / MP4 / JSON",
metaFmtSdwebui: "SD WebUI / SD Forge — PNG (parameters)",
metaFmtFooocus: "Fooocus — PNG (fooocus_scheme)",
metaFormatTodo: "Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image subgraph workflows supported",
@@ -1288,8 +1321,60 @@ const LANGUAGES = {
helpMetadata2: "Center column: Checkpoint, VAE, Diffusion Model, and Text Encoder lists extracted from the workflow",
helpMetadata3: "Right column: LoRA list (with strength values) and Prompt list (click to view full text below)",
helpMetadata4: "Prompt actions — Copy: copy to clipboard; GenUI:P/N: set GenerateUI positive/negative prompt; Prompt:P/N: set Prompt tab preset positive/negative",
helpMetadata5: "Supported: ComfyUI PNG/WebP/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image subgraph workflows), SD WebUI, SD Forge, Fooocus.",
helpMetadata5: "Supported: ComfyUI PNG/WebP/MP4/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image subgraph workflows; MP4 reads the workflow/prompt container tags written by SaveVideo, including all-in-one video nodes like MiniMax H3 ImageToVideo), SD WebUI, SD Forge, Fooocus.",
helpMetadata6: "This is now a sub-tab inside the Gallery tab (to the right of Style_Catalog), rather than its own top-level tab — everything else about it works exactly the same",
// -- Video Tab (MiniMax H3 / LTX-2.5 / Wan2.2, independent of GenerateUI) --
tabVideo: "Video",
loadInVideo: "Load in Video",
videoTitle: "Video",
videoFirstFrame: "First Frame (optional)",
videoLastFrame: "Last Frame (optional)",
videoDropOrClick: "Drop image or click to select",
videoPrompt: "Prompt",
videoAspectRatio: "Aspect Ratio",
videoMegapixels: "Megapixels",
videoMultiple: "Multiple",
videoDuration: "Duration (seconds)",
videoNoiseSeed: "Noise Seed",
videoRandomizeSeed: "Randomize",
videoGenerate: "Generate",
videoEditPlaceholder: "Editing tools coming soon",
videoNoWorkflowLoaded: "No workflow loaded",
videoUnsupportedWorkflow: "This workflow does not contain a supported video model node (MiniMax H3, LTX-2.5 Text/Image/First&Last-Frame to Video, or Wan2.2 Text to Video)",
videoWorkflowLoaded: (name) => `Workflow loaded: ${name}`,
videoGenerateSuccess: "Video generated",
videoDoneCount: (n) => `Done (${n} file${n === 1 ? "" : "s"})`,
videoSourceLabel: "Video Source",
videoSourceHint: "Load any video here to use Frame/GIF tools without generating one.",
videoSourceDropLabel: "Drop video or click to select",
videoNoVideo: "No video",
videoPropFrame: "Frame",
videoPropGif: "GIF",
videoFrameHint: "Play/seek the preview video to the position you want, then capture.",
videoCaptureFrame: "Capture Frame",
videoSaveToOutput: "Save to Output",
videoFrameSaved: (name) => `Frame saved: ${name}`,
videoFrameCaptureFailed: (msg) => `Failed to capture frame: ${msg}`,
videoGifStart: "Start (s)",
videoGifEnd: "End (s)",
videoGifFps: "FPS",
videoGifWidth: "Max Width",
videoConvertToGif: "Convert to GIF",
videoGifConverting: "Converting...",
videoGifDoneCount: (n) => `Done (${n} frame${n === 1 ? "" : "s"})`,
videoGifSaved: (name) => `GIF saved: ${name}`,
videoNoSourceLoaded: "Load a video first (generate one, or drop a file into Video Source)",
helpVideoTitle: "Video Tab",
helpVideoDesc: "A dedicated video generation tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows, independent of the GenerateUI tab.",
helpVideo1: "Set first_frame (optional) / last_frame (optional) images, prompt, aspect_ratio / megapixels / multiple (resolution), duration (seconds), and noise_seed, then click Generate. Leaving first_frame empty runs the workflow text-only (bypassed), and workflows with no LoadImage node at all are also supported.",
helpVideo2: "Model selection (UNet / CLIP / VAE / Audio VAE) is fixed to the loaded workflow's defaults and cannot be changed from this tab. For workflows with no ResolutionSelector node (e.g. Wan2.2), resolution also stays fixed to the loaded workflow's defaults and the Aspect Ratio / Megapixels / Multiple fields are disabled.",
helpVideo3: "Use the \"Load in Video\" button in the Workflow tab's detail modal to load a workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, or a Wan2.2 Text-to-Video node. Unsupported workflows show an error instead.",
helpVideo4: "Generated videos (mp4) can also be browsed and played back in the Gallery tab.",
helpVideo5: "The Video Source panel next to the preview lets you drop or pick any local video (not just a generated one) to use the Frame/GIF tools below without running the loaded video workflow first; Clear resets it back to empty.",
helpVideo6: "Frame tab (right panel): play/seek the preview video to the position you want, click Capture Frame to grab that frame client-side, then Save to Output to write it as a PNG into ComfyUI's output folder.",
helpVideo7: "GIF tab (right panel): set Start/End (seconds), FPS, and an optional Max Width, then Convert to GIF — the server decodes the video and encodes an animated GIF into ComfyUI's output folder.",
helpVideo8: "Highlight color: the Prompt / Duration / First Frame / Last Frame / Aspect Ratio / Megapixels / Multiple labels turn the same highlight color as the GenerateUI Model tab (customizable in the Settings tab) when the loaded workflow actually supports that field — e.g. for a Wan2.2 workflow (no ResolutionSelector node), the Aspect Ratio / Megapixels / Multiple labels stay unhighlighted since those fields are disabled.",
},
ja: {
@@ -1542,6 +1627,7 @@ const LANGUAGES = {
labNoWorkflowLoaded: "先にGenerateUIでワークフローを読み込んでください",
labNoSourceImage: "先に元になる画像をドロップしてください",
labNoResultsYet: "まだ結果がありません",
labLastFrameExtractFailed: (msg) => `生成された動画から最終フレームの抽出に失敗しました: ${msg}`,
labResultPreview: "プレビュー",
labEnterPlanName: "プラン名:",
labPlanSaved: "プランを保存しました",
@@ -1573,6 +1659,15 @@ const LANGUAGES = {
labT2IImageIgnored: "T2Iモードが有効なため、画像のアップロードは不要としてスキップしました",
labIndexImageSaved: (filename) => `インデックス画像をOutputへ保存しました: ${filename}`,
labIndexImageSaveFailed: "インデックス画像のOutputへの保存に失敗しました",
labPromptGroupBtnTitle: "プロンプトグループを適用",
labPromptGroupModalTitle: "プロンプトグループ",
labPromptGroupEmpty: "グループがまだありません。Promptタブのグループパネルで作成してください。",
labPromptGroupCount: (n) => `プリセット${n}件`,
labPromptGroupSelectFirst: "先にグループを選択してください",
labPromptGroupNoPresets: "このグループにはプリセットがありません",
labPromptGroupApplied: (name, n) => `「${name}」(${n}件のキーフレーム)をPromptに適用しました`,
labPromptGroupBatchRaised: (n) => `グループに合わせてBatch数を${n}に増やしました`,
labSelectKeyframeFirst: "先にキーフレームを選択してください",
// -- GenerateUIタブ Inputサブタブ: Image内プレースホルダ --
i2iPlaceholderTitle: "プレースホルダ画像",
@@ -1605,6 +1700,8 @@ const LANGUAGES = {
textSizeLabel: "文字サイズ",
textSizeTextarea: "プロンプト / チャット入力欄",
textSizeHint: "適用対象: 生成UIプロンプト、AIアシスタントチャット、プリセットプロンプト、ワイルドカード編集、Metadataプロンプトプレビュー",
videoVolumeLabel: "動画の音量",
videoVolumeHint: "適用対象: Videoタブのプレビュー、Galleryタブの詳細/ライトボックス/比較動画プレーヤー。ここで設定した音量(または各動画自身のコントロールで変更した音量)は、アプリ内のどこで次に動画を開いても引き継がれます。",
jsonColorsSection: "RAW JSON 文字色",
jsonColorBase: "通常テキスト",
jsonColorYellow: "名前 / スケジューラ",
@@ -1853,6 +1950,8 @@ const LANGUAGES = {
gallerySelectImageFirst: "先に画像を選択してください",
galleryNoLoadImageNode: "現在のワークフローにLoadImageノードがありません",
gallerySentGenUI: "GenerateUI Imageタブへ送信しました",
sendToLiNodeNoOpener: "この機能を使うにはComfyUIのトップメニューからWorkflow Studioを起動してください",
sendToLiNodeSuccess: (filename) => `"${filename}" をLIノードへ送信しました`,
galleryCCNotAvailable: "Send CCはComfyUI Comic Creator内のギャラリーから開いた場合のみ使用できます",
gallerySentCC: "ComfyUI Comic Creatorへ送信しました",
galleryNoEmbeddedWorkflow: "この画像にはComfyUIワークフローが埋め込まれていません。",
@@ -1920,7 +2019,7 @@ const LANGUAGES = {
taggerThreshold: "閾値",
taggerCharThreshold: "キャラ閾値",
taggerGenerateTags: "タグ生成",
taggerOllamaEnable: "Ollama VLM",
taggerOllamaEnable: "VLMタグ付け",
taggerOllamaUrl: "API URL",
taggerOllamaModel: "モデル",
taggerOllamaPrompt: "プロンプト",
@@ -1989,6 +2088,12 @@ const LANGUAGES = {
aiSettingsInputLang: "入力言語",
aiSettingsOutputLang: "翻訳言語",
aiSettingsSaveBtn: "設定を保存",
aiUnloadModel: "モデルをアンロード",
aiUnloading: "アンロード中...",
aiUnloadDone: "モデルをアンロードしました",
aiUnloadFailed: "アンロード失敗: ",
aiUnloadUnsupported: "このバックエンドはAPI経由のアンロードに未対応です",
aiUnloadNoModel: "先にモデルを選択してください",
aiToastNoText: "テキストを入力してください",
aiToastNoModel: "設定タブでモデルを選択してください",
aiToastInvalidUrl: "URLは http:// または https:// で始まる必要があります",
@@ -2059,7 +2164,8 @@ const LANGUAGES = {
helpGen5: "Modelタブ:Checkpoint/VAE/Diffusion Model(UNETLoader / UnetLoaderGGUF / LoaderGGUF対応)/Text Encoder(CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF対応 — typeおよびdevice選択付き、DualCLIPは2段モデル選択)は常時表示;ControlNetとHypernetwork(Strength入力付き)は使用頻度が低いためデフォルトで折りたたみ — 見出しをクリックで展開;LoRA(Single/Stackタブ)は右側に独立した列を表示;すべてのセレクタにフィルタ検索付き;LoRA Stack — Applyで有効な全LoRAを対象ノードに書き込み、同時にLoRA構文とCivitAIトリガーワードをPositiveプロンプトへ挿入;再Applyでは非アクティブなLoRAを削除し、アクティブなLoRAを再追加してプロンプトを更新",
helpGen28: "Modelタブ — ハイライト色:読み込んだワークフローに実際に該当ノードが含まれる場合、各モデル種別(Checkpoint/VAE/Diffusion Model/Text Encoder/ControlNet/Hypernetwork)のラベルとLoRA列見出しが指定色(デフォルトは明るい緑)で表示される;ControlNet/Hypernetworkが折りたたまれた状態でも色は見えるため、展開しなくても使用有無が一目で分かる;色はSettingsタブでカスタマイズ可能",
helpGen6: "Settingsタブ:KSamplerとLatent Imageを横並び(各50%幅)",
helpGen7: "Raw JSONを各タブの右列に常時表示 — 直接編集してApplyでワークフロー即時反映;読み込んだワークフローにBypass/Muteノードがある場合、検索バー上部に一覧が表示される(Bypassは除外され配線が再接続される、Muteは除外されるが再接続はされない点はComfyUI本体と同じ)",
helpGen31: "LTX-2.5とWan2.2の動画ワークフローも、専用のVideoタブだけでなく本タブに通常ワークフローとして読み込んだ場合に対応 — Positive/Negative PromptはLTX-2.5のLTXVDualCFGGuider / LTXVConditioningノードをたどって実際のプロンプト文を検出し、SettingsタブのLatent ImageはWan2.2のEmptyHunyuanLatentVideoとLTX-2.5のEmptyLTXVLatentVideoノードを認識(Length(フレーム数)欄も追加表示)して「No EmptyLatentImage node found」にならない;これらのワークフローからの生成もMiniMax H3の動画生成と同じ延長タイムアウトが適用される",
helpGen7: "Raw JSONを各タブの右列に常時表示 — 直接編集してApplyでワークフロー即時反映;読み込んだワークフローにBypass/Muteノードがある場合、検索バー上部に一覧が表示される(Bypassは除外され配線が再接続される、Muteは除外されるが再接続はされない点はComfyUI本体と同じ);検索バーはヒット箇所をハイライト表示してスクロールするだけでエディタにカーソルを移動しないため、検索直後にキー入力してもJSONが誤って書き換わることはない — 編集する際はエディタ内をクリックしてから行う",
helpGen8: "シード管理:ランダム / 固定 / 増加 / 減少",
helpGen9: "画像生成、進捗表示、生成停止、結果表示",
helpGen10: "Eagle連携:生成画像をEagleへ自動保存(SVG出力にも対応 — 標準SaveSVGNodeおよびcomfyui-tosvgのSave SVG Stringノードの両方)",
@@ -2121,6 +2227,8 @@ const LANGUAGES = {
helpLab15: "Checkpoint/LoRA/VAEは、他の列と全く同じ実効値ルール(上記参照)でそれぞれ独立して引き継がれます:いずれか1つのキーフレームが、残り2つをワークフロー本来の設定に戻すことはありません。編集モーダルで未設定のままの項目は、同じリスト内の以前のキーフレームで何か設定済みの場合、プレースホルダが「(ワークフローの設定のまま)」ではなく「(引き継ぎ: ...)」と表示され、実際に適用される値が分かるようになっています。「1回目の設定に戻す」やBypassも+/-と同様、現在C/L/Vトグルで選択中の1項目だけに作用し、残り2つには影響しません",
helpLab16: "LoRAノードをバイパスチェックボックス(LoRAキーフレーム自身の編集モーダルのみ):ComfyUI本来のノードBypass(mode:4)の代わりに、そのキーフレームのstrength_model/strength_clipを適用時に強制的に0にします — ここで使われるワークフローは既にAPI形式に変換済みでmodeの概念が無いため、強度をゼロにすることが実質的に同等の効果になります。チェック中は強度の入力欄が無効化されます。上記の行単位のBypassチェックボックス(helpLab13参照)とは独立しており、そちらは行全体をスキップするだけでノードには一切触れません",
helpLab17: "LoRA構文とトリガーワードをポジティブプロンプトに適用チェックボックス(LoRA列のみ):チェックすると、適用時に <lora:name:strengthModel:strengthClip> とそのLoRAのキャッシュ済みCivitAIトリガーワードを、カンマ区切りでポジティブプロンプトへ追加します — GenerateUIのModelタブのApplyボタンが書き込むのと同じ書式です。キーフレームを切り替えた場合(別のLoRAへの変更、このチェックボックスをオフにした場合、または行自体をBypassした場合)は、新しい内容を追加する前に必ず直前のイテレーションが注入した分だけを正確に取り除くため、バッチ内で使われた全LoRAが蓄積されることはありません。「LoRAノードをバイパス」がチェックされている間は自動的に無効化されます",
helpLab18: "キーフレームセルはシングルクリックで選択(青い枠線)に変わり、開くにはダブルクリックが必要になりました。各カラムのヘッダー(Model/Prompt/Ksampler)には▲/▼ボタンもあり、選択中のキーフレームを隣接するものと入れ替えて、入力し直すことなく並び順を変更できます。キーフレーム#1(ベースライン)は移動できず、他のキーフレームが#1の位置に入れ替わることもありません",
helpLab19: "Promptカラムヘッダーの PG ボタン:Promptタブのプリセットグループ(Tableビューの Presets Group、Batchタブのチェックリストと同じグループ)を1つ選ぶと、Prompt列全体をそのグループの並び順で1プリセットにつき1キーフレームへ置き換えます(#1から開始、#1は上書きで追加ではありません)。グループのプリセット数が現在のBatch数を超える場合はBatch数を自動的に引き上げます(上限50、Batch入力欄自体の上限と同じ)。それでも収まらない分は静かに削除されず、通常の「Batch数を超えたキーフレーム」警告が表示されます",
helpLabCardPlanTitle: "Settingサブタブ — 実行とプランファイル",
helpLabPlan1: "右ペイン — Batch:実行する回数。Note:プランと一緒に保存される自由記述のメモ",
helpLabPlan2: "Run/Pause/Cancel:Runでバッチループを開始、Pause/Resumeで回と回の間を一時停止・再開、Cancelで現在の生成を中断してループを止めます",
@@ -2139,7 +2247,7 @@ const LANGUAGES = {
helpLabResults3: "保存済みプランを読み込むと、プランファイルに記録された画像一覧からResultsの表示が復元されます",
helpSearchPlaceholder: "ヘルプを検索...",
helpPrompt1: "AIアシスタント(Ollama / LM Studio / Lemonade):モデル選択、チャットでプロンプト相談、画像添付(ビジョンモデル対応);バックエンドとURLは設定タブで設定",
helpPrompt1: "AIアシスタント(Ollama / LM Studio / Lemonade / Unsloth):チャットでプロンプト相談、画像添付(ビジョンモデル対応);⚙ 設定ボタンからバックエンド・接続URL・モデル・Thinking mode・Max tokensの選択とロード中モデルのアンロードが可能——設定はAI TOOLタブ・Taggerタブとは独立して保存される",
helpPrompt2: "AIの応答をGenerateUIのプロンプトに適用",
helpPrompt3: "翻訳機能:日⇔英、中⇔英",
helpPrompt4: "プリセット管理:作成・編集、ポジティブ/ネガティブプロンプトのクリップボードコピー(PP/NP)",
@@ -2164,14 +2272,17 @@ const LANGUAGES = {
helpPrompt23: "Wildcardsテーブル — Formタブのワイルドカードファイルマネージャーと同じファイル一覧です。File列のパスやExtドロップダウンを編集するとファイル名が変更されます(新しい名前で内容を保存してから、古いファイルを削除します)",
helpPrompt24: "Styleテーブル — Formタブのスタイル管理と同じスタイル一覧で、Presetsと同様にインライン編集できます",
helpPrompt25: "Presetsテーブルのツールバー — 検索ボックス横の★とBソートボタンで、お気に入り/Batch登録済みのプリセットを一覧の先頭に並べ替えます。両方同時にONにでき、その場合は★が優先、Bが次点の基準になり、それ以外は元の相対順序を維持します",
helpPrompt26: "Styleテーブルのツールバー — Fileバッジがcustom.jsonではない行を1件だけ選択すると「+ Add to this file」が有効になります。同じファイルを追加先とする空の行を追加します(保存前からFile列にバッジで表示されます)— Formタブのスタイルマネージャーと同じ機能です(上記参照)。custom.jsonのスタイルや複数選択時はボタンが無効のままです。その場合は通常の「+ New Style」を使ってください",
helpSettings1: "UI言語と要約言語の設定",
helpSettings2: "テーマ選択(13種プリセット)+カスタマイズ:カラー調整、背景パターン(ストライプ、ポルカドット、チェック、SVGタイリング)、フォント選択(日本語デザインフォント含む16種のGoogle Fonts)",
helpSettings3: "ワークフローデータフォルダのパス変更・リセット",
helpSettings4: "ComfyUI接続URL設定と接続テスト",
helpSettings5: "AI Assistant(プロンプトタブ):バックエンド(Ollama / LM Studio / Lemonade)・API URL・デフォルトモデル・接続テスト",
helpSettings5: "AI Assistant設定はこのタブから移動しました——Promptタブ・Taggerタブ・AI TOOLタブそれぞれが独自の⚙設定ボタン(バックエンド・URL・モデル・Thinking mode・Max tokens・モデルのアンロード)を持ち、個別に保存されます",
helpSettings6: "デフォルトワークフローの設定・解除",
helpSettings7: "Eagle連携URL、自動保存の有効/無効",
helpSettings8: "データ管理:設定・メタデータ・プロンプトなど全データをJSONにエクスポート、またはインポートして復元。インポート後はComfyUIを再起動してください。",
helpSettings8: "データ管理:設定・メタデータ・プロンプトなど主要データをJSONにエクスポート、またはインポートして復元。インポート後はComfyUIを再起動してください。",
helpSettings15: "フルバックアップ (ZIP):上記のJSONエクスポートと異なり、フォルダ形式のデータ(AI Skills、Lab Plan、Styleプリセット)とTaggerデータベースも含みます。復元すると既存ファイルは上書きされます。復元後はComfyUIを再起動してください。",
helpSettings16: "フルバックアップのボタン上にある2つのチェックボックスで、デフォルトワークフローフォルダーとImpact Packのwildcardフォルダーもエクスポートに含められます。どちらもエクスポート専用で自動復元はされません。必要な場合はZIP内の_external/フォルダから手動でコピーしてください。",
helpSettings9: "各セクションはアコーディオン式で折りたたみ可能",
helpSettings10: "Wildcard Integration:WFSのワイルドカードディレクトリをComfyUI-Impact-Packのwildcardsディレクトリへリンク(Windowsはジャンクション、他OSはシンボリックリンク)。既存ファイルは自動で移行されます",
helpSettings11: "テキストサイズ:スライダー1本(10〜28px)でプロンプト・チャット全テキストエリアのフォントサイズを一括調整 — GenerateUI ポジティブ/ネガティブプロンプト、AIアシスタントチャット入力、プリセット ポジティブ/ネガティブ、ワイルドカードプロンプト・ファイルエディタ、メタデータプロンプト全文プレビュー;即時反映・保存で確定",
@@ -2204,17 +2315,18 @@ const LANGUAGES = {
helpGallery4: "ツールバーフィルタ:お気に入り(★)、テキスト検索(ファイル名・タグ・プロンプト)、タグフィルタ、グループフィルタ、日付・名前ソート",
helpGallery5: "フォルダツリー:クリックで画像を読み込み;▶で展開;「+ New」で選択フォルダ内にサブフォルダを作成;「Del」でそのフォルダとすべての内容を削除",
helpGallery6: "複数選択:Ctrl+クリックで個別トグル;Shift+クリックで最後にクリックした位置から範囲選択 — 一括操作バー:グループを選択して「グループに追加」/「グループから削除」;「お気に入り追加(全件)」/「お気に入り解除(全件)」;「比較」(2〜4枚選択時);「移動先...」;「ファイル削除」",
helpGallery7: "詳細パネル — Infoタブ:ファイル名、サイズ、日付、タグ(追加/削除)、メモ;「Move To...」で他フォルダへ移動;「ファイル削除」で完全削除",
helpGallery7: "詳細パネル — Infoタブ:ファイル名、サイズ、寸法(画像は幅×高さ、動画は再生時間)、日付、タグ(追加/削除)、メモ;「Move To...」で他フォルダへ移動;「ファイル削除」で完全削除",
helpGallery8: "詳細パネル — JSONタブ:PNGの埋め込みデータ(prompt / workflow キー)またはGenerateUIタブで保存したメタデータからワークフローJSONを表示;「Copy & Send Canvas」ボタンでクリップボードにコピーしてComfyUIキャンバスへ直接送信(UI形式・API形式どちらも対応);ComfyUIツールバーから開いていない場合はUI形式のみタイトルドラッグのフォールバック",
helpGallery9: "詳細パネル — Groupsタブ:画像ごとのグループ作成、割り当て、解除、名前変更、削除",
helpGallery10: "ワークフロー自動保存:GenerateUIタブで生成した画像はワークフローが自動でギャラリーメタデータに保存され、JSONタブで確認可能",
helpGallery11: "PNG (tEXt/iTXt)、JPEG、WebP、GIF対応;PNG形式はComfyUIの埋め込みJSON(prompt / workflow キー)を読み込んでワークフロー抽出が可能",
helpGallery11: "PNG (tEXt/iTXt)、JPEG、WebP、GIF、MP4対応;PNG形式はComfyUIの埋め込みJSON(prompt / workflow キー)、MP4形式はSaveVideoが書き込むコンテナタグ(同キー、MiniMax H3出力等)からワークフロー抽出が可能",
helpGallery12: "Metadataボタン(緑、詳細パネルのタブバー内):選択画像をMetadataタブで開いて埋め込みデータを詳細確認。画像サムネイルのAlt+クリックでも同じ操作が可能",
helpGallery13: "Load GenUIボタン(青、詳細パネルのタブバー内):選択画像に埋め込まれたComfyUIワークフローをGenerateUIタブへ直接読み込んで切り替え。ワークフローが埋め込まれていない場合や非対応形式の場合は警告トーストを表示",
helpGallery14: "Taggerボタン(紫、詳細パネルのアクション行):選択画像をTaggerタブのSingleモードで直接開き、即座にタグ付けを開始できる",
helpGallery15: "Fボタン(シアン色オーバーレイ、各サムネイル左上):クリック一つで画像を __Feeder__ グループに追加/削除;グループ内の場合は常にシアン色で表示、非グループ時はホバー時のみ表示;FeederタブのGalleryモードへ素早く画像を追加できる",
helpGallery16: "Image Editボタン(ツールバー、Refreshボタン横):選択中の画像をImage Editタブに送信;既にレイヤーが存在する場合はキャンバスに合わせてスケールして新規レイヤーとして追加、存在しない場合はLayer 1になる",
helpGallery17: "Send GenUI Imageボタン(ツールバー、Image Editボタン横):選択画像をComfyUIにアップロードし、GenerateUIタブの最初のLoadImageノードへ入力として設定;GenerateUI → Input → Imageへ自動切り替え;事前にLoadImageノードを含むワークフローの読み込みが必要",
helpGallery27: "Send to LI nodeボタン(ツールバー、Send GenUI Imageボタン横):選択画像をアップロードし、そのファイル名をComfyUIキャンバス上で選択中のノード(無ければ最初に見つかったLoadImage系ノード)のimageウィジェットへ書き込む — Image EditタブのSend to LI nodeと同じ送信先;ComfyUIのトップメニューボタンからWorkflow Studioを起動している必要がある",
helpGallery18: "GalleryタブのOutputと並ぶ2つ目のサブタブ。視覚的なプロンプトライブラリを閲覧できる — ComfyUI outputフォルダ内のws_image_promptフォルダを管理(未作成時は自動生成)",
helpGallery19: "同じ3カラムレイアウト:フォルダツリー(左)|サムネイル一覧(中央)|プロンプトビルダー(右)。サムネイルクリックでプレビューとプロンプトテキストを表示 — この時点ではまだプロンプトに追加されない",
helpGallery20: "「+ 追加」で、プレビュー中の画像のプロンプトを「選択済みプロンプト」にチップとして追加;チップは個別(×)または一括(「全クリア」)で削除可能;「Save」でその画像のプロンプトテキストを編集・保存",
@@ -2226,13 +2338,13 @@ const LANGUAGES = {
// -- Tagger Tab --
helpTaggerTitle: "Taggerタブ",
helpTagger1: "WD Tagger(ONNX)・SwinV2・DeepDanbooru(.h5)・Ollama VLMによる自動タグ付け — サブタブ: Single / Batch / DB",
helpTagger1: "WD Tagger(ONNX)・SwinV2・DeepDanbooru(.h5)・VLM(Ollama / LM Studio / Lemonade / Unsloth)による自動タグ付け — サブタブ: Single / Batch / DB",
helpTagger2: "モデル配置:ComfyUI/models/tagger/<モデル名>/ 以下に各モデルのフォルダを作成し、.onnx + selected_tags.csv(DeepDanbooruは .h5 + ラベルファイル)を格納",
helpTagger3: "Singleタブ:プレビューエリアへ画像をドラッグ&ドロップ、またはUploadボタンでファイルを選択;GalleryタブのTaggerボタンで選択画像を直接開くことも可能",
helpTagger4: "閾値スライダー:一般タグの信頼スコア下限(デフォルト0.35);キャラ閾値:character: プレフィックス付きタグ専用の閾値(デフォルト0.85)",
helpTagger5: "Ollama VLM:チェックボックスをオンにするとWD Taggerと並行してビジョンモデルを実行;API URLとモデルを設定(↻で一覧更新)、プロンプトを編集可能;両モデルの結果はマージされる",
helpTagger5: "VLMタグ付け:チェックボックスをオンにするとWD Taggerと並行してビジョンモデルを実行;⚙設定ボタンからバックエンド(Ollama / LM Studio / Lemonade / Unsloth)・URL・モデル・Thinking mode・Max tokensの選択とモデルのアンロードが可能——Promptタブ独自のAI設定とは別管理;プロンプトとMax Tagsはインラインで編集可能;両モデルの結果はマージされる",
helpTagger6: "生成タグの送信先:(1) GenUI:P — 生成UIタブのポジティブプロンプトに追記し、読み込み中のワークフローへ即時適用;(2) プロンプトに送信 — Promptタブの正プロンプトテキストエリアに追記;(3) Galleryに保存 — ギャラリーの画像メタデータに保存(Galleryから開いた画像のみ有効);(4) ファイルに書込 — JPEGはEXIF(ImageDescription)、PNGはtEXt(Tagsキー)に書き込み;(5) DBに保存 — 内蔵SQLiteデータベースに保存",
helpTagger7: "Batchタブ:処理対象フォルダパスを入力してWD Tagger・Ollamaの設定を行い、出力オプション(DBに保存〈デフォルトON〉・ファイルに書込〈EXIF/PNGメタデータ〉・.txt出力〈画像と同フォルダに <ファイル名>.txt を生成〉)を選択;バッチ開始で指定フォルダ内の全画像を処理;進行状況バーとログがリアルタイム更新;停止ボタンは現在の画像処理完了後にキャンセル",
helpTagger7: "Batchタブ:処理対象フォルダパスを入力してWD Taggerを設定し、VLMタグ付けを有効化(Singleタブと同じ⚙設定を使用);出力オプション(DBに保存〈デフォルトON〉・ファイルに書込〈EXIF/PNGメタデータ〉・.txt出力〈画像と同フォルダに <ファイル名>.txt を生成〉)を選択;バッチ開始で指定フォルダ内の全画像を処理;進行状況バーとログがリアルタイム更新;停止ボタンは現在の画像処理完了後にキャンセル",
helpTagger8: "DBタブ:タグ付けした画像の検索可能データベース;行をクリックすると編集パネルでWDタグ・VLMタグを編集可能;保存で更新、削除でレコード削除;CSV出力で全レコードをダウンロード",
helpTagger9: "依存パッケージのインストール:python_embeded\\python.exe -m pip install -r requirements.txt;GPU推論にはonnxruntimeの代わりにonnxruntime-gpuをインストール;TensorFlow(DeepDanbooru用)はサイズ大のためデフォルトではコメントアウト",
@@ -2249,7 +2361,7 @@ const LANGUAGES = {
helpSidepanel10: "各サブタブ内で検索してアイテムをすばやく検索",
helpSidepanel11: "Modelsタブ:All / ★ Favorites / Groups / By Type サブタブ;Promptsタブ:All / ★ Favorites / Categories サブタブ+Groupsサブタブ(下段);Models Groupsの LoRA グループには「All N LoRAs」アイテムがあり、ドラッグで全 LoRA を Lora Loader (LoraManager) ノードに一括配置できる",
helpSidepanel12: "⚙ テーマボタン(ヘッダー):パネル背景・サブヘッダー背景・文字色・ボーダー・補助テキスト色をカスタマイズ可能、設定はlocalStorageに保存され次回起動時も反映",
helpSidepanel13: "I タブ(Information):ComfyUI の PNG / WebP / JSON をドロップするとサイドパネル内でモデル・LoRA・プロンプトのメタデータを確認可能 — サブタブ: model / lora / Prompts;UnetLoaderGGUF・QuadrupleCLIPLoader・Lora Loader (LoraManager) ノードタイプに対応",
helpSidepanel13: "I タブ(Information):ComfyUI の PNG / WebP / MP4 / JSON をドロップするとサイドパネル内でモデル・LoRA・プロンプトのメタデータを確認可能 — サブタブ: model / lora / Prompts;UnetLoaderGGUF・QuadrupleCLIPLoader・Lora Loader (LoraManager) ノードタイプに対応;MP4はSaveVideoが埋め込むworkflow/promptタグを読み取り、MiniMax H3 ImageToVideoのようなオールインワン動画ノードのプロンプトにも対応",
helpSidepanel14: "Information タブ — キャンバスへドラッグ:model サブタブのアイテムをドラッグすると対応ローダーノードを配置(Checkpoint → CheckpointLoaderSimple、VAE → VAELoader、Diffusion Model → UNETLoader、Text Encoder → CLIPLoader);ダブルクリックでもキャンバス中央に配置可能",
helpSidepanel15: "Information タブ — lora サブタブ:LoraLoader・LoraLoaderModelOnly・Lora Loader (LoraManager) ノード(APIフォーマット含む)から LoRA を検出;個別 LoRA をドラッグで LoraLoader を配置;「Multiple LORA」セクションで全 LoRA を Lora Loader (LoraManager) ノードに一括配置(LoRA構文自動入力);Prompts サブタブ:プロンプトをドラッグするとテキスト入力済みの CLIPTextEncode ノードを配置;クリックで全文表示・コピー可能",
helpSidepanel16: "A タブ(AI ツール):翻訳・Chat・TOOLS・設定のサブタブ。Ollama、LM Studio、Lemonade、Unsloth に対応;Chat は LLM とのマルチターン会話;TOOLS は VLM 画像解析とワイルドカード生成に対応;設定は SPA の AI タブと localStorage で共有される",
@@ -2259,7 +2371,7 @@ const LANGUAGES = {
helpAi2: "翻訳ペイン:Ollama、LM Studio、Lemonade、または Unsloth を使って日本語・英語・中国語・カスタム言語(Free)間でテキストを翻訳;⇄ ボタンで言語とテキストを同時入替;選択は自動保存",
helpAi3: "Chat ペイン:LLM とのマルチターン会話;Enter で送信、Shift+Enter で改行;Clear ボタンで会話履歴をリセット;モデルがtool callingに対応している場合、「猫の画像を作って」のように頼むとGenerateUIに読み込み中のワークフローで生成を実行し、結果をチャット内に表示する;ペインヘッダーの「画像生成を許可する」チェックボックスでこの機能のON/OFFを切り替えられる;画像が添付されている場合(TOOLSペインにドロップした画像)はLLMにもビジョン入力として送信され、generate_image呼び出し時はT2Iの代わりにI2I(image-to-image)の元画像として使われる;generate_image呼び出しにはsteps・cfg・sampler_name・scheduler・denoise・seed、width・height、batch_size(その1回の呼び出しで生成する枚数)、aspect_ratio(\"3:2\"のような比率プリセット。ワークフローにwidth/heightを供給するResolution Selectorノードがある場合のみ適用され、それ以外は無視される)といった任意の生成パラメータも指定できる;モデルが指定しなかった項目は読み込み中のワークフローの現在の設定がそのまま使われる;tool callingとビジョンの動作を確認済みのモデル: Gemma 4:e4b、Qwen 3.5:9b、Ministral 3:3b(Ollama)",
helpAi4: "TOOLS ペイン — VLM:画像(PNG/JPG/WebP)をドロップしてタスク(画像解説 / プロンプト作成 / タグ作成)を選んで Run;または「Create wildcards」を選んでカテゴリ名と件数を入力すると1行1エントリのワイルドカードを生成;ドロップした画像はChatペインの添付としても共有され(Chat側にも表示、I2I生成に使用)、✕ボタンでクリアするまで保持される",
helpAi6: "Settings ペイン:バックエンド(Ollama / LM Studio / Lemonade / Unsloth)の選択、APIのURL設定、接続テスト、モデル選択;Unslothはローカルアクセスでも常にAPIキー認証が必須——プラグインフォルダの .env.example を .env にコピーして UNSLOTH_API_KEY を設定し ComfyUI を再起動する(キーはサーバー側でのみ読み込まれ、ブラウザには一切送信されない);Unsloth Desktopアプリ側の設定画面で「モデル自動切り替え (OpenAI API)」もONにする必要がある——OFFのままだと、Unsloth Studio上で事前にモデルを手動ロードしていない限り HTTP 404 で接続に失敗する;Unslothのreasoningモデルは思考内容をインラインの<think>タグではなく別のreasoning_contentフィールドで返すため、Max tokensが少ないとモデルが思考だけでトークンを使い切り、空の返信になることがある——返信が空になる場合はMax tokensを増やす(2048以上を推奨);Generationセクション — Thinking modeトグル(デフォルトOFF;OllamaにはthinkフラグとしてOFF/ONを送信、バックエンドを問わずOFF時は出力中の<think>...</think>ブロックをクライアント側で除去するため、推論モデルの思考過程がTranslation/Chat/TOOLSの結果に混入しない)とMax tokens(Ollama: num_predict、LM Studio/Lemonade/Unsloth: max_tokens;0で無制限);Free言語名の設定;Chat Image Generationセクションでは、ChatからのT2I画像生成にGenerateUIの現在の読み込みワークフローの代わりに専用ワークフローを使うよう設定できる;Chat I2I Generationセクションは同様の設定を画像添付時のI2I生成向けに提供する;設定は localStorage に保存され、Library パネルの A タブと共有される",
helpAi6: "Settings ペイン:バックエンド(Ollama / LM Studio / Lemonade / Unsloth)の選択、APIのURL設定、接続テスト、モデル選択、および「Test connection」の右隣にある「Unload Model」ボタンでロード中のモデルをVRAM/メモリから解放——Ollamaは keep_alive:0、LM Studioは /api/v1/models/unload、Lemonadeは /api/v1/unload を使用;Unslothにはアンロード用APIが存在しないため未対応メッセージが表示される;Unslothはローカルアクセスでも常にAPIキー認証が必須——プラグインフォルダの .env.example を .env にコピーして UNSLOTH_API_KEY を設定し ComfyUI を再起動する(キーはサーバー側でのみ読み込まれ、ブラウザには一切送信されない);Unsloth Desktopアプリ側の設定画面で「モデル自動切り替え (OpenAI API)」もONにする必要がある——OFFのままだと、Unsloth Studio上で事前にモデルを手動ロードしていない限り HTTP 404 で接続に失敗する;Unslothのreasoningモデルは思考内容をインラインの<think>タグではなく別のreasoning_contentフィールドで返すため、Max tokensが少ないとモデルが思考だけでトークンを使い切り、空の返信になることがある——返信が空になる場合はMax tokensを増やす(2048以上を推奨);Generationセクション — Thinking modeトグル(デフォルトOFF;OllamaにはthinkフラグとしてOFF/ONを送信、バックエンドを問わずOFF時は出力中の<think>...</think>ブロックをクライアント側で除去するため、推論モデルの思考過程がTranslation/Chat/TOOLSの結果に混入しない)とMax tokens(Ollama: num_predict、LM Studio/Lemonade/Unsloth: max_tokens;0で無制限);Free言語名の設定;Chat Image Generationセクションでは、ChatからのT2I画像生成にGenerateUIの現在の読み込みワークフローの代わりに専用ワークフローを使うよう設定できる;Chat I2I Generationセクションは同様の設定を画像添付時のI2I生成向けに提供する;設定は localStorage に保存され、Library パネルの A タブと共有される",
helpAi7: "Chat ペイン — SVG:LLMはComfyUIワークフローを一切使わず、SVGグラフィックをテキストとして直接生成することもできる;「SVGで〜を描いて」のように頼み、応答にSVGコードが含まれていれば自動でインラインプレビュー表示され、「Galleryに保存」ボタンでGalleryタブの出力フォルダに.svgファイルとして保存できる;tool calling(function calling)を使用しないため、tool calling非対応のモデルでも動作する",
helpAi8: "Chat ペイン — スキル:メッセージ一覧上部のドロップダウンでスキルを選ぶと、その指示内容が system prompt として会話の先頭に付加される(表示上のチャット履歴には含まれない);鉛筆ボタンでスキル管理パネルを開き、.mdスキルファイルを作成・編集・削除できる(保存先: user/default/Workflow-Studio/ai_skills/);ファイル先頭の---で囲まれた部分にname/descriptionを書くとドロップダウンの表示に反映される;初期状態で2つのスキルを同梱: 「SVG Icon Generator」(描く前に対象を部位分解することで認識しやすいSVGを生成)と「Skill Creator」(対話形式で質問しながら新しいスキルファイルを下書きする);応答に```skillコードブロックが含まれる場合、メッセージ下部に「スキルとして保存」ボタンが表示され、内容が入った状態で管理パネルが開く",
helpAi9: "スキル作成のヒント:ドロップダウンやツールチップで分かりやすいよう、frontmatterのname/descriptionは明確に書く;期待する出力形式を具体的に指示し、SVGや別のスキルファイルのように後で抽出したい成果物がある場合は専用のコードフェンスで囲むよう指示する;曖昧な指示より具体的で命令形の指示の方がローカルの小型モデルには効きやすく、短い実例を1つ添えるとさらに効果的;禁止事項(不適切な内容、セキュリティ、文字数制限など)は暗黙に期待せず明示的に書く;迷ったらドロップダウンで「Skill Creator」スキルを選び、作りたいスキルの概要を伝えれば対話形式で下書きしてくれる",
@@ -2354,8 +2466,7 @@ const LANGUAGES = {
helpImageEditExportTitle: "エクスポートとナビゲーション",
helpImageEdit17: "Save PNG:全可視レイヤーを合成してPNGファイルとしてダウンロード",
helpImageEdit18: "Save to Gallery:ファイル名を入力(デフォルト: wfs-image-YYYYMMDDHHmmss)してギャラリーのルートフォルダに合成PNGを保存(設定 > Gallery Output Folderで設定);Galleryタブを一度開いてルートフォルダを設定する必要あり",
helpImageEdit19: "Save to Input:合成PNGをComfyUIのinputフォルダに /upload/image でアップロードし、Load Imageノードで選択可能にする",
helpImageEdit19b: "Send to Workflow:合成PNGをアップロードする点はSave to Inputと同じだが、さらにアップロード結果のファイル名をComfyUIグラフ内で選択中のノード(無ければ最初に見つかったLoadImage系ノード)のimageウィジェットへ書き込む;ComfyUIのトップメニューボタンからWorkflow Studioを起動している必要がある",
helpImageEdit19b: "Send to LI node:合成PNGをComfyUIのinputフォルダに /upload/image でアップロードし、さらにそのファイル名をComfyUIグラフ内で選択中のノード(無ければ最初に見つかったLoadImage系ノード)のimageウィジェットへ書き込む;ComfyUIのトップメニューボタンからWorkflow Studioを起動している必要がある",
helpImageEdit20: "キャンバスナビゲーション:スクロールホイールでズーム、Space + ドラッグでパン",
helpImageEdit21: "Undo / Redo:Ctrl+Z / Ctrl+Y(またはツールバーの ↩ ↪ ボタン)",
helpImageEditKbdTitle: "Image Edit キーボードショートカット",
@@ -2476,13 +2587,20 @@ const LANGUAGES = {
eagleUrl: "Eagle URL",
eagleAutoSave: "生成画像をEagleに自動保存",
dataManagement: "データ管理",
dataManagementHint: "設定・メタデータ・プロンプトなど全データをJSONファイルにエクスポート、またはインポートして復元できます。インポート後はComfyUIを再起動してください。",
dataManagementHint: "設定・メタデータ・プロンプトなど主要データをJSONファイルにエクスポート、またはインポートして復元できます。インポート後はComfyUIを再起動してください。",
exportData: "エクスポート",
importData: "インポート",
exportSuccess: "エクスポート完了",
exportError: "エクスポート失敗",
importSuccess: "インポート完了",
importError: "インポート失敗",
exportFullBackup: "フルバックアップ (ZIP)",
importFullBackup: "フルバックアップを復元 (ZIP)",
fullBackupHint: "フルバックアップ(ZIP)は上記のJSONエクスポートでは表現できないフォルダ形式のデータ(AI Skills、Lab Plan、Styleプリセット)とTaggerデータベースも含みます。復元すると既存ファイルは上書きされます。復元後はComfyUIを再起動してください。",
fullBackupFilesUnit: "件",
fullBackupIncludeWorkflows: "デフォルトワークフローフォルダーを含める (user/default/workflows)",
fullBackupIncludeWildcard: "Impact Packのwildcardフォルダーを含める(存在する場合)",
fullBackupExternalHint: "これらはエクスポート専用です。復元時には一切触れません。必要な場合はZIP内の_external/フォルダから手動でコピーしてください。",
saveSettings: "設定を保存",
settingsSaved: "設定を保存しました",
ollamaSaved: "AI Assistant設定を保存しました",
@@ -2551,8 +2669,8 @@ const LANGUAGES = {
metaSectionTe: "Text Encoder",
metaSectionLora: "LoRA",
metaSectionPrompt: "プロンプト",
metaDropMain: "画像 / JSON をドロップ",
metaDropSub: "PNG · WebP · JSON",
metaDropMain: "画像 / 動画 / JSON をドロップ",
metaDropSub: "PNG · WebP · MP4 · JSON",
metaParsing: "解析中...",
metaFileTooLarge: "ファイルが大きすぎます(最大 50 MB)",
metaNoMetadata: "メタデータが見つかりません",
@@ -2562,7 +2680,7 @@ const LANGUAGES = {
metaPromptText: "テキスト",
metaSelectPrompt: "上のプロンプトを選択すると全文を表示します...",
metaFormatNoteTitle: "対応フォーマット",
metaFmtComfyui: "ComfyUI — PNG / WebP / JSON",
metaFmtComfyui: "ComfyUI — PNG / WebP / MP4 / JSON",
metaFmtSdwebui: "SD WebUI / SD Forge — PNG(parameters チャンク)",
metaFmtFooocus: "Fooocus — PNG(fooocus_scheme チャンク)",
metaFormatTodo: "Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image サブグラフ形式に対応済み",
@@ -2572,8 +2690,60 @@ const LANGUAGES = {
helpMetadata2: "中列: ワークフローから抽出した Checkpoint・VAE・Diffusion Model・Text Encoder の一覧",
helpMetadata3: "右列: LoRA 一覧(強度値付き)+プロンプト一覧(クリックで下部に全文表示)",
helpMetadata4: "プロンプトアクション — Copy: クリップボードにコピー; GenUI:P/N: GenerateUI のポジティブ/ネガティブプロンプトにセット; Prompt:P/N: Prompt タブ Presets のポジティブ/ネガティブにセット",
helpMetadata5: "対応フォーマット: ComfyUI PNG/WebP/JSON(標準形式 + Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image サブグラフ形式)・SD WebUI・SD Forge・Fooocus。",
helpMetadata5: "対応フォーマット: ComfyUI PNG/WebP/MP4/JSON(標準形式 + Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image サブグラフ形式;MP4はSaveVideoが書き込むworkflow/promptコンテナタグを読み取り、MiniMax H3 ImageToVideoのようなオールインワン動画ノードにも対応)・SD WebUI・SD Forge・Fooocus。",
helpMetadata6: "現在は Gallery タブ内のサブタブ(Style_Catalog の右隣)になっており、独立したトップレベルタブではありません — それ以外の動作は全く同じです",
// -- Video タブ(MiniMax H3 / LTX-2.5 / Wan2.2対応、GenerateUIタブとは独立) --
tabVideo: "Video",
loadInVideo: "Videoに読み込み",
videoTitle: "Video",
videoFirstFrame: "First Frame(任意)",
videoLastFrame: "Last Frame(任意)",
videoDropOrClick: "画像をドロップまたはクリックして選択",
videoPrompt: "Prompt",
videoAspectRatio: "Aspect Ratio",
videoMegapixels: "Megapixels",
videoMultiple: "Multiple",
videoDuration: "Duration(秒)",
videoNoiseSeed: "Noise Seed",
videoRandomizeSeed: "ランダム化",
videoGenerate: "Generate",
videoEditPlaceholder: "編集機能は今後追加予定",
videoNoWorkflowLoaded: "ワークフローが読み込まれていません",
videoUnsupportedWorkflow: "このワークフローには対応する動画モデルノード(MiniMax H3、LTX-2.5のText/Image/First&Last-Frame to Video、またはWan2.2のText to Video)が含まれていません",
videoWorkflowLoaded: (name) => `ワークフローを読み込みました: ${name}`,
videoGenerateSuccess: "動画を生成しました",
videoDoneCount: (n) => `完了(${n}件)`,
videoSourceLabel: "動画ソース",
videoSourceHint: "生成せずにFrame/GIF機能を使いたい場合はここに任意の動画を読み込めます。",
videoSourceDropLabel: "動画をドロップまたはクリックして選択",
videoNoVideo: "動画なし",
videoPropFrame: "Frame",
videoPropGif: "GIF",
videoFrameHint: "プレビュー動画を再生・シークして止めたい位置で「Capture Frame」を押してください。",
videoCaptureFrame: "Capture Frame",
videoSaveToOutput: "Outputに保存",
videoFrameSaved: (name) => `フレームを保存しました: ${name}`,
videoFrameCaptureFailed: (msg) => `フレームのキャプチャに失敗しました: ${msg}`,
videoGifStart: "開始(秒)",
videoGifEnd: "終了(秒)",
videoGifFps: "FPS",
videoGifWidth: "最大幅",
videoConvertToGif: "GIFに変換",
videoGifConverting: "変換中...",
videoGifDoneCount: (n) => `完了(${n}フレーム)`,
videoGifSaved: (name) => `GIFを保存しました: ${name}`,
videoNoSourceLoaded: "先に動画を用意してください(生成するか、動画ソースにファイルをドロップ)",
helpVideoTitle: "Video タブ",
helpVideoDesc: "MiniMax H3 (Image to Video)、LTX-2.5 (Text / Image / First & Last Frame to Video)、Wan2.2 (Text to Video) ワークフロー対応の動画生成タブ。GenerateUIタブとは独立して動作します。",
helpVideo1: "first_frame(任意)/last_frame(任意)の画像、prompt、aspect_ratio/megapixels/multiple(解像度)、duration(秒)、noise_seedを指定してGenerateをクリックします。first_frameを未指定にするとテキストのみでバイパス実行され、LoadImageノード自体が無いワークフローにも対応しています。",
helpVideo2: "モデル選択(UNet/CLIP/VAE/Audio VAE)は読み込んだワークフローの既定値に固定され、このタブでは変更できません。ResolutionSelectorノードを持たないワークフロー(Wan2.2など)は解像度も既定値に固定され、Aspect Ratio/Megapixels/Multiple欄は無効化されます。",
helpVideo3: "Workflowタブの詳細モーダルにある「Videoに読み込み」ボタンから、MiniMax H3のImage to Videoノード、LTX-2.5のText/Image/First&Last-Frame to Videoノード、またはWan2.2のText to Videoノードを含むワークフローを読み込めます。対応していないワークフローはエラー表示になります。",
helpVideo4: "生成した動画(mp4)はGalleryタブでも閲覧・再生できます。",
helpVideo5: "プレビューの横にある「Video Source」パネルでは、生成した動画に限らず任意のローカル動画をドロップ/選択して、下のFrame/GIF機能を読み込んだワークフローを実行せずに使えます。Clearで選択をリセットできます。",
helpVideo6: "Frameタブ(右パネル): プレビュー動画を再生・シークして止めたい位置で「Capture Frame」を押すとその場でフレームをキャプチャし、「Save to Output」でPNGとしてComfyUIのOutputフォルダに保存します。",
helpVideo7: "GIFタブ(右パネル): Start/End(秒)・FPS・Max Width(任意)を指定して「Convert to GIF」を押すと、サーバー側で動画をデコードしアニメーションGIFとしてComfyUIのOutputフォルダに保存します。",
helpVideo8: "ハイライト色: 読み込んだワークフローが実際に対応する項目(Prompt・Duration・First Frame・Last Frame・Aspect Ratio・Megapixels・Multiple)のラベルが、生成UIタブのModelタブと同じハイライト色(設定タブでカスタマイズ可能)で表示されます — 例えばWan2.2ワークフロー(ResolutionSelectorノードなし)ではAspect Ratio/Megapixels/Multipleのラベルは非表示のままです(それらの項目は操作不可のため)。",
},
zh: {
@@ -2826,6 +2996,7 @@ const LANGUAGES = {
labNoWorkflowLoaded: "请先在GenerateUI中加载工作流",
labNoSourceImage: "请先拖入源图片",
labNoResultsYet: "暂无结果",
labLastFrameExtractFailed: (msg) => `从生成的视频提取最后一帧失败: ${msg}`,
labResultPreview: "预览",
labEnterPlanName: "方案名称:",
labPlanSaved: "方案已保存",
@@ -2857,6 +3028,15 @@ const LANGUAGES = {
labT2IImageIgnored: "T2I模式已开启,无需上传图片,已跳过",
labIndexImageSaved: (filename) => `索引图片已保存到Output:${filename}`,
labIndexImageSaveFailed: "索引图片保存到Output失败",
labPromptGroupBtnTitle: "应用提示词组",
labPromptGroupModalTitle: "提示词组",
labPromptGroupEmpty: "尚无分组。请在Prompt标签的分组面板中创建。",
labPromptGroupCount: (n) => `${n} 个预设`,
labPromptGroupSelectFirst: "请先选择一个分组",
labPromptGroupNoPresets: "该分组没有预设",
labPromptGroupApplied: (name, n) => `已将"${name}"(${n}个关键帧)应用到Prompt`,
labPromptGroupBatchRaised: (n) => `已将Batch数量提高到${n}以适应该分组`,
labSelectKeyframeFirst: "请先选择一个关键帧",
// -- GenerateUI标签页 Input子标签: Image内占位图 --
i2iPlaceholderTitle: "占位图片",
@@ -2889,6 +3069,8 @@ const LANGUAGES = {
textSizeLabel: "文字大小",
textSizeTextarea: "提示词 / 聊天输入框",
textSizeHint: "适用于:生成UI提示词、AI助手聊天、预设提示词、通配符编辑、Metadata提示词预览",
videoVolumeLabel: "视频音量",
videoVolumeHint: "适用于:Video 标签页预览、Gallery 标签页详情/灯箱/对比视频播放器。在此设置的音量(或在任意视频自身控件中调整的音量)会在应用内下次打开任意视频时保留。",
jsonColorsSection: "RAW JSON 文字颜色",
jsonColorBase: "普通文本",
jsonColorYellow: "名称 / 调度器",
@@ -3137,6 +3319,8 @@ const LANGUAGES = {
gallerySelectImageFirst: "请先选择图像",
galleryNoLoadImageNode: "当前工作流中没有LoadImage节点",
gallerySentGenUI: "已发送至GenerateUI图像标签",
sendToLiNodeNoOpener: "请通过ComfyUI顶部菜单打开Workflow Studio以使用此功能",
sendToLiNodeSuccess: (filename) => `已将"${filename}"发送到LI节点`,
galleryCCNotAvailable: "仅当从ComfyUI Comic Creator内的图库打开时才能使用Send CC",
gallerySentCC: "已发送至ComfyUI Comic Creator",
galleryNoEmbeddedWorkflow: "此图像中未嵌入ComfyUI工作流。",
@@ -3204,7 +3388,7 @@ const LANGUAGES = {
taggerThreshold: "阈值",
taggerCharThreshold: "角色阈值",
taggerGenerateTags: "生成标签",
taggerOllamaEnable: "Ollama VLM",
taggerOllamaEnable: "VLM打标",
taggerOllamaUrl: "API URL",
taggerOllamaModel: "模型",
taggerOllamaPrompt: "提示词",
@@ -3273,6 +3457,12 @@ const LANGUAGES = {
aiSettingsInputLang: "输入语言",
aiSettingsOutputLang: "翻译语言",
aiSettingsSaveBtn: "保存设置",
aiUnloadModel: "卸载模型",
aiUnloading: "卸载中...",
aiUnloadDone: "模型已卸载",
aiUnloadFailed: "卸载失败: ",
aiUnloadUnsupported: "此后端不支持通过API卸载",
aiUnloadNoModel: "请先选择模型",
aiToastNoText: "请输入文字",
aiToastNoModel: "请在设置标签中选择模型",
aiToastInvalidUrl: "URL必须以 http:// 或 https:// 开头",
@@ -3343,7 +3533,8 @@ const LANGUAGES = {
helpGen5: "Model标签:Checkpoint/VAE/Diffusion Model(支持UNETLoader / UnetLoaderGGUF / LoaderGGUF)/Text Encoder(支持CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — 含type和device选择器,DualCLIP显示两段模型选择)始终显示;ControlNet和Hypernetwork(带Strength输入)因使用频率较低默认折叠 — 点击标题展开;LoRA(Single/Stack标签)拥有独立的列;所有选择器均含筛选;LoRA Stack — 点击Apply会将所有启用的LoRA写入目标节点,并同时将LoRA语法和CivitAI触发词插入Positive提示词;再次Apply会移除未启用的LoRA并重新添加启用的LoRA以更新提示词",
helpGen28: "Model标签 — 高亮颜色:当前工作流实际包含某类型节点时(Checkpoint/VAE/Diffusion Model/Text Encoder/ControlNet/Hypernetwork),对应标签及LoRA列标题会以指定颜色(默认亮绿色)显示;即使ControlNet/Hypernetwork处于折叠状态该颜色依然可见,无需展开即可判断是否在使用;颜色可在Settings标签中自定义",
helpGen6: "Settings标签:KSampler与Latent Image并排显示(各占50%宽度)",
helpGen7: "Raw JSON在每个标签右列常驻显示 — 直接编辑并Apply即时重载工作流;如果加载的工作流包含Bypass或Mute节点,搜索栏上方会显示列表(Bypass节点会被排除但其连线会重新连接;Mute节点会被排除且不重新连接,与ComfyUI本体行为一致)",
helpGen31: "LTX-2.5和Wan2.2视频工作流在本标签中作为普通工作流加载时(不仅限于专用的Video标签)也可正常使用 — Positive/Negative Prompt会沿LTX-2.5的LTXVDualCFGGuider / LTXVConditioning节点追溯找到实际提示词文本,Settings标签的Latent Image部分能识别Wan2.2的EmptyHunyuanLatentVideo和LTX-2.5的EmptyLTXVLatentVideo节点(并新增Length(帧数)字段),不再显示\"No EmptyLatentImage node found\";从这些工作流生成时也会应用与MiniMax H3视频生成相同的延长超时",
helpGen7: "Raw JSON在每个标签右列常驻显示 — 直接编辑并Apply即时重载工作流;如果加载的工作流包含Bypass或Mute节点,搜索栏上方会显示列表(Bypass节点会被排除但其连线会重新连接;Mute节点会被排除且不重新连接,与ComfyUI本体行为一致);搜索栏只会高亮匹配项并滚动到该位置,不会将光标移入编辑器,因此搜索后立即按键不会意外覆盖JSON — 需要先点击编辑器内部才能实际编辑",
helpGen8: "种子管理:随机/固定/递增/递减",
helpGen9: "生成图片、进度显示、停止生成、查看结果",
helpGen10: "Eagle集成:自动保存生成图片到Eagle(也支持SVG输出 — 标准SaveSVGNode节点和comfyui-tosvg的Save SVG String节点均可)",
@@ -3405,6 +3596,8 @@ const LANGUAGES = {
helpLab15: "Checkpoint/LoRA/VAE与其他列采用完全相同的实际生效值规则(见上文),各自独立向后延续:其中一项的关键帧不会使另外两项恢复为工作流原始设置。在编辑弹窗中,若某字段留空,且同一列表中更早的关键帧已设置过值,其占位符会显示「(继承: ...)」而不是「(保持工作流原设置)」,方便确认实际会应用的值。「恢复第1次的设置」和Bypass与+/-一样,只会作用于当前C/L/V切换选中的那一项,不会影响另外两项",
helpLab16: "绕过LoRA节点复选框(仅LoRA关键帧自己的编辑弹窗中):在应用时强制将该关键帧的strength_model/strength_clip设为0,替代ComfyUI原生的节点Bypass(mode:4)——这里使用的工作流已转换为API格式,不带mode概念,因此将强度归零在效果上是等价的。勾选后会禁用强度输入框;与上方行级别的Bypass复选框(见helpLab13)相互独立,后者只是跳过整行而不会改动节点本身",
helpLab17: "将LoRA语法和触发词应用到正面提示词复选框(仅LoRA列):勾选后,会在应用时以逗号分隔的形式,将<lora:name:strengthModel:strengthClip>及该LoRA缓存的CivitAI触发词追加到正面提示词——格式与GenerateUI的Model标签页Apply按钮写入的完全一致。切换关键帧时(更换为另一个LoRA、取消勾选此复选框,或该行被Bypass)总会先精确移除上一次迭代注入的内容,再添加新内容,因此批次不会累积用过的所有LoRA。勾选「绕过LoRA节点」时会自动禁用",
helpLab18: "单击关键帧单元格现在只是选中它(蓝色描边),不再直接打开编辑弹窗——需要双击才能打开编辑弹窗。每列的表头(Model/Prompt/Ksampler)新增了▲/▼按钮,可将选中的关键帧与相邻的关键帧互换位置,从而在不重新输入内容的情况下调整顺序;关键帧#1(基准行)无法移动,也不会有其他关键帧被换到#1的位置",
helpLab19: "Prompt列表头的PG按钮:选择Prompt标签中的一个预设分组(Table视图中的Presets Group,与Batch标签复选列表使用的是同一批分组),即可将整个Prompt列替换为该分组内每个预设对应一个关键帧、按分组顺序排列(从#1开始,#1会被覆盖而不是在其后追加)。如果分组中的预设数量超过当前Batch数量,会自动提高Batch数量以容纳(上限为50,与Batch输入框本身的上限一致);仍然超出的部分不会被静默丢弃,而是照常显示「关键帧超出Batch数量」的提示",
helpLabCardPlanTitle: "Setting子标签 — 运行与方案文件",
helpLabPlan1: "右侧面板 — Batch:要运行的迭代次数;Note:与方案一起保存的自由备注",
helpLabPlan2: "Run/Pause/Cancel:Run开始批量循环;Pause/Resume在各次迭代之间暂停/继续;Cancel会中断当前生成并停止循环",
@@ -3423,7 +3616,7 @@ const LANGUAGES = {
helpLabResults3: "加载已保存的方案时,会根据方案文件中记录的图片列表恢复Results网格",
helpSearchPlaceholder: "搜索帮助...",
helpPrompt1: "AI助手(Ollama / LM Studio / Lemonade):模型选择、聊天咨询提示词、图片附件(视觉模型);后端和URL在设置标签页配置",
helpPrompt1: "AI助手(Ollama / LM Studio / Lemonade / Unsloth):聊天咨询提示词、图片附件(视觉模型);点击⚙设置按钮可选择后端、连接URL、模型、Thinking mode、Max tokens,并卸载已加载的模型——设置与AI TOOL标签页、Tagger标签页相互独立",
helpPrompt2: "将AI回复应用到生成UI的提示词",
helpPrompt3: "翻译功能:日\u2194英、中\u2194英",
helpPrompt4: "预设管理:创建、编辑、正面/负面提示词剪贴板复制(PP/NP)",
@@ -3448,14 +3641,17 @@ const LANGUAGES = {
helpPrompt23: "Wildcards表格 — 与Form标签的通配符文件管理器使用相同的文件列表;编辑File列的路径或Ext下拉框会重命名文件(先以新名称保存内容,再删除旧文件)",
helpPrompt24: "Style表格 — 与Form标签的Style管理器使用相同的Style列表,可像Presets一样进行内联编辑",
helpPrompt25: "Presets表格工具栏 — 搜索框旁边的★和B排序按钮,可将收藏/已加入Batch的预设排到列表顶部;两者可同时启用(★优先,B为次要条件),其余项保持原有的相对顺序",
helpPrompt26: "Style表格工具栏——只选中一行且其File徽标不是custom.json时,「+ Add to this file」按钮才会启用:会添加一个以该文件为目标的空白行(保存前File列就会显示该文件的徽标)——与Form标签中Style管理器的同一功能(见上文)。custom.json条目或多选时按钮保持禁用,此时请改用常规的「+ New Style」按钮",
helpSettings1: "UI语言和摘要语言设置",
helpSettings2: "主题选择(13种预设)+ 自定义:颜色调整、背景图案(条纹、波点、棋盘格、SVG平铺)、字体选择(含日文显示字体在内的16种Google Fonts)",
helpSettings3: "工作流数据文件夹路径更改/重置",
helpSettings4: "ComfyUI连接URL设置和测试",
helpSettings5: "AI助手(提示词标签页):后端(Ollama / LM Studio / Lemonade)、API URL、默认模型、连接测试",
helpSettings5: "AI助手设置已从此标签页移出——Prompt标签页、Tagger标签页、AI TOOL标签页现在各自拥有独立的⚙设置按钮(后端、URL、模型、Thinking mode、Max tokens、卸载模型),分别单独保存",
helpSettings6: "默认工作流设置/取消",
helpSettings7: "Eagle集成URL、自动保存开关",
helpSettings8: "数据管理:将所有插件数据(设置、元数据、提示词等)导出为JSON文件,或导入以恢复。导入后请重启ComfyUI。",
helpSettings8: "数据管理:将设置、元数据、提示词等主要数据导出为JSON文件,或导入以恢复。导入后请重启ComfyUI。",
helpSettings15: "完整备份 (ZIP):与上方的JSON导出不同,还包含文件夹型数据(AI Skills、Lab Plan、Style预设)以及Tagger数据库。恢复会覆盖现有文件,恢复后请重启ComfyUI。",
helpSettings16: "完整备份按钮上方的两个复选框可将ComfyUI默认工作流文件夹和Impact Pack的wildcard文件夹一并导出。两者均仅用于导出,不会自动恢复。如需要,请从ZIP中的_external/文件夹手动复制回去。",
helpSettings9: "各部分可折叠展开",
helpSettings10: "Wildcard Integration:将WFS通配符目录链接到ComfyUI-Impact-Pack的wildcards目录(Windows为目录联结,其他OS为符号链接);现有文件自动迁移",
helpSettings11: "文字大小:单个滑块(10–28 px)可一次性调整所有提示词和聊天文本框的字体大小 — GenerateUI正/负向提示词、AI助手聊天输入、预设正/负向提示、通配符提示和文件编辑器、元数据提示词全文预览;即时生效并通过「保存设置」保存",
@@ -3488,17 +3684,18 @@ const LANGUAGES = {
helpGallery4: "工具栏过滤器:收藏 (★)、文本搜索(文件名・标签・提示词)、标签过滤、分组过滤、按日期/名称排序",
helpGallery5: "文件夹树:点击加载图像,▶展开;'+ New'在选定文件夹内创建子文件夹;'Del'删除该文件夹及其所有内容",
helpGallery6: "多选:Ctrl+点击切换单张图像;Shift+点击从上次点击位置进行范围选择 — 批量操作栏:选择分组 → 「添加到分组」/「从分组中删除」;全部收藏/取消收藏;「对比」(2–4张);移动到...;删除文件",
helpGallery7: "详情面板 — 信息(Info)标签:文件名、大小、日期、标签(添加/移除)、备注;'移动到...'将图像移至另一文件夹;'删除文件'永久删除",
helpGallery7: "详情面板 — 信息(Info)标签:文件名、大小、尺寸(图片为宽×高,视频为时长)、日期、标签(添加/移除)、备注;'移动到...'将图像移至另一文件夹;'删除文件'永久删除",
helpGallery8: "详情面板 — JSON标签:显示来自PNG嵌入数据(prompt / workflow键)或Generate UI标签保存的工作流JSON;「Copy & Send Canvas」按钮将工作流复制到剪贴板并直接发送到ComfyUI画布(UI和API格式均支持);若Workflow Studio不是从ComfyUI工具栏打开,UI格式将回退到标题拖拽",
helpGallery9: "详情面板 — 分组(Groups)标签:对每个图像进行组的创建、分配、移除、重命名和删除",
helpGallery10: "工作流自动保存:在Generate UI标签生成的图像,其工作流会自动保存到图库元数据,并在JSON标签中显示",
helpGallery11: "支持PNG(tEXt/iTXt)、JPEG、WebP、GIF;PNG格式读取ComfyUI嵌入的JSON(prompt / workflow键)提取工作流",
helpGallery11: "支持PNG(tEXt/iTXt)、JPEG、WebP、GIF、MP4;PNG格式读取ComfyUI嵌入的JSON(prompt / workflow键)提取工作流,MP4格式读取SaveVideo写入的容器标签(同名键,如MiniMax H3输出)",
helpGallery12: "Metadata按钮(绿色,位于详情面板标签栏):在Metadata标签中打开所选图像以全面查看嵌入数据;Alt+点击任意图像缩略图效果相同",
helpGallery13: "Load GenUI按钮(蓝色,位于详情面板标签栏):将所选图像中嵌入的ComfyUI工作流直接加载到GenerateUI标签并切换过去;如果没有嵌入工作流或格式不受支持,则显示警告提示",
helpGallery14: "Tagger按钮(紫色,位于详情面板操作行):将所选图像直接在Tagger标签的Single模式中打开,即可立即进行标注",
helpGallery15: "F按钮(青色悬浮按钮,每个缩略图左上角):单击即可将图像添加到/从__Feeder__组中移除;图像在组中时始终显示青色,不在组中时仅悬停时可见;可快速为Feeder标签Gallery模式添加队列图像",
helpGallery16: "Image Edit按钮(工具栏,Refresh按钮旁):将当前选中的图像发送到Image Edit标签;如果已有图层则按比例缩放添加为新图层,否则将成为Layer 1",
helpGallery17: "Send GenUI Image按钮(工具栏,Image Edit按钮旁):将选中图像上传至ComfyUI并设置为GenerateUI标签中第一个LoadImage节点的输入;自动切换至GenerateUI → Input → Image;需要预先加载包含至少一个LoadImage节点的工作流",
helpGallery27: "Send to LI node按钮(工具栏,Send GenUI Image按钮旁):上传选中图像并将其文件名写入ComfyUI画布上当前选中节点(若无选中节点则回退到找到的第一个LoadImage类节点)的image部件 — 与Image Edit标签的Send to LI node发送到同一目标;需要通过ComfyUI顶部菜单按钮打开Workflow Studio",
helpGallery18: "Gallery标签页中与Output并列的第二个子标签,用于浏览可视化提示词库 — 管理ComfyUI output文件夹内的ws_image_prompt文件夹(未创建时自动生成)",
helpGallery19: "相同的三栏布局:文件夹树(左)|缩略图(中)|提示词构建器(右)。点击缩略图可预览图像及其提示词文本 — 此时尚未添加到提示词中",
helpGallery20: "「+ 添加」将预览中图像的提示词作为标签添加到「已选提示词」;标签可单独删除(×)或一次性清除(「全部清除」);「Save」用于编辑并保存该图像的提示词文本",
@@ -3511,13 +3708,13 @@ const LANGUAGES = {
// -- Tagger Tab --
helpTaggerTitle: "Tagger标签",
helpTagger1: "使用WD Tagger(ONNX)、SwinV2、DeepDanbooru(.h5)和Ollama VLM进行自动图像标注 — 子标签:Single / Batch / DB",
helpTagger1: "使用WD Tagger(ONNX)、SwinV2、DeepDanbooru(.h5)和VLM(Ollama / LM Studio / Lemonade / Unsloth)进行自动图像标注 — 子标签:Single / Batch / DB",
helpTagger2: "模型放置:在ComfyUI/models/tagger/<模型名>/ 下为每个模型创建单独子文件夹,必须包含 .onnx + selected_tags.csv(DeepDanbooru为 .h5 + 标签文件)",
helpTagger3: "Single标签:将图像拖放到预览区域,或点击Upload选择文件;图库详情面板的Tagger按钮可直接在此处打开所选图像",
helpTagger4: "阈值滑块:一般标签的最低置信度(默认0.35);角色阈值:character: 前缀标签的独立阈值(默认0.85)",
helpTagger5: "Ollama VLM:勾选复选框可与WD Tagger并行运行视觉模型;设置API URL、选择模型(点击↻刷新列表)并自定义提示词;两个模型的结果将合并",
helpTagger5: "VLM打标:勾选复选框可与WD Tagger并行运行视觉模型;点击⚙设置按钮可选择后端(Ollama / LM Studio / Lemonade / Unsloth)、URL、模型、Thinking mode、Max tokens,并卸载模型——与Prompt标签页自身的AI设置相互独立;提示词和Max Tags可在标签页内直接编辑;两个模型的结果将合并",
helpTagger6: "生成标签的发送目标:(1) GenUI:P — 追加到生成UI标签的正向提示词并立即应用到已加载工作流;(2) 发送到提示词 — 追加到提示词标签的正向文本区;(3) 保存到图库 — 保存到图库图像元数据(仅限从图库打开的图像);(4) 写入文件 — JPEG写入EXIF(ImageDescription)、PNG写入tEXt(Tags键);(5) 保存到DB — 存入内置SQLite数据库",
helpTagger7: "Batch标签:输入目标文件夹路径并配置WD Tagger和Ollama设置,选择输出选项(保存DB〈默认开启〉、写入文件〈EXIF/PNG元数据〉、输出.txt〈在图像同目录生成 <文件名>.txt〉);开始批处理后将处理文件夹内所有图像;进度条和日志实时更新;停止按钮在当前图像处理完成后取消",
helpTagger7: "Batch标签:输入目标文件夹路径并配置WD Tagger,启用VLM打标(与Single标签使用相同的⚙设置);选择输出选项(保存DB〈默认开启〉、写入文件〈EXIF/PNG元数据〉、输出.txt〈在图像同目录生成 <文件名>.txt〉);开始批处理后将处理文件夹内所有图像;进度条和日志实时更新;停止按钮在当前图像处理完成后取消",
helpTagger8: "DB标签:所有已标注图像的可搜索数据库;点击行可在编辑面板中修改WD标签/VLM标签;保存更新记录,删除移除记录;导出CSV可下载所有记录",
helpTagger9: "安装依赖包:python_embeded\\python.exe -m pip install -r requirements.txt;GPU推理请安装onnxruntime-gpu替代onnxruntime;TensorFlow(用于DeepDanbooru)因体积较大默认已注释",
@@ -3534,7 +3731,7 @@ const LANGUAGES = {
helpSidepanel10: "在各子标签内搜索快速查找项目",
helpSidepanel11: "Models标签:All / ★ Favorites / Groups / By Type子标签;Prompts标签:All / ★ Favorites / Categories子标签+Groups子标签(第二行);Models Groups的LoRA组显示「All N LoRAs」条目,可拖拽将全部LoRA放入单个Lora Loader (LoraManager)节点",
helpSidepanel12: "⚙ 主题按钮(标题栏):可自定义面板背景、子标题背景、文字颜色、边框及辅助文字颜色,设置保存至localStorage并在下次打开时生效",
helpSidepanel13: "I 标签(Information):拖放 ComfyUI PNG/WebP/JSON 即可在侧面板内查看模型、LoRA 和提示词元数据 — 子标签:model / lora / Prompts;支持 UnetLoaderGGUF、QuadrupleCLIPLoader 和 Lora Loader (LoraManager) 节点类型",
helpSidepanel13: "I 标签(Information):拖放 ComfyUI PNG/WebP/MP4/JSON 即可在侧面板内查看模型、LoRA 和提示词元数据 — 子标签:model / lora / Prompts;支持 UnetLoaderGGUF、QuadrupleCLIPLoader 和 Lora Loader (LoraManager) 节点类型;MP4会读取SaveVideo写入的workflow/prompt标签,也支持MiniMax H3 ImageToVideo等一体化视频节点的提示词",
helpSidepanel14: "Information 标签 — 拖拽到画布:model 子标签拖拽可放置对应加载节点(Checkpoint → CheckpointLoaderSimple、VAE → VAELoader、Diffusion Model → UNETLoader、Text Encoder → CLIPLoader);双击也可放置到画布中央",
helpSidepanel15: "Information 标签 — lora 子标签:可检测 LoraLoader、LoraLoaderModelOnly 及 Lora Loader (LoraManager) 节点(含API格式)的 LoRA;拖拽单个 LoRA 放置 LoraLoader;「Multiple LORA」区域可将全部 LoRA 一次性放入 Lora Loader (LoraManager) 节点并自动填入LoRA语法;Prompts 子标签:拖拽提示词放置预填文本的 CLIPTextEncode 节点;点击可查看全文并复制",
helpSidepanel16: "A 标签(AI 工具):翻译、Chat、TOOLS 和设置子标签,支持 Ollama、LM Studio、Lemonade 或 Unsloth;Chat 支持与 LLM 的多轮对话;TOOLS 包含 VLM 图像分析和通配符生成;设置通过 localStorage 与 SPA 的 AI 标签共享",
@@ -3544,7 +3741,7 @@ const LANGUAGES = {
helpAi2: "翻译面板:使用 Ollama、LM Studio、Lemonade 或 Unsloth 在日语、英语、中文或自定义语言(Free)之间翻译;⇄ 按钮同时互换语言和文本内容;选择自动保存",
helpAi3: "Chat 面板:与 LLM 进行多轮对话;Enter 发送消息,Shift+Enter 换行;Clear 按钮重置对话历史;如果模型支持 tool calling,当你要求生成图像(例如\"生成一张猫的图片\")时,会使用 GenerateUI 中当前加载的工作流执行生成,并在对话中显示结果;面板标题栏的\"允许生成图像\"复选框可开关此功能;如果附加了图像(在 TOOLS 面板中拖放的图像),该图像会作为视觉输入发送给 LLM,调用 generate_image 时会以该图像为基础执行图生图(I2I),而不是文生图;generate_image 还接受可选的生成参数——steps、cfg、sampler_name、scheduler、denoise、seed、width、height、batch_size(该次调用生成的图像数量),以及 aspect_ratio(形如\"3:2\"的比例预设,仅当工作流中存在向 width/height 供值的 Resolution Selector 节点时才会生效,否则忽略);模型未提供的参数将保留当前已加载工作流的设置;已验证可正常支持 tool calling 与视觉功能的模型:Gemma 4:e4b、Qwen 3.5:9b、Ministral 3:3b(Ollama)",
helpAi4: "TOOLS 面板 — VLM:拖放图像(PNG/JPG/WebP)并选择任务(图像描述 / 提示词生成 / 标签生成),点击 Run;或选择「Create wildcards」,输入类别名称和数量生成纯文本通配符条目(每行一条);拖放的图像也会作为 Chat 面板的附件共享(在该处显示并用于图生图生成),直到点击 ✕ 按钮清除",
helpAi6: "Settings 面板:选择后端(Ollama / LM Studio / Lemonade / Unsloth)、设置 API URL、测试连接、选择模型;Unsloth 即使在本地访问时也始终需要 API 密钥认证——将插件文件夹中的 .env.example 复制为 .env 并设置 UNSLOTH_API_KEY,然后重启 ComfyUI(密钥仅在服务器端读取,绝不会发送到浏览器);还需要在 Unsloth Desktop 应用自身的设置界面中开启「Auto model switching (OpenAI API)」——若保持关闭,除非已在 Unsloth Studio 中手动加载过模型,否则请求会以 HTTP 404 失败;Unsloth 的推理模型会将思考内容放在单独的 reasoning_content 字段中,而不是内联的 <think> 标签里,因此 Max tokens 太小会导致模型把全部配额都用在思考上,返回空白回复——如果回复为空,请调高 Max tokens(建议 2048 以上);Generation 部分 — Thinking mode 开关(默认关闭;Ollama会收到think标志,无论使用哪个后端,关闭时都会从输出中去除<think>...</think>思考块,避免推理模型的思考过程混入Translation/Chat/TOOLS的结果)以及 Max tokens(Ollama: num_predict,LM Studio/Lemonade/Unsloth: max_tokens;0为不限);配置 Free 语言名称;Chat 图像生成部分可让 Chat 触发的文生图使用专用工作流,而不是 GenerateUI 中当前加载的工作流;Chat I2I 生成部分提供相同设置,用于附加图像时的图生图生成;设置保存至 localStorage,并与 Library 面板的 A 标签共享",
helpAi6: "Settings 面板:选择后端(Ollama / LM Studio / Lemonade / Unsloth)、设置 API URL、测试连接、选择模型,以及使用「Test connection」右侧的「Unload Model」按钮将已加载的模型从显存/内存中卸载——Ollama 使用 keep_alive:0,LM Studio 使用 /api/v1/models/unload,Lemonade 使用 /api/v1/unload;Unsloth 没有卸载 API,因此会显示不支持的提示;Unsloth 即使在本地访问时也始终需要 API 密钥认证——将插件文件夹中的 .env.example 复制为 .env 并设置 UNSLOTH_API_KEY,然后重启 ComfyUI(密钥仅在服务器端读取,绝不会发送到浏览器);还需要在 Unsloth Desktop 应用自身的设置界面中开启「Auto model switching (OpenAI API)」——若保持关闭,除非已在 Unsloth Studio 中手动加载过模型,否则请求会以 HTTP 404 失败;Unsloth 的推理模型会将思考内容放在单独的 reasoning_content 字段中,而不是内联的 <think> 标签里,因此 Max tokens 太小会导致模型把全部配额都用在思考上,返回空白回复——如果回复为空,请调高 Max tokens(建议 2048 以上);Generation 部分 — Thinking mode 开关(默认关闭;Ollama会收到think标志,无论使用哪个后端,关闭时都会从输出中去除<think>...</think>思考块,避免推理模型的思考过程混入Translation/Chat/TOOLS的结果)以及 Max tokens(Ollama: num_predict,LM Studio/Lemonade/Unsloth: max_tokens;0为不限);配置 Free 语言名称;Chat 图像生成部分可让 Chat 触发的文生图使用专用工作流,而不是 GenerateUI 中当前加载的工作流;Chat I2I 生成部分提供相同设置,用于附加图像时的图生图生成;设置保存至 localStorage,并与 Library 面板的 A 标签共享",
helpAi7: "Chat 面板 — SVG:LLM 还可以直接以文本形式生成 SVG 图形,完全不涉及 ComfyUI 工作流;只需要求它用 SVG 绘制内容,如果回复中包含 SVG 代码,会自动渲染为内嵌预览,并提供\"保存到图库\"按钮,将其保存为 .svg 文件到 Gallery 标签页的输出文件夹;该功能不使用 tool calling(函数调用),因此不支持 tool calling 的模型也可以使用",
helpAi8: "Chat 面板 — 技能:在消息列表上方的下拉菜单中选择一个技能,其内容会作为 system prompt 添加到对话开头(不会显示在可见的聊天记录中);点击铅笔按钮打开技能管理面板,可创建、编辑、删除 .md 技能文件(保存路径:user/default/Workflow-Studio/ai_skills/);文件开头 --- 之间的 name/description 字段会显示在下拉菜单中;默认内置两个技能:「SVG Icon Generator」(在绘制前先将对象拆解为多个部件,以生成更易识别的 SVG)和「Skill Creator」(通过对话向你提问并起草新的技能文件);当回复中包含```skill代码块时,消息下方会出现「保存为技能」按钮,点击后会打开管理面板并预填内容",
helpAi9: "编写技能的小贴士:为 frontmatter 的 name/description 写清楚的内容,便于在下拉菜单和提示中阅读;明确说明期望的输出格式,如果有需要后续提取的成果物(如 SVG 或另一个技能文件),指示它用专门的代码围栏包裹;具体、祈使句式的指令比笼统的说明对本地小模型更有效,附上一个简短示例效果更佳;明确写出硬性约束(禁止内容、安全性、长度限制等),不要指望模型会自行推断;如果不确定怎么写,可以在下拉菜单中选择「Skill Creator」技能并描述你想要的技能,它会通过提问帮你起草",
@@ -3639,8 +3836,7 @@ const LANGUAGES = {
helpImageEditExportTitle: "导出与导航",
helpImageEdit17: "Save PNG:合并所有可见图层并下载为PNG文件",
helpImageEdit18: "Save to Gallery:输入文件名(默认:wfs-image-YYYYMMDDHHmmss)将合成PNG保存到Gallery根文件夹(在设置 > Gallery Output Folder中配置);需要至少打开过一次Gallery标签以设置根目录",
helpImageEdit19: "Save to Input:通过/upload/image将合成PNG上传到ComfyUI的输入文件夹,使其可在Load Image节点中选择",
helpImageEdit19b: "Send to Workflow:与 Save to Input 一样会上传合成PNG,但还会将上传结果的文件名写入 ComfyUI 图中当前选中节点(若无选中节点则回退到找到的第一个 LoadImage 类节点)的 image 部件;需要通过 ComfyUI 顶部菜单按钮打开 Workflow Studio",
helpImageEdit19b: "Send to LI node:通过 /upload/image 将合成PNG上传到ComfyUI的输入文件夹,并将上传结果的文件名写入 ComfyUI 图中当前选中节点(若无选中节点则回退到找到的第一个 LoadImage 类节点)的 image 部件;需要通过 ComfyUI 顶部菜单按钮打开 Workflow Studio",
helpImageEdit20: "画布导航:滚轮缩放,Space+拖动平移",
helpImageEdit21: "撤销/重做:Ctrl+Z / Ctrl+Y(或工具栏的 ↩ ↪ 按钮)",
helpImageEditKbdTitle: "图像编辑键盘快捷键",
@@ -3761,13 +3957,20 @@ const LANGUAGES = {
eagleUrl: "Eagle URL",
eagleAutoSave: "自动保存生成图片到Eagle",
dataManagement: "数据管理",
dataManagementHint: "将所有插件数据(设置、元数据、提示词等)导出为JSON文件,或导入之前导出的文件以恢复数据。导入后请重启ComfyUI以使更改生效。",
dataManagementHint: "将设置、元数据、提示词等主要数据导出为JSON文件,或导入之前导出的文件以恢复数据。导入后请重启ComfyUI以使更改生效。",
exportData: "导出",
importData: "导入",
exportSuccess: "导出完成",
exportError: "导出失败",
importSuccess: "导入完成",
importError: "导入失败",
exportFullBackup: "完整备份 (ZIP)",
importFullBackup: "恢复完整备份 (ZIP)",
fullBackupHint: "完整备份(ZIP)还包含上方JSON导出无法表示的文件夹型数据(AI Skills、Lab Plan、Style预设)以及Tagger数据库。恢复会覆盖现有文件,恢复后请重启ComfyUI。",
fullBackupFilesUnit: "个文件",
fullBackupIncludeWorkflows: "包含默认工作流文件夹 (user/default/workflows)",
fullBackupIncludeWildcard: "包含Impact Pack的wildcard文件夹(如存在)",
fullBackupExternalHint: "这些仅用于导出,恢复备份时不会处理它们。如需要,请从ZIP中的_external/文件夹手动复制回去。",
saveSettings: "保存设置",
settingsSaved: "设置已保存",
ollamaSaved: "AI助手设置已保存",
@@ -3836,8 +4039,8 @@ const LANGUAGES = {
metaSectionTe: "文本编码器",
metaSectionLora: "LoRA",
metaSectionPrompt: "提示词",
metaDropMain: "拖放图片 / JSON",
metaDropSub: "PNG · WebP · JSON",
metaDropMain: "拖放图片 / 视频 / JSON",
metaDropSub: "PNG · WebP · MP4 · JSON",
metaParsing: "解析中...",
metaFileTooLarge: "文件过大(最大 50 MB)",
metaNoMetadata: "未找到元数据",
@@ -3847,7 +4050,7 @@ const LANGUAGES = {
metaPromptText: "文本",
metaSelectPrompt: "选择上方提示词以查看全文...",
metaFormatNoteTitle: "支持格式",
metaFmtComfyui: "ComfyUI — PNG / WebP / JSON",
metaFmtComfyui: "ComfyUI — PNG / WebP / MP4 / JSON",
metaFmtSdwebui: "SD WebUI / SD Forge — PNG(parameters)",
metaFmtFooocus: "Fooocus — PNG(fooocus_scheme)",
metaFormatTodo: "已支持 Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image 子图工作流",
@@ -3857,8 +4060,60 @@ const LANGUAGES = {
helpMetadata2: "中列:从工作流中提取的 Checkpoint、VAE、扩散模型、文本编码器列表",
helpMetadata3: "右列:LoRA 列表(含强度值)和提示词列表(点击在下方显示全文)",
helpMetadata4: "提示词操作 — Copy:复制到剪贴板;GenUI:P/N:设置 GenerateUI 正/负向提示;Prompt:P/N:设置 Prompt 标签页预设正/负向提示",
helpMetadata5: "支持格式:ComfyUI PNG/WebP/JSON(标准格式 + Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image 子图工作流)、SD WebUI、SD Forge、Fooocus。",
helpMetadata5: "支持格式:ComfyUI PNG/WebP/MP4/JSON(标准格式 + Flux.2 / Qwen-Image / Z-Image / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Ernie Image 子图工作流;MP4读取SaveVideo写入的workflow/prompt容器标签,也支持MiniMax H3 ImageToVideo等一体化视频节点)、SD WebUI、SD Forge、Fooocus。",
helpMetadata6: "现在它是 Gallery 标签页内的一个子标签(位于 Style_Catalog 右侧),不再是独立的顶层标签页 — 其余操作方式完全相同",
// -- Video 标签页(支持 MiniMax H3 / LTX-2.5 / Wan2.2,独立于 GenerateUI) --
tabVideo: "Video",
loadInVideo: "加载到Video",
videoTitle: "Video",
videoFirstFrame: "First Frame(可选)",
videoLastFrame: "Last Frame(可选)",
videoDropOrClick: "拖放图片或点击选择",
videoPrompt: "Prompt",
videoAspectRatio: "Aspect Ratio",
videoMegapixels: "Megapixels",
videoMultiple: "Multiple",
videoDuration: "Duration(秒)",
videoNoiseSeed: "Noise Seed",
videoRandomizeSeed: "随机化",
videoGenerate: "Generate",
videoEditPlaceholder: "编辑功能即将推出",
videoNoWorkflowLoaded: "尚未加载工作流",
videoUnsupportedWorkflow: "该工作流不包含受支持的视频模型节点(MiniMax H3、LTX-2.5 的 Text/Image/First&Last-Frame to Video,或 Wan2.2 的 Text to Video)",
videoWorkflowLoaded: (name) => `已加载工作流: ${name}`,
videoGenerateSuccess: "视频已生成",
videoDoneCount: (n) => `完成(${n} 个文件)`,
videoSourceLabel: "视频来源",
videoSourceHint: "无需生成,也可在此加载任意视频以使用Frame/GIF工具。",
videoSourceDropLabel: "拖放视频或点击选择",
videoNoVideo: "暂无视频",
videoPropFrame: "Frame",
videoPropGif: "GIF",
videoFrameHint: "播放/拖动预览视频到想要的位置,然后点击截取。",
videoCaptureFrame: "截取当前帧",
videoSaveToOutput: "保存到Output",
videoFrameSaved: (name) => `已保存帧: ${name}`,
videoFrameCaptureFailed: (msg) => `截取帧失败: ${msg}`,
videoGifStart: "开始(秒)",
videoGifEnd: "结束(秒)",
videoGifFps: "FPS",
videoGifWidth: "最大宽度",
videoConvertToGif: "转换为GIF",
videoGifConverting: "转换中...",
videoGifDoneCount: (n) => `完成(${n} 帧)`,
videoGifSaved: (name) => `已保存GIF: ${name}`,
videoNoSourceLoaded: "请先准备视频(生成一个,或将文件拖入视频来源)",
helpVideoTitle: "Video 标签页",
helpVideoDesc: "支持 MiniMax H3(Image to Video)、LTX-2.5(Text / Image / First & Last Frame to Video)、Wan2.2(Text to Video)工作流的视频生成标签页,独立于 GenerateUI 标签页运行。",
helpVideo1: "设置 first_frame(可选)/last_frame(可选)图片、prompt、aspect_ratio/megapixels/multiple(分辨率)、duration(秒)和 noise_seed,然后点击 Generate。不指定 first_frame 时将以纯文本方式绕过执行,也支持完全没有 LoadImage 节点的工作流。",
helpVideo2: "模型选择(UNet/CLIP/VAE/Audio VAE)固定为所加载工作流的默认值,无法在此标签页中修改。没有 ResolutionSelector 节点的工作流(如 Wan2.2)分辨率也固定为默认值,Aspect Ratio/Megapixels/Multiple 字段会被禁用。",
helpVideo3: "可通过 Workflow 标签页详情弹窗中的「加载到Video」按钮,加载包含 MiniMax H3 Image to Video 节点、LTX-2.5 Text/Image/First&Last-Frame to Video 节点,或 Wan2.2 Text to Video 节点的工作流。不支持的工作流会显示错误。",
helpVideo4: "生成的视频(mp4)也可以在 Gallery 标签页中浏览和播放。",
helpVideo5: "预览旁边的「Video Source」面板可以拖放或选择任意本地视频(不仅限于生成的视频),无需先运行已加载的视频工作流即可使用下方的Frame/GIF工具。点击Clear可重置选择。",
helpVideo6: "Frame标签页(右侧面板):播放/拖动预览视频到想要的位置,点击「Capture Frame」在客户端截取该帧,再点击「Save to Output」将其保存为PNG到ComfyUI的输出文件夹。",
helpVideo7: "GIF标签页(右侧面板):设置Start/End(秒)、FPS和可选的Max Width,点击「Convert to GIF」后,服务器会解码视频并将动画GIF保存到ComfyUI的输出文件夹。",
helpVideo8: "高亮颜色:当加载的工作流实际支持某个字段时(Prompt、Duration、First Frame、Last Frame、Aspect Ratio、Megapixels、Multiple),对应标签会以与生成UI标签Model页相同的高亮颜色显示(可在设置标签中自定义)——例如Wan2.2工作流(没有ResolutionSelector节点)中,Aspect Ratio/Megapixels/Multiple标签保持不高亮,因为这些字段处于禁用状态。",
},
};
-1
View File
@@ -1112,7 +1112,6 @@ class ImageEditTab {
document.getElementById("ie-redo-btn")?.addEventListener("click", () => this._redo());
document.getElementById("ie-save-btn")?.addEventListener("click", () => this._fileExport.savePng());
document.getElementById("ie-save-gallery-btn")?.addEventListener("click", () => this._fileExport.saveToGallery());
document.getElementById("ie-upload-comfy-btn")?.addEventListener("click", () => this._fileExport.uploadToComfyUI());
document.getElementById("ie-send-workflow-btn")?.addEventListener("click", () => this._fileExport.sendToWorkflow());
document.getElementById("ie-zoom-fit")?.addEventListener("click", () => this._fitToView());
document.getElementById("ie-zoom-100")?.addEventListener("click", () => {
+5 -21
View File
@@ -2,7 +2,8 @@
* Image Edit Tab - File Export
* Composites the visible layers (respecting mask-apply clipping) into a
* flat canvas and offers three destinations: local PNG download, WFS
* Gallery, and ComfyUI's own /upload/image endpoint.
* Gallery, and the selected node's image widget on the ComfyUI canvas
* (Send to LI node).
*/
import { showToast } from "../app.js";
@@ -104,24 +105,7 @@ export class FileExport {
}
}
async uploadToComfyUI() {
if (!this._cb.getLayerManager()) { showToast("No image loaded", "error"); return; }
const canvas = this._buildCompositeCanvas();
const blob = await new Promise(resolve => canvas.toBlob(resolve, "image/png"));
const file = new File([blob], (this._cb.getBaseName() || "wfs-edit") + "-output.png", { type: "image/png" });
const form = new FormData();
form.append("image", file);
form.append("overwrite", "true");
try {
const r = await fetch("/upload/image", { method: "POST", body: form });
const data = await r.json();
showToast(`Uploaded: ${data.name}`, "success");
} catch {
showToast("Upload failed", "error");
}
}
// Uploads the composite like uploadToComfyUI(), then (via window.opener,
// Uploads the composite via /upload/image, then (via window.opener,
// since WFS runs in its own window — same cross-window pattern as
// wfmReceiveWorkflow/wfmOpenMaskEditorForNode) writes the resulting
// filename into the "image" widget of the currently selected ComfyUI
@@ -144,9 +128,9 @@ export class FileExport {
const data = await r.json();
const filename = data.subfolder ? `${data.subfolder}/${data.name}` : data.name;
window.opener.wfmSendImageToSelectedNode(filename);
showToast(`Sent "${filename}" to workflow`, "success");
showToast(`Sent "${filename}" to LI node`, "success");
} catch (err) {
showToast(`Send to workflow failed: ${err.message}`, "error");
showToast(`Send to LI node failed: ${err.message}`, "error");
}
}
}
+224 -9
View File
@@ -9,6 +9,7 @@
*/
import { comfyUI } from "./comfyui-client.js";
import { comfyWorkflow } from "./comfyui-workflow.js";
import { comfyEditor } from "./comfyui-editor.js";
import { showToast, openModal, closeModal } from "./app.js";
import { t } from "./i18n.js";
@@ -16,6 +17,8 @@ import { escapeHtml, embedPngTextChunk, getEagleSettings, saveToEagle, setupSear
import { extractAllMetadata, readAllPNGTextChunks } from "./metadata-tab.js";
import { syncJsonHighlight, syncScroll } from "./json-highlight.js";
import { _expandWildcardsInWorkflow } from "./generate-tab.js";
import { pmGroups, getPresetsInGroup } from "./prompt-presets.js";
import { isVideoFilename, extractLastFrameBlob } from "./video-utils.js";
// Checkpoint/LoRA/VAE are three fully independent keyframe timelines — same as
// Prompt/KSampler — each with its own +/-, its own atIteration sequence, its own
@@ -128,6 +131,13 @@ let _lastGeneratedImageRef = null; // ComfyUI "name [type]" annotated ref of the
// with the plan and simply resets to "checkpoint" on page load.
let _modelViewMode = "checkpoint";
// Single-click-selected keyframe index per real column key (checkpoint/lora/vae/prompt/
// ksampler) — used by that column's up/down reorder buttons. A single click selects
// (this object); a double click still opens the edit modal directly, bypassing
// selection. Not part of the Plan data — resets whenever columns are replaced wholesale
// (plan load/clear, Prompt Group apply) so a stale index never points past the new array.
let _selectedIdx = {};
// ============================================
// Init
// ============================================
@@ -137,6 +147,8 @@ export function initLabTab() {
_initPlanDropZone();
_initSubtabToggle();
_initColumnButtons();
_initReorderButtons();
_initPromptGroupButton();
_initModelViewToggle();
_initRunControls();
_initPlanButtons();
@@ -400,6 +412,133 @@ function _initColumnButtons() {
});
}
// Single click on a cell selects it (for the up/down reorder buttons below) instead of
// opening the edit modal — opening now requires a double click (_renderColumn wires
// both listeners on the same cell).
function _selectCell(col, idx) {
_selectedIdx[col] = idx;
_renderColumnForKey(col);
}
// Up/down buttons: swap the selected keyframe with its immediate array neighbor. Row 1
// (idx 0, the baseline) can never move and nothing can be swapped into its slot — it has
// no atIteration input of its own and drives the "live GenerateUI value" display, so
// letting another keyframe take its place would silently change that keyframe's
// behavior. Swapping the two keyframes' atIteration values (rather than reordering the
// array directly) keeps each object's own value permanently paired with its own
// atIteration field; re-deriving the array order from those swapped values below is
// then just "swap array position to match", not a re-sort of the whole column.
function _initReorderButtons() {
document.querySelectorAll(".wfm-lab-col-up").forEach((btn) => {
btn.addEventListener("click", () => _moveSelectedKeyframe(_resolveColumnKey(btn.dataset.col), -1));
});
document.querySelectorAll(".wfm-lab-col-down").forEach((btn) => {
btn.addEventListener("click", () => _moveSelectedKeyframe(_resolveColumnKey(btn.dataset.col), 1));
});
}
function _moveSelectedKeyframe(col, direction) {
const kfs = _lab.columns[col];
const idx = _selectedIdx[col];
if (idx == null || idx >= kfs.length) { // unselected, or stale after a bulk replace/remove
showToast(t("labSelectKeyframeFirst"), "error");
return;
}
const targetIdx = idx + direction;
if (idx <= 0 || targetIdx <= 0 || targetIdx >= kfs.length) return; // baseline immovable; can't swap past either end
const tmpIter = kfs[idx].atIteration;
kfs[idx].atIteration = kfs[targetIdx].atIteration;
kfs[targetIdx].atIteration = tmpIter;
[kfs[idx], kfs[targetIdx]] = [kfs[targetIdx], kfs[idx]];
_selectedIdx[col] = targetIdx;
_renderColumnForKey(col);
}
// "PG" button on the Prompt column header: lets the user pick one of the Prompt tab's
// preset groups (pmGroups, defined in prompt-presets.js) and replace the ENTIRE Prompt
// column with one keyframe per preset in the group, in group order, starting at
// iteration #1 (which is overwritten, not appended to).
function _initPromptGroupButton() {
const btn = document.getElementById("wfm-lab-prompt-group-btn");
if (btn) btn.title = t("labPromptGroupBtnTitle");
btn?.addEventListener("click", () => _openPromptGroupModal());
}
function _openPromptGroupModal() {
const groupNames = Object.keys(pmGroups).sort();
const listHtml = groupNames.length === 0
? `<div class="wfm-pm-empty">${t("labPromptGroupEmpty")}</div>`
: groupNames.map((g) => {
const count = getPresetsInGroup(g).length;
return `<div class="wfm-pm-item wfm-lab-pg-item" data-group="${escapeHtml(g)}">
<div class="wfm-pm-item-body">
<div class="wfm-pm-item-name">${escapeHtml(g)}</div>
<div class="wfm-pm-item-sub">${t("labPromptGroupCount", count)}</div>
</div>
</div>`;
}).join("");
const html = `
<div id="wfm-lab-pg-list">${listHtml}</div>
<div style="display:flex;gap:8px;margin-top:12px;justify-content:flex-end;">
<button id="wfm-lab-pg-apply" class="wfm-btn wfm-btn-primary" disabled>${t("labApply")}</button>
</div>`;
openModal(t("labPromptGroupModalTitle"), html);
let selectedGroup = null;
const applyBtn = document.getElementById("wfm-lab-pg-apply");
document.querySelectorAll(".wfm-lab-pg-item").forEach((el) => {
el.addEventListener("click", () => {
document.querySelectorAll(".wfm-lab-pg-item").forEach((o) => o.classList.remove("active"));
el.classList.add("active");
selectedGroup = el.dataset.group;
if (applyBtn) applyBtn.disabled = false;
});
});
applyBtn?.addEventListener("click", () => {
if (!selectedGroup) { showToast(t("labPromptGroupSelectFirst"), "error"); return; }
_applyPromptGroupToLab(selectedGroup);
});
}
// Full replacement of _lab.columns.prompt: one keyframe per preset in the group, in
// group order, atIteration 1..N — #1 is overwritten (never appended after), matching
// how every other "bulk load" action on Lab (e.g. plan load) replaces rather than merges.
function _applyPromptGroupToLab(groupName) {
const presets = getPresetsInGroup(groupName);
if (presets.length === 0) { showToast(t("labPromptGroupNoPresets"), "error"); return; }
// Batch input caps at 50 (see templates/index.html); raise batchCount to fit the
// group up to that cap, same as the existing keyframe-beyond-batch warning handles
// anything past it (see _warnIfKeyframesExceedBatch below) rather than silently
// dropping presets past #50.
if (presets.length > _lab.batchCount) {
_lab.batchCount = Math.min(presets.length, 50);
const batchEl = document.getElementById("wfm-lab-batch-count");
if (batchEl) batchEl.value = _lab.batchCount;
showToast(t("labPromptGroupBatchRaised", _lab.batchCount), "info");
}
_lab.columns.prompt = presets.map((p, idx) => ({
atIteration: idx + 1,
value: {
positive: p.text || p.posText || "",
negative: p.negText || "",
styleApplied: false,
styleName: "",
},
revertToBase: false,
bypassed: false,
}));
delete _selectedIdx.prompt; // stale selection would point past the freshly replaced array
_renderColumnForKey("prompt");
_warnIfKeyframesExceedBatch();
closeModal();
showToast(t("labPromptGroupApplied", groupName, presets.length), "success");
}
// Wires the Model column header's C/L/V buttons — switches which independent field
// (checkpoint/lora/vae) the shared cell list, +/-, and cell-click modal all operate on.
// Purely a display/routing selector: none of the three keyframe arrays are touched by
@@ -448,6 +587,17 @@ function _hasNodeForColumn(col) {
if (col === "vae") {
return (analysis?.vae_nodes?.length || 0) > 0 || (analysis?.checkpoint_nodes?.length || 0) > 0;
}
// Video all-in-one nodes (e.g. MiniMaxH3ImageToVideo) DO wire through a
// SamplerCustomAdvanced internally, so sampler_nodes.length alone isn't enough to
// detect "no user-adjustable sampler here" — that internal sampler is a fixed part
// of the model's own preset, not something meant to be edited per keyframe (unlike a
// real Advanced Sampling workflow's SamplerCustomAdvanced, e.g. Flux/SD3.5). Treat
// any video workflow as having no editable Ksampler column, same as the Model
// sub-columns above hide when their node is absent.
if (col === "ksampler") {
if (comfyWorkflow.isVideoWorkflow(analysis)) return false;
return (analysis?.sampler_nodes?.length || 0) > 0;
}
return true;
}
@@ -464,8 +614,12 @@ function _renderColumn(col, containerId = `wfm-lab-col-cells-${col}`) {
}
const keyframes = _lab.columns[col];
container.innerHTML = keyframes.map((kf, idx) => _cellHtml(col, kf, idx)).join("");
// Single click selects (for the up/down reorder buttons); double click still opens
// the edit modal directly, independent of whatever is currently selected.
container.querySelectorAll(".wfm-lab-cell").forEach((el) => {
el.addEventListener("click", () => _openCellModal(col, parseInt(el.dataset.idx, 10)));
const idx = parseInt(el.dataset.idx, 10);
el.addEventListener("click", () => _selectCell(col, idx));
el.addEventListener("dblclick", () => _openCellModal(col, idx));
});
}
@@ -485,6 +639,7 @@ function _cellHtml(col, kf, idx) {
const revertClass = kf.revertToBase ? " wfm-lab-cell-revert" : "";
const bypassClass = kf.bypassed ? " wfm-lab-cell-bypassed" : "";
const nodeBypassClass = (col === "lora" && kf.value?.nodeBypass) ? " wfm-lab-cell-node-bypassed" : "";
const selectedClass = _selectedIdx[col] === idx ? " wfm-lab-cell-selected" : "";
if (idx === 0) {
// Bypassed takes priority over the live-reflect display — an explicit "skip this
// row" toggle shouldn't be masked by Setting 1's usual "show the workflow's
@@ -492,13 +647,13 @@ function _cellHtml(col, kf, idx) {
const live = !kf.bypassed && _isLiveDisplay(col, idx);
const liveClass = live ? " wfm-lab-cell-live" : "";
const label = live ? _cellLabel(col, { value: _liveValueFor(col), revertToBase: false, bypassed: false }) : _cellLabel(col, kf);
return `<div class="wfm-lab-cell${revertClass}${bypassClass}${nodeBypassClass}${liveClass}" data-idx="${idx}">
return `<div class="wfm-lab-cell${revertClass}${bypassClass}${nodeBypassClass}${liveClass}${selectedClass}" data-idx="${idx}">
<span class="wfm-lab-cell-index">${kf.atIteration}:</span>
<span class="wfm-lab-cell-value">${label}</span>
</div>`;
}
// Iteration #2 and beyond: value on its own line, applied-at iteration below it
return `<div class="wfm-lab-cell${revertClass}${bypassClass}${nodeBypassClass}" data-idx="${idx}">
return `<div class="wfm-lab-cell${revertClass}${bypassClass}${nodeBypassClass}${selectedClass}" data-idx="${idx}">
<div class="wfm-lab-cell-value">${_cellLabel(col, kf)}</div>
<div class="wfm-lab-cell-applied">${t("labAppliedAt", kf.atIteration)}</div>
</div>`;
@@ -1218,6 +1373,20 @@ function _annotatedImageRef(img) {
return `${rel} [${img.type || "output"}]`;
}
// Extracts the last frame of a just-generated video output and uploads it as a plain
// "input" image, returning the filename LoadImage's image widget expects (no [type]
// suffix needed — uploadImage always lands in the input folder). Used only by the
// chain-image path below; the Video tab will reuse extractLastFrameBlob() directly
// once it grows its own batch/chaining feature.
async function _extractAndUploadLastFrame(img) {
const url = _resultImageUrl(img);
const blob = await extractLastFrameBlob(url);
const file = new File([blob], `lab_lastframe_${Date.now()}.png`, { type: "image/png" });
const result = await comfyUI.uploadImage(file, file.name);
if (!result.name) throw new Error("Upload returned no filename");
return result.name;
}
// ============================================
// Batch execution
// ============================================
@@ -1261,6 +1430,10 @@ async function _runLabBatch() {
const progressBar = document.getElementById("wfm-lab-progress-bar");
const progressText = document.getElementById("wfm-lab-progress-text");
const eagleAutoSave = getEagleSettings().autoSave;
// Video workflows (e.g. MiniMax H3) run far longer than a still image — use a longer
// timeout for every iteration so a multi-minute generation doesn't get force-rejected
// mid-batch (see comfyWorkflow.isVideoWorkflow and generate-tab.js's own use of this).
const isVideoWf = comfyWorkflow.isVideoWorkflow(comfyUI.currentAnalysis);
let completed = 0, failed = 0;
let prevLoraInjection = null;
@@ -1280,6 +1453,7 @@ async function _runLabBatch() {
const { images } = await comfyUI.generate(workflowExpanded, {
seedMode: seed != null ? "fixed" : "random",
seedValue: seed ?? -1,
timeoutMs: isVideoWf ? 30 * 60 * 1000 : undefined,
onProgress: (pct) => {
if (progressBar) progressBar.style.width = `${(pct * 100).toFixed(1)}%`;
if (progressText) progressText.textContent = `[${i}/${_lab.batchCount}] ${(pct * 100).toFixed(0)}%`;
@@ -1287,7 +1461,20 @@ async function _runLabBatch() {
});
const outputImages = images.filter((img) => img.type !== "temp");
if (outputImages.length > 0) {
_lastGeneratedImageRef = _annotatedImageRef(outputImages[0]);
const first = outputImages[0];
if (isVideoFilename(first.filename)) {
// LoadImage can't take an mp4 directly — extract its last frame
// client-side and upload that as an "input" image, so the chain
// (Use generated image for next) can feed it back in as first_frame.
try {
_lastGeneratedImageRef = await _extractAndUploadLastFrame(first);
} catch (err) {
showToast(t("labLastFrameExtractFailed", err.message), "error");
_lastGeneratedImageRef = null;
}
} else {
_lastGeneratedImageRef = _annotatedImageRef(first);
}
}
for (const img of outputImages) {
if (_lab.results.images.length < MAX_RESULTS) {
@@ -1337,14 +1524,23 @@ function _renderResultsGrid() {
grid.innerHTML = `<p class="wfm-placeholder">${t("labNoResultsYet")}</p>`;
return;
}
grid.innerHTML = _lab.results.images.map((img, i) => `
grid.innerHTML = _lab.results.images.map((img, i) => {
const url = _resultImageUrl(img);
const media = isVideoFilename(img.filename)
? `<video class="wfm-lab-result-thumb" data-idx="${i}" src="${url}" muted></video>`
: `<img class="wfm-lab-result-thumb" data-idx="${i}" src="${url}">`;
return `
<div class="wfm-lab-result-item">
<span class="wfm-lab-result-index">${img.iteration}</span>
<img class="wfm-lab-result-thumb" data-idx="${i}" src="${_resultImageUrl(img)}">
</div>`).join("");
${media}
</div>`;
}).join("");
grid.querySelectorAll(".wfm-lab-result-thumb").forEach((el) => {
el.addEventListener("click", () => {
openModal(t("labResultPreview"), `<img src="${el.src}" style="max-width:100%;max-height:80vh;display:block;margin:0 auto;">`);
const content = el.tagName === "VIDEO"
? `<video src="${el.src}" controls style="max-width:100%;max-height:80vh;display:block;margin:0 auto;"></video>`
: `<img src="${el.src}" style="max-width:100%;max-height:80vh;display:block;margin:0 auto;">`;
openModal(t("labResultPreview"), content);
});
});
}
@@ -1391,6 +1587,23 @@ function _loadImageEl(src) {
});
}
// A result item's own URL (e.g. .mp4) can't be loaded into an <img> — extract its
// last frame first so the index/contact-sheet gets a real thumbnail instead of
// silently failing onto the canvas's black background (see _buildIndexImageDataUrl).
async function _loadIndexCellImage(img) {
const url = _resultImageUrl(img);
if (!isVideoFilename(img.filename)) return _loadImageEl(url);
try {
const blob = await extractLastFrameBlob(url);
const blobUrl = URL.createObjectURL(blob);
const im = await _loadImageEl(blobUrl);
URL.revokeObjectURL(blobUrl);
return im;
} catch {
return null;
}
}
// planData, when given, is embedded into the resulting PNG as an iTXt chunk
// (LAB_PLAN_PNG_KEY) so the image alone — dropped onto the Plan drop zone, from
// anywhere, not just lab_plan/ — can be loaded back without needing a same-named
@@ -1410,7 +1623,7 @@ async function _buildIndexImageDataUrl(planData) {
ctx.fillRect(0, 0, canvas.width, canvas.height);
for (let i = 0; i < imgs.length; i++) {
const im = await _loadImageEl(_resultImageUrl(imgs[i]));
const im = await _loadIndexCellImage(imgs[i]);
if (!im) continue;
const col = i % cols, row = Math.floor(i / cols);
const scale = Math.max(cellSize / im.width, cellSize / im.height);
@@ -1517,6 +1730,7 @@ function _applyPlanData(filename, data) {
_lab.workflowFilename = data.workflow_filename || null;
_lab.columns = _migrateLabColumns(data.columns);
_lab.results = { images: (data.results?.images || []).slice(0, MAX_RESULTS) };
_selectedIdx = {}; // every column's array was just replaced wholesale
_updatePlanWorkflowUI();
_updateT2IModeUI();
@@ -1596,6 +1810,7 @@ async function _loadPlanFromServer(filename) {
function _clearPlan() {
if (!window.confirm(t("labConfirmClear"))) return;
_lab = _emptyLabState();
_selectedIdx = {};
const noteEl = document.getElementById("wfm-lab-note");
const batchEl = document.getElementById("wfm-lab-batch-count");
+94
View File
@@ -97,6 +97,81 @@ export async function readAllPNGTextChunks(file) {
return chunks;
}
// ── MP4 container metadata (moov/udta/meta の mdta keys/ilst) ──
// ComfyUIのSaveVideoはPNGのtEXtチャンクと同じキー名(workflow=UI形式, prompt=API形式)で
// JSON文字列をisobmff(mp4)のudta/meta(mdta)にコンテナレベルタグとして書き込む(FFmpegの
// movflags=+use_metadata_tags)。ここではPyAV等に頼らずブラウザ側でボックスを直接辿って読む。
function findMP4Box(view, bytes, start, end, targetType) {
let offset = start;
while (offset + 8 <= end) {
const size = view.getUint32(offset);
const type = String.fromCharCode(bytes[offset + 4], bytes[offset + 5], bytes[offset + 6], bytes[offset + 7]);
let boxSize = size;
let bodyStart = offset + 8;
if (size === 1) {
if (offset + 16 > end) break;
const hi = view.getUint32(offset + 8);
const lo = view.getUint32(offset + 12);
boxSize = hi * 4294967296 + lo;
bodyStart = offset + 16;
} else if (size === 0) {
boxSize = end - offset;
}
if (boxSize < 8) break;
if (type === targetType) return { bodyStart, end: offset + boxSize };
offset += boxSize;
}
return null;
}
export async function readMP4MetaTags(file) {
const buffer = await file.arrayBuffer();
const bytes = new Uint8Array(buffer);
const view = new DataView(buffer);
if (bytes.length < 12) return null;
const ftyp = String.fromCharCode(bytes[4], bytes[5], bytes[6], bytes[7]);
if (ftyp !== "ftyp") return null;
const moov = findMP4Box(view, bytes, 0, bytes.length, "moov");
if (!moov) return null;
const udta = findMP4Box(view, bytes, moov.bodyStart, moov.end, "udta");
let meta = udta ? findMP4Box(view, bytes, udta.bodyStart, udta.end, "meta") : null;
if (!meta) meta = findMP4Box(view, bytes, moov.bodyStart, moov.end, "meta");
if (!meta) return null;
const metaBody = meta.bodyStart + 4; // meta は FullBox (version+flags 4バイト)
const keysBox = findMP4Box(view, bytes, metaBody, meta.end, "keys");
const ilstBox = findMP4Box(view, bytes, metaBody, meta.end, "ilst");
if (!keysBox || !ilstBox) return null;
const utf8 = new TextDecoder("utf-8", { fatal: false });
let off = keysBox.bodyStart + 4; // version+flags をスキップ
const count = view.getUint32(off); off += 4;
const keyNames = [];
for (let i = 0; i < count && off + 8 <= keysBox.end; i++) {
const ksize = view.getUint32(off);
if (ksize < 8) break;
keyNames.push(utf8.decode(bytes.slice(off + 8, off + ksize)));
off += ksize;
}
const result = {};
let ioff = ilstBox.bodyStart;
while (ioff + 8 <= ilstBox.end) {
const itemSize = view.getUint32(ioff);
const keyIndex = view.getUint32(ioff + 4);
if (itemSize < 8) break;
const itemEnd = Math.min(ioff + itemSize, ilstBox.end);
const data = findMP4Box(view, bytes, ioff + 8, itemEnd, "data");
if (data) {
const payload = bytes.slice(data.bodyStart + 8, data.end); // type(4)+locale(4)をスキップ
const name = keyNames[keyIndex - 1];
if (name) { try { result[name] = utf8.decode(payload); } catch { /* skip */ } }
}
ioff = itemEnd;
}
return result;
}
// ── Workflow extraction helpers ───────────────────────────────
function collectUnique(arr) {
const seen = new Set(), out = [];
@@ -459,6 +534,13 @@ function extractPromptsAPI(wf) {
if (combined) textMap.set(id, combined);
continue;
}
// MiniMaxH3ImageToVideo等の動画生成オールインワンノード。CLIPTextEncode等を経由せず
// 自ノードの"prompt"入力に直接テキストを持つ(positive/negativeの区別も無い)ため、
// isTextEncoderNode判定を通さずtextMapへ直接投入する(fallbackのtextsに載る)。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo/i.test(ct)) {
textMap.set(id, n.inputs.prompt);
continue;
}
if (!isTextEncoderNode(ct)) continue;
// "prompt" — TextEncodeQwenImageEdit(Plus)/TextEncodeBooguEdit and similar Image Edit
// model text encoders use this key instead of "text"/"text_g".
@@ -607,6 +689,7 @@ 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");
const isMP4 = file.type === "video/mp4" || name.endsWith(".mp4");
async function fromWorkflow(originalWf, source) {
let wf = originalWf;
@@ -644,6 +727,17 @@ export async function extractAllMetadata(file) {
const wf = extractWorkflowFromEXIF(exif);
return wf ? await fromWorkflow(wf, "comfyui") : null;
}
if (isMP4) {
let tags; try { tags = await readMP4MetaTags(file); } catch { return null; }
if (!tags) return null;
for (const key of ["prompt", "workflow"]) {
const raw = tags[key];
if (!raw) continue;
let wf; try { wf = JSON.parse(sanitizeJSON(raw)); } catch { continue; }
if (wf) return await fromWorkflow(wf, "comfyui");
}
return null;
}
// PNG
const chunks = await readAllPNGTextChunks(file);
if (!chunks) return null;
+70 -105
View File
@@ -1,10 +1,11 @@
/**
* Prompt Tab - AI Assistant (Ollama / LM Studio chat, translate, apply to GenerateUI)
* Prompt Tab - AI Assistant (Ollama / LM Studio / Lemonade / Unsloth chat, translate, apply to GenerateUI)
*/
import { showToast } from "./app.js";
import { t } from "./i18n.js";
import { getAiBackendDefaultUrl } from "./util.js";
import { unslothProxy } from "./util.js";
import { openAiBackendSettingsModal, getAiBackendConfig } from "./ai-settings-modal.js";
// ============================================
// State
@@ -17,64 +18,73 @@ const ollamaState = {
const PROMPT_AI_KEY = "wfm_prompt_ai_settings";
function loadPromptAiSettings() {
try { return JSON.parse(localStorage.getItem(PROMPT_AI_KEY) || "{}"); } catch { return {}; }
}
// バックエンド変更検知用: モデル一覧を取得した時点のバックエンド名を記録
let _promptAiBackendForModels = null;
export function getPromptAiConfig() {
const s = loadPromptAiSettings();
const backend = s.backend || "ollama";
const url = (s.backendUrl || getAiBackendDefaultUrl(backend)).replace(/\/$/, "");
return { backend, url };
return getAiBackendConfig(PROMPT_AI_KEY);
}
export async function fetchAiModels() {
const { backend, url } = getPromptAiConfig();
// Ollama-style messages (with .images) → OpenAI互換 content 配列に変換
function _toOpenAiMessages(messages) {
return messages.map(msg => {
if (msg.images?.length) {
return {
role: msg.role,
content: [
{ type: "text", text: msg.content },
...msg.images.map(b64 => ({ type: "image_url", image_url: { url: `data:image/jpeg;base64,${b64}` } })),
],
};
}
return { role: msg.role, content: msg.content };
});
}
function _stripThinkingTags(text) {
return (text || "")
.replace(/<think>[\s\S]*?<\/think>/gi, "")
.replace(/<thinking>[\s\S]*?<\/thinking>/gi, "")
.trim();
}
// Ollamaは `think` (bool) と `options.num_predict`、OpenAI互換は `max_tokens` で制御
function _applyGenOptions(body, backend, cfg) {
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).models?.map(m => m.name) || [];
} else {
const res = await fetch(`${url}/v1/models`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return ((await res.json()).data || []).map(m => m.id);
body.think = !!cfg.thinkingMode;
if (cfg.maxTokens > 0) body.options = { ...(body.options || {}), num_predict: cfg.maxTokens };
} else if (cfg.maxTokens > 0) {
body.max_tokens = cfg.maxTokens;
}
return body;
}
async function chatWithAi(model, messages) {
const { backend, url } = getPromptAiConfig();
const cfg = getPromptAiConfig();
const { backend, url } = cfg;
if (backend === "ollama") {
const res = await fetch(`${url}/api/chat`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model, messages, stream: false }),
body: JSON.stringify(_applyGenOptions({ model, messages, stream: false }, backend, cfg)),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).message?.content || "";
const text = (await res.json()).message?.content || "";
return cfg.thinkingMode ? text : _stripThinkingTags(text);
} else if (backend === "unsloth") {
const body = _applyGenOptions({ model, messages: _toOpenAiMessages(messages), stream: false }, backend, cfg);
const data = await unslothProxy(url, "/v1/chat/completions", "POST", body);
const msg = data.choices?.[0]?.message;
// Unslothはreasoningを別フィールドで返すため<think>タグに畳んで表示に混ぜる
const text = (msg?.reasoning_content ? `<think>${msg.reasoning_content}</think>` : "") + (msg?.content || "");
return cfg.thinkingMode ? text : _stripThinkingTags(text);
} else {
// LM Studio / Lemonade (OpenAI-compatible): convert Ollama-style messages (with .images) to OpenAI content arrays
const openAiMessages = messages.map(msg => {
if (msg.images?.length) {
return {
role: msg.role,
content: [
{ type: "text", text: msg.content },
...msg.images.map(b64 => ({ type: "image_url", image_url: { url: `data:image/jpeg;base64,${b64}` } })),
],
};
}
return { role: msg.role, content: msg.content };
});
// LM Studio / Lemonade (OpenAI-compatible)
const res = await fetch(`${url}/v1/chat/completions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model, messages: openAiMessages, stream: false }),
body: JSON.stringify(_applyGenOptions({ model, messages: _toOpenAiMessages(messages), stream: false }, backend, cfg)),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return (await res.json()).choices?.[0]?.message?.content || "";
const text = (await res.json()).choices?.[0]?.message?.content || "";
return cfg.thinkingMode ? text : _stripThinkingTags(text);
}
}
@@ -192,37 +202,30 @@ function updateAttachmentDisplay() {
container.appendChild(item);
}
// ============================================
// Status label (設定モーダルで選択中のbackend/modelを表示)
// ============================================
function _updateStatusLabel() {
const status = document.getElementById("wfm-ollama-status");
if (!status) return;
const { backend, model } = getPromptAiConfig();
status.textContent = model ? `${backend}: ${model}` : `${backend}: ${t("selectModelFirst")}`;
status.className = model ? "wfm-ollama-status connected" : "wfm-ollama-status error";
}
// ============================================
// Send Message
// ============================================
async function sendMessage() {
const input = document.getElementById("wfm-ollama-input");
const modelSelect = document.getElementById("wfm-ollama-model");
if (!input || !modelSelect) return;
if (!input) return;
const message = input.value.trim();
if (!message) return;
// バックエンドが変更されていたらモデル一覧を自動更新
const { backend } = getPromptAiConfig();
if (backend !== _promptAiBackendForModels) {
const status = document.getElementById("wfm-ollama-status");
if (status) { status.textContent = `Switching to ${backend}...`; status.className = "wfm-ollama-status"; }
try {
const models = await fetchAiModels();
const savedModel = loadPromptAiSettings().model || "";
modelSelect.innerHTML = models.length
? models.map(name => `<option value="${name}" ${name === savedModel ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
_promptAiBackendForModels = backend;
if (status) { status.textContent = `${models.length} models [${backend}]`; status.className = "wfm-ollama-status connected"; }
} catch {
if (status) { status.textContent = t("failedConnect"); status.className = "wfm-ollama-status error"; }
}
}
const model = modelSelect.value;
const { model } = getPromptAiConfig();
if (!model) {
showToast(t("selectModelFirst"), "error");
return;
@@ -259,13 +262,12 @@ async function sendMessage() {
async function sendTranslate(direction) {
const input = document.getElementById("wfm-ollama-input");
const modelSelect = document.getElementById("wfm-ollama-model");
if (!input || !modelSelect) return;
if (!input) return;
const text = input.value.trim();
if (!text) return;
const model = modelSelect.value;
const { model } = getPromptAiConfig();
if (!model) {
showToast(t("selectModelFirst"), "error");
return;
@@ -318,48 +320,11 @@ function applyToGenerateUI(text) {
// ============================================
export function initAiChatUI() {
// AI model refresh
async function refreshModels() {
const select = document.getElementById("wfm-ollama-model");
const status = document.getElementById("wfm-ollama-status");
const { backend } = getPromptAiConfig();
try {
const models = await fetchAiModels();
const savedModel = loadPromptAiSettings().model || "";
if (select) {
select.innerHTML = models.length
? models.map(name => `<option value="${name}" ${name === savedModel ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
}
_promptAiBackendForModels = backend;
if (status) {
status.textContent = `${models.length} models [${backend}]`;
status.className = "wfm-ollama-status connected";
}
} catch {
if (status) {
status.textContent = t("failedConnect");
status.className = "wfm-ollama-status error";
}
}
}
_updateStatusLabel();
// Auto-load models on init
refreshModels();
document.getElementById("wfm-ollama-refresh-btn")?.addEventListener("click", refreshModels);
// Test connection
document.getElementById("wfm-ollama-test-btn")?.addEventListener("click", async () => {
const status = document.getElementById("wfm-ollama-status");
if (status) { status.textContent = "Testing..."; status.className = "wfm-ollama-status"; }
try {
await fetchAiModels();
if (status) { status.textContent = t("connectedCheck"); status.className = "wfm-ollama-status connected"; }
await refreshModels();
} catch {
if (status) { status.textContent = t("failedConnect"); status.className = "wfm-ollama-status error"; }
}
// Settings modal
document.getElementById("wfm-ollama-settings-btn")?.addEventListener("click", () => {
openAiBackendSettingsModal(PROMPT_AI_KEY, t("settings"), _updateStatusLabel);
});
// Send message
+7
View File
@@ -208,6 +208,13 @@ function matchesSearch(p) {
(p.tags || []).some(t => t.toLowerCase().includes(s));
}
// Ordered list of actual preset objects for a group (stale ids already filtered out by
// loadAllPresets, but this is defensive for callers that read pmGroups directly too).
export function getPresetsInGroup(groupName) {
const ids = pmGroups[groupName] || [];
return ids.map(id => promptPresets.find(p => p.id === id)).filter(Boolean);
}
export function isInBatchPreset(id) {
return (pmGroups["Batch"] || []).includes(id);
}
+29 -5
View File
@@ -768,6 +768,7 @@ function openWildcardPromptModal(file) {
let tableStyles = [];
let stylesSearch = "";
let pendingNewStyle = false;
let pendingNewStyleFile = null; // null = default custom.json; set by "+ Add to this file"
const selectedStyleNames = new Set();
function styleMatchesSearch(s) {
@@ -781,9 +782,18 @@ function styleMatchesSearch(s) {
function updateStylesDeleteBtn() {
const btn = document.getElementById("wfm-ptable-style-delete-btn");
const deselectBtn = document.getElementById("wfm-ptable-style-deselect-btn");
const addFileBtn = document.getElementById("wfm-ptable-style-addfile-btn");
const n = selectedStyleNames.size;
if (btn) { btn.disabled = n === 0; btn.textContent = n > 0 ? `Delete (${n})` : "Delete"; }
if (deselectBtn) deselectBtn.disabled = n === 0;
// 「このファイルへ追加」は選択が1件かつcustom.json以外のファイル由来のときだけ有効
// (prompt-styles.js の Form 版と同じ制約 — custom.jsonは既に「+ New Style」で追加可能)
if (addFileBtn) {
const single = n === 1 ? tableStyles.find(s => selectedStyleNames.has(s.name)) : null;
const targetFile = (single?.file && single.file !== "custom.json") ? single.file : "";
addFileBtn.disabled = !targetFile;
addFileBtn.dataset.targetFile = targetFile;
}
}
async function loadStylesTable() {
@@ -841,11 +851,14 @@ function buildStyleRow(style, index) {
tr.appendChild(tdName);
const tdFile = document.createElement("td");
if (style?.file) {
// 新規行は保存先未定(=custom.json)なら空欄のまま、「このファイルへ追加」経由なら
// pendingNewStyleFile を保存前からバッジ表示して、どこに追加されるか分かるようにする
const fileForBadge = style?.file || (isNew ? pendingNewStyleFile : null);
if (fileForBadge) {
const badge = document.createElement("span");
badge.className = "wfm-prompt-edit-file-badge";
badge.title = style.file;
badge.textContent = style.file;
badge.title = fileForBadge;
badge.textContent = fileForBadge;
tdFile.appendChild(badge);
}
tr.appendChild(tdFile);
@@ -872,9 +885,10 @@ function buildStyleRow(style, index) {
addBtn.addEventListener("click", async () => {
const name = nameInput.value.trim();
if (!name) { showToast(t("pleaseEnterStyleName"), "error"); nameInput.focus(); return; }
const result = await styleApiCreate(name, posTA.value, negTA.value, null);
const result = await styleApiCreate(name, posTA.value, negTA.value, pendingNewStyleFile);
if (result.ok) {
pendingNewStyle = false;
pendingNewStyleFile = null;
await loadStylesTable();
await styleRefreshList();
await refreshStylesList();
@@ -883,7 +897,7 @@ function buildStyleRow(style, index) {
showToast(t("errorWithMsg", result.error), "error");
}
});
cancelBtn.addEventListener("click", () => { pendingNewStyle = false; renderStylesTable(); });
cancelBtn.addEventListener("click", () => { pendingNewStyle = false; pendingNewStyleFile = null; renderStylesTable(); });
} else {
const saveStyleRow = async (changedEl) => {
const nameNow = nameInput.value.trim();
@@ -1073,6 +1087,16 @@ export function initPromptTableTab() {
document.getElementById("wfm-ptable-style-add-btn")?.addEventListener("click", () => {
if (pendingNewStyle) return;
pendingNewStyle = true;
pendingNewStyleFile = null;
renderStylesTable();
document.querySelector("#wfm-ptable-style-tbody input")?.focus();
});
document.getElementById("wfm-ptable-style-addfile-btn")?.addEventListener("click", (e) => {
if (pendingNewStyle) return;
const targetFile = e.currentTarget.dataset.targetFile;
if (!targetFile) return;
pendingNewStyle = true;
pendingNewStyleFile = targetFile;
renderStylesTable();
document.querySelector("#wfm-ptable-style-tbody input")?.focus();
});
+124 -128
View File
@@ -6,7 +6,7 @@ import { showToast } from "./app.js";
import { comfyUI } from "./comfyui-client.js";
import { t, getLang, getSummaryLang, setLang, setSummaryLang, getLanguageOptions, getSummaryLanguageOptions } from "./i18n.js";
import { getSettings, readJsonStorage, getAiBackendDefaultUrl } from "./util.js";
import { getSettings, readJsonStorage } from "./util.js";
const SETTINGS_KEY = "wfm_settings";
@@ -336,6 +336,34 @@ export function applyTextareaFontSize(size) {
el.textContent = `${TEXTAREA_FONT_SIZE_TARGETS} { font-size: ${px}px !important; }`;
}
// Video playback volume — shared by every <video> player in the app (Video tab preview,
// Gallery detail/lightbox/compare). The browser default for a freshly created <video> element
// is always 100%, and Gallery's players are recreated from scratch each time a different video
// is opened, so without this the volume silently jumps back to max on every video switch.
const VIDEO_VOLUME_DEFAULT = 1;
export function getVideoVolume() {
const v = loadLocalSettings().videoVolume;
return typeof v === "number" && v >= 0 && v <= 1 ? v : VIDEO_VOLUME_DEFAULT;
}
function setVideoVolume(volume) {
const clamped = Math.max(0, Math.min(1, volume));
saveLocalSettings({ videoVolume: clamped });
return clamped;
}
// Applies the saved volume to a <video> element, and keeps it in sync with any further change
// the user makes via that element's own native controls — so adjusting the volume on any video
// player anywhere in the app is remembered for the next video opened anywhere else.
export function applyStoredVideoVolume(videoEl) {
if (!videoEl) return;
videoEl.volume = getVideoVolume();
if (videoEl.dataset.wfmVolumeWired) return;
videoEl.dataset.wfmVolumeWired = "1";
videoEl.addEventListener("volumechange", () => setVideoVolume(videoEl.volume));
}
// JSON highlight color settings
const JSON_COLOR_STYLE_ID = "wfm-json-color-style";
@@ -378,7 +406,7 @@ export function applyModelTabActiveColor(color) {
el.id = MODEL_ACTIVE_COLOR_STYLE_ID;
document.head.appendChild(el);
}
el.textContent = `.wfm-form-group label.wfm-model-label-active,\n.wfm-settings-summary.wfm-model-label-active,\n#wfm-gen-lora-col-title.wfm-model-label-active,\n.wfm-lab-model-view-btn.wfm-model-label-active { color: ${val}; }`;
el.textContent = `.wfm-form-group label.wfm-model-label-active,\n.wfm-settings-summary.wfm-model-label-active,\n#wfm-gen-lora-col-title.wfm-model-label-active,\n.wfm-lab-model-view-btn.wfm-model-label-active,\n.wfm-video-form-panel label.wfm-model-label-active { color: ${val}; }`;
}
export function applyTheme(themeId) {
@@ -575,6 +603,24 @@ export async function initSettingsTab() {
</div>
</details>
<!-- Video Volume -->
<details class="wfm-settings-section" open>
<summary class="wfm-settings-summary">${t("videoVolumeLabel") || "Video Volume"}</summary>
<div class="wfm-form-group">
<label style="display:flex;align-items:center;justify-content:space-between;">
<span>${t("videoVolumeLabel") || "Video Volume"}</span>
<span id="wfm-video-volume-val" style="font-size:12px;color:var(--wfm-text-secondary);">${Math.round(getVideoVolume() * 100)}%</span>
</label>
<input type="range" class="wfm-range" id="wfm-video-volume"
min="0" max="100" step="1"
value="${Math.round(getVideoVolume() * 100)}"
style="width:100%;margin-top:4px;">
<small style="color:var(--wfm-text-secondary);font-size:11px;display:block;margin-top:4px;">
${t("videoVolumeHint") || "Applies to: Video tab preview, Gallery detail/lightbox/compare video players"}
</small>
</div>
</details>
<!-- RAW JSON Colors -->
<details class="wfm-settings-section" open>
<summary class="wfm-settings-summary">${t("jsonColorsSection") || "RAW JSON Colors"}</summary>
@@ -691,44 +737,6 @@ export async function initSettingsTab() {
<button class="wfm-btn wfm-btn-primary wfm-btn-sm" id="wfm-settings-default-ckpt-save">${t("save")}</button>
</details>
<!-- AI Assistant Settings (Prompt Tab) -->
<details class="wfm-settings-section">
<summary class="wfm-settings-summary">${t("ollamaSettings")}</summary>
<div class="wfm-form-group">
<label>${t("aiSettingsBackend")}</label>
<div class="wfm-ai-backend-row">
<label class="wfm-ai-radio-label">
<input type="radio" name="wfm-prompt-ai-backend" value="ollama"> Ollama
</label>
<label class="wfm-ai-radio-label">
<input type="radio" name="wfm-prompt-ai-backend" value="lmstudio"> LM Studio
</label>
<label class="wfm-ai-radio-label">
<input type="radio" name="wfm-prompt-ai-backend" value="lemonade"> Lemonade
</label>
</div>
</div>
<div class="wfm-form-group">
<label>${t("ollamaUrl")}</label>
<input type="text" class="wfm-input" id="wfm-settings-prompt-ai-url"
placeholder="http://localhost:11434">
</div>
<div class="wfm-form-group">
<label>${t("ollamaDefaultModel")}</label>
<div style="display:flex;gap:8px;">
<select class="wfm-select" id="wfm-settings-prompt-ai-model" style="flex:1;">
<option value="">${t("selectModel")}</option>
</select>
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-prompt-ai-refresh">${t("refresh")}</button>
</div>
</div>
<div style="display:flex;gap:8px;margin-top:8px;">
<button class="wfm-btn wfm-btn-primary wfm-btn-sm" id="wfm-settings-prompt-ai-save">${t("saveOllama")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-prompt-ai-test">${t("testConnection")}</button>
<span id="wfm-settings-prompt-ai-status" style="font-size:12px;line-height:28px;"></span>
</div>
</details>
<!-- CivitAI Settings -->
<details class="wfm-settings-section">
<summary class="wfm-settings-summary">${t("civitaiApiKeySetting")}</summary>
@@ -824,6 +832,25 @@ export async function initSettingsTab() {
<input type="file" id="wfm-settings-import-file" accept=".json" style="display:none;">
</label>
</div>
<p style="font-size:12px;color:var(--wfm-text-secondary);margin:12px 0 8px 0;">${t("fullBackupHint")}</p>
<div style="display:flex;flex-direction:column;gap:4px;margin-bottom:8px;">
<label class="wfm-lab-checkbox-label" style="font-size:12px;">
<input type="checkbox" id="wfm-settings-backup-include-workflows">
${t("fullBackupIncludeWorkflows")}
</label>
<label class="wfm-lab-checkbox-label" style="font-size:12px;">
<input type="checkbox" id="wfm-settings-backup-include-wildcard">
${t("fullBackupIncludeWildcard")}
</label>
<span style="font-size:11px;color:var(--wfm-text-secondary);">${t("fullBackupExternalHint")}</span>
</div>
<div style="display:flex;gap:8px;flex-wrap:wrap;">
<button class="wfm-btn wfm-btn-sm" id="wfm-settings-export-full">${t("exportFullBackup")}</button>
<label class="wfm-btn wfm-btn-sm" style="cursor:pointer;margin:0;">
${t("importFullBackup")}
<input type="file" id="wfm-settings-import-full-file" accept=".zip" style="display:none;">
</label>
</div>
<div id="wfm-settings-data-status" style="font-size:12px;margin-top:8px;"></div>
</details>
@@ -1139,92 +1166,6 @@ export async function initSettingsTab() {
}
});
// --- AI Assistant (Prompt Tab) settings ---
const PROMPT_AI_KEY = "wfm_prompt_ai_settings";
const loadPromptAiCfg = () => {
try { return JSON.parse(localStorage.getItem(PROMPT_AI_KEY) || "{}"); } catch { return {}; }
};
const savePromptAiCfg = (patch) => {
const data = { ...loadPromptAiCfg(), ...patch };
localStorage.setItem(PROMPT_AI_KEY, JSON.stringify(data));
};
// Restore saved values into UI
const promptAiSaved = loadPromptAiCfg();
const promptAiBackendSaved = promptAiSaved.backend || "ollama";
document.querySelectorAll('input[name="wfm-prompt-ai-backend"]').forEach(r => {
r.checked = r.value === promptAiBackendSaved;
});
const promptAiUrlEl = document.getElementById("wfm-settings-prompt-ai-url");
if (promptAiUrlEl) {
promptAiUrlEl.value = promptAiSaved.backendUrl || "";
promptAiUrlEl.placeholder = getAiBackendDefaultUrl(promptAiBackendSaved);
}
// Backend change → switch URL to the new backend's default
document.querySelectorAll('input[name="wfm-prompt-ai-backend"]').forEach(r => {
r.addEventListener("change", () => {
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
if (promptAiUrlEl) promptAiUrlEl.value = getAiBackendDefaultUrl(backend);
});
});
// Load models directly from the selected backend
async function loadPromptAiModels() {
const select = document.getElementById("wfm-settings-prompt-ai-model");
if (!select) return;
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
const url = (promptAiUrlEl?.value.trim() || getAiBackendDefaultUrl(backend)).replace(/\/$/, "");
try {
let models = [];
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
models = (await res.json()).models?.map(m => m.name) || [];
} else {
const res = await fetch(`${url}/v1/models`);
models = ((await res.json()).data || []).map(m => m.id);
}
const saved = loadPromptAiCfg().model || "";
select.innerHTML = models.length
? models.map(name => `<option value="${name}" ${name === saved ? "selected" : ""}>${name}</option>`).join("")
: `<option value="">${t("noModelsFound")}</option>`;
} catch {
select.innerHTML = `<option value="">${t("failedLoadModels")}</option>`;
}
}
await loadPromptAiModels();
document.getElementById("wfm-settings-prompt-ai-refresh")?.addEventListener("click", loadPromptAiModels);
document.getElementById("wfm-settings-prompt-ai-test")?.addEventListener("click", async () => {
const statusEl = document.getElementById("wfm-settings-prompt-ai-status");
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
const url = (promptAiUrlEl?.value.trim() || getAiBackendDefaultUrl(backend)).replace(/\/$/, "");
if (statusEl) { statusEl.textContent = t("aiStatusConnecting"); statusEl.style.color = "var(--wfm-text-secondary)"; }
try {
let count = 0;
if (backend === "ollama") {
const res = await fetch(`${url}/api/tags`);
count = ((await res.json()).models || []).length;
} else {
const res = await fetch(`${url}/v1/models`);
count = ((await res.json()).data || []).length;
}
if (statusEl) { statusEl.textContent = `${t("ollamaConnected")} (${count} models)`; statusEl.style.color = "var(--wfm-success)"; }
await loadPromptAiModels();
} catch (err) {
if (statusEl) { statusEl.textContent = `${t("ollamaFailed")}: ${err.message}`; statusEl.style.color = "var(--wfm-danger)"; }
}
});
document.getElementById("wfm-settings-prompt-ai-save")?.addEventListener("click", () => {
const backend = document.querySelector('input[name="wfm-prompt-ai-backend"]:checked')?.value || "ollama";
const url = promptAiUrlEl?.value.trim() || "";
const model = document.getElementById("wfm-settings-prompt-ai-model")?.value || "";
savePromptAiCfg({ backend, backendUrl: url, model });
showToast(t("ollamaSaved"), "success");
});
// CivitAI host select
document.getElementById("wfm-settings-civitai-host")?.addEventListener("change", async (e) => {
const host = e.target.value;
@@ -1342,6 +1283,16 @@ export async function initSettingsTab() {
applyTextareaFontSize(px);
});
// --- Video volume slider (auto-saves immediately, no "Save" click needed — a dragged
// slider that silently didn't persist would defeat the whole point of this setting) ---
document.getElementById("wfm-video-volume")?.addEventListener("input", (e) => {
const pct = parseInt(e.target.value) || 0;
const valEl = document.getElementById("wfm-video-volume-val");
if (valEl) valEl.textContent = `${pct}%`;
const volume = setVideoVolume(pct / 100);
document.querySelectorAll("video").forEach((v) => { v.volume = volume; });
});
// --- JSON highlight color pickers ---
document.getElementById("wfm-json-color-grid")?.addEventListener("input", (e) => {
if (e.target.type !== "color") return;
@@ -1532,8 +1483,53 @@ export async function initSettingsTab() {
statusEl.textContent = t("importError") + ": " + e.message;
statusEl.style.color = "var(--wfm-error, #f44336)";
}
// Reset file input so same file can be re-selected
e.target.value = "";
});
// --- Full Backup Export (ZIP) ---
document.getElementById("wfm-settings-export-full")?.addEventListener("click", async () => {
const statusEl = document.getElementById("wfm-settings-data-status");
try {
const includeWorkflows = document.getElementById("wfm-settings-backup-include-workflows")?.checked ? "1" : "0";
const includeWildcard = document.getElementById("wfm-settings-backup-include-wildcard")?.checked ? "1" : "0";
const res = await fetch(`/api/wfm/settings/export-full?include_workflows=${includeWorkflows}&include_wildcard=${includeWildcard}`);
if (!res.ok) throw new Error(await res.text());
const blob = await res.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "wfm-full-backup.zip";
a.click();
URL.revokeObjectURL(url);
statusEl.textContent = t("exportSuccess");
statusEl.style.color = "var(--wfm-success, #4caf50)";
} catch (e) {
statusEl.textContent = t("exportError") + ": " + e.message;
statusEl.style.color = "var(--wfm-error, #f44336)";
}
});
// --- Full Backup Import (ZIP) ---
document.getElementById("wfm-settings-import-full-file")?.addEventListener("change", async (e) => {
const statusEl = document.getElementById("wfm-settings-data-status");
const file = e.target.files?.[0];
if (!file) return;
try {
const fd = new FormData();
fd.append("file", file, file.name);
const res = await fetch("/api/wfm/settings/import-full", {
method: "POST",
body: fd,
});
const result = await res.json();
if (!res.ok) throw new Error(result.error || res.statusText);
statusEl.textContent = `${t("importSuccess")}: ${result.extracted?.length ?? 0} ${t("fullBackupFilesUnit")}`;
statusEl.style.color = "var(--wfm-success, #4caf50)";
} catch (e) {
statusEl.textContent = t("importError") + ": " + e.message;
statusEl.style.color = "var(--wfm-error, #f44336)";
} finally {
e.target.value = "";
}
});
// Save G'MIC path setting
+42 -77
View File
@@ -1,10 +1,16 @@
/**
* Tagger Tab
* Handles WD Tagger / DeepDanbooru + Ollama VLM single/batch tagging.
* Handles WD Tagger / DeepDanbooru + VLM (Ollama/LM Studio/Lemonade/Unsloth) single/batch tagging.
*/
import { t } from "./i18n.js";
import { showToast } from "./app.js";
import { openAiBackendSettingsModal, getAiBackendConfig } from "./ai-settings-modal.js";
const TAGGER_AI_KEY = "wfm_tagger_ai_settings";
function getTaggerAiConfig() {
return getAiBackendConfig(TAGGER_AI_KEY);
}
// ── 状態 ────────────────────────────────────────────────────────
@@ -32,7 +38,7 @@ export function initTaggerTab() {
_setupBatchActions();
_setupDbActions();
_loadModels();
_loadSettings();
_updateVlmBackendIndicators();
}
/** GalleryタブからTaggerタブへ画像を渡す */
@@ -74,8 +80,6 @@ function _applyI18n() {
"wfm-tagger-char-threshold-label": "taggerCharThreshold",
"wfm-tagger-generate-btn": "taggerGenerateTags",
"wfm-tagger-ollama-header-label": "taggerOllamaEnable",
"wfm-tagger-ollama-url-label": "taggerOllamaUrl",
"wfm-tagger-ollama-model-label": "taggerOllamaModel",
"wfm-tagger-ollama-prompt-label": "taggerOllamaPrompt",
"wfm-tagger-ollama-max-label": "taggerOllamaMaxTags",
"wfm-tagger-result-header": "taggerResult",
@@ -87,8 +91,7 @@ function _applyI18n() {
"wfm-tagger-batch-folder-header": "taggerBatchFolder",
"wfm-tagger-batch-threshold-label": "taggerThreshold",
"wfm-tagger-batch-char-threshold-label": "taggerCharThreshold",
"wfm-tagger-batch-url-label": "taggerOllamaUrl",
"wfm-tagger-batch-model-label": "taggerOllamaModel",
"wfm-tagger-batch-ollama-header-label": "taggerOllamaEnable",
"wfm-tagger-batch-prompt-label": "taggerOllamaPrompt",
"wfm-tagger-batch-output-header": "taggerBatchOutput",
"wfm-tagger-batch-save-db-label": "taggerSaveToDB",
@@ -113,6 +116,11 @@ function _applyI18n() {
if (el) el.textContent = t(key);
}
["wfm-tagger-ollama-settings-btn", "wfm-tagger-batch-ollama-settings-btn"].forEach(id => {
const el = document.getElementById(id);
if (el) el.title = t("settings");
});
// サブタブボタン
const subtabKeys = ["taggerSingleTab", "taggerBatchTab", "taggerDbTab"];
document.querySelectorAll(".wfm-tagger-subtab-btn").forEach((btn, i) => {
@@ -168,6 +176,24 @@ function _setupOllamaToggle() {
});
wrap.style.display = chk.checked ? "" : "none";
}
document.getElementById("wfm-tagger-ollama-settings-btn")?.addEventListener("click", () => {
openAiBackendSettingsModal(TAGGER_AI_KEY, t("settings"), _updateVlmBackendIndicators);
});
document.getElementById("wfm-tagger-batch-ollama-settings-btn")?.addEventListener("click", () => {
openAiBackendSettingsModal(TAGGER_AI_KEY, t("settings"), _updateVlmBackendIndicators);
});
}
// ── VLMバックエンド表示 (Taggerタブ独自のAI設定を参照) ────────────
function _updateVlmBackendIndicators() {
const { backend, model } = getTaggerAiConfig();
const label = `${backend}: ${model || t("taggerNoModel")}`;
const singleEl = document.getElementById("wfm-tagger-ollama-backend-value");
if (singleEl) singleEl.textContent = label;
const batchEl = document.getElementById("wfm-tagger-batch-backend-value");
if (batchEl) batchEl.textContent = label;
}
// ── モデル一覧ロード ─────────────────────────────────────────────
@@ -188,61 +214,6 @@ async function _loadModels() {
}
}
// ── Ollamaモデル一覧ロード ───────────────────────────────────────
async function _loadOllamaModels(urlId, selId) {
const urlEl = document.getElementById(urlId);
const selEl = document.getElementById(selId);
if (!urlEl || !selEl) return;
const api = urlEl.value || "http://127.0.0.1:11434";
try {
const res = await fetch(`/wfm/tagger/ollama/models?api_url=${encodeURIComponent(api)}`);
const data = await res.json();
const models = data.models || [];
if (models.length === 0) {
selEl.innerHTML = `<option value="">(${t("taggerNoModel")})</option>`;
} else {
selEl.innerHTML = models.map(m => `<option value="${m}">${m}</option>`).join("");
}
} catch {
selEl.innerHTML = `<option value="">(${t("taggerNoModel")})</option>`;
}
}
// ── 設定の読み込み/保存 ─────────────────────────────────────────
async function _loadSettings() {
try {
const res = await fetch("/wfm/tagger/settings");
const data = await res.json();
if (data.ollama_url) {
const el = document.getElementById("wfm-tagger-ollama-url");
if (el) el.value = data.ollama_url;
}
if (data.batch_ollama_url) {
const el = document.getElementById("wfm-tagger-batch-ollama-url");
if (el) el.value = data.batch_ollama_url;
}
} catch {
// 初回は無視
}
}
async function _saveSettings() {
try {
await fetch("/wfm/tagger/settings", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
ollama_url: document.getElementById("wfm-tagger-ollama-url")?.value || "",
batch_ollama_url: document.getElementById("wfm-tagger-batch-ollama-url")?.value || "",
}),
});
} catch {
// サイレントに失敗
}
}
// ── Single サブタブ ─────────────────────────────────────────────
function _setupSingleActions() {
@@ -279,11 +250,6 @@ function _setupSingleActions() {
// タグ生成
document.getElementById("wfm-tagger-generate-btn")?.addEventListener("click", _generateTags);
// Ollamaリフレッシュ
document.getElementById("wfm-tagger-ollama-refresh-btn")?.addEventListener("click", () => {
_loadOllamaModels("wfm-tagger-ollama-url", "wfm-tagger-ollama-model");
});
// 結果アクション
document.getElementById("wfm-tagger-send-genui-btn")?.addEventListener("click", _sendToGenUI);
document.getElementById("wfm-tagger-send-prompt-btn")?.addEventListener("click", _sendToPrompt);
@@ -321,8 +287,7 @@ async function _generateTags() {
const threshold = parseFloat(document.getElementById("wfm-tagger-threshold")?.value || "0.35");
const charThreshold = parseFloat(document.getElementById("wfm-tagger-char-threshold")?.value || "0.85");
const useOllama = document.getElementById("wfm-tagger-ollama-enable")?.checked || false;
const ollamaUrl = document.getElementById("wfm-tagger-ollama-url")?.value || "http://127.0.0.1:11434";
const ollamaModel = document.getElementById("wfm-tagger-ollama-model")?.value || "";
const { backend: vlmBackend, url: vlmUrl, model: ollamaModel, thinkingMode, maxTokens } = getTaggerAiConfig();
const ollamaPrompt = document.getElementById("wfm-tagger-ollama-prompt")?.value || "";
const maxTags = parseInt(document.getElementById("wfm-tagger-ollama-max-tags")?.value || "40");
@@ -344,12 +309,13 @@ async function _generateTags() {
}
if (useOllama && ollamaModel) {
const res2 = await fetch("/wfm/tagger/ollama/predict", {
const res2 = await fetch("/wfm/tagger/vlm/predict", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
image_b64: state.imageB64, api_url: ollamaUrl,
image_b64: state.imageB64, backend: vlmBackend, api_url: vlmUrl,
model: ollamaModel, prompt: ollamaPrompt, max_tags: maxTags,
thinking_mode: thinkingMode, max_tokens: maxTokens,
}),
});
const data2 = await res2.json();
@@ -361,7 +327,6 @@ async function _generateTags() {
if (!tags) { showToast(t("taggerNoTags"), "warning"); return; }
document.getElementById("wfm-tagger-result").value = tags;
showToast(t("taggerDone"), "success");
_saveSettings();
} catch (e) {
showToast(e.message, "error");
} finally {
@@ -453,10 +418,6 @@ async function _saveToDb() {
// ── Batch サブタブ ───────────────────────────────────────────────
function _setupBatchActions() {
document.getElementById("wfm-tagger-batch-ollama-refresh-btn")?.addEventListener("click", () => {
_loadOllamaModels("wfm-tagger-batch-ollama-url", "wfm-tagger-batch-ollama-model");
});
document.getElementById("wfm-tagger-batch-start-btn")?.addEventListener("click", _batchStart);
document.getElementById("wfm-tagger-batch-stop-btn")?.addEventListener("click", _batchStop);
}
@@ -465,15 +426,19 @@ async function _batchStart() {
const folder = document.getElementById("wfm-tagger-batch-folder")?.value || "";
if (!folder) { showToast(t("taggerBatchFolder"), "warning"); return; }
const { backend: vlmBackend, url: vlmUrl, model: vlmModel, thinkingMode, maxTokens } = getTaggerAiConfig();
const body = {
folder,
model: document.getElementById("wfm-tagger-batch-model")?.value || "",
threshold: parseFloat(document.getElementById("wfm-tagger-batch-threshold")?.value || "0.35"),
char_threshold: parseFloat(document.getElementById("wfm-tagger-batch-char-threshold")?.value || "0.85"),
use_ollama: document.getElementById("wfm-tagger-batch-ollama-enable")?.checked || false,
ollama_api: document.getElementById("wfm-tagger-batch-ollama-url")?.value || "http://127.0.0.1:11434",
ollama_model: document.getElementById("wfm-tagger-batch-ollama-model")?.value || "",
vlm_backend: vlmBackend,
vlm_api_url: vlmUrl,
ollama_model: vlmModel,
ollama_prompt: document.getElementById("wfm-tagger-batch-ollama-prompt")?.value || "",
thinking_mode: thinkingMode,
max_tokens: maxTokens,
save_db: document.getElementById("wfm-tagger-batch-save-db")?.checked ?? true,
write_file: document.getElementById("wfm-tagger-batch-write-file")?.checked || false,
write_txt: document.getElementById("wfm-tagger-batch-write-txt")?.checked || false,
+46
View File
@@ -109,6 +109,52 @@ export function getAiBackendDefaultUrl(backend) {
return AI_BACKEND_DEFAULT_URLS[backend] || AI_BACKEND_DEFAULT_URLS.ollama;
}
// Unslothはローカルでも常にAPIキーが必要なため、フロントから直接叩かず
// サーバー側プロキシ(/api/wfm/unsloth/proxy)経由でキーを付与して中継する
// (see py/routes/unsloth_routes.py)
export async function unslothProxy(baseUrl, path, method, payload) {
const res = await fetch("/api/wfm/unsloth/proxy", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ baseUrl, path, method, payload }),
});
const data = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(data.message || `HTTP ${res.status}`);
return data;
}
// ローカルVLM/LLMバックエンドからモデルをVRAM/メモリからアンロードする。
// 公式APIが存在しない場合(Unsloth)は "UNSUPPORTED" エラーを投げる。
export async function unloadAiModel(url, backend, model) {
if (!model) throw new Error("No model selected");
if (backend === "ollama") {
// keep_alive:0 + 空プロンプトが公式に文書化されたアンロード方法
// (専用エンドポイントは存在しない) https://docs.ollama.com/api
const res = await fetch(`${url}/api/generate`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model, prompt: "", keep_alive: 0 }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
} else if (backend === "lmstudio") {
const res = await fetch(`${url}/api/v1/models/unload`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ instance_id: model }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
} else if (backend === "lemonade") {
const res = await fetch(`${url}/api/v1/unload`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model_name: model }),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
} else {
throw new Error("UNSUPPORTED");
}
}
// ============================================
// Eagle Auto-Save
// ============================================
+816
View File
@@ -0,0 +1,816 @@
/**
* Video Tab - MiniMax H3 (Image to Video) / LTX-2.5 (Text・Image・First&Last-Frame to
* Video) / Wan2.2 (Text to Video) 対応の動画生成UI。GenerateUIタブとは完全に独立。
* UI形式ワークフローJSONを直接編集し、comfyWorkflow.convertUiToApi() でAPI形式に
* 変換して実行する。状態は「テンプレートJSON+フォーム値」のみ保持し、生成の都度
* structuredClone() したコピーに書き込む(複数回生成をまたいだID不整合を防ぐ)。
*/
import { showToast } from "./app.js";
import { t } from "./i18n.js";
import { comfyUI } from "./comfyui-client.js";
import { comfyWorkflow } from "./comfyui-workflow.js";
import { escapeHtml } from "./util.js";
import { applyStoredVideoVolume } from "./settings-tab.js";
const state = {
templateWorkflow: null,
templateFilename: null,
firstFrameFilename: null,
lastFrameFilename: null,
generating: false,
// Whatever's currently shown in the center preview frame — a just-generated
// result, or a video dropped/picked in the Video Source panel. Used by the
// Frame/GIF property tabs so they work on any video, not just generated ones.
// { kind: "output"|"input", filename, subfolder, type } for anything already on
// the server, or { kind: "local", file } for a picked file not yet uploaded.
previewSource: null,
};
// ============================================
// 動画モデルノードの動的特定(ノードIDをハードコードしない)
// MiniMax H3 / LTX-2.5 (Text・Image・First&Last-Frame to Video) / Wan2.2 (Text to Video)
// に対応。サブグラフの内部ノード型(Wan2.2のみサブグラフ名)で対象ワークフローの種類を
// 判定し、以降はサブグラフが公開する入力のlabel(無ければname)で意味的にスロットを
// 特定する。これによりLTX-2.5の3バリアント間で公開入力のname(text/value/value_1...)
// が揺れていても、label(prompt/duration/width...)は共通しているため同じロジックで
// 処理できる。
// ============================================
// ノードのinputs[]のうちwidgetキーを持つものだけを抽出した並び順で、指定した入力定義の
// インデックスを引く。widgets_values配列はこの並び順と1:1対応する(link接続されていても
// widgetキーを持つ入力はwidgets_valuesにスロットを持つ「legacy full」形式のため)。
function _widgetIndexOf(node, inputDef) {
if (!inputDef) return -1;
const widgetInputs = (node?.inputs || []).filter((inp) => inp.widget);
return widgetInputs.indexOf(inputDef);
}
// 上と同じ並び順ルールで、名前から直接インデックスを引く版(ResolutionSelectorや
// LoadImageなど、モデルファミリー間で入力名が揺れないノードに使う)。
function _widgetIndex(node, name) {
const widgetInputs = (node?.inputs || []).filter((inp) => inp.widget);
return widgetInputs.findIndex((inp) => inp.name === name);
}
// サブグラフが公開する入力は、labelがあればlabel、無ければnameが意味的な役割を表す
// (例: MiniMax H3の"width"はlabel無しでname自体が"width"、LTX-2.5の"value_2"はlabelが
// "width")。
function _findInputByLabel(node, label) {
return (node?.inputs || []).find((inp) => (inp.label || inp.name) === label) || null;
}
function _detectVideoSubgraph(workflow) {
if (!Array.isArray(workflow?.nodes) || !Array.isArray(workflow?.links)) return null;
const subgraphs = workflow.definitions?.subgraphs || [];
const minimax = subgraphs.find((sg) => (sg.nodes || []).some((n) => n.type === "MiniMaxH3ImageToVideo"));
if (minimax) return { family: "minimax", sgDef: minimax };
// LTX-2.5のText/Image/First&Last-Frame to Videoはいずれも内部にLTXV*系ノードを持つ
// サブグラフとして配布される。バリアントごとにサブグラフの公開入力nameが異なるため、
// 内部ノード型のプレフィックスで検出する。
const ltx = subgraphs.find((sg) => (sg.nodes || []).some((n) => typeof n.type === "string" && n.type.startsWith("LTXV")));
if (ltx) return { family: "ltx25", sgDef: ltx };
// Wan2.2はUNETLoader/KSamplerAdvanced/EmptyHunyuanLatentVideoなど汎用ノードのみで
// 構成されており、MiniMax H3/LTX-2.5のような固有ノード型による検出ができない。
// そのためサブグラフ自体の名前(公式テンプレート由来の "...(Wan2.2)" 表記)で検出する。
const wan22 = subgraphs.find((sg) => /wan\s*2\.2/i.test(sg.name || ""));
if (wan22) return { family: "wan22", sgDef: wan22 };
return null;
}
function locateVideoModelNodes(workflow) {
const detected = _detectVideoSubgraph(workflow);
if (!detected) return null;
const { family, sgDef } = detected;
const instanceNode = workflow.nodes.find((n) => n.type === sgDef.id);
if (!instanceNode || !Array.isArray(instanceNode.widgets_values)) return null;
// Wan2.2の公開入力はプロンプトが label 無しの name="text" のまま(MiniMax H3の"prompt"や
// LTX-2.5の label="prompt" と異なる)ため、"prompt" が見つからない場合は "text" にフォール
// バックする。
const promptInput = _findInputByLabel(instanceNode, "prompt") || _findInputByLabel(instanceNode, "text");
const durationInput = _findInputByLabel(instanceNode, "duration");
const widthInput = _findInputByLabel(instanceNode, "width");
if (!promptInput || !durationInput || !widthInput) return null;
const promptIdx = _widgetIndexOf(instanceNode, promptInput);
const durationIdx = _widgetIndexOf(instanceNode, durationInput);
if (promptIdx === -1 || durationIdx === -1) return null;
const widthSlot = instanceNode.inputs.indexOf(widthInput);
const findLinkedNode = (targetSlot) => {
if (targetSlot === -1) return null;
const link = workflow.links.find((l) => l[3] === instanceNode.id && l[4] === targetSlot);
if (!link) return null;
return workflow.nodes.find((n) => n.id === link[1]) || null;
};
// 一部のLTX-2.5バリアント(First & Last Frame to Video等)はResolutionSelectorを介さず、
// width/heightをサブグラフの直接ウィジェット値として持つ。その場合はresolutionNode: null
// を返し、以降の処理ではaspect_ratio等の操作をスキップする(テンプレートのwidth/height値が
// そのまま使われる)。
const rawResolutionNode = findLinkedNode(widthSlot);
const resolutionNode = (rawResolutionNode && rawResolutionNode.type === "ResolutionSelector") ? rawResolutionNode : null;
// first_frame/last_frameはoptional入力のため、対応するLoadImageノードが接続されて
// いないワークフロー(テキストのみで動作するT2V構成など)もサポート対象とする。
// 未接続の場合はnullのまま返し、必要ならrunGeneration側で動的にノードを注入する。
const firstFrameInput = _findInputByLabel(instanceNode, "first_frame");
const lastFrameInput = _findInputByLabel(instanceNode, "last_frame");
const firstFrameSlot = firstFrameInput ? instanceNode.inputs.indexOf(firstFrameInput) : -1;
const lastFrameSlot = lastFrameInput ? instanceNode.inputs.indexOf(lastFrameInput) : -1;
const rawLoadImageNode = findLinkedNode(firstFrameSlot);
const loadImageNode = (rawLoadImageNode && rawLoadImageNode.type === "LoadImage") ? rawLoadImageNode : null;
const rawLastLoadImageNode = findLinkedNode(lastFrameSlot);
const lastLoadImageNode = (rawLastLoadImageNode && rawLastLoadImageNode.type === "LoadImage") ? rawLastLoadImageNode : null;
return {
family, sgDef, instanceNode, loadImageNode, lastLoadImageNode, resolutionNode,
firstFrameSlot, lastFrameSlot, promptIdx, durationIdx,
};
}
// ============================================
// ワークフロー読み込み
// ============================================
// GenerateUIタブのModelタブが使う「ロードされたワークフローに該当する項目」ハイライト
// (wfm-model-label-active、色は設定のGenerateUI Modelタブ ハイライト色と共通) を、
// Videoタブの左パネルにも適用する。Wan2.2などResolutionSelectorを持たないファミリーは
// Aspect Ratio/Megapixels/Multipleが操作不可(既にdisabled)になるため、ここでも
// 該当なし扱いにしてハイライトしない。
const _VIDEO_FIELD_LABEL_IDS = [
"wfm-video-prompt-label",
"wfm-video-duration-label",
"wfm-video-first-frame-label",
"wfm-video-last-frame-label",
"wfm-video-aspect-ratio-label",
"wfm-video-megapixels-label",
"wfm-video-multiple-label",
];
function _setFieldActive(id, active) {
document.getElementById(id)?.classList.toggle("wfm-model-label-active", !!active);
}
function _updateFieldHighlights(nodes) {
if (!nodes) {
_VIDEO_FIELD_LABEL_IDS.forEach((id) => _setFieldActive(id, false));
return;
}
const hasResolution = !!nodes.resolutionNode;
_setFieldActive("wfm-video-prompt-label", true);
_setFieldActive("wfm-video-duration-label", true);
_setFieldActive("wfm-video-first-frame-label", nodes.firstFrameSlot !== -1);
_setFieldActive("wfm-video-last-frame-label", nodes.lastFrameSlot !== -1);
_setFieldActive("wfm-video-aspect-ratio-label", hasResolution);
_setFieldActive("wfm-video-megapixels-label", hasResolution);
_setFieldActive("wfm-video-multiple-label", hasResolution);
}
function _showFramePreview(which, filename) {
const previewImg = document.getElementById(`wfm-video-${which}-frame-preview`);
const wrap = document.getElementById(`wfm-video-${which}-frame-wrap`);
if (!previewImg || !wrap || !filename) return;
previewImg.src = `${comfyUI.baseUrl}/view?filename=${encodeURIComponent(filename)}&type=input`;
wrap.style.display = "";
}
export async function loadWorkflowIntoVideoEditor(workflow, filename) {
const nodes = locateVideoModelNodes(workflow);
if (!nodes) {
showToast(t("videoUnsupportedWorkflow"), "error");
_updateFieldHighlights(null);
return false;
}
_updateFieldHighlights(nodes);
state.templateWorkflow = workflow;
state.templateFilename = filename || "";
// 前回読み込んだワークフローのFirst/Last Frameプレビューが残っていると、画像を使わない
// ワークフロー(T2V構成など)を読み込んだ際に誤って画像が使われるかのように見えてしまう。
// state自体は下で再設定されるが、プレビュー表示(DOM)側は明示的にクリアしないと残留する。
_clearFrame("first");
_clearFrame("last");
const nameEl = document.getElementById("wfm-video-wf-name");
if (nameEl) nameEl.textContent = filename || "Loaded Workflow";
const { instanceNode, resolutionNode, loadImageNode, lastLoadImageNode, promptIdx, durationIdx } = nodes;
const promptEl = document.getElementById("wfm-video-prompt");
if (promptEl) promptEl.value = instanceNode.widgets_values[promptIdx] ?? "";
const durationEl = document.getElementById("wfm-video-duration");
if (durationEl) durationEl.value = instanceNode.widgets_values[durationIdx] ?? 2;
const arIdx = _widgetIndex(resolutionNode, "aspect_ratio");
const mpIdx = _widgetIndex(resolutionNode, "megapixels");
const multIdx = _widgetIndex(resolutionNode, "multiple");
const aspectEl = document.getElementById("wfm-video-aspect-ratio");
if (aspectEl && arIdx !== -1 && resolutionNode.widgets_values[arIdx] != null) {
aspectEl.value = resolutionNode.widgets_values[arIdx];
}
const mpEl = document.getElementById("wfm-video-megapixels");
if (mpEl && mpIdx !== -1) mpEl.value = resolutionNode.widgets_values[mpIdx] ?? mpEl.value;
const multEl = document.getElementById("wfm-video-multiple");
if (multEl && multIdx !== -1) multEl.value = resolutionNode.widgets_values[multIdx] ?? multEl.value;
// ResolutionSelectorを介さないバリアント(width/heightが直接ウィジェット値)では
// aspect_ratio/megapixels/multipleを反映する先が無いため、操作できないことが分かるよう無効化する。
[aspectEl, mpEl, multEl].forEach((el) => { if (el) el.disabled = !resolutionNode; });
const fnIdx = _widgetIndex(loadImageNode, "image");
if (fnIdx !== -1 && loadImageNode.widgets_values[fnIdx]) {
state.firstFrameFilename = loadImageNode.widgets_values[fnIdx];
_showFramePreview("first", state.firstFrameFilename);
}
const lastFnIdx = _widgetIndex(lastLoadImageNode, "image");
if (lastFnIdx !== -1 && lastLoadImageNode.widgets_values[lastFnIdx]) {
state.lastFrameFilename = lastLoadImageNode.widgets_values[lastFnIdx];
_showFramePreview("last", state.lastFrameFilename);
}
showToast(t("videoWorkflowLoaded", filename || ""), "success");
return true;
}
// ============================================
// Aspect Ratio 選択肢(object_infoから動的取得、ハードコードしない)
// ============================================
async function _populateAspectRatioOptions() {
const select = document.getElementById("wfm-video-aspect-ratio");
if (!select) return;
try {
const info = await comfyUI.fetchObjectInfo("ResolutionSelector");
const inputDef = info?.ResolutionSelector?.input?.required?.aspect_ratio;
if (!inputDef) return;
const first = inputDef[0];
let values = null;
if (Array.isArray(first)) values = first;
else if (typeof first === "string" && Array.isArray(inputDef[1]?.values)) values = inputDef[1].values;
else if (typeof first === "string" && Array.isArray(inputDef[1]?.options)) values = inputDef[1].options;
if (!values?.length) return;
select.innerHTML = values.map((v) => `<option value="${escapeHtml(v)}">${escapeHtml(v)}</option>`).join("");
} catch {
// ResolutionSelectorが未導入の環境などは選択肢が空のまま(手入力不可のselectなので実質何もできないが、
// Videoタブ自体の初期化は継続させる)。
}
}
// ============================================
// first_frame / last_frame アップロード
// ============================================
function _wireDropZone(dropZoneId, fileInputId, onFile) {
const dropZone = document.getElementById(dropZoneId);
const fileInput = document.getElementById(fileInputId);
if (!dropZone || !fileInput) return;
fileInput.addEventListener("change", () => {
if (fileInput.files.length > 0) onFile(fileInput.files[0]);
});
dropZone.addEventListener("dragover", (e) => { e.preventDefault(); dropZone.classList.add("drag-over"); });
dropZone.addEventListener("dragleave", () => dropZone.classList.remove("drag-over"));
dropZone.addEventListener("drop", (e) => {
e.preventDefault();
dropZone.classList.remove("drag-over");
if (e.dataTransfer.files.length > 0) onFile(e.dataTransfer.files[0]);
});
}
async function _handleFrameUpload(which, file) {
if (!file || !file.type.startsWith("image/")) return;
const statusEl = document.getElementById(`wfm-video-${which}-frame-status`);
const previewImg = document.getElementById(`wfm-video-${which}-frame-preview`);
const wrap = document.getElementById(`wfm-video-${which}-frame-wrap`);
if (previewImg) previewImg.src = URL.createObjectURL(file);
if (wrap) wrap.style.display = "";
if (statusEl) statusEl.textContent = "Uploading...";
try {
const result = await comfyUI.uploadImage(file, file.name);
if (which === "first") state.firstFrameFilename = result.name;
else state.lastFrameFilename = result.name;
if (statusEl) {
statusEl.textContent = `✓ ${result.name}`;
statusEl.style.color = "var(--wfm-success)";
}
} catch (err) {
if (statusEl) {
statusEl.textContent = `✗ ${err.message}`;
statusEl.style.color = "var(--wfm-danger)";
}
}
}
function _clearFrame(which) {
if (which === "first") state.firstFrameFilename = null;
else state.lastFrameFilename = null;
const wrap = document.getElementById(`wfm-video-${which}-frame-wrap`);
const previewImg = document.getElementById(`wfm-video-${which}-frame-preview`);
const statusEl = document.getElementById(`wfm-video-${which}-frame-status`);
const fileInput = document.getElementById(`wfm-video-${which}-frame-file`);
if (wrap) wrap.style.display = "none";
if (previewImg) previewImg.src = "";
if (statusEl) statusEl.textContent = "";
if (fileInput) fileInput.value = "";
}
// ============================================
// フォーム値の読み取り・ワークフローへの反映
// ============================================
function _readFormValues() {
return {
prompt: document.getElementById("wfm-video-prompt")?.value || "",
aspectRatio: document.getElementById("wfm-video-aspect-ratio")?.value || "",
megapixels: Number(document.getElementById("wfm-video-megapixels")?.value) || 0.2,
multiple: Number(document.getElementById("wfm-video-multiple")?.value) || 32,
duration: Number(document.getElementById("wfm-video-duration")?.value) || 2,
};
}
function _applyFormToWorkflow(nodes, form) {
const { instanceNode, resolutionNode, loadImageNode, lastLoadImageNode, promptIdx, durationIdx } = nodes;
instanceNode.widgets_values[promptIdx] = form.prompt;
instanceNode.widgets_values[durationIdx] = form.duration;
const arIdx = _widgetIndex(resolutionNode, "aspect_ratio");
const mpIdx = _widgetIndex(resolutionNode, "megapixels");
const multIdx = _widgetIndex(resolutionNode, "multiple");
if (arIdx !== -1) resolutionNode.widgets_values[arIdx] = form.aspectRatio;
if (mpIdx !== -1) resolutionNode.widgets_values[mpIdx] = form.megapixels;
if (multIdx !== -1) resolutionNode.widgets_values[multIdx] = form.multiple;
// first_frame/last_frameは既存のLoadImageノードが接続されている場合のみここで書き換える。
// 接続が無い場合(loadImageNode/lastLoadImageNode: null)は、画像が新規指定された時だけ
// _injectFrameNode()でノードごと注入する(未指定ならバイパス=未接続のまま実行)。
if (loadImageNode) {
const fnIdx = _widgetIndex(loadImageNode, "image");
if (fnIdx !== -1) loadImageNode.widgets_values[fnIdx] = state.firstFrameFilename;
}
if (lastLoadImageNode) {
const fnIdx = _widgetIndex(lastLoadImageNode, "image");
if (fnIdx !== -1) lastLoadImageNode.widgets_values[fnIdx] = state.lastFrameFilename;
}
}
// first_frame/last_frameが未接続のワークフローに対して、画像が指定された時だけ
// LoadImageノードを新規注入する共通ヘルパー。ノードID/リンクIDはclone内の実際の
// 最大値+1で採番するため、重複ID/リンクID不整合は起きない
// (CLAUDE.md記載の既知の落とし穴への対策)。未指定時は何もしない
// (テンプレート由来のlink:nullのまま=クリーンな状態を毎回cloneするので残留の心配がない=バイパス扱い)。
function _injectFrameNode(clone, instanceNode, targetSlot, filename) {
const maxNodeId = Math.max(clone.last_node_id || 0, ...clone.nodes.map((n) => n.id));
const maxLinkId = Math.max(clone.last_link_id || 0, ...clone.links.map((l) => l[0]));
const newNodeId = maxNodeId + 1;
const newLinkId = maxLinkId + 1;
clone.nodes.push({
id: newNodeId,
type: "LoadImage",
pos: [(instanceNode.pos?.[0] || 0) - 260, (instanceNode.pos?.[1] || 0) + 40],
size: [280, 314],
flags: {},
order: clone.nodes.length,
mode: 0,
inputs: [
{ localized_name: "image", name: "image", type: "COMBO", widget: { name: "image" }, link: null },
{ localized_name: "choose file to upload", name: "upload", type: "IMAGEUPLOAD", widget: { name: "upload" }, link: null },
],
outputs: [
{ localized_name: "IMAGE", name: "IMAGE", type: "IMAGE", links: [newLinkId] },
{ localized_name: "MASK", name: "MASK", type: "MASK", links: null },
],
properties: { "Node name for S&R": "LoadImage" },
widgets_values: [filename, "image"],
});
clone.links.push([newLinkId, newNodeId, 0, instanceNode.id, targetSlot, "IMAGE"]);
const targetInput = instanceNode.inputs[targetSlot];
if (targetInput) targetInput.link = newLinkId;
clone.last_node_id = newNodeId;
clone.last_link_id = newLinkId;
}
// ============================================
// 実行
// ============================================
async function runGeneration() {
if (state.generating) return;
if (!state.templateWorkflow) {
showToast(t("videoNoWorkflowLoaded"), "error");
return;
}
const clone = structuredClone(state.templateWorkflow);
const nodes = locateVideoModelNodes(clone);
if (!nodes) {
showToast(t("videoUnsupportedWorkflow"), "error");
return;
}
_applyFormToWorkflow(nodes, _readFormValues());
// first_frame/last_frame: 既存のLoadImageノードが無いワークフロー(T2V構成等)で、
// ユーザーが新たに画像を指定した場合のみノードを注入する。未指定ならバイパス(未接続のまま実行)。
if (!nodes.loadImageNode && state.firstFrameFilename) {
_injectFrameNode(clone, nodes.instanceNode, nodes.firstFrameSlot, state.firstFrameFilename);
}
if (!nodes.lastLoadImageNode && state.lastFrameFilename) {
_injectFrameNode(clone, nodes.instanceNode, nodes.lastFrameSlot, state.lastFrameFilename);
}
const genBtn = document.getElementById("wfm-video-generate-btn");
const progressBar = document.getElementById("wfm-video-progress-bar");
const progressText = document.getElementById("wfm-video-progress-text");
state.generating = true;
if (genBtn) genBtn.disabled = true;
if (progressBar) progressBar.style.width = "0%";
if (progressText) progressText.textContent = "Converting workflow...";
try {
const apiWorkflow = await comfyWorkflow.convertUiToApi(clone);
const seedValue = Number(document.getElementById("wfm-video-noise-seed")?.value) || 0;
const seedMode = document.getElementById("wfm-video-seed-randomize")?.checked ? "random" : "fixed";
const { images, seed } = await comfyUI.generate(apiWorkflow, {
seedMode,
seedValue,
timeoutMs: 30 * 60 * 1000, // 動画生成は静止画より長時間になりうる
onProgress: (pct) => {
if (progressBar) progressBar.style.width = `${(pct * 100).toFixed(1)}%`;
if (progressText) progressText.textContent = `${(pct * 100).toFixed(0)}%`;
},
});
const seedEl = document.getElementById("wfm-video-noise-seed");
if (seedEl) seedEl.value = seed;
const outputMedia = images.filter((img) => img.type !== "temp");
if (progressText) progressText.textContent = t("videoDoneCount", outputMedia.length);
if (progressBar) progressBar.style.width = "100%";
_renderResult(outputMedia);
await _saveGeneratedVideoMeta(outputMedia, apiWorkflow);
showToast(t("videoGenerateSuccess"), "success");
} catch (err) {
showToast(t("errorWithMsg", err.message), "error");
if (progressText) progressText.textContent = "Error";
} finally {
state.generating = false;
if (genBtn) genBtn.disabled = false;
}
}
// ============================================
// 結果表示
// ============================================
// Sets (or clears) the center preview frame's video and records where it came from —
// `source` is what the Frame/GIF property tabs act on (see state.previewSource above).
// Revokes the previous blob: URL (if any) so picking a series of local files doesn't
// leak memory.
let _previewObjectUrl = null;
function _setPreviewMedia(url, source) {
state.previewSource = source;
const video = document.getElementById("wfm-video-preview-video");
const placeholder = document.getElementById("wfm-video-preview-placeholder");
if (!video || !placeholder) return;
if (_previewObjectUrl) {
URL.revokeObjectURL(_previewObjectUrl);
_previewObjectUrl = null;
}
if (url && url.startsWith("blob:")) _previewObjectUrl = url;
if (url) {
video.src = url;
video.style.display = "block";
placeholder.style.display = "none";
} else {
video.pause();
video.removeAttribute("src");
video.load();
video.style.display = "none";
placeholder.style.display = "";
}
}
function _renderResult(images) {
// Both MiniMax H3 and LTX-2.5 emit a single VIDEO output — but guard generically
// (prefer an mp4 if present) in case a future video workflow's SaveVideo/PreviewVideo
// ordering differs.
const media = (images || []).find((img) => img.filename.toLowerCase().endsWith(".mp4")) || images?.[0];
if (!media) {
_setPreviewMedia(null, null);
return;
}
const params = new URLSearchParams({ filename: media.filename, subfolder: media.subfolder || "", type: media.type || "output" });
const src = `${comfyUI.baseUrl}/view?${params}`;
_setPreviewMedia(src, {
kind: media.type === "input" ? "input" : "output",
filename: media.filename,
subfolder: media.subfolder || "",
type: media.type || "output",
});
}
// ============================================
// Gallery連携(生成結果のワークフローをサイドカーメタとして保存)
// ============================================
let _outputDir = "";
async function _fetchOutputDir() {
try {
const res = await fetch("/api/wfm/settings/output-dir");
if (res.ok) {
const data = await res.json();
_outputDir = (data.current || "").replace(/\\/g, "/").replace(/\/$/, "");
}
} catch { /* non-critical */ }
}
async function _saveGeneratedVideoMeta(images, workflow) {
if (!_outputDir) await _fetchOutputDir();
if (!_outputDir) return;
for (const img of images) {
if (img.type !== "output") continue;
const parts = [_outputDir];
if (img.subfolder) parts.push(img.subfolder);
parts.push(img.filename);
const path = parts.join("/");
try {
await fetch("/wfm/gallery/image/meta", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path, workflow }),
});
} catch { /* non-critical */ }
}
}
// ============================================
// i18nの適用(app.jsのapplyI18nToHtml()と同じ「個別要素にt()を適用」方式)
// ============================================
function _applyVideoI18n() {
const setText = (id, key) => {
const el = document.getElementById(id);
if (el) el.textContent = t(key);
};
setText("wfm-video-title-label", "videoTitle");
setText("wfm-video-first-frame-label", "videoFirstFrame");
setText("wfm-video-last-frame-label", "videoLastFrame");
setText("wfm-video-first-frame-drop-label", "videoDropOrClick");
setText("wfm-video-last-frame-drop-label", "videoDropOrClick");
setText("wfm-video-first-frame-clear", "clear");
setText("wfm-video-last-frame-clear", "clear");
setText("wfm-video-prompt-label", "videoPrompt");
setText("wfm-video-aspect-ratio-label", "videoAspectRatio");
setText("wfm-video-megapixels-label", "videoMegapixels");
setText("wfm-video-multiple-label", "videoMultiple");
setText("wfm-video-duration-label", "videoDuration");
setText("wfm-video-noise-seed-label", "videoNoiseSeed");
setText("wfm-video-randomize-label", "videoRandomizeSeed");
setText("wfm-video-generate-btn", "videoGenerate");
setText("wfm-video-edit-placeholder-label", "videoEditPlaceholder");
setText("wfm-video-source-label", "videoSourceLabel");
setText("wfm-video-source-hint", "videoSourceHint");
setText("wfm-video-source-drop-label", "videoSourceDropLabel");
setText("wfm-video-source-clear", "clear");
setText("wfm-video-preview-placeholder", "videoNoVideo");
setText("wfm-video-prop-tab-frame", "videoPropFrame");
setText("wfm-video-prop-tab-gif", "videoPropGif");
setText("wfm-video-frame-hint", "videoFrameHint");
setText("wfm-video-frame-capture-btn", "videoCaptureFrame");
setText("wfm-video-frame-save-btn", "videoSaveToOutput");
setText("wfm-video-gif-start-label", "videoGifStart");
setText("wfm-video-gif-end-label", "videoGifEnd");
setText("wfm-video-gif-fps-label", "videoGifFps");
setText("wfm-video-gif-width-label", "videoGifWidth");
setText("wfm-video-gif-convert-btn", "videoConvertToGif");
}
// ============================================
// Video Source panel — loads any local video into the preview frame, independent of
// generation, so Frame/GIF tools work without running the loaded video workflow first.
// ============================================
function _wireVideoSourcePanel() {
_wireDropZone("wfm-video-source-drop", "wfm-video-source-file", (file) => {
if (!file.type.startsWith("video/")) return;
const statusEl = document.getElementById("wfm-video-source-status");
_setPreviewMedia(URL.createObjectURL(file), { kind: "local", file });
if (statusEl) { statusEl.textContent = file.name; statusEl.style.color = ""; }
});
document.getElementById("wfm-video-source-clear")?.addEventListener("click", () => {
_setPreviewMedia(null, null);
const statusEl = document.getElementById("wfm-video-source-status");
if (statusEl) statusEl.textContent = "";
const fileInput = document.getElementById("wfm-video-source-file");
if (fileInput) fileInput.value = "";
});
}
// ============================================
// Properties panel tabs (Frame / GIF)
// ============================================
function _initPropTabs() {
const tabs = document.querySelectorAll(".wfm-video-prop-tab");
tabs.forEach((btn) => {
btn.addEventListener("click", () => {
tabs.forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
const target = btn.dataset.propTab;
document.querySelectorAll(".wfm-video-prop-content").forEach((c) => {
c.style.display = c.id === `wfm-video-prop-${target}` ? "" : "none";
});
});
});
}
// ============================================
// Frame tab — captures the preview video's current playback position as a PNG,
// client-side (canvas), and saves it into ComfyUI's own output folder.
// ============================================
let _capturedFrameBlob = null;
function _blobToDataUrl(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(reader.result);
reader.onerror = () => reject(new Error("Failed to read blob"));
reader.readAsDataURL(blob);
});
}
function _initFrameTab() {
const captureBtn = document.getElementById("wfm-video-frame-capture-btn");
const saveBtn = document.getElementById("wfm-video-frame-save-btn");
const previewWrap = document.getElementById("wfm-video-frame-preview-wrap");
const previewImg = document.getElementById("wfm-video-frame-preview-img");
const statusEl = document.getElementById("wfm-video-frame-status");
captureBtn?.addEventListener("click", () => {
const video = document.getElementById("wfm-video-preview-video");
if (!video || video.style.display === "none" || !video.videoWidth) {
showToast(t("videoNoSourceLoaded"), "error");
return;
}
try {
const canvas = document.createElement("canvas");
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext("2d").drawImage(video, 0, 0);
canvas.toBlob((blob) => {
if (!blob) return;
_capturedFrameBlob = blob;
if (previewImg) previewImg.src = URL.createObjectURL(blob);
if (previewWrap) previewWrap.style.display = "";
if (saveBtn) saveBtn.disabled = false;
if (statusEl) statusEl.textContent = "";
}, "image/png");
} catch (err) {
showToast(t("videoFrameCaptureFailed", err.message), "error");
}
});
saveBtn?.addEventListener("click", async () => {
if (!_capturedFrameBlob) return;
saveBtn.disabled = true;
if (statusEl) statusEl.textContent = "Saving...";
try {
const dataUrl = await _blobToDataUrl(_capturedFrameBlob);
const res = await fetch("/api/wfm/video/frame/save-to-output", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ image_base64: dataUrl }),
});
const json = await res.json();
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
if (statusEl) { statusEl.textContent = `✓ ${json.filename}`; statusEl.style.color = "var(--wfm-success)"; }
showToast(t("videoFrameSaved", json.filename), "success");
} catch (err) {
if (statusEl) { statusEl.textContent = `✗ ${err.message}`; statusEl.style.color = "var(--wfm-danger)"; }
showToast(t("errorWithMsg", err.message), "error");
} finally {
saveBtn.disabled = false;
}
});
}
// ============================================
// GIF tab — sends the preview video (uploading it first if it's a local file not yet
// on the server) to the server, which decodes it with PyAV and encodes an animated
// GIF with Pillow (both already required by ComfyUI itself — no ffmpeg dependency).
// ============================================
function _initGifTab() {
const convertBtn = document.getElementById("wfm-video-gif-convert-btn");
const progressBar = document.getElementById("wfm-video-gif-progress-bar");
const progressText = document.getElementById("wfm-video-gif-progress-text");
const previewWrap = document.getElementById("wfm-video-gif-preview-wrap");
const previewImg = document.getElementById("wfm-video-gif-preview-img");
const statusEl = document.getElementById("wfm-video-gif-status");
convertBtn?.addEventListener("click", async () => {
if (!state.previewSource) {
showToast(t("videoNoSourceLoaded"), "error");
return;
}
convertBtn.disabled = true;
if (statusEl) statusEl.textContent = "";
if (progressBar) progressBar.style.width = "20%";
if (progressText) progressText.textContent = "Uploading...";
try {
let ref = state.previewSource;
if (ref.kind === "local") {
const result = await comfyUI.uploadImage(ref.file, ref.file.name);
ref = { kind: "input", filename: result.name, subfolder: result.subfolder || "", type: "input" };
// Cache the uploaded reference so a repeat conversion doesn't re-upload.
state.previewSource = ref;
}
const start = Number(document.getElementById("wfm-video-gif-start")?.value) || 0;
const endRaw = document.getElementById("wfm-video-gif-end")?.value;
const fps = Number(document.getElementById("wfm-video-gif-fps")?.value) || 10;
const widthRaw = document.getElementById("wfm-video-gif-width")?.value;
if (progressBar) progressBar.style.width = "60%";
if (progressText) progressText.textContent = t("videoGifConverting");
const res = await fetch("/api/wfm/video/to-gif", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
filename: ref.filename,
subfolder: ref.subfolder || "",
type: ref.type,
start_time: start,
end_time: endRaw ? Number(endRaw) : null,
fps,
max_width: widthRaw ? Number(widthRaw) : null,
}),
});
const json = await res.json();
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
if (progressBar) progressBar.style.width = "100%";
if (progressText) progressText.textContent = t("videoGifDoneCount", json.frame_count ?? 0);
const params = new URLSearchParams({ filename: json.filename, subfolder: json.subfolder || "", type: "output" });
if (previewImg) previewImg.src = `${comfyUI.baseUrl}/view?${params}`;
if (previewWrap) previewWrap.style.display = "";
if (statusEl) { statusEl.textContent = `✓ ${json.filename}`; statusEl.style.color = "var(--wfm-success)"; }
showToast(t("videoGifSaved", json.filename), "success");
} catch (err) {
if (statusEl) { statusEl.textContent = `✗ ${err.message}`; statusEl.style.color = "var(--wfm-danger)"; }
if (progressText) progressText.textContent = "Error";
showToast(t("errorWithMsg", err.message), "error");
} finally {
convertBtn.disabled = false;
}
});
}
// ============================================
// 初期化
// ============================================
export function initVideoTab() {
_applyVideoI18n();
_populateAspectRatioOptions();
_wireDropZone("wfm-video-first-frame-drop", "wfm-video-first-frame-file", (file) => _handleFrameUpload("first", file));
_wireDropZone("wfm-video-last-frame-drop", "wfm-video-last-frame-file", (file) => _handleFrameUpload("last", file));
document.getElementById("wfm-video-first-frame-clear")?.addEventListener("click", () => _clearFrame("first"));
document.getElementById("wfm-video-last-frame-clear")?.addEventListener("click", () => _clearFrame("last"));
document.getElementById("wfm-video-generate-btn")?.addEventListener("click", runGeneration);
_wireVideoSourcePanel();
_initPropTabs();
_initFrameTab();
_initGifTab();
// 保存済みの音量を適用し、以降ユーザーがネイティブコントロールで変更した音量も
// 自動保存する(要素自体は永続的なので初期化時に一度呼べば十分)。
applyStoredVideoVolume(document.getElementById("wfm-video-preview-video"));
}
+73
View File
@@ -0,0 +1,73 @@
/**
* Video helper utilities shared across tabs that deal with generated mp4 output
* (Lab tab's "use generated image for next" chaining, and the Video tab's future
* batch features). Kept dependency-free (no comfyUI/comfyEditor imports) so it can
* be reused from either tab without pulling in unrelated state.
*/
export function isVideoFilename(filename) {
return /\.(mp4|webm|mov)$/i.test(filename || "");
}
// Extracts the last frame of a video at `videoUrl` as a PNG Blob, by seeking a
// detached <video> element to just before its end and drawing that frame onto a
// canvas. Runs entirely client-side (no server round-trip / PyAV dependency).
//
// Seeks to (duration - 0.05s) rather than duration itself: seeking exactly to the
// end is unreliable across browsers (some clamp it back to the last keyframe's
// timestamp, which can fire a "seeked" event before the frame is actually decoded).
// The "seeked" listener also ignores events that don't land near that target time,
// since loading a video can fire an initial seeked-to-0 before the real seek lands.
export function extractLastFrameBlob(videoUrl) {
return new Promise((resolve, reject) => {
const video = document.createElement("video");
video.muted = true;
video.playsInline = true;
video.preload = "auto";
let target = null;
let settled = false;
const cleanup = () => {
video.removeAttribute("src");
video.load();
};
const finish = (fn, arg) => {
if (settled) return;
settled = true;
cleanup();
fn(arg);
};
video.addEventListener("error", () => {
finish(reject, new Error("Failed to load video for last-frame extraction"));
});
video.addEventListener("loadedmetadata", () => {
if (!Number.isFinite(video.duration) || video.duration <= 0) {
finish(reject, new Error("Video has no readable duration"));
return;
}
target = Math.max(0, video.duration - 0.05);
video.currentTime = target;
});
video.addEventListener("seeked", () => {
if (target == null || Math.abs(video.currentTime - target) > 0.5) return;
try {
const canvas = document.createElement("canvas");
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas.getContext("2d").drawImage(video, 0, 0);
canvas.toBlob((blob) => {
if (blob) finish(resolve, blob);
else finish(reject, new Error("Failed to encode last frame"));
}, "image/png");
} catch (err) {
finish(reject, err);
}
});
video.src = videoUrl;
});
}
+18 -25
View File
@@ -7,6 +7,7 @@
import { showToast, openModal, closeModal } from "./app.js";
import { comfyWorkflow } from "./comfyui-workflow.js";
import { loadWorkflowIntoEditor } from "./generate-tab.js";
import { loadWorkflowIntoVideoEditor } from "./video-tab.js";
import { t, getSummaryPrompt } from "./i18n.js";
import { highlightJSON } from "./json-highlight.js";
import { openBadgeEditModal } from "./models-tab.js";
@@ -615,6 +616,8 @@ async function showSidePanel(wf, cardEl) {
// Enable toolbar load buttons
const listLoadBtn = document.getElementById("wfm-list-load-btn");
if (listLoadBtn) { listLoadBtn.disabled = false; listLoadBtn.title = ""; }
const listLoadVideoBtn = document.getElementById("wfm-list-load-video-btn");
if (listLoadVideoBtn) { listLoadVideoBtn.disabled = false; listLoadVideoBtn.title = ""; }
const listOpenComfyBtn = document.getElementById("wfm-list-open-comfyui-btn");
if (listOpenComfyBtn) { listOpenComfyBtn.disabled = false; listOpenComfyBtn.title = ""; }
@@ -660,6 +663,8 @@ function closeSidePanel() {
if (titleEl) titleEl.textContent = "";
const listLoadBtn = document.getElementById("wfm-list-load-btn");
if (listLoadBtn) { listLoadBtn.disabled = true; listLoadBtn.title = t("selectCardFirst"); }
const listLoadVideoBtn = document.getElementById("wfm-list-load-video-btn");
if (listLoadVideoBtn) { listLoadVideoBtn.disabled = true; listLoadVideoBtn.title = t("selectCardFirst"); }
const listOpenComfyBtn = document.getElementById("wfm-list-open-comfyui-btn");
if (listOpenComfyBtn) { listOpenComfyBtn.disabled = true; listOpenComfyBtn.title = t("selectCardFirst"); }
renderSideGroup(null);
@@ -956,8 +961,6 @@ function openDetailModal(wf) {
<textarea class="wfm-textarea" id="wfm-detail-memo" rows="4" placeholder="${t("memoPlaceholder")}">${meta.memo || ""}</textarea>
</section>
<div class="wfm-modal-actions">
<button class="wfm-btn wfm-btn-primary" id="wfm-detail-load">${t("loadInGenerate")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-detail-open-comfyui">${t("sendToCanvas")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-detail-set-default">${t("setAsDefault")}</button>
<button class="wfm-btn wfm-btn-sm" id="wfm-detail-change-thumb">${t("changeThumbnail")}</button>
<input type="file" id="wfm-detail-thumb-file" accept="image/png,image/webp,image/jpeg" style="display:none">
@@ -1094,29 +1097,6 @@ function openDetailModal(wf) {
}
});
// Load in GenerateUI
document.getElementById("wfm-detail-load").addEventListener("click", async () => {
try {
const wfData = await getRawWorkflow(wf.filename);
const loaded = await loadWorkflowIntoEditor(wfData, wf.filename);
if (loaded === false) return;
document.querySelector('.wfm-tab[data-tab="generate"]')?.click();
closeModal();
} catch (err) {
showToast(t("loadError") + ": " + err.message, "error");
}
});
// Send to Canvas
document.getElementById("wfm-detail-open-comfyui")?.addEventListener("click", async () => {
try {
const wfData = await getRawWorkflow(wf.filename);
sendToCanvas(wfData, wf.filename);
} catch (err) {
showToast(t("loadError") + ": " + err.message, "error");
}
});
// Set as default workflow
document.getElementById("wfm-detail-set-default")?.addEventListener("click", async () => {
try {
@@ -1398,6 +1378,19 @@ export function initWorkflowTab() {
}
});
// Toolbar: Load in Video button (MiniMax H3 / LTX-2.5 / Wan2.2対応。非対応ワークフローはloadWorkflowIntoVideoEditor内でエラートースト表示済み)
document.getElementById("wfm-list-load-video-btn")?.addEventListener("click", async () => {
if (!state.selectedWf) return;
try {
const wfData = await getRawWorkflow(state.selectedWf.filename);
const loaded = await loadWorkflowIntoVideoEditor(wfData, state.selectedWf.filename);
if (loaded === false) return;
document.querySelector('.wfm-tab[data-tab="video"]')?.click();
} catch (err) {
showToast(t("loadError") + ": " + err.message, "error");
}
});
// Toolbar: Send to Canvas button
document.getElementById("wfm-list-open-comfyui-btn")?.addEventListener("click", async () => {
if (!state.selectedWf) return;
+230 -42
View File
@@ -10,6 +10,7 @@
<link rel="stylesheet" href="/wfm_static/css/tagger-tab.css">
<link rel="stylesheet" href="/wfm_static/css/image-edit-tab.css">
<link rel="stylesheet" href="/wfm_static/css/lab-tab.css">
<link rel="stylesheet" href="/wfm_static/css/video-tab.css">
</head>
<body>
<!-- Header -->
@@ -25,6 +26,7 @@
<button class="wfm-tab" data-tab="prompt">Prompt</button>
<button class="wfm-tab" data-tab="gallery">Gallery</button>
<button class="wfm-tab" data-tab="image-edit">Image Edit</button>
<button class="wfm-tab" data-tab="video">Video</button>
<button class="wfm-tab" data-tab="tagger">Tagger</button>
<button class="wfm-tab" data-tab="settings">Settings</button>
<button class="wfm-tab" data-tab="help">Help</button>
@@ -54,6 +56,7 @@
<option value="">All Groups</option>
</select>
<button id="wfm-list-load-btn" class="wfm-btn wfm-btn-sm wfm-btn-primary" disabled title="Select a card first">Load in GenerateUI</button>
<button id="wfm-list-load-video-btn" class="wfm-btn wfm-btn-sm" disabled title="Select a card first">Load in Video</button>
<button id="wfm-list-open-comfyui-btn" class="wfm-btn wfm-btn-sm" disabled title="Select a card first">Send to Canvas</button>
<div class="wfm-view-btns">
<button class="wfm-view-btn active" data-view="thumb" title="Thumbnail">&#8862;</button>
@@ -567,6 +570,8 @@
</div>
</div>
<div class="wfm-lab-col-btns">
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-up" data-col="model" title="Move selected keyframe up">▲</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-down" data-col="model" title="Move selected keyframe down">▼</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-add" data-col="model" title="Add keyframe">+</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-remove" data-col="model" title="Remove last keyframe">-</button>
</div>
@@ -577,6 +582,9 @@
<div class="wfm-lab-col-header">
<span>プロンプト</span>
<div class="wfm-lab-col-btns">
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-up" data-col="prompt" title="Move selected keyframe up">▲</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-down" data-col="prompt" title="Move selected keyframe down">▼</button>
<button type="button" id="wfm-lab-prompt-group-btn" class="wfm-btn wfm-btn-xs" title="Apply Prompt Group">PG</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-add" data-col="prompt" title="Add keyframe">+</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-remove" data-col="prompt" title="Remove last keyframe">-</button>
</div>
@@ -587,6 +595,8 @@
<div class="wfm-lab-col-header">
<span>Ksampler</span>
<div class="wfm-lab-col-btns">
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-up" data-col="ksampler" title="Move selected keyframe up">▲</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-down" data-col="ksampler" title="Move selected keyframe down">▼</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-add" data-col="ksampler" title="Add keyframe">+</button>
<button type="button" class="wfm-btn wfm-btn-xs wfm-lab-col-remove" data-col="ksampler" title="Remove last keyframe">-</button>
</div>
@@ -898,6 +908,7 @@
<!-- Result Display -->
<div class="wfm-gen-result">
<img id="wfm-gen-result-img" style="display:none;max-width:100%;border-radius:6px;">
<video id="wfm-gen-result-video" controls style="display:none;max-width:100%;border-radius:6px;"></video>
<div id="wfm-gen-result-thumbs" class="wfm-gen-thumbs"></div>
</div>
</div>
@@ -940,12 +951,8 @@
<div class="wfm-prompt-split-header">AI Assistant</div>
<div class="wfm-ollama-assistant">
<div class="wfm-ollama-controls">
<select id="wfm-ollama-model" class="wfm-select" style="flex:1;min-width:120px;">
<option value="">Loading models...</option>
</select>
<button id="wfm-ollama-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh</button>
<button id="wfm-ollama-test-btn" class="wfm-btn wfm-btn-sm">Test</button>
<span id="wfm-ollama-status" class="wfm-ollama-status">Disconnected</span>
<button id="wfm-ollama-settings-btn" class="wfm-btn wfm-btn-sm" style="margin-left:auto;" title="Settings">&#9881;</button>
</div>
<div class="wfm-ollama-controls" style="margin-top:6px;">
<button id="wfm-ollama-attach-btn" class="wfm-btn wfm-btn-sm">Attach Image</button>
@@ -1277,6 +1284,7 @@
<span style="flex:1;"></span>
<button id="wfm-ptable-style-deselect-btn" class="wfm-btn wfm-btn-sm" disabled title="Clear row selection">Deselect</button>
<button id="wfm-ptable-style-delete-btn" class="wfm-btn wfm-btn-sm wfm-btn-danger" disabled>Delete</button>
<button id="wfm-ptable-style-addfile-btn" class="wfm-btn wfm-btn-sm" disabled title="Select a style whose file is not custom.json to add a new style to that same file">+ Add to this file</button>
<button id="wfm-ptable-style-add-btn" class="wfm-btn wfm-btn-sm wfm-btn-primary">+ New Style</button>
</div>
<div class="wfm-prompt-table-scroll">
@@ -1328,6 +1336,7 @@
<button class="wfm-help-nav-item" data-help-page="aitool">AI TOOL Tab</button>
<button class="wfm-help-nav-item" data-help-page="tagger">Tagger Tab</button>
<button class="wfm-help-nav-item" data-help-page="imageedit">Image Edit Tab</button>
<button class="wfm-help-nav-item" data-help-page="video">Video Tab</button>
<button class="wfm-help-nav-item" data-help-page="shortcuts">Keyboard Shortcuts</button>
<button class="wfm-help-nav-item" data-help-page="trouble">Troubleshooting</button>
</div>
@@ -1404,7 +1413,8 @@
<li id="wfm-help-gen-5">Model tab: Checkpoint, VAE, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — type and device selectors; DualCLIP shows two clip selectors) are always shown; ControlNet and Hypernetwork (with Strength field) are collapsed by default since they're used less often — click their header to expand; LoRA (Single/Stack tabs) has its own column to the right; all selectors have a 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>
<li id="wfm-help-gen-28">Model tab — Highlight color: the label of each model type (Checkpoint, VAE, Diffusion Model, Text Encoder, ControlNet, Hypernetwork) and the LoRA column header turn a distinct color (default bright green) when the loaded workflow actually contains that type of node; this stays visible even while ControlNet/Hypernetwork are collapsed, so you can tell at a glance whether they're in use without expanding them; the color is customizable in the Settings tab</li>
<li id="wfm-help-gen-6">Settings tab: KSampler and Latent Image side by side, each at 50% width</li>
<li id="wfm-help-gen-7">Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow; if the loaded workflow has Bypass or Mute nodes, a note listing them appears above the search bar (Bypass nodes are excluded with their wires reconnected around them; Mute nodes are excluded with no reconnection, matching ComfyUI itself)</li>
<li id="wfm-help-gen-31">LTX-2.5 and Wan2.2 video workflows also work when loaded as regular workflows in this tab (not just the dedicated Video tab): Positive/Negative Prompt detection follows LTX-2.5's LTXVDualCFGGuider / LTXVConditioning nodes to find the actual prompt text, and the Settings tab's Latent Image section recognizes Wan2.2's EmptyHunyuanLatentVideo and LTX-2.5's EmptyLTXVLatentVideo nodes (with an added Length (frames) field) instead of showing "No EmptyLatentImage node found"; generating from these workflows also gets the same extended timeout as MiniMax H3 video generations</li>
<li id="wfm-help-gen-7">Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow; if the loaded workflow has Bypass or Mute nodes, a note listing them appears above the search bar (Bypass nodes are excluded with their wires reconnected around them; Mute nodes are excluded with no reconnection, matching ComfyUI itself); the search bar highlights matches and scrolls to them without moving the cursor into the editor, so typing right after a search can't accidentally overwrite the JSON — click into the editor first to actually edit</li>
<li id="wfm-help-gen-30">The <b>Save</b> button (right end of the subtab bar) is hidden while the <b>Batch</b> or <b>Lab</b> subtab is active, since those work on workflow copies / their own Plan files rather than the currently loaded workflow; it reappears on Input/Model/Settings/Feeder</li>
</ul>
</div>
@@ -1512,6 +1522,8 @@
<li id="wfm-help-lab-15">Checkpoint / LoRA / VAE each carry forward independently, the same effective-value rule as every other column (see above): a keyframe in one never resets the other two to the workflow default. A field left blank in the edit modal shows "(inherits: ...)" as its placeholder instead of "(workflow default)" when an earlier keyframe in that same list already set something, so it's clear what actually applies. "Revert to #1's setting" and Bypass — like +/- — only ever affect whichever ONE of the three is currently selected by the C/L/V toggle, never the other two</li>
<li id="wfm-help-lab-16">Bypass LoRA node checkbox (LoRA keyframe's own edit modal only): forces that keyframe's strength_model/strength_clip to 0 at apply-time, standing in for ComfyUI's own node Bypass (mode:4) — the workflow used here is already converted to API format, which has no mode concept, so zeroing strength is the behavioral equivalent. Disables the strength fields while checked; independent of the row-level Bypass checkbox above, which skips the whole row instead of touching the node</li>
<li id="wfm-help-lab-17">Apply LoRA syntax + trigger words to Positive prompt checkbox (LoRA column only): when checked, appends &lt;lora:name:strengthModel:strengthClip&gt; plus that LoRA's cached CivitAI trigger words to the Positive prompt, comma-separated, at apply-time — the same format GenerateUI's own Model tab Apply button writes. Switching keyframes (a different LoRA, this checkbox turned off, or the row Bypassed) always strips exactly what the previous iteration injected before adding anything new, so a batch never accumulates every LoRA it has used. Disabled automatically while Bypass LoRA node is checked</li>
<li id="wfm-help-lab-18">A single click on a keyframe cell selects it (blue outline) instead of opening it — double-click to open the edit modal as before. Each column's header (Model / Prompt / Ksampler) also has <b>&#9650; / &#9660;</b> buttons that swap the selected keyframe with its immediate neighbor to reorder them without retyping anything; keyframe #1 (the baseline) can never move, and nothing can be swapped into its slot</li>
<li id="wfm-help-lab-19">Prompt column header's <b>PG</b> button: pick one of the Prompt tab's preset groups (Table view's Presets Group, the same groups used by the Batch tab's checklist) and replace the entire Prompt column with one keyframe per preset in that group's order, starting at #1 (#1 is overwritten, not appended after). If the group has more presets than the current Batch count, Batch count is raised automatically to fit (capped at 50, the Batch input's own limit); anything still beyond that shows the usual "keyframes beyond Batch count" warning instead of being silently dropped</li>
</ul>
</div>
@@ -1556,7 +1568,7 @@
<div class="wfm-help-card">
<h3 id="wfm-help-prompt-card-ai-title">AI Assistant &amp; Translation</h3>
<ul>
<li id="wfm-help-prompt-1">AI assistant (Ollama): model selection, chat for prompt consultation, image attachment (vision models)</li>
<li id="wfm-help-prompt-1">AI assistant (Ollama / LM Studio / Lemonade / Unsloth): chat for prompt consultation, image attachment (vision models); click the &#9881; Settings button to choose backend, connection URL, model, Thinking mode, Max tokens, and unload the loaded model &mdash; settings are independent from the AI TOOL and Tagger tabs</li>
<li id="wfm-help-prompt-2">Apply AI responses to GenerateUI prompts</li>
<li id="wfm-help-prompt-3">Translation: JA&#8596;EN, ZH&#8596;EN</li>
</ul>
@@ -1600,6 +1612,7 @@
<li id="wfm-help-prompt-23">Wildcards table — same files as the Form tab's Wildcard file manager; editing the <b>File</b> path or the <b>Ext</b> dropdown renames the file (saves the content under the new name, then removes the old file)</li>
<li id="wfm-help-prompt-24">Style table — same styles as the Form tab's Style manager, editable inline the same way as Presets</li>
<li id="wfm-help-prompt-25">Presets table toolbar — the ★ and B sort buttons (next to the search box) bring favorited / batch-selected presets to the top of the list; both can be enabled together (★ takes priority, B breaks ties), and everything else keeps its original relative order</li>
<li id="wfm-help-prompt-26">Style table toolbar — select exactly one row whose <b>File</b> badge isn't <code>custom.json</code> to enable <b>+ Add to this file</b>: it adds a blank row targeting that same file (shown as a badge in the File column even before saving) — the same capability as the Form tab's Style manager (see above); custom.json entries and multi-row selections leave the button disabled, use the regular <b>+ New Style</b> button for those instead</li>
</ul>
</div>
</div>
@@ -1628,7 +1641,7 @@
<div class="wfm-help-card">
<h3 id="wfm-help-metadata-card-formats-title">Supported Formats</h3>
<ul>
<li id="wfm-help-metadata-5">Supported: ComfyUI PNG/WebP/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Mage-Flow subgraph workflows), SD WebUI, SD Forge, Fooocus. Model extraction covers UNETLoader, UnetLoaderGGUF, UNETLoaderGGUF (e.g. HiDream GGUF), CLIPLoader, DualCLIPLoader, TripleCLIPLoader, and QuadrupleCLIPLoader (e.g. HiDream 4-CLIP).</li>
<li id="wfm-help-metadata-5">Supported: ComfyUI PNG/WebP/MP4/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Mage-Flow subgraph workflows; MP4 reads the workflow/prompt container tags written by SaveVideo, including all-in-one video nodes like MiniMax H3 ImageToVideo), SD WebUI, SD Forge, Fooocus. Model extraction covers UNETLoader, UnetLoaderGGUF, UNETLoaderGGUF (e.g. HiDream GGUF), CLIPLoader, DualCLIPLoader, TripleCLIPLoader, and QuadrupleCLIPLoader (e.g. HiDream 4-CLIP).</li>
</ul>
</div>
</div>
@@ -1650,7 +1663,7 @@
<h3 id="wfm-help-settings-card-connections-title">Connections</h3>
<ul>
<li id="wfm-help-settings-4">ComfyUI connection URL and test</li>
<li id="wfm-help-settings-5">Ollama URL, default model, and connection test</li>
<li id="wfm-help-settings-5">AI Assistant settings have moved out of this tab &mdash; the Prompt tab, Tagger tab, and AI TOOL tab each have their own &#9881; Settings button (backend, URL, model, Thinking mode, Max tokens, unload model), saved independently</li>
<li id="wfm-help-settings-7">Eagle integration URL and auto-save toggle</li>
</ul>
</div>
@@ -1673,7 +1686,9 @@
<div class="wfm-help-card">
<h3 id="wfm-help-settings-card-misc-title">Data &amp; Misc</h3>
<ul>
<li id="wfm-help-settings-8">Data Management: export all plugin data to JSON / import to restore</li>
<li id="wfm-help-settings-8">Data Management: export core settings/metadata/prompts to JSON / import to restore</li>
<li id="wfm-help-settings-15">Full Backup (ZIP): unlike the JSON export above, also includes folder-based data (AI Skills, Lab Plans, Style presets) and the Tagger database; Restore overwrites existing files — restart ComfyUI afterward</li>
<li id="wfm-help-settings-16">Two opt-in checkboxes above the Full Backup buttons additionally include ComfyUI's default workflows folder and the Impact Pack's wildcard folder in the export — both export-only, never restored automatically; copy the ZIP's _external/ folder back by hand if you want them</li>
<li id="wfm-help-settings-13">CivitAI Host: choose between civitai.com (SFW only) and civitai.red (unrestricted) — determines which site opens when clicking a model link in the Models tab CivitAI panel</li>
</ul>
</div>
@@ -1752,7 +1767,7 @@
<div class="wfm-help-card">
<h3 id="wfm-help-gallery-card-detail-title">Detail Panel</h3>
<ul>
<li id="wfm-help-gallery-7">Detail panel — Info tab: filename, size, date, tags (add/remove), memo; <b>download icon</b> (on image hover) to download the single image; "Move To..." moves the image to another folder, "Delete File" removes it permanently</li>
<li id="wfm-help-gallery-7">Detail panel — Info tab: filename, size, dimensions (image width×height) or video duration, date, tags (add/remove), memo; <b>download icon</b> (on image hover) to download the single image; "Move To..." moves the image to another folder, "Delete File" removes it permanently</li>
<li id="wfm-help-gallery-8">Detail panel — JSON tab: displays workflow JSON from PNG embedded data (prompt / workflow keys) or from metadata saved by the Generate UI tab; 'Copy &amp; Send Canvas' button copies to clipboard and stores the workflow for title-drag to canvas</li>
<li id="wfm-help-gallery-9">Detail panel — Groups tab: create, assign, remove, rename, and delete groups per image; the <b>__Feeder__</b> group is reserved (shown with 🔒) and cannot be renamed or deleted — rename and delete buttons are disabled when it is selected</li>
</ul>
@@ -1765,13 +1780,14 @@
<li id="wfm-help-gallery-14"><b>Tagger</b> button (purple, in the detail panel action row): opens the selected image directly in the Tagger tab's Single mode for instant tagging</li>
<li id="wfm-help-gallery-16"><b>Image Edit</b> button (toolbar, next to Refresh): sends the currently selected image to the Image Edit tab; if layers already exist the image is added as a new layer scaled to fit the canvas, otherwise it becomes Layer 1</li>
<li id="wfm-help-gallery-17"><b>Send GenUI Image</b> button (toolbar, next to Image Edit): uploads the selected image to ComfyUI and sets it as the input for the first LoadImage node in the GenerateUI tab; automatically switches to GenerateUI → Input → Image; requires a workflow with at least one LoadImage node to be loaded first</li>
<li id="wfm-help-gallery-27"><b>Send to LI node</b> button (toolbar, next to Send GenUI Image): uploads the selected image and writes its filename into the image widget of the currently selected node on the ComfyUI canvas (falling back to the first LoadImage-type node found) — same destination as Image Edit tab's Send to LI node; requires Workflow Studio to have been opened from ComfyUI's top menu button</li>
</ul>
</div>
<div class="wfm-help-card">
<h3 id="wfm-help-gallery-card-formats-title">Formats &amp; Auto-save</h3>
<ul>
<li id="wfm-help-gallery-10">Workflow auto-save: images generated in the Generate UI tab automatically have their workflow saved to gallery metadata and shown in the JSON tab</li>
<li id="wfm-help-gallery-11">Supports PNG (tEXt/iTXt), JPEG, WebP, GIF; workflow extraction reads ComfyUI prompt and workflow keys embedded in PNG metadata</li>
<li id="wfm-help-gallery-11">Supports PNG (tEXt/iTXt), JPEG, WebP, GIF, MP4; workflow extraction reads ComfyUI prompt/workflow keys embedded in PNG metadata or in MP4 container tags (as written by SaveVideo, e.g. MiniMax H3 output)</li>
</ul>
</div>
</div>
@@ -1848,7 +1864,7 @@
<div class="wfm-help-card">
<h3 id="wfm-help-sidepanel-card-info-title">Information (I) tab</h3>
<ul>
<li id="wfm-help-sidepanel-13">I tab (Information): drop a ComfyUI PNG/WebP/JSON to inspect model, LoRA, and prompt metadata in the side panel — sub-tabs: model / lora / Prompts; supports UnetLoaderGGUF and QuadrupleCLIPLoader node types</li>
<li id="wfm-help-sidepanel-13">I tab (Information): drop a ComfyUI PNG/WebP/MP4/JSON to inspect model, LoRA, and prompt metadata in the side panel — sub-tabs: model / lora / Prompts; supports UnetLoaderGGUF and QuadrupleCLIPLoader node types; MP4 reads the workflow/prompt tags embedded by SaveVideo, including all-in-one video nodes like MiniMax H3 ImageToVideo</li>
<li id="wfm-help-sidepanel-14">Information tab — drag items to canvas: model sub-tab places the loader node (Checkpoint → CheckpointLoaderSimple, VAE → VAELoader, Diffusion Model → UNETLoader, Text Encoder → CLIPLoader); double-click also places at canvas center</li>
<li id="wfm-help-sidepanel-15">Information tab — LoRA sub-tab: drag individual LoRA to place LoraLoader; "Multiple LORA" section at bottom places all LoRAs in a single Lora Loader (LoraManager) node; Prompts sub-tab: drag a prompt to place CLIPTextEncode node with text pre-filled; click prompt to view full text and copy</li>
</ul>
@@ -1903,7 +1919,7 @@
</div>
<div class="wfm-help-card">
<h3 id="wfm-help-ai-card-settings-title">Settings pane</h3>
<p id="wfm-help-ai-6">Settings pane: choose backend (Ollama / LM Studio / Lemonade / Unsloth), set API URL, test connection, select model; Unsloth always requires an API key even for local access — set UNSLOTH_API_KEY in a .env file in the plugin folder (copy .env.example) and restart ComfyUI, the key is read server-side and never sent to the browser; Unsloth also requires "Auto model switching (OpenAI API)" to be turned ON in the Unsloth Desktop app itself (its own Settings screen) — without it, requests fail with HTTP 404 unless a model was already manually loaded in the Unsloth Studio UI; Unsloth reasoning models return their thinking in a separate reasoning_content field rather than inline &lt;think&gt; tags, so a low Max tokens can make the model spend its whole budget reasoning and return an empty reply — increase Max tokens (2048+) if replies come back blank; Generation section — Thinking mode toggle (off by default; Ollama receives a `think` flag, and regardless of backend any &lt;think&gt;...&lt;/think&gt; block is stripped from the output when off, so reasoning models don't clutter Translation/Chat/TOOLS results) and Max tokens (Ollama: num_predict, LM Studio/Lemonade/Unsloth: max_tokens; 0 = unlimited); configure Free language names; Chat Image Generation section lets you enable a dedicated workflow for Chat-triggered text-to-image generation instead of the one currently loaded in GenerateUI; Chat I2I Generation section is the same but for image-to-image generation when an image is attached; settings are shared with the Library panel's A tab via localStorage</p>
<p id="wfm-help-ai-6">Settings pane: choose backend (Ollama / LM Studio / Lemonade / Unsloth), set API URL, test connection, select model, and use the Unload Model button (next to Test connection) to free the loaded model from VRAM/memory &mdash; Ollama uses keep_alive:0, LM Studio uses /api/v1/models/unload, Lemonade uses /api/v1/unload; Unsloth has no unload API, so this shows an unsupported message for it; Unsloth always requires an API key even for local access — set UNSLOTH_API_KEY in a .env file in the plugin folder (copy .env.example) and restart ComfyUI, the key is read server-side and never sent to the browser; Unsloth also requires "Auto model switching (OpenAI API)" to be turned ON in the Unsloth Desktop app itself (its own Settings screen) — without it, requests fail with HTTP 404 unless a model was already manually loaded in the Unsloth Studio UI; Unsloth reasoning models return their thinking in a separate reasoning_content field rather than inline &lt;think&gt; tags, so a low Max tokens can make the model spend its whole budget reasoning and return an empty reply — increase Max tokens (2048+) if replies come back blank; Generation section — Thinking mode toggle (off by default; Ollama receives a `think` flag, and regardless of backend any &lt;think&gt;...&lt;/think&gt; block is stripped from the output when off, so reasoning models don't clutter Translation/Chat/TOOLS results) and Max tokens (Ollama: num_predict, LM Studio/Lemonade/Unsloth: max_tokens; 0 = unlimited); configure Free language names; Chat Image Generation section lets you enable a dedicated workflow for Chat-triggered text-to-image generation instead of the one currently loaded in GenerateUI; Chat I2I Generation section is the same but for image-to-image generation when an image is attached; settings are shared with the Library panel's A tab via localStorage</p>
</div>
</div>
@@ -1915,7 +1931,7 @@
<div class="wfm-help-card">
<h3 id="wfm-help-tagger-card-overview-title">Overview &amp; Setup</h3>
<ul>
<li id="wfm-help-tagger-1">Automatic image tagging using WD Tagger (ONNX), SwinV2, DeepDanbooru (.h5), and Ollama VLM — 3 sub-tabs: Single / Batch / DB</li>
<li id="wfm-help-tagger-1">Automatic image tagging using WD Tagger (ONNX), SwinV2, DeepDanbooru (.h5), and VLM (Ollama / LM Studio / Lemonade / Unsloth) — 3 sub-tabs: Single / Batch / DB</li>
<li id="wfm-help-tagger-2">Model placement: put each model in its own subfolder under ComfyUI/models/tagger/&lt;model-name&gt;/; the folder must contain a .onnx file + selected_tags.csv (or .h5 + label file for DeepDanbooru)</li>
<li id="wfm-help-tagger-9">Install dependencies into ComfyUI's embedded Python: python_embeded\python.exe -m pip install -r requirements.txt; for GPU ONNX inference install onnxruntime-gpu instead of onnxruntime; TensorFlow (for DeepDanbooru) is commented out by default due to size</li>
</ul>
@@ -1925,7 +1941,7 @@
<ul>
<li id="wfm-help-tagger-3">Single tab: drag &amp; drop an image onto the preview area, or click Upload to pick a file; the Tagger button in the Gallery detail panel opens the selected image directly here</li>
<li id="wfm-help-tagger-4">Threshold slider: minimum confidence score for general tags (default 0.35); Character Threshold: separate threshold for character: prefix tags (default 0.85)</li>
<li id="wfm-help-tagger-5">Ollama VLM: enable the checkbox to run a vision model alongside WD Tagger; set API URL, select model (click ↻ to refresh), and customize the prompt; results from both models are merged</li>
<li id="wfm-help-tagger-5">VLM Tagging: enable the checkbox to run a vision model alongside WD Tagger; click the &#9881; Settings button to choose backend (Ollama / LM Studio / Lemonade / Unsloth), URL, model, Thinking mode, Max tokens, and unload the model &mdash; independent from the Prompt tab's own AI settings; customize the prompt and Max Tags inline; results from both models are merged</li>
</ul>
</div>
<div class="wfm-help-card">
@@ -1937,7 +1953,7 @@
<div class="wfm-help-card">
<h3 id="wfm-help-tagger-card-batch-title">Batch &amp; DB Tabs</h3>
<ul>
<li id="wfm-help-tagger-7">Batch tab: enter a folder path, configure WD Tagger and Ollama settings; output options: Save to DB (default on), Write to File (EXIF/PNG metadata), Write .txt (creates &lt;filename&gt;.txt alongside each image); click Start Batch to process all images in the folder; progress bar and log are updated in real time; Stop cancels after the current image</li>
<li id="wfm-help-tagger-7">Batch tab: enter a folder path, configure WD Tagger and enable VLM tagging (uses the same &#9881; Settings as the Single tab); output options: Save to DB (default on), Write to File (EXIF/PNG metadata), Write .txt (creates &lt;filename&gt;.txt alongside each image); click Start Batch to process all images in the folder; progress bar and log are updated in real time; Stop cancels after the current image</li>
<li id="wfm-help-tagger-8">DB tab: searchable database of all tagged images; click a row to open the edit panel and modify WD Tags / VLM Tags; Save updates the record, Delete removes it; Export CSV downloads all records as a CSV file</li>
</ul>
</div>
@@ -2051,8 +2067,7 @@
<ul>
<li id="wfm-help-imageedit-17">Save PNG: composites all visible layers and downloads the result as a PNG file</li>
<li id="wfm-help-imageedit-18">Save to Gallery: prompts for a filename (default: wfs-image-YYYYMMDDHHmmss) and saves the composite PNG directly to the Gallery root folder (configured in Settings &gt; Gallery Output Folder); requires the Gallery tab to have been opened at least once to set the root</li>
<li id="wfm-help-imageedit-19">Save to Input: uploads the composite PNG to ComfyUI's input folder via /upload/image, making it selectable in Load Image nodes</li>
<li id="wfm-help-imageedit-19b">Send to Workflow: uploads the composite PNG (same as Save to Input) and additionally writes the resulting filename into the image widget of the currently selected node in the ComfyUI graph, falling back to the first LoadImage-type node found; requires Workflow Studio to have been opened from ComfyUI's top menu button so the ComfyUI tab is reachable</li>
<li id="wfm-help-imageedit-19b">Send to Workflow: uploads the composite PNG to ComfyUI's input folder via /upload/image and writes the resulting filename into the image widget of the currently selected node in the ComfyUI graph, falling back to the first LoadImage-type node found; requires Workflow Studio to have been opened from ComfyUI's top menu button so the ComfyUI tab is reachable</li>
<li id="wfm-help-imageedit-20">Canvas navigation: scroll wheel to zoom, Space + drag to pan</li>
<li id="wfm-help-imageedit-21">Undo / Redo: Ctrl+Z / Ctrl+Y (or toolbar buttons ↩ ↪)</li>
</ul>
@@ -2073,6 +2088,24 @@
</div>
</div>
<div class="wfm-help-page" id="wfm-help-page-video">
<h2 id="wfm-help-video-title">Video Tab</h2>
<p id="wfm-help-video-desc">A dedicated video generation tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows, independent of the GenerateUI tab.</p>
<div class="wfm-help-card">
<ul>
<li id="wfm-help-video-1">Set first_frame (optional) / last_frame (optional) images, prompt, aspect_ratio / megapixels / multiple (resolution), duration (seconds), and noise_seed, then click Generate. Leaving first_frame empty runs the workflow text-only (bypassed), and workflows with no LoadImage node at all are also supported.</li>
<li id="wfm-help-video-2">Model selection (UNet / CLIP / VAE / Audio VAE) is fixed to the loaded workflow's defaults and cannot be changed from this tab. For workflows with no ResolutionSelector node (e.g. Wan2.2), resolution also stays fixed to the loaded workflow's defaults and the Aspect Ratio / Megapixels / Multiple fields are disabled.</li>
<li id="wfm-help-video-3">Use the "Load in Video" button in the Workflow tab's detail modal to load a workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, or a Wan2.2 Text-to-Video node. Unsupported workflows show an error instead.</li>
<li id="wfm-help-video-4">Generated videos (mp4) can also be browsed and played back in the Gallery tab.</li>
<li id="wfm-help-video-5">The Video Source panel next to the preview lets you drop or pick any local video (not just a generated one) to use the Frame/GIF tools below without running the loaded video workflow first; Clear resets it back to empty.</li>
<li id="wfm-help-video-6">Frame tab (right panel): play/seek the preview video to the position you want, click Capture Frame to grab that frame client-side, then Save to Output to write it as a PNG into ComfyUI's output folder.</li>
<li id="wfm-help-video-7">GIF tab (right panel): set Start/End (seconds), FPS, and an optional Max Width, then Convert to GIF — the server decodes the video and encodes an animated GIF into ComfyUI's output folder.</li>
<li id="wfm-help-video-8">Highlight color: the Prompt / Duration / First Frame / Last Frame / Aspect Ratio / Megapixels / Multiple labels turn the same highlight color as the GenerateUI Model tab (customizable in the Settings tab) when the loaded workflow actually supports that field — e.g. for a Wan2.2 workflow (no ResolutionSelector node), the Aspect Ratio / Megapixels / Multiple labels stay unhighlighted since those fields are disabled.</li>
</ul>
</div>
<button class="wfm-help-jump-btn wfm-btn wfm-btn-sm" data-jump-tab="video">Go to Video Tab</button>
</div>
<div class="wfm-help-page" id="wfm-help-page-shortcuts">
<div class="wfm-help-article-header">
<h2 id="wfm-help-shortcuts-title">Keyboard Shortcuts</h2>
@@ -2205,6 +2238,7 @@
<option value="name_asc">Name A-Z</option>
<option value="name_desc">Name Z-A</option>
</select>
<button id="wfm-gallery-clear-filters-btn" class="wfm-btn wfm-btn-sm" title="Clear all filters"></button>
<div class="wfm-view-btns">
<button class="wfm-view-btn active" data-gallery-view="thumb" title="Thumbnail">&#8862;</button>
<button class="wfm-view-btn" data-gallery-view="table" title="Table">&#8801;</button>
@@ -2213,8 +2247,8 @@
<button id="wfm-gallery-refresh-btn" class="wfm-btn wfm-btn-sm">Refresh</button>
<button id="wfm-gallery-send-image-edit-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to Image Edit tab">Image Edit</button>
<button id="wfm-gallery-send-genui-image-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to GenerateUI Image input">Send GenUI Image</button>
<button id="wfm-gallery-send-li-node-btn" class="wfm-btn wfm-btn-sm" title="Upload and write selected image's filename into the selected node's image widget (e.g. LoadImage)">Send to LI node</button>
<button id="wfm-gallery-send-cc-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to ComfyUI Comic Creator's selected panel" style="display:none;">Send CC</button>
<button id="wfm-gallery-clear-filters-btn" class="wfm-btn wfm-btn-sm" title="Clear all filters"></button>
</div>
<!-- 複数選択時の一括操作バー -->
<div id="wfm-gallery-bulk-bar" class="wfm-gallery-bulk-bar" style="display:none;">
@@ -2276,14 +2310,16 @@
</div>
<div class="wfm-gallery-detail-action-row">
<button id="wfm-gallery-open-metadata-btn" class="wfm-gallery-action-btn wfm-gallery-action-btn-green" title="Open in Metadata tab (or Alt+click image)">Metadata</button>
<button id="wfm-gallery-load-genui-btn" class="wfm-gallery-action-btn wfm-gallery-action-btn-primary" title="Load workflow into GenerateUI">Load GenUI</button>
<button id="wfm-gallery-load-genui-btn" class="wfm-gallery-action-btn wfm-gallery-action-btn-primary" title="Load workflow into GenerateUI">GenUI</button>
<button id="wfm-gallery-open-tagger-btn" class="wfm-gallery-action-btn wfm-gallery-action-btn-tagger" title="Open in Tagger"></button>
<button id="wfm-gallery-download-btn" class="wfm-gallery-action-btn wfm-gallery-action-btn-orange" title="Download">Download</button>
</div>
<!-- Info タブ -->
<div id="wfm-gallery-detail-info" class="wfm-gallery-detail-tab-content" style="display:none;">
<div class="wfm-gallery-info-section">
<div class="wfm-gallery-info-row" id="wfm-gallery-info-name"></div>
<div class="wfm-gallery-info-row" id="wfm-gallery-info-size"></div>
<div class="wfm-gallery-info-row" id="wfm-gallery-info-dim"></div>
<div class="wfm-gallery-info-row" id="wfm-gallery-info-date"></div>
</div>
<!-- ImagePromptサイドカー ( .txt / ponyxlWildcardsVault 由来のプロンプトがある画像のみ表示) -->
@@ -2497,8 +2533,8 @@
<div class="wfm-metadata-col1">
<div class="wfm-metadata-drop-zone" id="wfm-meta-drop">
<div class="wfm-meta-drop-label" id="wfm-meta-drop-label">
<div class="wfm-meta-drop-main">Drop image / JSON</div>
<div class="wfm-meta-drop-sub">PNG · WebP · JSON</div>
<div class="wfm-meta-drop-main">Drop image / video / JSON</div>
<div class="wfm-meta-drop-sub">PNG · WebP · MP4 · JSON</div>
</div>
<img id="wfm-meta-preview-img" class="wfm-meta-preview-img" style="display:none;" alt="preview">
</div>
@@ -2506,13 +2542,13 @@
<div class="wfm-meta-format-note" id="wfm-meta-format-note">
<div class="wfm-meta-format-note-title" id="wfm-meta-format-note-title">Supported formats</div>
<ul class="wfm-meta-format-list">
<li id="wfm-meta-fmt-comfyui">ComfyUI — PNG / WebP / JSON</li>
<li id="wfm-meta-fmt-comfyui">ComfyUI — PNG / WebP / MP4 / JSON</li>
<li id="wfm-meta-fmt-sdwebui">SD WebUI / SD Forge — PNG (parameters)</li>
<li id="wfm-meta-fmt-fooocus">Fooocus — PNG (fooocus_scheme)</li>
</ul>
<div class="wfm-meta-format-todo" id="wfm-meta-format-todo">Flux.2 / Qwen-Image / Z-Image subgraph workflows supported</div>
</div>
<input type="file" id="wfm-meta-file-input" accept="image/png,image/webp,.json,application/json" style="display:none;">
<input type="file" id="wfm-meta-file-input" accept="image/png,image/webp,video/mp4,.mp4,.json,application/json" style="display:none;">
</div>
<!-- Col2: Model info -->
@@ -2592,8 +2628,7 @@
<button class="wfm-btn wfm-btn-sm" id="ie-redo-btn" title="Redo (Ctrl+Y)">↪</button>
<button class="wfm-btn wfm-btn-sm" id="ie-save-btn">Save PNG</button>
<button class="wfm-btn wfm-btn-sm" id="ie-save-gallery-btn" title="Save to Gallery root folder">Save to Gallery</button>
<button class="wfm-btn wfm-btn-sm" id="ie-upload-comfy-btn">Save to Input</button>
<button class="wfm-btn wfm-btn-sm" id="ie-send-workflow-btn" title="Upload and write this image's filename into the selected node's image widget (e.g. LoadImage)">Send to Workflow</button>
<button class="wfm-btn wfm-btn-sm" id="ie-send-workflow-btn" title="Upload and write this image's filename into the selected node's image widget (e.g. LoadImage)">Send to LI node</button>
</div>
<!-- Tool options -->
@@ -2650,6 +2685,168 @@
</div>
</section>
<!-- Video Tab (MiniMax H3 / LTX-2.5対応・GenerateUIタブとは独立) -->
<section id="wfm-tab-video" class="wfm-tab-content">
<div class="wfm-video-layout">
<div class="wfm-video-form-panel">
<div class="wfm-video-header">
<h3 id="wfm-video-title-label">Video</h3>
<span id="wfm-video-wf-name" class="wfm-video-wf-name">No workflow loaded</span>
</div>
<div class="wfm-video-frame-slots">
<div class="wfm-video-frame-slot">
<label id="wfm-video-first-frame-label">First Frame (optional)</label>
<div class="wfm-i2i-preview-wrap" id="wfm-video-first-frame-wrap" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-video-first-frame-preview">
</div>
<div class="wfm-i2i-drop-zone" id="wfm-video-first-frame-drop">
<label class="wfm-i2i-drop-label">
<span id="wfm-video-first-frame-drop-label">Drop image or click to select</span>
<input type="file" accept="image/*" id="wfm-video-first-frame-file" style="display:none;">
</label>
</div>
<div style="display:flex;gap:6px;align-items:center;">
<span class="wfm-i2i-status" id="wfm-video-first-frame-status" style="flex:1;"></span>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-first-frame-clear">Clear</button>
</div>
</div>
<div class="wfm-video-frame-slot">
<label id="wfm-video-last-frame-label">Last Frame (optional)</label>
<div class="wfm-i2i-preview-wrap" id="wfm-video-last-frame-wrap" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-video-last-frame-preview">
</div>
<div class="wfm-i2i-drop-zone" id="wfm-video-last-frame-drop">
<label class="wfm-i2i-drop-label">
<span id="wfm-video-last-frame-drop-label">Drop image or click to select</span>
<input type="file" accept="image/*" id="wfm-video-last-frame-file" style="display:none;">
</label>
</div>
<div style="display:flex;gap:6px;align-items:center;">
<span class="wfm-i2i-status" id="wfm-video-last-frame-status" style="flex:1;"></span>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-last-frame-clear">Clear</button>
</div>
</div>
</div>
<label for="wfm-video-prompt" id="wfm-video-prompt-label">Prompt</label>
<textarea id="wfm-video-prompt" class="wfm-textarea" rows="6"></textarea>
<div class="wfm-video-resolution-row">
<div>
<label for="wfm-video-aspect-ratio" id="wfm-video-aspect-ratio-label">Aspect Ratio</label>
<select id="wfm-video-aspect-ratio" class="wfm-input"></select>
</div>
<div>
<label for="wfm-video-megapixels" id="wfm-video-megapixels-label">Megapixels</label>
<input type="number" id="wfm-video-megapixels" class="wfm-input" step="0.01" min="0.01" value="0.2">
</div>
<div>
<label for="wfm-video-multiple" id="wfm-video-multiple-label">Multiple</label>
<input type="number" id="wfm-video-multiple" class="wfm-input" step="8" min="8" value="32">
</div>
</div>
<div class="wfm-video-resolution-row">
<div>
<label for="wfm-video-duration" id="wfm-video-duration-label">Duration (seconds)</label>
<input type="number" id="wfm-video-duration" class="wfm-input" step="0.5" min="0.5" value="2">
</div>
<div>
<label for="wfm-video-noise-seed" id="wfm-video-noise-seed-label">Noise Seed</label>
<input type="number" id="wfm-video-noise-seed" class="wfm-input" value="0">
</div>
<div class="wfm-video-seed-randomize-wrap">
<label><input type="checkbox" id="wfm-video-seed-randomize" checked> <span id="wfm-video-randomize-label">Randomize</span></label>
</div>
</div>
<div style="display:flex;align-items:center;gap:10px;margin-top:10px;">
<button id="wfm-video-generate-btn" class="wfm-btn wfm-btn-primary" style="flex:1;">Generate</button>
</div>
<div class="wfm-gen-progress-container">
<div class="wfm-gen-progress-track">
<div id="wfm-video-progress-bar" class="wfm-gen-progress-bar"></div>
</div>
<span id="wfm-video-progress-text" class="wfm-gen-progress-text">Ready</span>
</div>
</div>
<!-- 中央ペイン: プレビュー(生成結果 or ドロップされた任意の動画) + 編集(将来機能用プレースホルダー) -->
<div class="wfm-video-center-panel">
<div class="wfm-video-preview-row">
<div class="wfm-video-preview-frame" id="wfm-video-preview-frame">
<span class="wfm-placeholder" id="wfm-video-preview-placeholder">No video</span>
<video id="wfm-video-preview-video" class="wfm-video-preview-el" controls style="display:none;"></video>
</div>
<div class="wfm-video-source-panel">
<div class="wfm-video-pane-header" id="wfm-video-source-label">Video Source</div>
<p class="wfm-video-prop-hint" id="wfm-video-source-hint">Load any video here to use Frame/GIF tools without generating one.</p>
<div class="wfm-i2i-drop-zone" id="wfm-video-source-drop">
<label class="wfm-i2i-drop-label">
<span id="wfm-video-source-drop-label">Drop video or click to select</span>
<input type="file" accept="video/*" id="wfm-video-source-file" style="display:none;">
</label>
</div>
<div style="display:flex;gap:6px;align-items:center;margin-top:6px;">
<span class="wfm-i2i-status" id="wfm-video-source-status" style="flex:1;"></span>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-clear">Clear</button>
</div>
</div>
</div>
<div class="wfm-video-edit-panel">
<span id="wfm-video-edit-placeholder-label" class="wfm-placeholder">Editing tools coming soon</span>
</div>
</div>
<!-- 右ペイン: プロパティ(Frame抽出 / GIF変換の2タブ) -->
<div class="wfm-video-properties-panel">
<div class="wfm-video-prop-tabnav">
<button type="button" class="wfm-video-prop-tab active" data-prop-tab="frame" id="wfm-video-prop-tab-frame">Frame</button>
<button type="button" class="wfm-video-prop-tab" data-prop-tab="gif" id="wfm-video-prop-tab-gif">GIF</button>
</div>
<div id="wfm-video-prop-frame" class="wfm-video-prop-content active">
<p class="wfm-video-prop-hint" id="wfm-video-frame-hint">Play/seek the preview video to the position you want, then capture.</p>
<button type="button" id="wfm-video-frame-capture-btn" class="wfm-btn wfm-btn-sm" style="width:100%;">Capture Frame</button>
<div class="wfm-i2i-preview-wrap" id="wfm-video-frame-preview-wrap" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-video-frame-preview-img">
</div>
<button type="button" id="wfm-video-frame-save-btn" class="wfm-btn wfm-btn-primary wfm-btn-sm" style="width:100%;margin-top:6px;" disabled>Save to Output</button>
<span class="wfm-i2i-status" id="wfm-video-frame-status"></span>
</div>
<div id="wfm-video-prop-gif" class="wfm-video-prop-content" style="display:none;">
<div class="wfm-lab-field-row">
<label id="wfm-video-gif-start-label">Start (s)</label>
<input type="number" id="wfm-video-gif-start" class="wfm-input" value="0" min="0" step="0.1">
</div>
<div class="wfm-lab-field-row">
<label id="wfm-video-gif-end-label">End (s)</label>
<input type="number" id="wfm-video-gif-end" class="wfm-input" placeholder="end" min="0" step="0.1">
</div>
<div class="wfm-lab-field-row">
<label id="wfm-video-gif-fps-label">FPS</label>
<input type="number" id="wfm-video-gif-fps" class="wfm-input" value="10" min="1" max="30">
</div>
<div class="wfm-lab-field-row">
<label id="wfm-video-gif-width-label">Max Width</label>
<input type="number" id="wfm-video-gif-width" class="wfm-input" placeholder="original" min="16">
</div>
<button type="button" id="wfm-video-gif-convert-btn" class="wfm-btn wfm-btn-primary wfm-btn-sm" style="width:100%;margin-top:8px;">Convert to GIF</button>
<div class="wfm-gen-progress-container" style="margin-top:8px;">
<div class="wfm-gen-progress-track">
<div id="wfm-video-gif-progress-bar" class="wfm-gen-progress-bar"></div>
</div>
<span id="wfm-video-gif-progress-text" class="wfm-gen-progress-text"></span>
</div>
<div class="wfm-i2i-preview-wrap" id="wfm-video-gif-preview-wrap" style="display:none;">
<img class="wfm-i2i-preview-img" id="wfm-video-gif-preview-img">
</div>
<span class="wfm-i2i-status" id="wfm-video-gif-status"></span>
</div>
</div>
</div>
</section>
<!-- Tagger Tab -->
<section id="wfm-tab-tagger" class="wfm-tab-content">
<div class="wfm-tagger-subtab-nav">
@@ -2708,13 +2905,8 @@
</div>
<div id="wfm-tagger-ollama-settings" style="display:none">
<div class="wfm-form-row wfm-tagger-form-row">
<label class="wfm-tagger-label" id="wfm-tagger-ollama-url-label"></label>
<input type="text" id="wfm-tagger-ollama-url" class="wfm-search-input" value="http://127.0.0.1:11434" style="flex:1;">
</div>
<div class="wfm-form-row wfm-tagger-form-row">
<label class="wfm-tagger-label" id="wfm-tagger-ollama-model-label"></label>
<select id="wfm-tagger-ollama-model" class="wfm-select wfm-tagger-select"></select>
<button id="wfm-tagger-ollama-refresh-btn" class="wfm-btn wfm-btn-sm" title="Refresh models">↻</button>
<span id="wfm-tagger-ollama-backend-value" style="flex:1;color:var(--wfm-text-secondary);font-size:12px;"></span>
<button id="wfm-tagger-ollama-settings-btn" class="wfm-btn wfm-btn-sm" title="Settings">&#9881;</button>
</div>
<div class="wfm-form-row wfm-tagger-form-row" style="align-items:flex-start">
<label class="wfm-tagger-label" id="wfm-tagger-ollama-prompt-label" style="padding-top:4px;"></label>
@@ -2776,18 +2968,13 @@
<div class="wfm-tagger-section-header">
<label style="display:flex;align-items:center;gap:6px;cursor:pointer;font-weight:600;">
<input type="checkbox" id="wfm-tagger-batch-ollama-enable">
Ollama VLM
<span id="wfm-tagger-batch-ollama-header-label">VLM Tagging</span>
</label>
</div>
<div id="wfm-tagger-batch-ollama-settings">
<div class="wfm-form-row wfm-tagger-form-row">
<label class="wfm-tagger-label" id="wfm-tagger-batch-url-label"></label>
<input type="text" id="wfm-tagger-batch-ollama-url" class="wfm-search-input" value="http://127.0.0.1:11434" style="flex:1;">
</div>
<div class="wfm-form-row wfm-tagger-form-row">
<label class="wfm-tagger-label" id="wfm-tagger-batch-model-label"></label>
<select id="wfm-tagger-batch-ollama-model" class="wfm-select wfm-tagger-select"></select>
<button id="wfm-tagger-batch-ollama-refresh-btn" class="wfm-btn wfm-btn-sm">↻</button>
<span id="wfm-tagger-batch-backend-value" style="flex:1;color:var(--wfm-text-secondary);font-size:12px;"></span>
<button id="wfm-tagger-batch-ollama-settings-btn" class="wfm-btn wfm-btn-sm" title="Settings">&#9881;</button>
</div>
<div class="wfm-form-row wfm-tagger-form-row" style="align-items:flex-start">
<label class="wfm-tagger-label" id="wfm-tagger-batch-prompt-label" style="padding-top:4px;"></label>
@@ -3015,6 +3202,7 @@
</div>
<div class="wfm-ai-settings-row">
<button id="wfm-ai-test-btn" class="wfm-btn">Test connection</button>
<button id="wfm-ai-unload-btn" class="wfm-btn">Unload Model</button>
<span id="wfm-ai-test-result" class="wfm-ai-test-result"></span>
</div>
</div>
+101 -7
View File
@@ -673,9 +673,9 @@ window.wfmOpenMaskEditorForNode = async (imageDataUrl, maskDataUrl) => {
};
// ============================================
// Cross-window bridge for SPA "Send to Workflow"
// Cross-window bridge for SPA "Send to LI node"
// ============================================
// WFS Image Edit タブから呼ばれる。アップロード済みの画像ファイル名を、現在ComfyUIキャンバス上で
// WFS Image Edit / Galleryタブから呼ばれる。アップロード済みの画像ファイル名を、現在ComfyUIキャンバス上で
// 選択中のノードの "image" ウィジェット(LoadImage / LoadImage 互換ノード)へ書き込む。
// 選択ノードに該当ウィジェットが無ければグラフ内の最初の該当ノードにフォールバックする。
// chat_TE カスタムノードの "Send to workflow" ボタンと同じロジック。
@@ -2553,6 +2553,81 @@ async function _readAllPNGTextChunks(file) {
return chunks;
}
// ── MP4 container metadata (moov/udta/meta の mdta keys/ilst) ──
// ComfyUIのSaveVideoはPNGのtEXtチャンクと同じキー名(workflow=UI形式, prompt=API形式)で
// JSON文字列をisobmff(mp4)のudta/meta(mdta)にコンテナレベルタグとして書き込む(FFmpegの
// movflags=+use_metadata_tags)。static/js/metadata-tab.js の readMP4MetaTags() と同一ロジック。
function _findMP4Box(view, bytes, start, end, targetType) {
let offset = start;
while (offset + 8 <= end) {
const size = view.getUint32(offset);
const type = String.fromCharCode(bytes[offset + 4], bytes[offset + 5], bytes[offset + 6], bytes[offset + 7]);
let boxSize = size;
let bodyStart = offset + 8;
if (size === 1) {
if (offset + 16 > end) break;
const hi = view.getUint32(offset + 8);
const lo = view.getUint32(offset + 12);
boxSize = hi * 4294967296 + lo;
bodyStart = offset + 16;
} else if (size === 0) {
boxSize = end - offset;
}
if (boxSize < 8) break;
if (type === targetType) return { bodyStart, end: offset + boxSize };
offset += boxSize;
}
return null;
}
async function _readMP4MetaTags(file) {
const buffer = await file.arrayBuffer();
const bytes = new Uint8Array(buffer);
const view = new DataView(buffer);
if (bytes.length < 12) return null;
const ftyp = String.fromCharCode(bytes[4], bytes[5], bytes[6], bytes[7]);
if (ftyp !== "ftyp") return null;
const moov = _findMP4Box(view, bytes, 0, bytes.length, "moov");
if (!moov) return null;
const udta = _findMP4Box(view, bytes, moov.bodyStart, moov.end, "udta");
let meta = udta ? _findMP4Box(view, bytes, udta.bodyStart, udta.end, "meta") : null;
if (!meta) meta = _findMP4Box(view, bytes, moov.bodyStart, moov.end, "meta");
if (!meta) return null;
const metaBody = meta.bodyStart + 4; // meta は FullBox (version+flags 4バイト)
const keysBox = _findMP4Box(view, bytes, metaBody, meta.end, "keys");
const ilstBox = _findMP4Box(view, bytes, metaBody, meta.end, "ilst");
if (!keysBox || !ilstBox) return null;
const utf8 = new TextDecoder("utf-8", { fatal: false });
let off = keysBox.bodyStart + 4; // version+flags をスキップ
const count = view.getUint32(off); off += 4;
const keyNames = [];
for (let i = 0; i < count && off + 8 <= keysBox.end; i++) {
const ksize = view.getUint32(off);
if (ksize < 8) break;
keyNames.push(utf8.decode(bytes.slice(off + 8, off + ksize)));
off += ksize;
}
const result = {};
let ioff = ilstBox.bodyStart;
while (ioff + 8 <= ilstBox.end) {
const itemSize = view.getUint32(ioff);
const keyIndex = view.getUint32(ioff + 4);
if (itemSize < 8) break;
const itemEnd = Math.min(ioff + itemSize, ilstBox.end);
const data = _findMP4Box(view, bytes, ioff + 8, itemEnd, "data");
if (data) {
const payload = bytes.slice(data.bodyStart + 8, data.end); // type(4)+locale(4)をスキップ
const name = keyNames[keyIndex - 1];
if (name) { try { result[name] = utf8.decode(payload); } catch { /* skip */ } }
}
ioff = itemEnd;
}
return result;
}
// ============================================
// UI→API変換(static/js/comfyui-workflow.js の convertUiToApi() 相当ロジックの複製)
// web/comfyui/ は static/js/ と配信URLが異なりESモジュールをimportできないため、
@@ -3330,6 +3405,13 @@ function _extractPromptsAPI(wf) {
if (combined) textMap.set(id, combined);
continue;
}
// MiniMaxH3ImageToVideo等の動画生成オールインワンノード。CLIPTextEncode等を経由せず
// 自ノードの"prompt"入力に直接テキストを持つ(positive/negativeの区別も無い)ため、
// _isTextEncoderNode判定を通さずtextMapへ直接投入する(fallbackのtextsに載る)。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo/i.test(ct)) {
textMap.set(id, n.inputs.prompt);
continue;
}
if (!_isTextEncoderNode(ct)) continue;
// "prompt" — TextEncodeQwenImageEdit(Plus)/TextEncodeBooguEdit and similar Image Edit
// model text encoders use this key instead of "text"/"text_g".
@@ -3457,6 +3539,7 @@ 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");
const isMP4 = file.type === "video/mp4" || name.endsWith(".mp4");
async function fromWorkflow(originalWf, source) {
let wf = originalWf;
@@ -3492,6 +3575,17 @@ async function _extractAllMetadata(file) {
const wf = _extractWorkflowFromEXIF(exif);
return wf ? await fromWorkflow(wf, "comfyui") : null;
}
if (isMP4) {
let tags; try { tags = await _readMP4MetaTags(file); } catch { return null; }
if (!tags) return null;
for (const key of ["prompt", "workflow"]) {
const raw = tags[key];
if (!raw) continue;
let wf; try { wf = JSON.parse(_sanitizeJSON(raw)); } catch { continue; }
if (wf) return await fromWorkflow(wf, "comfyui");
}
return null;
}
// PNG
const chunks = await _readAllPNGTextChunks(file);
if (!chunks) return null;
@@ -3601,7 +3695,7 @@ const setupInfoDropHandlers = (container) => {
const renderInfoModels = (container, meta) => {
container.innerHTML = "";
if (!meta) {
container.innerHTML = `<div class="wfm-nlp-info-empty">Drop a PNG/WebP/JSON file to view model info</div>`;
container.innerHTML = `<div class="wfm-nlp-info-empty">Drop a PNG/WebP/MP4/JSON file to view model info</div>`;
return;
}
const sections = [
@@ -3640,7 +3734,7 @@ const renderInfoModels = (container, meta) => {
const renderInfoLoras = (container, meta) => {
container.innerHTML = "";
if (!meta || !meta.loras || meta.loras.length === 0) {
container.innerHTML = `<div class="wfm-nlp-info-empty">${meta ? "No LoRA found" : "Drop a PNG/WebP/JSON file to view LoRA info"}</div>`;
container.innerHTML = `<div class="wfm-nlp-info-empty">${meta ? "No LoRA found" : "Drop a PNG/WebP/MP4/JSON file to view LoRA info"}</div>`;
return;
}
for (const lora of meta.loras) {
@@ -3689,7 +3783,7 @@ const renderInfoPrompts = (container, meta) => {
const promptFull = panelEl?.querySelector("#wfm-nlp-info-prompt-full");
const promptFullLabel = panelEl?.querySelector("#wfm-nlp-info-prompt-full-label");
if (!meta) {
container.innerHTML = `<div class="wfm-nlp-info-empty">Drop a PNG/WebP/JSON file to view prompts</div>`;
container.innerHTML = `<div class="wfm-nlp-info-empty">Drop a PNG/WebP/MP4/JSON file to view prompts</div>`;
return;
}
const allPrompts = [
@@ -3754,8 +3848,8 @@ const renderInfoTab = (container) => {
<div class="wfm-nlp-info-layout">
<div class="wfm-nlp-info-drop" id="wfm-nlp-info-drop">
<img id="wfm-nlp-info-preview-img" style="display:none;max-width:100%;max-height:100%;object-fit:contain;pointer-events:none;">
<span id="wfm-nlp-info-drop-label" style="font-size:11px;color:var(--descrip-text,#999);pointer-events:none;">Drop PNG / WebP / JSON</span>
<input type="file" id="wfm-nlp-info-file-input" accept=".png,.webp,.json,image/png,image/webp,application/json" style="display:none;">
<span id="wfm-nlp-info-drop-label" style="font-size:11px;color:var(--descrip-text,#999);pointer-events:none;">Drop PNG / WebP / MP4 / JSON</span>
<input type="file" id="wfm-nlp-info-file-input" accept=".png,.webp,.mp4,.json,image/png,image/webp,video/mp4,application/json" style="display:none;">
</div>
<div id="wfm-nlp-info-fileinfo" class="wfm-nlp-info-fileinfo">—</div>
<div id="wfm-nlp-info-subcontent" class="wfm-nlp-info-subcontent"></div>