Compare commits

...
7 Commits
Author SHA1 Message Date
ketle-manandClaude Sonnet 5.5 092b83b35d feat: add Register as Asset, Edit audio conversion, and Video Source layout fix (v0.8.9)
- Video Source: "Register as Asset" copies the loaded video into output/video and tags it into Video Assets
- Video Edit: "Convert audio..." next to the crop buttons, sharing Gallery's convert dialog
- Video Source panel widened so the file name and three buttons fit on one line each
- Help text (helpVideo5/11) updated in en/ja/zh

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 20:25:36 +09:00
ketle-manandClaude Sonnet 5.5 b052826ac2 docs: distinguish official MOSS-Image templates from the custom manga workflow
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 10:25:24 +09:00
ketle-manandClaude Sonnet 5.5 1e18509a4a feat: support MOSS-Image and speed up the first GenerateUI check (v0.8.8)
- MOSS-Image (Base/SFT, T2I and bounding-box layout, 8-step LoRA): read the
  outer subgraph node's widgets_values_named (inputs[] omits some widget
  ports, so index lookup shifted model/sampler values), treat unions such as
  BOUNDING_BOX,ARRAY,STRING by their first segment, support the
  BOUNDING_BOXES widget ({"__value__": [...]} in the API prompt), detect
  MOSSImageLayoutPrompt as the positive prompt and propagate roles through
  linked PrimitiveString nodes
- Gallery Prompt tab converts subgraph UI workflows before extraction; the
  side-panel I tab's converter copy gets the same widgets_values_named fix
- Fetch /object_info/<type> only for the node types a workflow uses instead
  of the full /object_info (43 s -> 0.25 s on first conversion/check); drop
  the full pre-fetch when opening the workflow detail
- README / DEVLOG updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 10:18:42 +09:00
ketle-manandClaude Sonnet 5.5 a993702d86 feat: support Qwen Image 2.1 Turbo and Flux.3 Image Klein templates (v0.8.7)
- Qwen Image 2.1 Turbo (T2I/I2I): detect the positive prompt behind the
  prompt-enhancer ComfySwitchNode, duplicate outer links to every fan-out
  target when flattening subgraphs (enhancer BatchImagesNode was left
  unwired), and merge the enhancer's TextGenerate prompt with the switch's
  raw prompt through one shared PrimitiveStringMultiline
- Flux.3 Image Klein (4 templates): split positive/negative roles through
  ReferenceMultiLatent and hide the unused leftover EmptyFlux2LatentImage
- COMBO validation: prefer the choice whose file name matches before the
  choices[0] fallback (templates store model names without the sub-folder
  prefix, which silently swapped in an unrelated model)
- README: add Gallery semantic search screenshot

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-16 11:42:57 +09:00
ketle-manandClaude Sonnet 5.5 296f8df4d1 docs: DEVLOG - record follow-up candidates after v0.8.6 (LoRA stack UI format, Gemini metadata display, partner node cost guard, sync script)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 15:37:11 +09:00
ketle-manandClaude Sonnet 5.5 091d37fa1a release: v0.8.6 - run partner API nodes (Nano Banana etc.) from GenerateUI, fix DynamicCombo widgets_values conversion
- partner_routes.py: /api/wfm/partner/prompt relays /prompt and adds COMFY_API_KEY (.env) as
  extra_data.api_key_comfy_org only for workflows containing an API node; client uses it when configured
- Gemini image nodes' prompt shows in the Prompt tab; sample workflow ws_nano_banana_2_1_t2i; help (helpGen32)
- converter: count only widget sub-inputs of a DynamicCombo option, and skip the control_after_generate slot
  after a seed even when the next widget is not numeric (checked against 301 saved UI workflows)
- Gallery: show the Prompt tab for cc_nanobanana images that carry embedded metadata
- README, DEVLOG, bump version to 0.8.6

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 15:26:36 +09:00
ketle-manandClaude Sonnet 5.5 ffcc68568c release: v0.8.5 - read Gemini / Nano Banana node images (prompt, model, seed) in Metadata tab and I tab
- metadata-tab.js / node_sets_menu.js: Gemini(Image|NanoBanana)* nodes' prompt input, model name
  and seed are extracted (API format)
- README, DEVLOG, bump version to 0.8.5

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 14:46:32 +09:00
25 changed files with 1082 additions and 78 deletions
+8
View File
@@ -19,3 +19,11 @@ UNSLOTH_API_KEY=
# Get a key at https://aistudio.google.com (free tier available).
# Same steps as above: copy to ".env", paste the key, restart ComfyUI.
GEMINI_API_KEY=
# ComfyUI-Workflow-Studio - Partner API nodes in GenerateUI (Nano Banana, Kling, Seedream, ...)
# A Comfy API key issued at https://platform.comfy.org (separate from the Gemini key above;
# usage is billed as Comfy credits). With it set, GenerateUI queues prompts through the plugin
# server, which adds the key to the request only when the workflow contains a partner API node.
# Same steps as above: copy to ".env", paste the key, restart ComfyUI.
COMFY_API_KEY=
+5
View File
@@ -2,6 +2,11 @@
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.8.9(2026-10-20)** — Video: アセット登録ボタン / Editの音声変換 / ソースパネルのレイアウト
- **v0.8.8(2026-10-19)** — MOSS-Image 対応(GenerateUI / Gallery / Metadata / Iタブ)
- **v0.8.7(2026-10-16)** — Qwen Image 2.1 Turbo(ComfyUI公式テンプレート T2I / I2I)対応
- **v0.8.6(2026-10-14)** — GenerateUI: パートナーAPIノード(Nano Banana 等)の実行に対応
- **v0.8.5(2026-10-14)** — Metadata / I タブ: Gemini 系ノード(Nano Banana)の画像を読めるように
- **v0.8.4(2026-10-14)** — ComfyUI v0.40.0 対応: ネイティブ LoRA スタックノード(`LoadLoraModel` / `LoadLoraTextEncoder`)
- **v0.8.3(2026-10-13)** — GenerateUI: シードモード「Workflow」を追加(改善候補メモ 2-A)
- **v0.8.2(2026-10-12)** — Gallery: セマンティック検索(Gemini Embedding 2 / EmbeddingGemma 2)
+115
View File
@@ -2,6 +2,121 @@
---
## v0.8.9(2026-10-20)
### Video: アセット登録ボタン / Editの音声変換 / ソースパネルのレイアウト
- **アセット登録**: 動画ソースパネルに「アセット登録」ボタンを追加(`video-tab.js`)。ローカルファイルは`comfyUI.uploadImage`でinputへ上げ、バックエンド`POST /api/wfm/video/asset/register`(`VideoService.register_asset`)でoutput/videoへコピーしてから`__Video Assets__`グループへ追加する。Galleryはoutputフォルダしか一覧しないためコピーが必要。すでにoutput配下のソース(Asset選択・生成結果)はコピーせずタグ付けのみ。同名はアンダースコア+連番で回避。登録後はAssetタブを更新。
- **Editの音声変換**: クロップ行のボタンをクロップ関連(編集/キャンセル/リセット)左寄せ→`|`区切り→「音声変換...」の並びに変更。Galleryの変換モーダルを`openAudioConvertDialog()`として共通化・export(`convertOne`コールバック方式。`allowDelete`/`allowCopyMeta`で項目の出し分け)。Gallery側の挙動は不変。Editのクリップはinputフォルダにあるため`POST /api/wfm/video/edit/convert-audio`(`VideoService.convert_audio_to_output`、PyAVを`asyncio.to_thread`で実行)がoutput/videoへ保存する。音声付き動画クリップのみ対象、読み込み中のクリップはトーストで案内。
- **ソースパネルのレイアウト**: パネル幅を220→320pxに拡大(左右プレビューはflex:1で自動的に縮む)、ファイル名を専用の1行(省略表示)にし、ボタン3つを折り返さず横一列に。
- ヘルプ(helpVideo5/helpVideo11、日英中)を更新。
- 教訓: i18n.jsの英語文字列内に`"`を入れると全体が構文エラーになる(`node --check`は.mjsコピーで確認)。
## v0.8.8(2026-10-19)
### MOSS-Image 対応(GenerateUI / Gallery / Metadata / Iタブ)
ユーザー提供の5本(公式テンプレートのBase/SFT × T2I/バウンディングボックス4本と、公式ではない自作のmanga 8step LoRA構成1本)で、`convertUiToApi`→`analyzeWorkflow`を実測して直した。
- **サブグラフの外側ウィジェット値のズレ**: 新フロントエンドは外側ノードに`widgets_values_named`(名前キーの値)も保存し、`inputs[]`にはseed/steps/cfg/sampler/schedulerが載らない一方`widgets_values`は全ポートを持つ。従来の「`inputs[]`内の位置」参照だとunet_nameに25、vae_nameに`er_sde`が入っていた。`_flattenSubgraphs()`で`widgets_values_named`を優先(無い場合は従来どおり)。Iタブ用の複製(`node_sets_menu.js`の`_wfmFlattenSubgraphs`)にも同じ修正。
- **`CreateBoundingBoxes`の変換**: `bboxes`の型`BOUNDING_BOX,ARRAY,STRING`が共用体の途中にSTRINGを含むため入力欄と誤判定され、本来の入力欄`editor_state`/`last_incoming`(型`BOUNDING_BOXES`)が読まれていなかった。共用体型は先頭セグメントだけで判定し、`BOUNDING_BOXES`を入力欄型に追加。配列値はAPIでリンク扱いされるため`{"__value__": [...]}`で送る(バックエンドが展開)。Flux.3 Klein 4種にも同ノードがあり、変換前は検証エラーになる出力だったものが直った。
- **プロンプト検出**: `MOSSImageLayoutPrompt`の`prompt`をpositiveとして検出(`textKey: prompt`)。リンクされた`PrimitiveStringMultiline`/`PrimitiveString`はロールを上流へ伝播し、リンクのままの値は編集対象にしない(従来は配列がtextに入っていた)。
- **Gallery Promptタブ**: APIの`prompt`チャンクが無くサブグラフ入りのUI形式のみの画像は、変換してから抽出(Metadataタブと同じ扱い)。通常の生成画像は従来どおりAPI形式を使う。
- 実機(8189)で公式bboxes版と自作manga版の生成成功を確認。ワークフロー357件で変換結果を新旧比較し、差分はFlux.3 Klein 4件のCreateBoundingBoxesのみ。
### 変換チェック(GenerateUI Check)の初回待ち時間を短縮
初回に`/object_info`全件(この環境で約26MB・約43秒、毎回)を取得していたのが原因。ワークフロー詳細を開いた時点で全件の先読みも走らせており、サーバーを長時間塞いでいた。
- `_loadObjectInfoFor(types)`: 使用ノード型(サブグラフ内も含む)だけを`/object_info/<型>`で取得(1型約20ms、16並列、型ごとにキャッシュ)。転送失敗時や、既知の型が1つも無いときは全件にフォールバック。全件キャッシュがあればそれを優先。`invalidateObjectInfoCache()`は型別キャッシュも消す。
- 変換(`_convertUiToApiImpl`)と互換性チェックで使用。GenerateUIの初回変換も速くなる。先読みは削除。
- MOSSで初回変換 約43秒→約250ms、2回目以降は約2ms。362ワークフローで全件版との変換結果が完全一致。
## v0.8.7(2026-10-16)
### Qwen Image 2.1 Turbo(ComfyUI公式テンプレート T2I / I2I)対応
テンプレート(`SamplerCustomAdvanced`+`ManualSigmas`+`CFGGuider`、プロンプトエンハンサー=`TextGenerate`+`ComfySwitchNode`構成)をGenerateUIで使えるようにした。
- **Positiveプロンプトが空になる問題**: プロンプトが`PreviewAny → ComfySwitchNode(on_false=文字列リテラル)`経由で`TextEncodeQwenImage21.prompt`に入るため検出できなかった。`comfyui-workflow.js`のPass 1で`TextEncodeQwenImage21`のリンクされた`prompt`/`negative_prompt`へロールを伝播し、Pass 2で文字列リテラルを持つ`ComfySwitchNode`を`textKey: "on_false"`のプロンプトノードとして登録。
- **サブグラフ展開のファンアウト**: `_flattenSubgraphs()`は外部リンクをポートの最初の接続先にしか張らなかったため、`images.image_1`がTextEncodeとプロンプトエンハンサー用`BatchImagesNode`の2か所へ分岐するI2Iで、後者が画像未接続になっていた。2番目以降の接続先にも同じ外部リンクを複製するよう修正。
- 実機(8189)でT2I/I2Iとも生成成功を確認。
- プロンプトエンハンサー対応: `TextGenerate.prompt`とスイッチ`on_false`が展開後に別々のリテラルになる問題を、`_unifyPromptEnhancerText()`で共有の`PrimitiveStringMultiline`(`<switchId>:wfs_prompt`)へ集約して解消。GenerateUIの入力欄の編集がエンハンサー入力にも反映される。I2Iでエンハンサーをオンにして実機確認(入力プロンプトと参照画像の両方がエンハンサーに届く)。
### Flux.3 Image Klein(ComfyUI公式テンプレート 4種)対応
Klein(cfg 3.5/25step)とKlein SD(蒸留、cfg 1/16step)それぞれのT2I(プロンプトエンハンサー付きサブグラフ)とImage Edit(`ReferenceMultiLatent`)。`CLIPLoader`のtype=`flux3`は既存の変換でそのまま通る。
- **`ReferenceMultiLatent`のロール伝播**: positive/negative入力が別々の出力に出るノードなので、`InstructPixToPixConditioning`と同様にロールを各入力へ個別に伝播。従来はEdit版のPositive/Negativeが両方とも"Positive Prompt"というタイトルだったため、Negative側もpositiveと誤判定されていた。
- **未使用の空Latent**: `ReferenceMultiLatent`は参照画像サイズの`empty_latent`を自前で出力するため、テンプレートに残っている未接続の`EmptyFlux2LatentImage`はSettingsのLatent Imageに出さない(`ReferenceMultiLatent`を含むワークフローに限定)。
- T2I側はQwen Image 2.1 Turboと同様、エンハンサーの`TextGenerate.prompt`が入力用`PrimitiveStringMultiline`に直結しているため、そのまま編集が両方に反映される。SD版T2I(SD_4)はテンプレート既定でエンハンサーがオン。
- **COMBO値の誤置換**: テンプレートは`unet_name`をフォルダ接頭辞なし(`flux3_image_klein_int8_convrot.safetensors`)で保存しているが、実機の選択肢は`diffusion_models\flux3_...`。従来の「選択肢に無い値はchoices[0]へ無警告で差し替え」により、無関係なモデルに差し替わって実行されていた。選択肢に無い場合はまずファイル名(区切り文字`\`/`/`の後ろ)が一致する選択肢が1つだけあればそれを採用してから、従来のフォールバックに回すよう変更(`_convertUiToApiImpl`のCOMBO検証)。
- 実機で4種とも生成成功(エンハンサーはオフ)。Edit版は参照画像の編集が効くことを画像で確認。
## v0.8.6(2026-10-14)
### GenerateUI: パートナーAPIノード(Nano Banana 等)の実行に対応
v0.8.5 で見送った課題。パートナーAPIノードは `/prompt` の `extra_data` に Comfy の認証情報(`auth_token_comfy_org` = ブラウザのログイン、または `api_key_comfy_org` = Comfy APIキー)が必要。ComfyUI 本体の画面は自動で付けるが、WFS の `queuePrompt`(`fetch('/prompt')` 直叩き)は付けないため、GenerateUI からは `Unauthorized: Please login first to use this node.` で失敗していた。
- **`py/routes/partner_routes.py`(新規)**: `GET /api/wfm/partner/status`(キー設定の有無のみ)、`POST /api/wfm/partner/prompt`(`/prompt` の中継)。`.env` の `COMFY_API_KEY`(prestartup_script.py が python-dotenv で読み込み)が設定されているとき、プロンプトに API ノード(`/object_info` の `api_node: true`、クラスごとにキャッシュ)が含まれる場合だけ `extra_data.api_key_comfy_org` を付与して自 ComfyUI の `/prompt` へ中継し、応答はそのまま返す。クライアントが既に認証情報を付けている場合は上書きしない。キーはブラウザへ出さない。`.env.example` に追記。
- **`comfyui-client.js`**: `queuePrompt` は、キー設定あり(`isPartnerKeyConfigured()`、60秒キャッシュ)かつ接続先が同一オリジンのときだけ中継を使う(別サーバーへキーを送らない)。`execution_error` が `Unauthorized` / `login first` のときは、設定方法を案内する文言(`partnerAuthHint`、3言語)を付ける。
- **`comfyui-workflow.js`**: `Gemini(Image|NanoBanana)*` ノードの `prompt` 入力を `prompt_nodes`(positive、`textKey: "prompt"`)に追加し、GenerateUI の Prompt タブで編集できるようにした。参考画像は従来どおり Image タブの `LoadImage` 経由。
- ヘルプ(`helpGen32`、`index.html` / `i18n.js` 3言語 / `app.js` の `helpIdMap`)、README、サンプルワークフロー `workflows/ws_nano_banana_2_1_t2i.json` を追加。
### UI形式→API形式の変換: DynamicCombo ノードの `widgets_values` ずれを修正
Nano Banana 2.1 の UI 形式ワークフローを変換すると値がずれていた(`seed` が `"IMAGE"`、システムプロンプトが `response_modalities` に入る等)。原因は2つで、どちらも修正した。
1. `_getDynamicComboSubNames` が、選択肢の子入力のうちソケット(`images` = Autogrow、`files` = `GEMINI_INPUT_FILES`)まで `widgets_values` の1枠として数えていた。ウィジェット型の子入力だけを数えるようにした(`_resolveWidgetType` を再利用)。
2. `seed` 等の `control_after_generate` 付きウィジェットの直後に入るフロントエンド専用の `"randomize"` 等の1枠を、次のウィジェットが数値型のときしか読み飛ばせなかった(Nano Banana 2.1 は `seed` の次が COMBO の `response_modalities`)。object_info の `control_after_generate` フラグで判定する `_hasControlAfterGenerate` を追加。
- 検証: ComfyUI 本体のフロントエンドで作ったワークフローの `graphToPrompt()` 出力と、変換結果が完全に一致。実機の保存済み UI 形式ワークフロー301件を修正前後で比較し、300件は変換結果が同一、変化は今回の Nano Banana サンプルのみ。
### Gallery: `cc_nanobanana` フォルダの画像でもメタデータがあれば Prompt タブを表示
Comic Creator v1.55.0 で、半自動マンガがネイティブノード経由で生成した画像が `cc_nanobanana` に保存され、PNG に `prompt` / `workflow` が埋め込まれるようになるため。`gallery-tab.js`: 埋め込みワークフローがある画像は `isNanobananaFolderImage` による Prompt タブの非表示を解除する(埋め込みの無い Gemini API 直叩きの画像だけ従来どおり非表示)。
**実機確認(ComfyUI_5 / ポート8189、v0.40.0)**
- `.env` に `COMFY_API_KEY` を設定し、GenerateUI でサンプル(Nano Banana 2.1)を読み込み、Prompt タブで編集して Apply → Generate を実クリック: リクエストは `/api/wfm/partner/prompt` 経由、16.4秒で成功、編集どおりの絵(青いティーポット)が `output/nano_banana_00001_.png` に出力された。
- キー未設定時の案内文(`partnerAuthHint`)が表示用文言として解決されること、ヘルプ(`helpGen32`)が表示されることを確認。
### 今後の作業候補(2026-10-14 時点・未着手。v0.8.4〜v0.8.6 の続き)
**ネイティブ LoRA スタックノード(`LoadLoraModel` / `LoadLoraTextEncoder`、v0.8.4)**
- **UI形式への対応**: ComfyUI フロントエンド 1.55.17 は DynamicGroup を実装していない(行を追加できず `widgets_values` も空)。フロントエンドが対応したら、実物の UI 形式 JSON で `widgets_values` の並びを確認し、`analyzeWorkflow` / Metadata / I タブの UI 形式分岐を追加する。
- **画面操作の確認**: GenerateUI の Stack タブ(Stack グループを複数行として書き込む処理)は、関数の直接呼び出しでのみ確認済み。Models タブで Stack グループを登録した状態での画面確認が未実施。
**Gemini / Nano Banana 系ノード(v0.8.5 / v0.8.6)**
- **Metadata / I タブの表示拡充**: プロンプトは Positive / Negative に分けず全文を1件で表示している(送信全文に `NEGATIVE_PROMPT:` が含まれる)。`NEGATIVE_PROMPT:` で分割して Positive / Negative に振り分ける、`aspect_ratio` / `resolution` / `thinking_level` を設定欄に出す、UI 形式の `widgets_values`(並びは `[prompt, model, aspect_ratio, resolution, thinking_level, seed, control_after_generate, response_modalities, system_prompt, temperature, top_p]`)に対応する、が候補。
- **他のパートナーAPIノードの Prompt タブ対応**: 現状は `Gemini(Image|NanoBanana)*` のみを `prompt_nodes` に登録している。`/object_info` の `api_node: true` かつ `prompt` 入力を持つノード(Seedream / Kling 等)へ一般化できないか検討する。
- **費用ガード**: Batch / Lab / カタログ作成などの繰り返し実行でパートナーAPIノードを使うと、回数ぶんのクレジットが連続して消費される。`/object_info` の `price_badge` から概算を出して、実行前に表示・確認する案。
- **Settings タブに `COMFY_API_KEY` の設定状態を表示**: 現状は `.env` 編集のみ。`GET /api/wfm/partner/status`(設定の有無のみ返す)を使って、設定済み/未設定と設定手順を Settings タブに出す。キー自体は表示・入力させない方針を維持する。
- **サンプルの追加**: 参考画像付き(I2I、`LoadImage` → `model.images.image_1`)の Nano Banana ワークフロー、複数参考画像のもの。Nano Banana Pro(`GeminiImage2Node`)は Comic Creator 側のネイティブ対応と合わせて。
**運用・開発環境**
- **同期スクリプトの整備**: 開発リポジトリから実機の `custom_nodes` への反映は、今回も手作業(追跡ファイルの `cmp` 比較 + `cp`、`workflows/` / `data/` / `.env` は除外)だった。CLAUDE.md の「同期スクリプトでパッケージ全体をデプロイ」に沿って、`tools/` に同期スクリプト(除外リスト付き、ハッシュ比較・`__pycache__` 削除まで)を用意する。部分同期が残ると古い版が混在する(今回、実機は v0.8.2 開発途中の版のまま止まっていた)。
- **comfy-cli / comfy-mcp の既定ワークスペース**が ComfyUI_6(プラグイン 0.3.78)で、実際に使っている ComfyUI_5(8189)と一致しない。`server_info` の `running` / `freshness` は ComfyUI_6 の情報になるため、MCP で実機を扱うときは注意するか、既定ワークスペースを揃える。
- **英語・中国語UIでの表示確認**: 今回追加したヘルプ(`helpGen32` ほか)と `partnerAuthHint` は日本語UIでのみ画面確認した。
## v0.8.5(2026-10-14)
### Metadata / I タブ: Gemini 系ノード(Nano Banana)の画像を読めるように
Comic Creator v1.54.0 で、Nano Banana を ComfyUI ネイティブノード(`GeminiNanoBanana2V2`)経由で生成できるようにした(併用)。この経路の画像は SaveImage により `prompt` / `workflow` が PNG に埋め込まれるため、Workflow Studio 側で通常の ComfyUI 画像として読めるようにした。
- `metadata-tab.js` / `web/comfyui/node_sets_menu.js`: 自ノードの `prompt` 入力を持つ `Gemini(Image|NanoBanana)*` ノードを、動画ノード(`*ImageToVideo` / `*TextToVideo`)と同じ扱いでプロンプト候補(`texts`)へ追加。`NEGATIVE_PROMPT:` を含む送信全文がそのまま1件として出る(Positive / Negative の分割はしない)。
- `extractDiffusionModels`(API形式): Gemini 系ノードの `model` 入力(例: `Gemini Nano Banana 2.1`)をモデル名として表示。
- `extractSamplerSettings`: Gemini 系ノードの `seed` を補助ノードとして拾い、設定欄に表示。
- 対象は API 形式のみ(DynamicCombo のため UI 形式の `widgets_values` の並びは未確認)。`GenerateUI` のプロンプト編集・実行は対象外。
- `cc_nanobanana` フォルダ用の特別扱い(`history.jsonl` 参照・Promptタブ非表示)は、従来の Gemini API 直叩きの画像のため変更なし。ネイティブ経路の出力先は別フォルダ(`cc_nanobanana_native`)なので、この特別扱いに該当せず、埋め込みメタデータが使われる。
**実機確認(ComfyUI_5 / ポート8189、v0.40.0)**
- Comic Creator のネイティブ経路で実際に生成した画像(`cc_nanobanana_native/NB_00001_.png`、848×1264)を `extractAllMetadata` に通し、モデル名(`Gemini Nano Banana 2.1`)・シード・プロンプト(`NEGATIVE_PROMPT:` 付き全文)が取れることを確認。Gallery の一覧・画像メタ取得でも通常の画像として扱われる(`nanobanana` エントリは null)。
**ネイティブ API ノードの認証について(今回の調査で判明)**
- API ノードは `/prompt` の `extra_data` に `auth_token_comfy_org`(ブラウザのログイン)または `api_key_comfy_org`(Comfy APIキー)が必要。ComfyUI 本体の画面は自動で付けるが、Workflow Studio の `queuePrompt`(`fetch('/prompt')` 直叩き)は付けないため、GenerateUI からパートナーAPIノードを実行すると認証エラーになる。今回は対応せず(Comic Creator はサーバー側で `COMFY_API_KEY` を渡す方式で対応)。必要になれば Workflow Studio 側にも同様のサーバー側プロキシが必要。
## v0.8.4(2026-10-14)
### ComfyUI v0.40.0 対応: ネイティブ LoRA スタックノード(`LoadLoraModel` / `LoadLoraTextEncoder`)
+3 -3
View File
@@ -27,7 +27,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.8.4-green)
![Version](https://img.shields.io/badge/version-0.8.9-green)
## Features (tab -> feature names)
@@ -53,7 +53,7 @@ Setting / Results / Plan JSON sub-panels, Per-column keyframes, Model column —
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, VRAM Management (Ollama), 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, MP4 video support, MP4 embedded metadata, WebM support, Embedded metadata reading fixes, Audio support, File conversion, Move To folder filter, Semantic Search, Audio waveform colors, Info tab: dimensions & duration, Multi-select, Image Compare, Prompt search, Server-side filtering, Group management, Thumbnail F button, Favorites, Detail panel, Prompt tab, Nanobanana tab, Workflow viewer, GenUI button, Image Edit button, Send GenUI Image button, Send to LI node button, Send to LV node button, Send CC button, Search clear (✕), Clear all filters (✕ Clear), Workflow auto-save, Output folder configurable, SVG file support, PSD 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, WebM support, Embedded metadata reading fixes, Audio support, File conversion, Move To folder filter, Semantic Search, Audio waveform colors, Info tab: dimensions & duration, Multi-select, Image Compare, Prompt search, Server-side filtering, Group management, Thumbnail F button, Favorites, Detail panel, Prompt tab, Nanobanana tab, Gemini / Nano Banana nodes, MOSS-Image in GenerateUI, Faster GenerateUI Check / conversion, Partner API nodes in GenerateUI, Workflow viewer, GenUI button, Image Edit button, Send GenUI Image button, Send to LI node button, Send to LV node button, Send CC button, Search clear (✕), Clear all filters (✕ Clear), Workflow auto-save, Output folder configurable, SVG file support, PSD 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
@@ -77,7 +77,7 @@ Model Browser, Thumbnail / Table views, Table column sort, Search & Filter, User
Layer-based image editor, Loading images, Open PSD button, Close button, New button, Tools, Layer panel, Duplicate layer (⧉), Layer lock, Text quality, Export, Canvas navigation, Undo / Redo
### Video Tab (v0.5.0 – v0.7.4)
Dedicated video generation UI, independent of GenerateUI, Plan subtab, Base settings row, Edit subtab, Edit: Multi-track, Edit: Audio / BGM, Edit: Text overlays, Edit: Crop, Edit: Undo / Redo, Edit project persistence, Asset subtab, Project subtab, Two center previews, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, Frame tab, GIF tab, Playback volume
Dedicated video generation UI, independent of GenerateUI, Plan subtab, Base settings row, Edit subtab, Edit: Multi-track, Edit: Audio / BGM, Edit: Text overlays, Edit: Crop, Edit: Convert audio, Edit: Undo / Redo, Edit project persistence, Asset subtab, Project subtab, Two center previews, Register as Asset, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, 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, Decision API client, 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)
+13 -3
View File
@@ -23,7 +23,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.8.4-green)
![Version](https://img.shields.io/badge/version-0.8.9-green)
## Screenshots
@@ -55,6 +55,10 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
| :--------------------------------: | :------------------------------------------: |
| ![Lab Tab](docs/15_labtab.png) | ![Lab Index Image](docs/16_lab_index.png) |
| Gallery Tab - Semantic Search ("sunset city street") |
| :-----------------------------------------------------------------: |
| ![Gallery Semantic Search](docs/20_gallery_semantic_search.png) |
---
## Features
@@ -287,6 +291,10 @@ 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 or five tabs — **Info** / **JSON** / **Groups** / **Prompt** / **Nanobanana** (only for `cc_nanobanana`-folder images, see below)
- **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; hidden entirely for images in the `cc_nanobanana` folder (see Nanobanana tab below), since they carry no embedded ComfyUI workflow to extract a prompt from
- **Nanobanana tab** (v0.7.14) — shown only for images in a `cc_nanobanana` folder (written by ComfyUI Comic Creator's Nanobanana tab) that have a matching entry in that folder's `history.jsonl` generation log; shows engine, model, image size, seed, timestamp, and the prompt/negative prompt actually used — the same info is also surfaced in the Metadata tab (see below) when opened from here via the **Metadata** button
- **Gemini / Nano Banana nodes** (v0.8.5) — images generated by ComfyUI's native Nano Banana nodes (`GeminiNanoBanana2V2` etc., e.g. via ComfyUI Comic Creator's "ComfyUI native node" engine) are readable like any other ComfyUI image: the Metadata tab and the side-panel I tab show the prompt (in the prompt list, including the appended `NEGATIVE_PROMPT:` text), the model name (under Diffusion Model, e.g. `Gemini Nano Banana 2.1`) and the seed; these images need no history file and are not special-cased like the `cc_nanobanana` folder (API-format workflows only)
- **MOSS-Image in GenerateUI** (v0.8.8) — the official MOSS-Image templates (Base / SFT, T2I and the bounding-box layout versions) load and run from GenerateUI; a custom (non-official) manga workflow using MOSS-Image Base with the 8-step distillation LoRA was also tested and works. The `MOSSImageLayoutPrompt` text is edited as the positive prompt, `CreateBoundingBoxes` converts correctly (the boxes themselves are still drawn on ComfyUI's canvas), and the Gallery Prompt tab, Metadata tab and side-panel I tab read the prompt, models and sampler settings of MOSS images. Newer frontends save subgraph widget values by name (`widgets_values_named`); these are now read correctly, so model names and sampler values no longer shift
- **Faster GenerateUI Check / conversion** (v0.8.8) — the first conversion or check used to download the full `/object_info` (tens of MB, 40+ s on installs with many custom nodes); it now fetches only the node types the workflow uses (about 0.25 s) and caches them per type
- **Partner API nodes in GenerateUI** (v0.8.6) — workflows containing ComfyUI's partner API nodes (Nano Banana / Gemini image nodes, etc.) can be run from GenerateUI. These nodes need Comfy credentials in the `/prompt` request's `extra_data`, which ComfyUI's own screen adds automatically but a separate page cannot: add `COMFY_API_KEY=...` (a Comfy API key issued at platform.comfy.org) to the plugin's `.env` and restart ComfyUI. With it set, GenerateUI queues prompts through the plugin server (`/api/wfm/partner/prompt`), which adds the key only when the workflow contains an API node (`api_node` in `/object_info`) and only for this ComfyUI instance; the key never reaches the browser, and usage is billed as Comfy credits. Without a key, an authentication error now shows how to set it up. A Gemini image node's prompt shows in the Prompt tab (reference images go through `LoadImage` in the Image tab); sample: `ws_nano_banana_2_1_t2i`. Also fixed: UI-format → API-format conversion misaligned `widgets_values` for nodes whose DynamicCombo option has socket sub-inputs (Nano Banana 2.1's `images` / `files`) or a widget right after a `control_after_generate` seed; Gallery now shows the Prompt tab for `cc_nanobanana`-folder images that carry embedded metadata (images made through Comic Creator's ComfyUI native node engine)
- **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)
- **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; PSD files (v0.6.0) are fully decomposed into their original layers instead of being flattened into one image
@@ -337,13 +345,13 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **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`); WebM isn't supported here (this parser only understands MP4's ISO-BMFF container) — the Gallery tab's own video metadata reading (PyAV-based, see Gallery Tab above) covers WebM instead
- **Settings section** (v0.7.14) — image size (width×height) and, when the embedded workflow has a KSampler-type node, its Seed / Steps / CFG / Sampler / Scheduler / Denoise values, read from the API-format embedding's named inputs (UI-format workflows are converted through the same UI→API path GenerateUI uses first)
- **Nanobanana section** (v0.7.14) — shown only for images from ComfyUI Comic Creator's Nanobanana tab (a `cc_nanobanana`-folder image opened via the Gallery tab's **Metadata** button, with a matching entry in that folder's `history.jsonl` log); shows engine, model, image size, seed, timestamp, and the prompt/negative prompt actually used — since these images carry no embedded ComfyUI workflow, this section's data replaces what would otherwise be a "no metadata found" error, with the rest of the layout (Checkpoint/LoRA/Prompt/Settings) simply staying empty
- **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)
- **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, MOSS-Image); 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
- **Custom multi-output text node fix** (v0.7.14) — nodes whose text output comes from a differently-named widget (e.g. ComfyUI-LiveChatStream's `response`/`positive`/`negative` outputs, backed by `response_text`/`prompt_text`/`negative_text` widgets) previously resolved to nothing when the API-format embedding was used, since the generic key lookup didn't recognize those widget names — LiveChatStream is now resolved by name explicitly; confirmed working with response text up to 40,000 characters
- **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/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 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 / MOSS-Image subgraph workflows), SD WebUI, SD Forge, Fooocus
- **Format note** — supported formats and covered model types are always shown in the left column
</details>
@@ -447,11 +455,13 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Edit: Audio / BGM** (v0.7.4) — the export panel's **Audio** section sets the soundtrack: **Keep original audio** (with its own volume in dB) keeps every clip's audio aligned to its segment even across multiple clips (image clips contribute silence), and one **BGM** file is laid over the whole video with its own volume and start offset (a longer BGM is cut to the video length). Pick the BGM with **BGM...**, by dropping an audio/video file onto the Audio section, or with **Set as BGM** on a video in the Asset subtab (that video's audio track is used; videos without audio are rejected). Built entirely inside the export graph with ComfyUI core audio nodes (EmptyAudio / AudioMerge / AudioConcat / LoadAudio / TrimAudioDuration / AudioAdjustVolume) passed to ConcatenateVideo's `complete_audio` — no extra dependencies. ▶ Preview plays the BGM alongside the clips
- **Edit: Text overlays** (v0.7.4) — each clip can carry any number of text overlays (**+ Add text** under the trim panel): text, start/end seconds within the clip, size as % of frame height, color, 9-position anchor, outline, and an optional background box. They follow the clip when it's reordered, are previewed live over the Source/Result panes, and are burned in on Export as a final pass (PyAV decode → Pillow → H.264 encode, frame by frame so memory stays flat; the soundtrack is remuxed untouched). Japanese/CJK text renders with a system CJK font (Meiryo / Yu Gothic / Noto Sans JP on Windows)
- **Edit: Crop** (v0.7.4) — **Edit crop** puts a draggable/corner-resizable rectangle over the Source preview (optionally locked to 16:9 / 9:16 / 1:1 / 4:3 / 3:4); **Done** keeps it, **Cancel** restores the crop from before editing, and switching to another subtab/tab ends editing like Done. Export applies it with ComfyUI core `VideoCrop`; the output size is the first video clip's cropped size, and other clips of a different size are center-fit to it. Text overlay previews are drawn relative to the cropped frame
- **Edit: Convert audio** (v0.8.9) — a **Convert audio...** button sits next to the crop buttons (separated by `|`); it converts the selected video clip's audio track to FLAC / MP3 / Opus / M4A / WAV with the same dialog as Gallery's **Convert...** (bitrate, sample rate, channels), and saves the result into the output/video folder so it shows up in Gallery. Delete-original and carry-over-gallery-meta options are not offered here. Server route: `POST /api/wfm/video/edit/convert-audio`
- **Edit: Undo / Redo** (v0.7.4) — **↶ / ↷** in the timeline toolbar (or Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z outside text fields) step through edits to clips, trims, crops, text and audio settings; a deleted clip comes back without re-uploading. History resets when a project is loaded
- **Edit project persistence** (v0.7.2) — **Save** / **Save As** / **Load** buttons in the Edit subtab's export panel persist the timeline itself (clip order, trim points, and which uploaded server-side file each clip refers to — plus crops, text overlays and audio/BGM settings since v0.7.4) as a `ws_videoeditproj_*.json` project file; Load re-fetches and re-probes each clip from its saved server reference, so the original files need to still exist
- **Asset subtab** (center panel, next to Plan/Edit — moved here from the sidebar in v0.7.0) — browses generated videos/images through three groups: **Video Assets** (a manually-curated keeper group you organize yourself, on your own schedule), **Video Temp** (every plan run's output lands here automatically regardless of whether the plan itself was saved — a **Clear Video Temp** button in the Gallery tab's detail panel empties it in one click), and **All Video Assets** (the union of both); a filename search box, a video/image type filter dropdown (All Types / Video Only / Image Only, v0.7.2), and a thumbnail-grid/table (▦/☰) view toggle sit above the list (v0.7.0). Selecting an item shows it in the center preview and lets you tag/memo it, **Send to Edit** (queues it as a clip in the Edit subtab), **Set as BGM** for videos (v0.7.4 — uses its audio track as the Edit BGM), jump straight to the full Gallery tab, or — for images only — **Set as First Image** / **Set as Last Image** (v0.7.0, uploads it straight into the currently-selected Plan block and switches to the Plan subtab)
- **Project subtab** (sidebar) — lists saved plan files while the center Plan subtab is active, or saved Edit projects while the center Edit subtab is active (v0.7.2 — thumbnail/block-or-clip-count/last-updated) — click one to load it into the matching editor, or delete it with the × button; the panel collapses back down when its own tab is clicked again, and switching Plan↔Edit while it's open refreshes the list in place
- **Two center previews** (v0.5.5) — the left preview shows either the video currently selected in the Asset subtab or whatever's dropped/picked in the **Video Source** panel to its left (**Clear** resets it to empty); the right preview always shows the most recently generated clip; both preview frames are a fixed height (v0.7.0) so switching sources never shifts the Plan/Edit/Asset panel below them. The Frame/GIF tools act on whichever preview was touched most recently
- **Register as Asset** (v0.8.9) — a **Register as Asset** button in the Video Source panel (next to **Add to Edit** and **Clear**) puts the loaded video into the **Video Assets** group so it appears in the Asset subtab: local files are uploaded and copied into output/video (Gallery only lists the output folder), sources already in output are just tagged. The Video Source panel was also widened so the file name stays on one line and the three buttons fit in a row. Server route: `POST /api/wfm/video/asset/register`
- **First Frame / Last Frame are both optional** — leaving First Image 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** — Prompt / Duration / First Image / Last Image / Aspect Ratio / Megapixels / Multiple / Noise Seed / Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance 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 while Width / Height light up instead
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

+107
View File
@@ -0,0 +1,107 @@
"""Partner (API) node execution support for GenerateUI.
ComfyUI's partner API nodes (Nano Banana / Gemini, Kling, Seedream, ...) authenticate through the
``extra_data`` of the ``/prompt`` request: ``auth_token_comfy_org`` (the browser's Comfy login) or
``api_key_comfy_org`` (a Comfy API key issued at platform.comfy.org). ComfyUI's own web UI adds
the login token automatically, but Workflow Studio is a separate page that POSTs to ``/prompt`` itself,
so such a prompt fails with "Unauthorized: Please login first to use this node."
When COMFY_API_KEY is set (loaded from the plugin's .env by prestartup_script.py), the frontend
queues prompts through this proxy instead. The proxy adds the key to ``extra_data`` — only when the
prompt actually contains an API node (``api_node: true`` in /object_info) — and relays the request
to the local ComfyUI. The key never reaches the browser. Usage is billed as Comfy credits.
"""
import json
import logging
import os
from urllib.parse import quote
import aiohttp
from aiohttp import web
logger = logging.getLogger(__name__)
_api_node_cache: dict = {} # class_type -> bool (api_node flag); the node set only changes on restart
def _get_comfy_key():
"""Return the Comfy API key from the environment (.env), or None."""
return os.environ.get("COMFY_API_KEY", "").strip() or None
def _local_base_url() -> str:
"""Base URL of this ComfyUI instance (from its --listen / --port launch arguments)."""
try:
from comfy.cli_args import args as _a
port = getattr(_a, "port", None) or 8188
host = str(getattr(_a, "listen", "") or "127.0.0.1").split(",")[0].strip()
if host in ("", "0.0.0.0", "::"):
host = "127.0.0.1"
elif ":" in host:
host = f"[{host}]"
except Exception:
host, port = "127.0.0.1", 8188
return f"http://{host}:{port}"
async def _is_api_node(sess: aiohttp.ClientSession, base: str, class_type: str) -> bool:
if class_type in _api_node_cache:
return _api_node_cache[class_type]
for attempt in range(2): # /object_info occasionally drops the connection; one retry is enough
try:
async with sess.get(f"{base}/object_info/{quote(class_type, safe='')}") as r:
if r.status == 200:
info = await r.json(content_type=None)
flag = bool((info.get(class_type) or {}).get("api_node"))
_api_node_cache[class_type] = flag
return flag
break
except Exception:
if attempt == 1:
logger.warning("object_info lookup failed for %s", class_type)
return False
def setup_routes(app: web.Application):
app.router.add_get("/api/wfm/partner/status", handle_status)
app.router.add_post("/api/wfm/partner/prompt", handle_prompt)
async def handle_status(request: web.Request) -> web.Response:
"""GET /api/wfm/partner/status - whether a Comfy API key is configured (the key itself is never returned)."""
return web.json_response({"configured": _get_comfy_key() is not None})
async def handle_prompt(request: web.Request) -> web.Response:
"""POST /api/wfm/partner/prompt - Relay a /prompt request to this ComfyUI, adding the Comfy API key
to ``extra_data`` when the prompt contains an API node. The response is passed through unchanged."""
try:
body = await request.json()
except Exception:
return web.json_response({"error": {"message": "invalid JSON body"}}, status=400)
prompt = body.get("prompt")
if not isinstance(prompt, dict):
return web.json_response({"error": {"message": "prompt is required"}}, status=400)
base = _local_base_url()
key = _get_comfy_key()
try:
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=120, connect=10)) as sess:
if key:
extra = body.get("extra_data")
extra = extra if isinstance(extra, dict) else {}
already = extra.get("auth_token_comfy_org") or extra.get("api_key_comfy_org")
if not already:
classes = {n.get("class_type") for n in prompt.values() if isinstance(n, dict) and n.get("class_type")}
for cls in classes:
if await _is_api_node(sess, base, cls):
extra["api_key_comfy_org"] = key
break
body["extra_data"] = extra
async with sess.post(f"{base}/prompt", json=body) as r:
data = await r.read()
return web.Response(status=r.status, body=data, content_type="application/json")
except Exception as e:
logger.error("partner prompt relay failed: %s", e)
return web.json_response({"error": {"message": f"relay failed: {e}"}}, status=502)
+41
View File
@@ -21,6 +21,8 @@ _edit_project_service = VideoEditProjectService(VIDEO_EDIT_PROJECT_DIR)
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)
app.router.add_post("/api/wfm/video/asset/register", handle_register_asset)
app.router.add_post("/api/wfm/video/edit/convert-audio", handle_convert_audio)
app.router.add_get("/api/wfm/video/edit/probe", handle_probe_video)
app.router.add_post("/api/wfm/video/edit/overlay-text", handle_overlay_text)
@@ -49,6 +51,45 @@ async def handle_save_frame(request: web.Request) -> web.Response:
return web.json_response({"error": str(e)}, status=500)
async def handle_register_asset(request: web.Request) -> web.Response:
try:
body = await request.json()
filename = body.get("filename", "")
if not filename:
return web.json_response({"error": "filename required"}, status=400)
result = await asyncio.to_thread(
_service.register_asset, filename, body.get("subfolder", ""), body.get("type", "input")
)
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 registering video asset: %s", e)
return web.json_response({"error": str(e)}, status=500)
async def handle_convert_audio(request: web.Request) -> web.Response:
try:
body = await request.json()
filename = body.get("filename", "")
if not filename:
return web.json_response({"error": "filename required"}, status=400)
# PyAVの変換はCPU負荷が高いのでスレッドで実行する(イベントループを止めない)
result = await asyncio.to_thread(
_service.convert_audio_to_output, filename, body.get("subfolder", ""), body.get("type", "input"), body
)
return web.json_response({"ok": True, **result})
except FileNotFoundError as e:
return web.json_response({"ok": False, "error": str(e)}, status=404)
except ValueError as e:
return web.json_response({"ok": False, "error": str(e)}, status=400)
except Exception as e:
logger.error("Error converting clip audio: %s", e)
return web.json_response({"ok": False, "error": str(e)}, status=500)
async def handle_to_gif(request: web.Request) -> web.Response:
try:
body = await request.json()
+62
View File
@@ -237,6 +237,68 @@ class VideoService:
save_path.write_bytes(image_bytes)
return {"filename": save_name, "subfolder": subfolder}
@staticmethod
def _unique_output_path(stem: str, ext: str) -> tuple[Path, str]:
"""output/video/ 配下で未使用のパスを決める。戻り値は (絶対パス, subfolder)。"""
import folder_paths # type: ignore
subfolder = "video"
out_dir = Path(folder_paths.get_output_directory()) / subfolder
out_dir.mkdir(parents=True, exist_ok=True)
dst = out_dir / f"{stem}{ext}"
counter = 1
while dst.exists():
dst = out_dir / f"{stem}_{counter}{ext}"
counter += 1
return dst, subfolder
def register_asset(self, filename: str, subfolder: str, type_: str) -> dict:
"""Video Sourceの動画をGalleryに載せるため、outputフォルダ配下の実体にする。
既にoutput配下ならそのまま、input/tempならoutput/videoへコピーする。"""
import shutil
src = self._resolve_media_path(filename, subfolder, type_)
if type_ == "output":
return {"filename": src.name, "subfolder": subfolder or "", "path": str(src).replace("\\", "/")}
dst, out_sub = self._unique_output_path(src.stem, src.suffix)
shutil.copy2(src, dst)
return {"filename": dst.name, "subfolder": out_sub, "path": str(dst).replace("\\", "/")}
def convert_audio_to_output(self, filename: str, subfolder: str, type_: str, opts: dict) -> dict:
"""動画/音声クリップの音声を指定形式へ変換し、output/videoへ保存する。"""
from .convert_service import OUTPUT_FORMATS, convert_audio, supports_tags
fmt = str(opts.get("format", ""))
if fmt not in OUTPUT_FORMATS:
raise ValueError(f"Unsupported format: {fmt}")
def _int(key: str) -> int:
try:
return max(0, int(opts.get(key) or 0))
except (TypeError, ValueError):
return 0
src = self._resolve_media_path(filename, subfolder, type_)
inherit = bool(opts.get("inherit_metadata", True))
dst, out_sub = self._unique_output_path(src.stem, OUTPUT_FORMATS[fmt]["ext"])
try:
convert_audio(
src, dst, fmt,
bitrate_kbps=_int("bitrate"),
sample_rate=_int("sample_rate"),
channels=str(opts.get("channels", "keep")),
inherit_metadata=inherit,
)
except Exception:
dst.unlink(missing_ok=True)
raise
return {
"filename": dst.name,
"subfolder": out_sub,
"path": str(dst).replace("\\", "/"),
"tags_skipped": inherit and not supports_tags(fmt),
}
def probe_video(self, filename: str, subfolder: str, type_: str) -> dict:
"""Reads duration/dimensions/fps/audio presence via PyAV only (no ffmpeg
subprocess) — used by the Video Edit tab right after a clip is added, so
+2 -1
View File
@@ -99,12 +99,13 @@ 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, video_routes, vram_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, vram_routes, partner_routes
workflow_routes.setup_routes(app)
settings_routes.setup_routes(app)
ollama_routes.setup_routes(app)
unsloth_routes.setup_routes(app)
partner_routes.setup_routes(app)
eagle_routes.setup_routes(app)
nodes_routes.setup_routes(app)
prompts_routes.setup_routes(app)
+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.8.4"
version = "0.8.9"
license = { file = "LICENSE" }
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+39 -1
View File
@@ -821,6 +821,21 @@
border-top: 1px solid var(--wfm-border);
}
/* クロップ関連ボタンを左寄せにし、|区切りの右に音声変換を置く */
.wfm-video-edit-crop-head {
justify-content: flex-start;
}
.wfm-video-edit-crop-head > span:first-child {
margin-right: 4px;
}
.wfm-video-edit-head-sep {
color: var(--wfm-text-secondary);
font-weight: 400;
user-select: none;
}
.wfm-video-edit-crop-row {
display: flex;
align-items: end;
@@ -992,12 +1007,35 @@
}
.wfm-video-source-panel {
width: 220px;
width: 320px;
flex: none;
display: flex;
flex-direction: column;
}
/* ファイル名は1行(はみ出しは省略)、操作ボタン3つは折り返さず横一列 */
.wfm-video-source-status-line {
margin-top: 6px;
min-height: 1.4em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wfm-video-source-actions {
display: flex;
gap: 6px;
margin-top: 6px;
}
.wfm-video-source-actions .wfm-btn {
flex: 1 1 auto;
min-width: 0;
padding-left: 6px;
padding-right: 6px;
white-space: nowrap;
}
.wfm-video-pane-header {
font-weight: 600;
margin-bottom: 4px;
+1
View File
@@ -492,6 +492,7 @@ function applyI18nToHtml() {
"wfm-help-gen-29": "helpGen29",
"wfm-help-gen-30": "helpGen30",
"wfm-help-gen-31": "helpGen31",
"wfm-help-gen-32": "helpGen32",
"wfm-help-feeder-title": "helpFeederTitle",
"wfm-help-feeder-desc": "helpFeederDesc",
"wfm-help-feeder-imgloop-title": "helpFeederImgloopTitle",
+24 -2
View File
@@ -4,6 +4,7 @@
*/
import { prepareVramForGeneration } from "./vram-prepare.js";
import { t } from "./i18n.js";
function _uuid() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -194,6 +195,21 @@ export const comfyUI = {
return this._fetchModelList(["KSampler"], "scheduler");
},
// パートナー(API)ノード(Nano Banana等)は /prompt の extra_data にComfyの認証情報が必要。ComfyUI画面は
// ログイン情報を自動で付けるが、本アプリの直接fetchは付けないため、サーバー側の COMFY_API_KEY(.env) が
// 設定されていれば WFSサーバー経由で投入してキーを付与する(キーはブラウザへ出さない)。
async isPartnerKeyConfigured() {
const now = Date.now();
if (this._partnerKey && now - this._partnerKey.at < 60000) return this._partnerKey.value;
let value = false;
try {
const res = await fetch("/api/wfm/partner/status");
if (res.ok) value = !!(await res.json()).configured;
} catch { /* 無視 */ }
this._partnerKey = { value, at: now };
return value;
},
// Generation
async queuePrompt(workflow, extraData = null) {
// Settings tab "VRAM Management": unload Ollama models to free VRAM (no-op when off, never throws)
@@ -203,7 +219,10 @@ export const comfyUI = {
client_id: this.clientId,
};
if (extraData) body.extra_data = extraData;
const res = await fetch(`${this.baseUrl}/prompt`, {
// 接続先が同一オリジン(このComfyUI)のときだけ中継を使う(別サーバーへキーを送らない)
const sameOrigin = !this.baseUrl || this.baseUrl === location.origin;
const viaProxy = sameOrigin && await this.isPartnerKeyConfigured();
const res = await fetch(viaProxy ? "/api/wfm/partner/prompt" : `${this.baseUrl}/prompt`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
@@ -251,7 +270,10 @@ export const comfyUI = {
}
}
if (msg.type === "execution_error" && msg.data?.prompt_id === promptId) {
finish(false, new Error(msg.data.exception_message || "Execution error"));
let message = msg.data.exception_message || "Execution error";
// パートナー(API)ノードの認証エラーには、設定方法を案内する
if (/Unauthorized|login first/i.test(message)) message = `${message.trim()} ${t("partnerAuthHint")}`;
finish(false, new Error(message));
}
if (msg.type === "execution_interrupted" && msg.data?.prompt_id === promptId) {
finish(false, new Error("Execution interrupted"));
+221 -19
View File
@@ -74,12 +74,51 @@ async function _loadObjectInfo() {
return _objectInfoCache || {};
}
// Per-node-type object_info (GET /object_info/<type>, ~20 ms each). The full /object_info is
// tens of MB and can take 10-40 s on installs with many custom nodes, so conversions and the
// compatibility check only fetch the types the workflow actually uses. type -> info, or null when
// ComfyUI doesn't know the type. Only successful responses are cached.
const _objectInfoByType = new Map();
async function _loadObjectInfoFor(types) {
if (_objectInfoCache) return _objectInfoCache;
const wanted = [...new Set(types)].filter((ty) => typeof ty === "string" && ty && !_objectInfoByType.has(ty));
let failed = false;
for (let i = 0; i < wanted.length; i += 16) {
await Promise.all(wanted.slice(i, i + 16).map(async (ty) => {
try {
const res = await fetch(`/object_info/${encodeURIComponent(ty)}`);
if (!res.ok) { if (res.status === 404) _objectInfoByType.set(ty, null); else failed = true; return; }
const data = await res.json();
_objectInfoByType.set(ty, data?.[ty] || null);
} catch { failed = true; }
}));
}
// Any transport failure: fall back to the full snapshot rather than report types as unknown
if (failed) return _loadObjectInfo();
const out = {};
for (const ty of types) { const info = _objectInfoByType.get(ty); if (info) out[ty] = info; }
return out;
}
// Node types a UI-format workflow uses, including nodes inside subgraph definitions
function _collectNodeTypes(workflow) {
const sgIds = new Set((workflow?.definitions?.subgraphs || []).map((sg) => sg.id));
const types = new Set();
const add = (nodes) => { for (const n of nodes || []) if (n?.type && !sgIds.has(n.type)) types.add(n.type); };
add(workflow?.nodes);
for (const sg of workflow?.definitions?.subgraphs || []) add(sg.nodes);
return [...types];
}
/**
* 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"]);
// BOUNDING_BOXES: CreateBoundingBoxes' canvas widgets (editor_state / last_incoming) — array-valued
// frontend widgets that occupy a widgets_values slot; sent to the API as {"__value__": [...]}.
const _WIDGET_TYPE_SET = new Set(["INT", "FLOAT", "STRING", "BOOLEAN", "COMBO", "COMFY_DYNAMICCOMBO_V3", "BOUNDING_BOXES"]);
/**
* Resolve a possibly-compound object_info type spec (e.g. LTXVEmptyLatentAudio's frame_rate:
@@ -100,11 +139,10 @@ function _resolveWidgetType(type, spec) {
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;
// Only the first (default) segment decides: a union that merely *accepts* a scalar as one of its
// link types (CreateBoundingBoxes.bboxes: "BOUNDING_BOX,ARRAY,STRING") is still a link-only socket.
const first = type.split(",")[0].trim().toUpperCase();
return _WIDGET_TYPE_SET.has(first) ? first : null;
}
function _getWidgetInputNames(objectInfo, classType) {
@@ -172,6 +210,11 @@ function _getWidgetInputTypes(objectInfo, classType) {
* presence_penalty under optional — all 7 still occupy a widgets_values slot). Dropping the
* optional ones here under-counts how many slots the combo actually consumed, misaligning
* every widget declared after it in the node's schema.
*
* Only sub-fields that are actually widgets count: a sub-field can also be a link socket (e.g. the
* Nano Banana 2.1 node's "images" Autogrow group and its "files" GEMINI_INPUT_FILES input), which the
* frontend does NOT serialize into widgets_values — counting those would shift every value after
* them (seed read as "IMAGE", the system prompt landing in response_modalities, ...).
*/
function _getDynamicComboSubNames(objectInfo, classType, widgetName, selectedKey) {
const info = objectInfo[classType];
@@ -179,9 +222,13 @@ function _getDynamicComboSubNames(objectInfo, classType, widgetName, selectedKey
const options = spec?.[1]?.options;
if (!Array.isArray(options)) return [];
const opt = options.find((o) => o.key === selectedKey) || options[0];
const isWidget = ([, sub]) => {
if (Array.isArray(sub) && sub[1]?.forceInput) return false;
return !!_resolveWidgetType(Array.isArray(sub) ? sub[0] : sub, sub);
};
return [
...Object.keys(opt?.inputs?.required || {}),
...Object.keys(opt?.inputs?.optional || {}),
...Object.entries(opt?.inputs?.required || {}).filter(isWidget).map(([k]) => k),
...Object.entries(opt?.inputs?.optional || {}).filter(isWidget).map(([k]) => k),
];
}
@@ -192,6 +239,14 @@ function _getDynamicComboSubNames(objectInfo, classType, widgetName, selectedKey
*/
const _CONTROL_AFTER_GENERATE = new Set(["fixed", "increment", "decrement", "randomize"]);
// True when the widget's object_info spec declares control_after_generate (seed-style INT widgets):
// the frontend then serializes one extra "randomize"/"fixed"/... slot right after the widget's value.
function _hasControlAfterGenerate(objectInfo, classType, widgetName) {
const info = objectInfo[classType]?.input;
const spec = info?.required?.[widgetName] || info?.optional?.[widgetName];
return !!(Array.isArray(spec) && spec[1]?.control_after_generate);
}
function _isExtraWidgetValue(val, expectedType) {
if (expectedType === "INT" || expectedType === "FLOAT") {
// If we expect a number but got a string like "fixed", it's a control widget
@@ -441,6 +496,9 @@ function _flattenSubgraphs(workflow, objectInfo) {
// from ports that truly carry a link end-to-end (e.g. width/height wired to a
// ResolutionSelector node).
const redirectedTargets = new Set();
// Extra links for the 2nd+ fan-out targets of a port that has a real outer link
// (collected here and appended after the loop so wf.links isn't mutated mid-iteration).
const fanOutLinks = [];
for (const link of wf.links) {
if (link[3] === node.id) {
const dstSlot = link[4];
@@ -458,6 +516,13 @@ function _flattenSubgraphs(workflow, objectInfo) {
link[3] = target.targetNodeId;
link[4] = target.targetSlot;
redirectedTargets.add(`${target.targetNodeId}:${target.targetSlot}`);
// Same real outer link feeding further internal targets (e.g. Qwen Image 2.1
// Edit: images.image_1 -> TextEncodeQwenImage21 AND the prompt-enhancer's
// BatchImagesNode) — duplicate it for each remaining target.
for (const extra of (inputPortTargets[portIdx] || []).slice(1)) {
fanOutLinks.push([0, link[1], link[2], extra.targetNodeId, extra.targetSlot, link[5]]);
redirectedTargets.add(`${extra.targetNodeId}:${extra.targetSlot}`);
}
}
}
if (link[1] === node.id) {
@@ -470,6 +535,11 @@ function _flattenSubgraphs(workflow, objectInfo) {
}
}
for (const l of fanOutLinks) {
l[0] = ++maxLinkId;
wf.links.push(l);
}
// === Add internal nodes (remapped IDs) ===
const remappedByOrigId = {};
for (const iNode of sgDef.nodes) {
@@ -519,9 +589,19 @@ function _flattenSubgraphs(workflow, objectInfo) {
const port = sgDef.inputs[portIdx];
const outerInp = outerWidgetInputs.find((inp) => inp.name === port.name);
const outerWidgetIdx = outerInp ? outerWidgetInputs.indexOf(outerInp) : -1;
const hasOuterOverride = !!outerInp && outerInp.link == null && outerWidgetIdx !== -1
&& outerWidgetIdx < (node.widgets_values || []).length;
const outerValue = hasOuterOverride ? node.widgets_values[outerWidgetIdx] : undefined;
// Newer frontends also save a name-keyed copy of the outer widget values
// (widgets_values_named) and may omit widget ports (seed/steps/cfg/...) from the outer
// node's inputs[] while widgets_values still holds every port, so the index-among-inputs
// lookup drifts (e.g. MOSS-Image: unet_name read the steps value). Prefer the named copy.
const named = node.widgets_values_named;
const hasNamed = !!named && typeof named === "object"
&& Object.prototype.hasOwnProperty.call(named, port.name);
const hasOuterOverride = hasNamed
? !(outerInp && outerInp.link != null)
: (!!outerInp && outerInp.link == null && outerWidgetIdx !== -1
&& outerWidgetIdx < (node.widgets_values || []).length);
const outerValue = !hasOuterOverride ? undefined
: (hasNamed ? named[port.name] : node.widgets_values[outerWidgetIdx]);
// Value to apply to non-widget (wildcard) fan-out targets: the outer override if
// present, otherwise whatever a sibling widget-type target ends up holding (its own
@@ -629,6 +709,11 @@ export const comfyWorkflow = {
return _loadObjectInfo();
},
// object_info limited to the given node types (fast; see _loadObjectInfoFor)
async getObjectInfoForTypes(types) {
return _loadObjectInfoFor(types);
},
getLastBypassedNodes() {
return _lastBypassedNodes;
},
@@ -647,6 +732,7 @@ export const comfyWorkflow = {
// at the top) would replace it with an unrelated pre-existing file instead.
invalidateObjectInfoCache() {
_objectInfoCache = null;
_objectInfoByType.clear();
},
// opts.readOnly: 表示用の読み取り変換。COMBO値の差し替えを行わず、Workflowタブの互換性
@@ -668,7 +754,7 @@ export const comfyWorkflow = {
_lastMutedNodes = [];
if (!workflow.nodes || !workflow.links) return {};
const objectInfo = await _loadObjectInfo();
const objectInfo = await _loadObjectInfoFor(_collectNodeTypes(workflow));
// Flatten subgraphs before conversion (needs objectInfo to correctly map outer
// subgraph-node widget values onto internal nodes' widgets_values indices)
@@ -764,6 +850,16 @@ export const comfyWorkflow = {
if (wIdx >= widgets.length) break;
const name = widgetNames[nIdx];
const expectedType = widgetTypes[nIdx];
// A control_after_generate widget (seed etc.) is followed by a frontend-only
// "randomize"/"fixed"/... slot even when the next widget is not numeric (e.g.
// Nano Banana 2.1: seed -> response_modalities); the type heuristic below only
// catches it when the next widget happens to be INT/FLOAT.
if (nIdx > 0 && !linkedInputNames.has(widgetNames[nIdx - 1])
&& _hasControlAfterGenerate(objectInfo, node.type, widgetNames[nIdx - 1])
&& _CONTROL_AFTER_GENERATE.has(widgets[wIdx])) {
wIdx++;
if (wIdx >= widgets.length) break;
}
// Skip if this input is already linked
if (linkedInputNames.has(name)) {
if (!linkedSlotNames.has(name)) {
@@ -819,6 +915,14 @@ export const comfyWorkflow = {
const spec = allInputDefs[name];
if (spec) {
const choices = Array.isArray(spec[0]) ? spec[0] : null;
// Template saved the bare file name while this install lists it under a
// sub-folder (or the reverse, or with the other path separator): prefer the
// choice whose file name matches over an unrelated choices[0].
if (choices && choices.length > 0 && typeof val === "string" && !choices.includes(val)) {
const base = (x) => String(x).split(/[\\/]/).pop();
const sameFile = choices.filter((c) => typeof c === "string" && base(c) === base(val));
if (sameFile.length === 1) val = sameFile[0];
}
if (!opts.readOnly && choices && choices.length > 0 && !choices.includes(val)) {
if (name === "ckpt_name") {
_lastCheckpointSubstitutions.push({
@@ -840,6 +944,9 @@ export const comfyWorkflow = {
}
}
}
// List values are reserved for node links in the API format; the backend unwraps
// {"__value__": [...]} for array-valued widgets.
if (expectedType === "BOUNDING_BOXES" && Array.isArray(val)) val = { __value__: val };
inputs[name] = val;
}
} else {
@@ -879,6 +986,7 @@ export const comfyWorkflow = {
_meta: { title: node.title || node.type },
};
}
_unifyPromptEnhancerText(api);
return api;
},
@@ -1109,6 +1217,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;
}
// ReferenceMultiLatent (Flux.3 Klein edit) — encodes reference images into the
// conditioning and outputs positive/negative/empty_latent: separate positive/negative
// inputs feeding separate outputs, so each role routes only to its own input.
if (ct === "ReferenceMultiLatent") {
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.
@@ -1141,6 +1256,13 @@ export const comfyWorkflow = {
if (isNeg) samplerNegativeRef[tv[0]] = true;
}
}
// TextEncodeQwenImage21 — fixed roles (the node feeds both guider inputs): a linked
// "prompt" (prompt-enhancer switch chain, Qwen Image 2.1 Turbo) is the positive text,
// a linked "negative_prompt" the negative.
if (ct === "TextEncodeQwenImage21") {
if (Array.isArray(inputs.prompt)) samplerPositiveRef[inputs.prompt[0]] = true;
if (Array.isArray(inputs.negative_prompt)) samplerNegativeRef[inputs.negative_prompt[0]] = true;
}
// PreviewAny — generic value tap/relay used mid-chain in prompt-enhancement wiring
// (e.g. Krea-2's "Refine Prompt?" switch output tap); pass role through its
// "source" input unchanged.
@@ -1151,6 +1273,15 @@ export const comfyWorkflow = {
if (isNeg) samplerNegativeRef[sv[0]] = true;
}
}
// PrimitiveStringMultiline/PrimitiveString whose value is linked (MOSS-Image's
// layout-prompt workflows feed it from a PreviewAny relay) — pass the role upstream.
if (ct === "PrimitiveStringMultiline" || ct === "PrimitiveString") {
const tv = inputs.value;
if (Array.isArray(tv)) {
if (isPos) samplerPositiveRef[tv[0]] = true;
if (isNeg) samplerNegativeRef[tv[0]] = true;
}
}
// StringConcatenate — appends e.g. a LoRA trigger word onto the prompt text
// (Krea-2); propagate role through both operands so the upstream literal is found.
if (ct === "StringConcatenate") {
@@ -1165,6 +1296,19 @@ export const comfyWorkflow = {
}
}
// ReferenceMultiLatent outputs its own empty latent sized from the reference image, so a
// template's leftover EmptyFlux2LatentImage that nothing consumes does nothing — don't offer
// its width/height in Settings.
const hasRefMultiLatent = Object.values(workflow).some((n) => n?.class_type === "ReferenceMultiLatent");
const referencedIds = new Set();
if (hasRefMultiLatent) {
for (const n of Object.values(workflow)) {
for (const v of Object.values(n?.inputs || {})) {
if (Array.isArray(v) && v.length === 2) referencedIds.add(String(v[0]));
}
}
}
// === Pass 2: Main analysis ===
for (const [id, node] of Object.entries(workflow)) {
if (!node?.class_type) continue;
@@ -1435,8 +1579,30 @@ export const comfyWorkflow = {
}
}
// ComfySwitchNode holding the raw prompt as an inline literal (on_false) — the
// prompt-enhancer toggle of Qwen Image 2.1 Turbo, where the subgraph's prompt widget
// lands directly on the switch instead of a PrimitiveStringMultiline.
if (ct === "ComfySwitchNode" && typeof inputs.on_false === "string" && (isPos || isNeg)) {
result.prompt_nodes.push({
id, type: ct, title, role: getRole(),
text: inputs.on_false, textKey: "on_false",
});
}
// PrimitiveStringMultiline / PrimitiveString — when feeding a prompt node
if ((ct === "PrimitiveStringMultiline" || ct === "PrimitiveString") && (isPos || isNeg)) {
// MOSSImageLayoutPrompt (MOSS-Image bounding-box layout) — builds the final prompt from its own
// "prompt" widget (whole-image description) plus the CreateBoundingBoxes elements.
if (ct === "MOSSImageLayoutPrompt" && typeof inputs.prompt === "string" && (isPos || isNeg)) {
result.prompt_nodes.push({
id, type: ct, title, role: getRole(),
text: inputs.prompt, textKey: "prompt",
});
}
// PrimitiveStringMultiline / PrimitiveString — when feeding a prompt node (a linked
// value has no literal to edit; its role is propagated upstream in Pass 1b instead)
if ((ct === "PrimitiveStringMultiline" || ct === "PrimitiveString") && (isPos || isNeg)
&& !Array.isArray(inputs.value)) {
result.prompt_nodes.push({
id, type: ct, title, role: getRole(),
text: inputs.value || "",
@@ -1457,6 +1623,16 @@ export const comfyWorkflow = {
});
}
// Gemini image nodes (Nano Banana etc., partner API nodes) — like the video all-in-one nodes above
// they hold their own "prompt" widget (no negative counterpart; the node's reference images
// arrive through LoadImage nodes, which GenerateUI's Image tab already handles generically).
if (/^Gemini(Image|NanoBanana)/.test(ct) && 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 —
@@ -1466,12 +1642,14 @@ export const comfyWorkflow = {
// has the same width/height/batch_size shape plus a "layers" count, left as-is.
if (ct === "EmptyLatentImage" || ct === "EmptySD3LatentImage" || ct === "EmptyFlux2LatentImage"
|| ct === "EmptyQwenImageLayeredLatentImage") {
result.latent_nodes.push({
id, type: ct, title,
width: typeof inputs.width === "number" ? inputs.width : undefined,
height: typeof inputs.height === "number" ? inputs.height : undefined,
batch_size: inputs.batch_size,
});
if (!hasRefMultiLatent || referencedIds.has(String(id))) {
result.latent_nodes.push({
id, type: ct, title,
width: typeof inputs.width === "number" ? inputs.width : undefined,
height: typeof inputs.height === "number" ? inputs.height : undefined,
batch_size: inputs.batch_size,
});
}
}
// Video latent nodes (Wan2.2's EmptyHunyuanLatentVideo, LTX-2.5's
@@ -1721,6 +1899,30 @@ export const comfyWorkflow = {
};
/** Check if a node is display-only (no connected inputs or outputs) */
/**
* Prompt-enhancer toggle (Qwen Image 2.1 Turbo): the template's subgraph "prompt" port fans out to
* both a ComfySwitchNode.on_false (raw text) and TextGenerate.prompt (text fed to the enhancer,
* wired to on_true). After flattening these are two independent literals, so editing one in the UI
* would leave the other stale. Route both through one shared PrimitiveStringMultiline instead.
*/
function _unifyPromptEnhancerText(api) {
for (const [swId, sw] of Object.entries(api)) {
if (sw.class_type !== "ComfySwitchNode" || typeof sw.inputs?.on_false !== "string") continue;
const tgRef = sw.inputs.on_true;
if (!Array.isArray(tgRef)) continue;
const tg = api[String(tgRef[0])];
if (tg?.class_type !== "TextGenerate" || tg.inputs.prompt !== sw.inputs.on_false) continue;
const primId = `${swId}:wfs_prompt`;
api[primId] = {
class_type: "PrimitiveStringMultiline",
inputs: { value: sw.inputs.on_false },
_meta: { title: "Prompt" },
};
sw.inputs.on_false = [primId, 0];
tg.inputs.prompt = [primId, 0];
}
}
function _isDisplayOnlyNode(node) {
const hasConnectedOutput = node.outputs?.some(o => o.links && o.links.length > 0);
const hasConnectedInput = node.inputs?.some(i => i.link != null);
+51 -22
View File
@@ -1082,6 +1082,9 @@ async function loadImageDetail(img) {
apiFetch(API.imageWorkflow(img.path)),
]);
state.embeddedWorkflow = wfRes.has_workflow ? wfRes.workflow : null;
// cc_nanobananaフォルダでも、ComfyUIネイティブノード経由(半自動マンガ・Auto等)の画像にはワークフロー/
// プロンプトが埋め込まれているため、Promptタブを表示する(埋め込みの無いGemini API直叩きの画像だけ非表示のまま)
if (state.embeddedWorkflow && isNanobananaFolderImage(img)) updatePromptTabVisibility(false);
renderWorkflowJson(state.embeddedWorkflow);
_updateCopyCanvasBtn();
renderImagePromptSection(metaRes.image_prompt);
@@ -1090,7 +1093,16 @@ async function loadImageDetail(img) {
// Promptタブは prompt_workflow (API形式優先) を使う。トップレベルとサブグラフに
// 独立した複数系統を持つワークフローでは workflow (UI形式) からの抽出だと
// トップレベル系統しか拾えないことがあるため(Metadataタブと同じ優先順位に揃える)。
renderPromptTab(wfRes.prompt_workflow ?? state.embeddedWorkflow, metaRes.embedded);
let promptWf = wfRes.prompt_workflow ?? state.embeddedWorkflow;
// サブグラフを持つUI形式(API形式のpromptチャンクが無い画像)は、外側ノードの実際の値を
// 反映するため変換してから抽出する(Metadataタブと同じ扱い)。失敗時は元の形式のまま。
if (Array.isArray(promptWf?.nodes) && promptWf.definitions?.subgraphs?.length > 0) {
try {
const converted = await comfyWorkflow.convertUiToApi(promptWf, { readOnly: true });
if (converted && Object.keys(converted).length > 0) promptWf = converted;
} catch { /* keep UI format */ }
}
renderPromptTab(promptWf, metaRes.embedded);
} catch (e) {
renderWorkflowJson(null);
_updateCopyCanvasBtn();
@@ -1852,13 +1864,38 @@ function openConvertModal(paths) {
showToast(t("convertNoTarget"), "info");
return;
}
const hasVideo = targets.some(isVideoFile);
openAudioConvertDialog({
count: targets.length,
hasVideo: targets.some(isVideoFile),
convertOne: async (opts, i) => {
const res = await fetch(API.convert, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: targets[i].path, ...opts }),
});
const data = await res.json();
if (!data.ok) throw new Error(data.error || `HTTP ${res.status}`);
if (data.deleted) state.selectedImages.delete(targets[i].path);
return data;
},
onDone: async () => {
await loadImages();
updateBulkBar();
},
});
}
/**
* 音声変換ダイアログ(Gallery・Video Edit共通)。
* convertOne(opts, i): i件目を変換し、失敗時はthrowする。結果は {tags_skipped?} を含むオブジェクト。
* allowDelete / allowCopyMeta=false の場合は該当チェックを出さず、optsにもfalseで渡す。
*/
export function openAudioConvertDialog({ count, hasVideo, convertOne, onDone, allowDelete = true, allowCopyMeta = true }) {
const overlay = document.createElement("div");
overlay.className = "wfm-gallery-lightbox";
overlay.innerHTML = `
<div class="wfm-gallery-move-modal wfm-gallery-convert-modal">
<div class="wfm-gallery-move-modal-title">${escapeHtml(t("convertTitle", targets.length))}</div>
<div class="wfm-gallery-move-modal-title">${escapeHtml(t("convertTitle", count))}</div>
${hasVideo ? `<div class="wfm-gallery-convert-note">${escapeHtml(t("convertVideoNote"))}</div>` : ""}
<label class="wfm-gallery-convert-row">${escapeHtml(t("convertFormat"))}
<select id="wfm-convert-format" class="wfm-select">
@@ -1883,8 +1920,8 @@ function openConvertModal(paths) {
</select>
</label>
<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-inherit" checked> ${escapeHtml(t("convertInherit"))}</label>
<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-copymeta" checked> ${escapeHtml(t("convertCopyMeta"))}</label>
<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-delete"> ${escapeHtml(t("convertDeleteOriginal"))}</label>
${allowCopyMeta ? `<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-copymeta" checked> ${escapeHtml(t("convertCopyMeta"))}</label>` : ""}
${allowDelete ? `<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-delete"> ${escapeHtml(t("convertDeleteOriginal"))}</label>` : ""}
<div class="wfm-gallery-convert-status" id="wfm-convert-status"></div>
<div class="wfm-gallery-move-modal-footer">
<button id="wfm-convert-run" class="wfm-btn wfm-btn-primary">${escapeHtml(t("convertRun"))}</button>
@@ -1913,8 +1950,8 @@ function openConvertModal(paths) {
q("#wfm-convert-cancel").addEventListener("click", () => { if (!running) overlay.remove(); });
overlay.addEventListener("click", (e) => { if (e.target === overlay && !running) overlay.remove(); });
q("#wfm-convert-run").addEventListener("click", async () => {
const deleteOriginal = q("#wfm-convert-delete").checked;
if (deleteOriginal && !window.confirm(t("convertConfirmDelete", targets.length))) return;
const deleteOriginal = !!q("#wfm-convert-delete")?.checked;
if (deleteOriginal && !window.confirm(t("convertConfirmDelete", count))) return;
running = true;
q("#wfm-convert-run").disabled = true;
q("#wfm-convert-cancel").disabled = true;
@@ -1924,33 +1961,25 @@ function openConvertModal(paths) {
sample_rate: Number(q("#wfm-convert-rate").value),
channels: q("#wfm-convert-channels").value,
inherit_metadata: q("#wfm-convert-inherit").checked,
copy_gallery_meta: q("#wfm-convert-copymeta").checked,
copy_gallery_meta: !!q("#wfm-convert-copymeta")?.checked,
delete_original: deleteOriginal,
};
let ok = 0, fail = 0, tagsSkipped = false;
for (let i = 0; i < targets.length; i++) {
q("#wfm-convert-status").textContent = t("convertProgress", i + 1, targets.length);
for (let i = 0; i < count; i++) {
q("#wfm-convert-status").textContent = t("convertProgress", i + 1, count);
try {
const res = await fetch(API.convert, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: targets[i].path, ...opts }),
});
const data = await res.json();
if (!data.ok) throw new Error(data.error || `HTTP ${res.status}`);
const data = await convertOne(opts, i);
ok++;
if (data.tags_skipped) tagsSkipped = true;
if (data.deleted) state.selectedImages.delete(targets[i].path);
if (data?.tags_skipped) tagsSkipped = true;
} catch (e) {
fail++;
console.warn("[Gallery] convert failed:", targets[i].filename, e);
console.warn("[Gallery] convert failed:", i, e);
}
}
overlay.remove();
showToast(t("convertDone", ok, fail), fail ? "error" : "success");
if (tagsSkipped && opts.inherit_metadata) showToast(t("convertTagsSkipped"), "info");
await loadImages();
updateBulkBar();
await onDone?.({ ok, fail });
});
document.body.appendChild(overlay);
+30 -6
View File
File diff suppressed because one or more lines are too long
+13 -2
View File
@@ -201,7 +201,12 @@ function extractDiffusionModels(wf) {
if (!wf || typeof wf !== "object") return [];
const UNET_TYPES = new Set(["UNETLoader", "UnetLoaderGGUF", "UNETLoaderGGUF"]);
if (Array.isArray(wf.nodes)) return collectUnique(collectAllNodes(wf).filter(n => UNET_TYPES.has(n.type)).map(n => n.widgets_values?.[0]));
return collectUnique(Object.values(wf).filter(n => UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name));
// Gemini系の画像生成ノード(Nano Banana等、API形式)は"model"入力がモデル名(例: "Gemini Nano Banana 2.1")
const isGeminiImage = (ct) => /^Gemini(Image|NanoBanana)/.test(ct ?? "");
return collectUnique([
...Object.values(wf).filter(n => UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name),
...Object.values(wf).filter(n => isGeminiImage(n?.class_type)).map(n => typeof n.inputs?.model === "string" ? n.inputs.model : undefined),
]);
}
function extractTextEncoders(wf) {
if (!wf || typeof wf !== "object") return [];
@@ -300,6 +305,11 @@ function extractSamplerSettings(apiWf) {
// 補助ノードから不足分を補う。
const AUX = {
RandomNoise: ["noise_seed"],
// Gemini系の画像生成ノード(Nano Banana等)はseedのみ(GeminiへはseedではなくComfyUIのキャッシュキーとして働く)
GeminiImageNode: ["seed"],
GeminiImage2Node: ["seed"],
GeminiNanoBanana2: ["seed"],
GeminiNanoBanana2V2: ["seed"],
BasicScheduler: ["steps", "scheduler", "denoise"],
KSamplerSelect: ["sampler_name"],
CFGGuider: ["cfg"],
@@ -613,7 +623,8 @@ function extractPromptsAPI(wf) {
// MiniMaxH3ImageToVideo等の動画生成オールインワンノード。CLIPTextEncode等を経由せず
// 自ノードの"prompt"入力に直接テキストを持つ(positive/negativeの区別も無い)ため、
// isTextEncoderNode判定を通さずtextMapへ直接投入する(fallbackのtextsに載る)。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo/i.test(ct)) {
// Gemini系の画像生成ノード(Nano Banana等)も同様に自ノードの"prompt"入力を持つ。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo|^Gemini(Image|NanoBanana)/i.test(ct)) {
textMap.set(id, n.inputs.prompt);
continue;
}
+34 -7
View File
@@ -83,7 +83,8 @@ import {
setSourcePreview, setResultPreview, getActivePreviewVideoElement, getResultPreviewVideoElement,
getPreviewPaneElements,
} from "./video-preview.js";
import { VTEMP_GROUP, ensureVideoGroup } from "./gallery-tab.js";
import { VTEMP_GROUP, ensureVideoGroup, openAudioConvertDialog } from "./gallery-tab.js";
import { escapeHtml } from "./util.js";
const _s = {
clips: [], // { id, name, file, kind:"video"|"image", serverRef:{filename,subfolder,type}|null, duration, width, height, fps, hasAudio, trimStart, trimEnd, crop:{x,y,w,h}(0..1)|null, probing, error }
@@ -1057,13 +1058,13 @@ function _renderCropSection(clip) {
.map((k) => `<option value="${k}">${k === "free" ? t("videoEditCropFree") : k}</option>`)
.join("");
host.innerHTML = `
<div class="wfm-video-edit-section-head">
<div class="wfm-video-edit-section-head wfm-video-edit-crop-head">
<span>${t("videoEditCrop")}</span>
<span style="display:flex;gap:6px;">
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-toggle"></button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-cancel" style="display:${_cropEditing ? "" : "none"};">${t("videoEditCropCancel")}</button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-reset">${t("videoEditCropReset")}</button>
</span>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-toggle"></button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-cancel" style="display:${_cropEditing ? "" : "none"};">${t("videoEditCropCancel")}</button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-reset">${t("videoEditCropReset")}</button>
<span class="wfm-video-edit-head-sep" aria-hidden="true">|</span>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-audio-convert" title="${escapeHtml(t("videoEditAudioConvertTitle"))}">${t("videoEditAudioConvert")}</button>
</div>
<div class="wfm-video-edit-crop-row">
<label>${t("videoEditCropAspect")}<select class="wfm-input" id="wfm-video-edit-crop-aspect">${aspectOptions}</select></label>
@@ -1089,6 +1090,7 @@ function _renderCropSection(clip) {
clip.crop = _cropEditing ? { x: 0, y: 0, w: 1, h: 1 } : null;
_commitCrop(clip);
});
document.getElementById("wfm-video-edit-audio-convert").addEventListener("click", () => _openClipAudioConvert(clip));
aspect.addEventListener("change", () => {
_cropAspect = aspect.value;
if (clip.crop) _applyCropAspect(clip);
@@ -1097,6 +1099,31 @@ function _renderCropSection(clip) {
_updateCropInfo(clip);
}
// Audio conversion for the selected clip: reuses Gallery's convert dialog, but the
// clip lives in ComfyUI's input folder, so the backend writes the result into
// output/video (visible in Gallery) instead of next to the source.
function _openClipAudioConvert(clip) {
if (clip.probing || !clip.serverRef) { showToast(t("videoEditClipNotReady"), "info"); return; }
if (clip.kind !== "video" || !clip.hasAudio) { showToast(t("convertNoTarget"), "info"); return; }
openAudioConvertDialog({
count: 1,
hasVideo: true,
allowDelete: false,
allowCopyMeta: false,
convertOne: async (opts) => {
const res = await fetch("/api/wfm/video/edit/convert-audio", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ...clip.serverRef, ...opts }),
});
const data = await res.json();
if (!data.ok) throw new Error(data.error || `HTTP ${res.status}`);
showToast(t("videoEditAudioConvertSaved", data.filename), "success");
return data;
},
});
}
// Leaves crop-edit mode. keep=true ("Done", or leaving the Edit subtab /
// selecting another clip) keeps the adjusted rect; keep=false ("Cancel")
// puts back the crop the clip had when editing started.
+39
View File
@@ -150,6 +150,7 @@ function _applyVideoI18n() {
setText("wfm-video-edit-bgm-hint", "videoEditBgmHint");
setText("wfm-video-edit-sound-btn", "videoEditSoundAdd");
setText("wfm-video-source-add-to-edit", "videoSourceAddToEdit");
setText("wfm-video-source-register-asset", "videoSourceRegisterAsset");
setText("wfm-video-source-label", "videoSourceLabel");
setText("wfm-video-source-hint", "videoSourceHint");
setText("wfm-video-source-drop-label", "videoSourceDropLabel");
@@ -211,6 +212,44 @@ function _wireVideoSourcePanel() {
}
});
// "Register as Asset" — puts whatever is loaded in the Source pane into Gallery's
// curated __Video Assets__ group so it shows up in the Asset subtab. Local files
// are uploaded to input first, then copied into output/video by the backend
// (Gallery only lists the output folder); sources already in output are tagged as-is.
document.getElementById("wfm-video-source-register-asset")?.addEventListener("click", async (e) => {
const btn = e.currentTarget;
let ref = getActivePreviewSource();
if (!ref) { showToast(t("videoNoSourceLoaded"), "error"); return; }
btn.disabled = true;
try {
if (ref.kind === "local") {
const uploaded = await comfyUI.uploadImage(ref.file, ref.file.name);
ref = { kind: "input", filename: uploaded.name, subfolder: uploaded.subfolder || "", type: "input" };
updateActivePreviewSourceRef(ref);
}
const res = await fetch("/api/wfm/video/asset/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ filename: ref.filename, subfolder: ref.subfolder || "", type: ref.type || "input" }),
});
const json = await res.json();
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
await ensureVideoGroup();
const addRes = await fetch(`/wfm/gallery/groups/${encodeURIComponent(VIDEO_GROUP)}/add`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: json.path }),
});
if (!addRes.ok) throw new Error(`HTTP ${addRes.status}`);
showToast(t("videoSourceAssetRegistered", json.filename), "success");
refreshVideoAssetTab();
} catch (err) {
showToast(t("errorWithMsg", err.message), "error");
} finally {
btn.disabled = false;
}
});
document.getElementById("wfm-video-source-clear")?.addEventListener("click", () => {
setSourcePreview(null, null);
const statusEl = document.getElementById("wfm-video-source-status");
+5 -1
View File
@@ -65,7 +65,11 @@ async function _checkConversion(raw, filename) {
} catch (e) {
return { status: "error", lines: [t("compatConvertFailed", e.message || String(e))] };
}
const objectInfo = await comfyWorkflow.getObjectInfo();
// Only the node types in use are needed — the full /object_info can take tens of seconds
const usedTypes = [...new Set(Object.values(api || {}).map((n) => n?.class_type).filter(Boolean))];
let objectInfo = await comfyWorkflow.getObjectInfoForTypes(usedTypes);
// Nothing known at all: either every type is missing or the server is unreachable — only the full snapshot can tell
if (Object.keys(objectInfo).length === 0 && usedTypes.length > 0) objectInfo = await comfyWorkflow.getObjectInfo();
if (format === "api") subs = _comboMismatches(api, objectInfo);
const ids = Object.keys(api || {});
-2
View File
@@ -1110,8 +1110,6 @@ function openDetailModal(wf) {
getRawWorkflow(wf.filename)
.then((raw) => setFormatBadge(document.getElementById("wfm-detail-format-badge"), comfyWorkflow.detectFormat(raw, wf.filename)))
.catch(() => {});
// Warm the /object_info cache (large; ~10 s on first fetch) so the check button answers quickly
comfyWorkflow.getObjectInfo();
document.getElementById("wfm-detail-compat-check")?.addEventListener("click", async () => {
const btn = document.getElementById("wfm-detail-compat-check");
const el = document.getElementById("wfm-detail-compat-result");
+6 -4
View File
@@ -1431,6 +1431,7 @@
<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>
<li id="wfm-help-gen-32"><b>Partner API nodes</b> (Nano Banana / Gemini image nodes, etc.): GenerateUI can run workflows that contain ComfyUI's partner API nodes. These nodes need Comfy credentials in the /prompt request — ComfyUI's own screen adds them automatically, but a separate page cannot — so add <code>COMFY_API_KEY=...</code> (a Comfy API key issued at platform.comfy.org) to the plugin's .env file and restart ComfyUI. With the key set, GenerateUI sends the request through the plugin server, which adds the key only when the workflow contains a partner API node (the key never reaches the browser); usage is billed as Comfy credits. A Gemini image node's prompt appears in the Prompt tab, and its reference images go through LoadImage nodes in the Image tab. Sample: ws_nano_banana_2_1_t2i</li>
</ul>
</div>
<div class="wfm-help-card">
@@ -2137,13 +2138,13 @@
<li id="wfm-help-video-2">A plan with a single block behaves exactly like the old one-shot form. Model selection (UNet / CLIP / VAE / Audio VAE) is fixed to the loaded workflow's defaults. For workflows with no ResolutionSelector node (e.g. Wan2.2, LTX-2.5 First & Last Frame to Video), the Aspect Ratio / Megapixels / Multiple fields are disabled and the workflow's own Width / Height become directly editable instead. Turbo Mode / Strength / Steps only apply to MiniMax H3's turbo LoRA, and Prompt Enhance only to LTX-2.5 — both stay disabled for other model families. Noise Seed is disabled for the one workflow that doesn't expose it: Wan2.2 Text-to-Video.</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 — this starts a fresh single-block plan seeded from the workflow's own current values. Unsupported workflows show an error instead.</li>
<li id="wfm-help-video-4">Generated videos (mp4) automatically appear in the Asset subtab's Video Temp group, and can also be browsed and played back in the Gallery tab. Organizing keepers into Video Assets is entirely up to you, on your own schedule.</li>
<li id="wfm-help-video-5">The center panel shows two previews: the left one shows either the video you select in the Asset subtab or whatever you drop/pick in the Video Source panel on its left (Clear resets it to empty), letting you use the Frame/GIF tools without running the loaded video workflow first; the right one always shows the most recently generated clip.</li>
<li id="wfm-help-video-5">The center panel shows two previews: the left one shows either the video you select in the Asset subtab or whatever you drop/pick in the Video Source panel on its left (Clear resets it to empty; "Register as Asset" copies the loaded video into the output folder and tags it into Video Assets so it shows up in the Asset subtab), letting you use the Frame/GIF tools without running the loaded video workflow first; the right one always shows the most recently generated clip.</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 — check "Add to Video Assets group" first to also tag the saved frame into Gallery's Video Assets group.</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">Chaining: setting a block's First Image to "use previous block's last frame" continues smoothly from the previous clip — if that previous block has its own explicit Last Image, that image is used directly; otherwise the actual last frame of its generated video is extracted automatically.</li>
<li id="wfm-help-video-9">Project tab (sidebar): lists saved Video Plans while the center Plan subtab is active, or saved Edit projects while the center Edit subtab is active (thumbnail/block or clip count, last updated) — click one to load it, or delete it with the × button; clicking the same tab again collapses the panel.</li>
<li id="wfm-help-video-10">Highlight color: the Prompt / Duration / First Image / Last Image / Aspect Ratio / Megapixels / Multiple / Noise Seed / Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance 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 while Width / Height light up instead.</li>
<li id="wfm-help-video-11">Edit subtab: a lightweight clip timeline for trimming and concatenating video/image clips outside of generation. Add clips via the Video Source panel's "Add to Edit" button or the Asset subtab's "Send to Edit" button, then drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, and Clear to empty the timeline (this also resets the Audio section). The trim panel for the selected video clip shows a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges — image clips instead get a simple hold-duration field. ▶ Preview plays every ready clip back-to-back (trimmed to its in/out points) in the right-hand result preview; Export builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into the Video Temp group automatically. The Audio section of the export panel controls the soundtrack: "Keep original audio" (with its own volume in dB) keeps each clip's audio aligned to its segment even across multiple clips (image clips contribute silence), and "BGM..." lays one audio file over the whole video with its own volume and start offset (a longer BGM is cut to the video length). Each clip can also carry text overlays ("+ Add text" under the trim panel: text, start/end seconds within the clip, size as % of frame height, color, 9-position anchor, outline, background box); they are previewed live over the Source/Result panes and burned in on Export as a final pass. The BGM can be chosen with "BGM...", by dropping an audio/video file onto the Audio section, or with "Set as BGM" on a video in the Asset subtab (its audio track is used). Video clips can also be cropped: "Edit crop" shows a draggable/resizable rectangle over the Source preview (optionally locked to 16:9 / 9:16 / 1:1 / 4:3 / 3:4) — "Done" keeps it, "Cancel" restores the crop from before editing, and switching to another subtab/tab ends editing like Done; the export size becomes the first video clip's cropped size, and other clips of a different size are center-fit to it. ↶/↷ in the timeline toolbar (or Ctrl+Z / Ctrl+Y) undo and redo edits to clips, trims, crops, text and audio settings. The export panel's Save/Save As/Load buttons persist the timeline itself (clip order, trim points, crop, text overlays, audio/BGM settings, and which uploaded file each clip and the BGM refer to) as a JSON project file on the server. The project only stores references to those files in ComfyUI's input folder, so Load re-fetches each clip from its saved server reference and re-probes it — the original files must still exist (Settings → Full Backup can bundle them with "Include media used by Video Edit projects"). These saved projects also show up in the sidebar's Project tab whenever the Edit subtab is active (see the Project tab item).</li>
<li id="wfm-help-video-11">Edit subtab: a lightweight clip timeline for trimming and concatenating video/image clips outside of generation. Add clips via the Video Source panel's "Add to Edit" button or the Asset subtab's "Send to Edit" button, then drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, and Clear to empty the timeline (this also resets the Audio section). The trim panel for the selected video clip shows a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges — image clips instead get a simple hold-duration field. ▶ Preview plays every ready clip back-to-back (trimmed to its in/out points) in the right-hand result preview; Export builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into the Video Temp group automatically. The Audio section of the export panel controls the soundtrack: "Keep original audio" (with its own volume in dB) keeps each clip's audio aligned to its segment even across multiple clips (image clips contribute silence), and "BGM..." lays one audio file over the whole video with its own volume and start offset (a longer BGM is cut to the video length). Each clip can also carry text overlays ("+ Add text" under the trim panel: text, start/end seconds within the clip, size as % of frame height, color, 9-position anchor, outline, background box); they are previewed live over the Source/Result panes and burned in on Export as a final pass. The BGM can be chosen with "BGM...", by dropping an audio/video file onto the Audio section, or with "Set as BGM" on a video in the Asset subtab (its audio track is used). Video clips can also be cropped: "Edit crop" shows a draggable/resizable rectangle over the Source preview (optionally locked to 16:9 / 9:16 / 1:1 / 4:3 / 3:4) — "Done" keeps it, "Cancel" restores the crop from before editing, and switching to another subtab/tab ends editing like Done; the export size becomes the first video clip's cropped size, and other clips of a different size are center-fit to it. The "Convert audio..." button next to the crop buttons converts the selected video clip's audio track to FLAC / MP3 / Opus / M4A / WAV (same dialog as Gallery's Convert) and saves it into the output/video folder. ↶/↷ in the timeline toolbar (or Ctrl+Z / Ctrl+Y) undo and redo edits to clips, trims, crops, text and audio settings. The export panel's Save/Save As/Load buttons persist the timeline itself (clip order, trim points, crop, text overlays, audio/BGM settings, and which uploaded file each clip and the BGM refer to) as a JSON project file on the server. The project only stores references to those files in ComfyUI's input folder, so Load re-fetches each clip from its saved server reference and re-probes it — the original files must still exist (Settings → Full Backup can bundle them with "Include media used by Video Edit projects"). These saved projects also show up in the sidebar's Project tab whenever the Edit subtab is active (see the Project tab item).</li>
<li id="wfm-help-video-12">Asset subtab (center panel, next to Plan/Edit): browses every video/image tagged into Video Assets or Video Temp (via the group dropdown, or "All Video Assets" for both). Search filters by filename; the ▦/☰ buttons switch between a thumbnail grid and a table (filename/updated/tags). Selecting an item shows its tags/memo, loads it into the center preview, and offers "Send to Edit" (queues it as a clip in the Edit subtab) plus, for images only, "Set as First Image"/"Set as Last Image" (uploads it straight into the currently-selected Plan block, switching to the Plan subtab). Audio files tagged into Video Assets also appear (&quot;Audio Only&quot; filter): the detail panel gets a player plus &quot;Set as BGM&quot; and &quot;Add as sound&quot; (places it on the Edit subtab's Audio track at the selected clip's start).</li>
</ul>
</div>
@@ -2847,8 +2848,9 @@
<input type="file" accept="video/*,image/*" 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>
<div class="wfm-i2i-status wfm-video-source-status-line" id="wfm-video-source-status"></div>
<div class="wfm-video-source-actions">
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-register-asset">Register as Asset</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-add-to-edit">Add to Edit</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-clear">Clear</button>
</div>
+16 -4
View File
@@ -2962,10 +2962,16 @@ function _wfmFlattenSubgraphs(workflow, objectInfo) {
}
const outerWidgetInputs = (node.inputs || []).filter((inp) => inp.widget);
// widgets_values_named (name-keyed copy saved by newer frontends, e.g. MOSS-Image): outer inputs[]
// may omit widget ports (seed/steps/...) while widgets_values holds every port, so the index
// lookup below would drift — see static/js/comfyui-workflow.js _flattenSubgraphs.
const namedOuter = node.widgets_values_named;
const hasNamedOuter = !!namedOuter && typeof namedOuter === "object";
outerWidgetInputs.forEach((inp, widgetIdx) => {
if (inp.link != null) return;
if (widgetIdx >= (node.widgets_values || []).length) return;
const outerValue = node.widgets_values[widgetIdx];
const useNamed = hasNamedOuter && Object.prototype.hasOwnProperty.call(namedOuter, inp.name);
if (!useNamed && widgetIdx >= (node.widgets_values || []).length) return;
const outerValue = useNamed ? namedOuter[inp.name] : node.widgets_values[widgetIdx];
const portIdx = (sgDef.inputs || []).findIndex((p) => p.name === inp.name);
if (portIdx === -1) return;
@@ -3214,7 +3220,12 @@ function _extractDiffusionModels(wf) {
if (!wf || typeof wf !== "object") return [];
const _UNET_TYPES = new Set(["UNETLoader", "UnetLoaderGGUF", "UNETLoaderGGUF"]);
if (Array.isArray(wf.nodes)) return _collectUnique(_collectAllNodes(wf).filter(n => _UNET_TYPES.has(n.type)).map(n => n.widgets_values?.[0]));
return _collectUnique(Object.values(wf).filter(n => _UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name));
// Gemini系の画像生成ノード(Nano Banana等、API形式)は"model"入力がモデル名(例: "Gemini Nano Banana 2.1")
const _isGeminiImage = (ct) => /^Gemini(Image|NanoBanana)/.test(ct ?? "");
return _collectUnique([
...Object.values(wf).filter(n => _UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name),
...Object.values(wf).filter(n => _isGeminiImage(n?.class_type)).map(n => typeof n.inputs?.model === "string" ? n.inputs.model : undefined),
]);
}
function _extractTextEncoders(wf) {
if (!wf || typeof wf !== "object") return [];
@@ -3537,7 +3548,8 @@ function _extractPromptsAPI(wf) {
// MiniMaxH3ImageToVideo等の動画生成オールインワンノード。CLIPTextEncode等を経由せず
// 自ノードの"prompt"入力に直接テキストを持つ(positive/negativeの区別も無い)ため、
// _isTextEncoderNode判定を通さずtextMapへ直接投入する(fallbackのtextsに載る)。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo/i.test(ct)) {
// Gemini系の画像生成ノード(Nano Banana等)も同様に自ノードの"prompt"入力を持つ。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo|^Gemini(Image|NanoBanana)/i.test(ct)) {
textMap.set(id, n.inputs.prompt);
continue;
}
+246
View File
@@ -0,0 +1,246 @@
{
"id": "ws-nano-banana-2-1-t2i",
"revision": 0,
"last_node_id": 2,
"last_link_id": 1,
"nodes": [
{
"id": 1,
"type": "GeminiNanoBanana2V2",
"pos": [
100,
100
],
"size": [
400,
398
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"localized_name": "prompt",
"name": "prompt",
"type": "STRING",
"widget": {
"name": "prompt"
},
"link": null
},
{
"localized_name": "aspect_ratio",
"name": "model.aspect_ratio",
"type": "COMBO",
"widget": {
"name": "model.aspect_ratio"
},
"link": null
},
{
"localized_name": "resolution",
"name": "model.resolution",
"type": "COMBO",
"widget": {
"name": "model.resolution"
},
"link": null
},
{
"localized_name": "thinking_level",
"name": "model.thinking_level",
"type": "COMBO",
"widget": {
"name": "model.thinking_level"
},
"link": null
},
{
"localized_name": "image_1",
"name": "model.images.image_1",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"localized_name": "files",
"name": "model.files",
"shape": 7,
"type": "GEMINI_INPUT_FILES",
"link": null
},
{
"localized_name": "model",
"name": "model",
"type": "COMFY_DYNAMICCOMBO_V3",
"widget": {
"name": "model"
},
"link": null
},
{
"localized_name": "seed",
"name": "seed",
"type": "INT",
"widget": {
"name": "seed"
},
"link": null
},
{
"localized_name": "response_modalities",
"name": "response_modalities",
"type": "COMBO",
"widget": {
"name": "response_modalities"
},
"link": null
},
{
"localized_name": "system_prompt",
"name": "system_prompt",
"shape": 7,
"type": "STRING",
"widget": {
"name": "system_prompt"
},
"link": null
},
{
"localized_name": "temperature",
"name": "temperature",
"shape": 7,
"type": "FLOAT",
"widget": {
"name": "temperature"
},
"link": null
},
{
"localized_name": "top_p",
"name": "top_p",
"shape": 7,
"type": "FLOAT",
"widget": {
"name": "top_p"
},
"link": null
}
],
"outputs": [
{
"localized_name": "IMAGE",
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"localized_name": "STRING",
"name": "STRING",
"type": "STRING",
"links": null
},
{
"localized_name": "thought_image",
"name": "thought_image",
"type": "IMAGE",
"links": null
}
],
"properties": {
"Node name for S&R": "GeminiNanoBanana2V2"
},
"widgets_values": [
"a cute watercolor illustration of a red fox in a forest",
"Gemini Nano Banana 2.1",
"auto",
"1K",
"MEDIUM",
42,
"randomize",
"IMAGE",
"You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests.",
1,
0.95
],
"color": "#432",
"bgcolor": "#653",
"title": "Nano Banana 2.1"
},
{
"id": 2,
"type": "SaveImage",
"pos": [
700,
100
],
"size": [
270,
58
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"localized_name": "images",
"name": "images",
"type": "IMAGE",
"link": 1
},
{
"localized_name": "filename_prefix",
"name": "filename_prefix",
"type": "STRING",
"widget": {
"name": "filename_prefix"
},
"link": null
}
],
"outputs": [
{
"localized_name": "images",
"name": "images",
"type": "IMAGE",
"links": null
}
],
"properties": {
"Node name for S&R": "SaveImage"
},
"widgets_values": [
"nano_banana"
],
"widgets_values_named": {
"filename_prefix": "ComfyUI"
}
}
],
"links": [
[
1,
1,
0,
2,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"bvSmartPipeRootId": "fab0b8d3-84d9-402b-a229-8e739ac71670",
"bvSmartPipeRoutes": {},
"ds": {
"scale": 1.0545043882575544,
"offset": [
944.7666109676784,
628.4452835934753
]
}
},
"version": 0.4
}