Compare commits

...
9 Commits
Author SHA1 Message Date
ketle-manandClaude Opus 5.5 98d30db04e release: v0.10.2 — Game tab Settings pane, help for Prompt Typer and Sky Heart (game pack v0.3.0)
- Help: Prompt Typer (helpGame10) and Sky Heart (helpGame11) in en/ja/zh;
  helpGame2 now explains the right pane's Result / Settings tabs.
- README: Game tab section lists games 3 and 4 and the Settings tab.
- Version 0.10.2, DEVLOG entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 15:34:24 +09:00
ketle-manandClaude Opus 5.5 65c1351a83 feat: Game tab right pane split into Result / Settings tabs
Left pane now lists games only. Play settings and image generation
settings move to a Settings tab in the right pane; the Result tab
keeps the status and image cards and opens automatically when a new
image card is added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 13:51:16 +09:00
ketle-manandClaude Opus 5.5 8ce74d761e release: v0.10.1 — Game tab help for Turbo Heart (game pack v0.2.0)
- Help: Turbo Heart entry (controls, 5 races, top 3 to advance, hearts,
  obstacles, images) in en / ja / zh
- README: Turbo Heart in the Game tab section
- No code changes needed on the Workflow Studio side

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 12:01:48 +09:00
ketle-manandClaude Opus 5.5 1888dd0698 chore: stop tracking PLAN_GAME_TAB.md
- Keep the Game tab planning doc local (added to .gitignore like the
  other *_PLAN.md files); the file itself stays in the working folder
- README / DEVLOG / game-tab.js no longer point to it (README links the
  game pack's README instead)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:52:05 +09:00
ketle-manandClaude Opus 5.5 b6778560b0 docs: Game tab help for Turbo Heart, plan notes for game 2
- Help page: Turbo Heart entry (controls, 5 races, top 3 to advance,
  images) in en / ja / zh
- PLAN_GAME_TAB.md: section 13 (Turbo Heart design, scenery, thrill,
  image prompts, shared code) and notes on clouds, city-pop BGM and
  tire squeal

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 18:43:17 +09:00
ketle-manandClaude Opus 5.5 0830a3f372 release: v0.10.0 — Game tab (experimental, needs ComfyUI-WFS-Games)
- Game tab: shown only when the ComfyUI-WFS-Games pack answers
  /wfs_games/manifest; games are ES modules mounted with
  mount(container, host) and report through runStart / stageClear /
  finish
- Result panel: one card per image (each stage clear, ending, game
  over, private photo), generated one at a time in the background while
  playing; prompts listed by kind, editable, Regenerate / Open in
  GenerateUI; the game's negative tags are added
- Settings: generation workflow (default ws_game_sdxl_t2i.json, now in
  workflows/), base / negative prompt, auto-generate per stage / ending
  / game over, difficulty, music, sound effects
- VRAM Management: prepareVramForGeneration({ quiet }) and
  comfyUI.generate(..., { quietVram }); no toast while the Game tab is
  open or for Game tab generations
- en / ja / zh strings, help page, README, DEVLOG, PLAN_GAME_TAB.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 17:21:03 +09:00
ketle-manandClaude Opus 5.5 086a767aff feat: experimental Game tab (needs the ComfyUI-WFS-Games pack)
- Game tab shows only when /wfs_games/manifest responds (pack installed);
  the help page is hidden the same way
- Games are loaded with dynamic import and mounted via mount(container, host);
  host passes language and play settings (difficulty, sound, bgm)
- On clear, the prompts returned by the game (style / heroine / scene /
  stage) are listed with their kind; the base prompt plus the checked
  prompts are written into the chosen workflow's positive prompt and
  generated with comfyUI.generate(); the game's negative tags are added
- Generation workflow is chosen in the Game settings
  (default ws_game_sdxl_t2i.json); no generation on game over
- Settings kept in localStorage wfm_game_settings (included in backups)
- en / ja / zh strings, help page, PLAN_GAME_TAB.md (plan, library
  choice, research on similar nodes, implementation notes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 23:51:40 +09:00
ketle-manandClaude Opus 5.5 bf824a160a release: v0.9.10 — prompt translation API, backup of browser-side settings
Prompt translation API (for Comic Creator):
- POST /api/wfm/translate/prompt: prompt-aware translation on the server
  (prompt splitting moved from prompt-translate.js to translate_service.py;
  GenerateUI / Lab / Video Plan now use it)
- target_lang (PLaMo 3 Translate's 53 languages), protect_quotes for text
  drawn in the image, no more silent truncation of long text
- config: api version + languages; warmup ignore_enabled
- VRAM management keeps CPU-resident (size_vram == 0) Ollama models

Data management:
- JSON export and full backup now carry the localStorage settings
  (groups, badge palette, appearance, AI / decision / VRAM settings, presets)
- JSON export includes semantic_settings.json
- full backup skips the unused models/ folder and *.tmp files; semantic index
  (default on) and TagSpace cache (default off) are optional

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:53:04 +09:00
ketle-manandClaude Opus 5.5 6016ac1fcf docs: manual v0.9.9 (ja/en) — prompt translation
- New section 5-10: writing prompts in your own language (Prompt
  Translation) — setup, PLaMo 3 Translate sizes, GPU vs CPU-resident,
  the globe/Original buttons, automatic translation for Generate, Lab Run
  and Video Plan Run.
- Notes in 7-5 and 10-2 (PLaMo in the translate buttons), 11-4 (Video Plan
  globe button and the v0.9.9 Plan-values fix), 11-5 settings table, 12-3
  troubleshooting table, appendix glossary and links.
- Rebuilt the combined MD and ZIP for v0.9.9 (v0.9.6 files removed);
  README points to the v0.9.9 ZIPs and the v0.9.9 EPUB edition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 11:56:50 +09:00
43 changed files with 2457 additions and 203 deletions
+1
View File
@@ -12,3 +12,4 @@ graphify-out/
# Working-notes plan docs — local scratch, not meant to ship with the repo
VIDEO_EDIT_TAB_PLAN.md
QWEN_CHAT_INTEGRATION_PLAN.md
PLAN_GAME_TAB.md
+4
View File
@@ -2,6 +2,10 @@
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.10.2(2026-11-18)** — Game タブ: 右ペインを「結果 / 設定」のタブに、第3弾・第4弾に対応(ゲームパック ComfyUI-WFS-Games v0.3.0)
- **v0.10.1(2026-11-18)** — Game タブ: 第2弾 Turbo Heart に対応(ゲームパック ComfyUI-WFS-Games v0.2.0)
- **v0.10.0(2026-11-17)** — Game タブ(実験的機能・別パッケージ ComfyUI-WFS-Games が必要)
- **v0.9.10(2026-11-15)** — プロンプト翻訳API(Comic Creator から使うための整備)
- **v0.9.9(2026-11-15)** — プロンプト翻訳(自国語 → 英語、PLaMo 3 Translate)
- **v0.9.8(2026-11-14)** — セキュリティ: クライアントから受け取るパスを解決前に検証
- **v0.9.6(2026-11-12)** — マニュアル v0.9.6版(ja/en)
+67
View File
@@ -2,6 +2,68 @@
---
## v0.10.2(2026-11-18)
### Game タブ: 右ペインを「結果 / 設定」のタブに、第3弾・第4弾に対応(ゲームパック ComfyUI-WFS-Games v0.3.0)
- 左ペインはゲーム一覧だけにし、プレイ設定と画像生成設定を右ペインの「設定」タブへ移動。「結果」タブは画像カード。新しい画像カードが追加されたときは結果タブに切り替える。タブは共通の .wfm-side-tab-nav / .wfm-side-tab-btn を使用、i18n キー gameSettingsTab(英日中)。
- ヘルプに Prompt Typer(helpGame10)と Sky Heart(helpGame11)の項目を追加し、helpGame2 に右ペインのタブの説明を追記(英日中)。
- README の Game タブ節に第3弾・第4弾を追加。Host API の変更はなし。
- 第3弾 Prompt Typer(パック側): 打った文字(誤字込み)がそのままプロンプトになるタイピングゲーム。10ステージ x 20ワード、85%でクリア、クリアできなくても毎ステージ画像生成、リトライ可。英日中(日中は IME の入力欄、漢字に読みがな、ひらがな/カタカナ同一視)、バックスペースは今のワードのみ(ミス数は減らない)、BGM なし。
- 第4弾 Sky Heart(パック側): 画面の奥へ飛ぶ疑似3Dシューティング。ヒカリ(ジェットパック)で全5ステージ+ボス、高度計、空中・地上のハート、地上のミサイル発射台、パワーアップ(1UP・バリア・サポートメカ)、ステージ4のビルは4発で破壊。
---
## v0.10.1(2026-11-18)
### Game タブ: 第2弾 Turbo Heart に対応(ゲームパック ComfyUI-WFS-Games v0.2.0)
- ヘルプページに Turbo Heart の項目を追加(英日中): 操作、全5レース、8台で3位以内なら次へ、コース上のハート5個、障害物(ダンボール・オイル・道を渡る人)、画像の仕組みは Star Formation と同じ。
- README の Game タブ節に Turbo Heart を追加。WFS 側のコード変更はなし(Host API はそのまま使える)。
- 企画書 PLAN_GAME_TAB.md はリポジトリ外で管理するようにした(.gitignore に追加し、履歴からも削除)。
---
## v0.10.0(2026-11-17)
### Game タブ(実験的機能・別パッケージ ComfyUI-WFS-Games が必要)
- ゲームをクリアした結果で画像を生成するタブ。ゲーム本体は別パッケージ [ComfyUI-WFS-Games](https://github.com/ketle-man/ComfyUI-WFS-Games)(Phaser 4.2.1 同梱、ノードなし)で配布し、`/wfs_games/manifest` が応答したときだけタブとヘルプページを表示する(Mask Editor One 連携と同じ「ルート疎通」方式)。未インストール環境では従来どおり。
- ゲームは manifest の `entry`(同一オリジン `/wfs_games/static/` 配下のみ許可)を動的 import し `mount(container, host)` で起動。host は言語・プレイ設定(難易度・BGM・効果音)と `runStart()` / `stageClear(result)` / `finish(result)` を渡す。ゲームは ComfyUI を直接操作しない。
- 結果パネルは「画像1枚 = カード1枚」。ステージクリア・エンディング・ゲームオーバーごとにカードを追加し、生成はキューで1枚ずつ順番に(プレイは止めない)。カードではゲームから渡されたプロンプトを種類(画風/ヒロイン/シーン/ステージ)付きで確認・除外・編集でき、「再生成」「GenerateUIで開く」。ゲームのネガティブはワークフローのネガティブ(または設定値)に足す。
- 設定(localStorage `wfm_game_settings`、バックアップ対象): 生成ワークフロー(既定 `ws_game_sdxl_t2i.json`)、ベースプロンプト、ネガティブ、ステージクリアごと/エンディング/ゲームオーバーの自動生成、難易度・BGM・効果音。旧既定のベースプロンプトは自動で置き換え。
- サンプルワークフロー `workflows/ws_game_sdxl_t2i.json`(SDXL T2I、1216x832、出力 `WFS_Game/`)を同梱。Game タブの既定。
- 生成は既存の `convertUiToApi` → `analyzeWorkflow` → ポジティブノードへ書き込み → `_expandWildcardsInWorkflow` → `comfyUI.generate` を再利用。
- VRAM 調整: `prepareVramForGeneration({ quiet })` と `comfyUI.generate(..., { quietVram })` を追加。Game タブからの生成と Game タブ表示中はトーストを出さずコンソールにだけ出す(ゲーム画面を隠さない)。
- 第一弾「Star Formation」(パック側): 80年代(アーケード/MSX2/PC-8801)風の縦シューティング。全5ステージ・ステージごとのボス(WARNING とボス BGM)、ナビゲーターのリナとの ADV 風会話、PSG 風のオリジナル BGM、ドット絵・DotGothic16・走査線。ステージクリアで勝利の記念カット、各ステージ5個のハートを全部取るとプライベート写真(ステージごとに露出が増え、上限は水着。ネガティブで制限)、全クリアでエンディング、ゲームオーバーで敗北シーンを生成。
- en/ja/zh の文言とヘルプページ、企画書(企画・ライブラリ選定・類似ノード調査・実装記録。リポジトリ外で管理)。
- 実機確認: Playwright で検出/非表示、操作・一時停止、各ボスの動き、アイテム、ステージごと・エンディング・ゲームオーバー・プライベート写真の実生成、VRAM 調整でモデルがアンロードされてもトーストが出ないこと。
---
## v0.9.10(2026-11-15)
### プロンプト翻訳API(Comic Creator から使うための整備)
- `POST /api/wfm/translate/prompt {text|texts, target_lang?, source_lang?, protect_quotes?, model?}` を追加。記法を残す分割(`split_prompt` / `_rebuild`)をブラウザ側から `translate_service.py` へ移し、GenerateUI・Lab・Video Plan の🌐と自動翻訳もこの API を使うように切り替え(分割の実装を1か所に)。Lab は1回のリクエストにまとめて送る。🌐で変化が無いとき(非ASCIIの `<lora:...>` 名だけ等)は「翻訳する部分がありません」を表示。旧 `POST /api/wfm/translate`(丸ごと翻訳)は互換のため残す。
- 翻訳先 `target_lang`: PLaMo 3 Translate の53言語(`zh`→`zh-hans`、`zh-tw`→`zh-hant` 等の別名)。キャッシュキーに翻訳先を追加。PLaMo 以外のモデルの指示文も言語名に追従。翻訳元も同じ一覧で検証。
- `protect_quotes`: 「」『』“”"" の中身を `『QT0』` のようなトークンにして文ごと訳し、元の文字に戻す(画像に描く文字用。トークンが消えたら引用の前後を別々に訳す)。既定オフ(GenerateUI も従来どおり)。例: 「看板に『営業中』と書かれた喫茶店」→ `A coffee shop with a sign that reads "営業中"`。
- 長文の無言切り捨てを廃止: 1回のモデル呼び出しは最大1000文字(改行→文末で分割して連結)。1リクエスト合計3万文字超・1文1000文字超は 400、出力が `num_predict` に達した(`done_reason == "length"`)ら 502。
- `GET /api/wfm/translate/config` に `api: 1`(API の版)と `languages` を追加。`POST /api/wfm/translate/warmup` は `{"ignore_enabled": true}` で WFS のオン/オフに関係なく読み込む(独自のオン/オフを持つクライアント用)。サーバーは `prompt_translate_enabled` を見ない方針を README「Prompt Translation API」節に明記。
- VRAM調整(毎回・「今すぐすべてアンロード」・Ollama のアンロードボタン)で `size_vram == 0` の CPU 常駐モデル(翻訳の CPU モード等)を外さないように。応答に `kept_cpu`、トーストに「CPU常駐のため残しました」(3言語)。
- 説明文の修正: CPU 常駐の RAM「約2GB」→約2.7GB、「生成UIを開いたとき」→「生成UIにワークフローを読み込んだとき」(設定・ヘルプ・README)。
- 実機確認: HTTP(記法保持、zh、protect_quotes、各エラー、1619文字の長文分割、旧API、warmup)、VRAM「すべてアンロード」で GPU の 0.8B だけ外れ CPU 常駐の 2B が残る、ブラウザで🌐→翻訳→原文復元と Lab の一括翻訳。
### 設定のデータ管理の監査
- ブラウザ(localStorage)に保存している設定が、どちらのバックアップにも入っていなかった(ワークフロー/プロンプトプリセットのグループ、モデルバッジの配色、外観、AI TOOL・Prompt・Tagger の接続設定、意思決定モデル・VRAM調整の設定、Latent プリセット、Draw パレット等)。JSON エクスポート(`__browser_storage`)とフルバックアップ(`_browser_storage.json`、データフォルダには展開しない)の両方に同梱し、復元時にブラウザへ書き戻して「ページを再読み込み」ボタンを表示。対象は `wfm_*` と `ie_draw_palette_v1`(一時キー `wfm_pending_workflow` / `wfm_library_filter_request` は除外)、規則はサーバー `_clean_browser_storage` とクライアントで共通。
- JSON エクスポートに `semantic_settings.json`(Gallery セマンティック検索の設定)を追加。
- フルバックアップから `models/`(v0.8.2〜v0.8.13 の ONNX EmbeddingGemma の残骸、約300MB、v0.8.14 の Ollama 化以降は未使用)と `*.tmp`(アトミック書き込みの途中ファイル)を除外。チェックボックス「Gallery セマンティック検索のインデックス」(既定オン、作り直すと全画像の埋め込み直し=Gemini では API 費用)と「TagSpace のキャッシュ」(既定オフ、作り直せる)を追加。`export-full` は POST(JSON)にも対応(GET は互換で残す)。実環境で約700MB→108.7MB。
- 説明文・ヘルプ(dataManagementHint / fullBackupHint / helpSettings8・15・16、3言語+index.html)と README を更新。
- 実機確認: ボタン操作で JSON・ZIP のエクスポート内容を検査、ブラウザ設定だけを入れた JSON・ZIP のインポートで書き戻しと不正キーの除外、データファイルが書き換わらないことを確認。
---
## v0.9.9(2026-11-15)
### プロンプト翻訳(自国語 → 英語、PLaMo 3 Translate)
@@ -27,6 +89,11 @@
- 設定タブ(helpSettings26)と GenerateUI(helpGen33)にプロンプト翻訳を追加(en/ja/zh)。
### マニュアル v0.9.9版(ja/en)
- 新節 5-10「日本語のままプロンプトを書く(プロンプト翻訳)」(準備・モデルの大きさ・GPU/CPU常駐・🌐と原文・実行時の自動翻訳・Lab/Video Plan)。7-5・10-2 に PLaMo の注記、11-4 に Video Plan の🌐と v0.9.9 修正の注意、11-5 の表・12-3 のトラブル表・付録の用語集と参考リンクを追記。対象バージョンを v0.9.9 に更新し、全章MD・ZIPを `manual/rebuild_repo_edition.py` で再生成(v0.9.6版は削除)。
- EPUB(画像付き、75枚=新規3枚: 設定のプロンプト翻訳・生成UIで翻訳後・Labモーダル)を Google ドライブで公開。
## v0.9.8(2026-11-14)
### セキュリティ: クライアントから受け取るパスを解決前に検証
+24 -5
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.9.9-green)
![Version](https://img.shields.io/badge/version-0.10.2-green)
## Features (tab -> feature names)
@@ -76,6 +76,9 @@ Model Browser, Thumbnail / Table views, Table column sort, Search & Filter, User
### TagSpace Tab (v0.9.0)
Choose tags visually in a 3D latent space, Build / Update, Choosing tags, Explore, Search with a card's or Gallery image's tags, Make a prompt, Tagger fill, Glow / Twinkle, Hover preview, Requirements
### Game Tab (v0.10.0 – v0.10.2, experimental)
Play, then generate, Star Formation, Turbo Heart, Prompt Typer, Sky Heart, An image at every stage clear, Prompts from the game, Settings, For game authors
### Image Edit Tab (v0.3.65)
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
@@ -114,6 +117,8 @@ Sample workflows are included in the `workflows/` folder. You can open them dire
Samples for the Feeder tab: `ws_sdxl_image_feeder_i2i` / `ws_dwpose_image_feeder` (Image Loop mode, require the `comfyui-image-feeder` custom node) and `ws_sdxl_gallery_feeder_i2i` (v0.8.3, SDXL I2I with the bundled **WFS_GalleryFeeder** node — no extra custom node needed; put images in the `__Feeder__` Gallery group and use the Feeder tab's Gallery mode).
Sample for the Game tab: `ws_game_sdxl_t2i` (v0.10.0, SDXL text-to-image, 1216x832, saves to `output/WFS_Game`) — the Game tab's default workflow. Import it from the Workflow tab (or copy it into ComfyUI's `user/default/workflows`) and change the checkpoint to an SDXL model you have (the sample uses an Illustrious model, which suits the game's 1980s anime prompts).
> **Note:** Some sample workflows require additional custom nodes.
> If a node is shown as missing (red/unknown) after loading, install the required custom nodes via **ComfyUI Manager** or by cloning the repository from GitHub into your `ComfyUI/custom_nodes/` directory.
>
@@ -128,12 +133,12 @@ Samples for the Feeder tab: `ws_sdxl_image_feeder_i2i` / `ws_dwpose_image_feeder
## Manual
A beginner-oriented manual (covers v0.9.6, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
A beginner-oriented manual (covers v0.9.9, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.9.6_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.9.6.zip`
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.9.9_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.9.9.zip`
An EPUB edition with screenshots (Japanese and English, v0.9.6) is available on [Google Drive](https://drive.google.com/drive/folders/14mOHcnLYrFgNrOo6fy7ELyFjjWrAoU-_?usp=sharing).
An EPUB edition with screenshots (Japanese and English, v0.9.9) is available on [Google Drive](https://drive.google.com/drive/folders/14mOHcnLYrFgNrOo6fy7ELyFjjWrAoU-_?usp=sharing).
---
@@ -163,6 +168,20 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
---
## Prompt Translation API
Other front-ends on the same ComfyUI server (e.g. Comic Creator) can use the prompt translator through these endpoints. Other `/api/wfm/translate*` routes are for the Workflow Studio UI only and may change.
| Endpoint | Purpose |
| --- | --- |
| `GET /api/wfm/translate/config` | `{api, config, presets, languages}`. `api` is the API version (currently `1`); a 404 or a missing `api` means Workflow Studio is absent or older than this API. `config` holds the `prompt_translate_*` settings; `languages` maps the accepted language codes to names |
| `POST /api/wfm/translate/prompt` | Prompt-aware translation. Body: `{"text": "..."}` (or `{"texts": [...]}`, up to 200), optional `target_lang` (default `en`; any PLaMo 3 Translate code such as `ja`, `zh-hans`, `zh-hant`, `ko`; `zh` = `zh-hans`), `source_lang` (default: the Settings value; `auto` = detect), `protect_quotes` (default `false`; keeps the text inside 「」『』“”"" untranslated, for text drawn in the image). Returns `{"status": "success", "translated": "..."}` (or `translations`). Prompt syntax is kept as in the 🌐 button |
| `POST /api/wfm/translate/warmup` | Preloads the model when CPU-resident mode is selected. Send `{"ignore_enabled": true}` if your front-end has its own on/off switch |
- Settings (model, Ollama URL, GPU / CPU-resident, unload after translating) are shared with Workflow Studio. The server does **not** check `prompt_translate_enabled`: that switch only shows or hides the translation buttons in Workflow Studio, so a client decides on its own whether to offer translation.
- Errors: HTTP 400 for bad input (unsupported language, more than 30,000 characters in one request, a single sentence over 1,000 characters), HTTP 502 for Ollama errors, including a translation that would be cut at the output token limit. Long text is split at line breaks and sentence ends and translated chunk by chunk; nothing is cut silently.
- VRAM management (Settings → VRAM Management and the Ollama "Unload Model" buttons) never unloads a model that uses no VRAM (`size_vram == 0`, such as the CPU-resident translator); the response lists it in `kept_cpu`.
## Requirements
- **ComfyUI** — any recent version (v1.33.9+ recommended for action bar integration)
+40 -7
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.9.9-green)
![Version](https://img.shields.io/badge/version-0.10.2-green)
## Screenshots
@@ -250,14 +250,16 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- ~~AI Assistant Settings~~ (removed in v0.5.4) — the central Ollama backend/URL/model panel that used to live here was replaced by a ⚙ Settings button + modal directly in the Prompt tab and the Tagger tab, each with its own independent configuration (backend, URL, model, Thinking mode, Max tokens, and a model Unload button) — see those tabs below; the AI TOOL tab's own Settings pane is unaffected
- **VRAM Management (Ollama)** (v0.7.13) — right before every image generation from Workflow Studio (GenerateUI, Lab, batches, Video, AI TOOL chat generation — anything that goes through its queue), unload the models Ollama has loaded so ComfyUI has free VRAM. **Before generating**: Do nothing (default) / Unload only as much as needed when free VRAM is below a target (biggest model first, one at a time, stopping once the target is reached) / Unload everything every time; **Target free VRAM (GB)** for the second mode; **Unload all now** button. Free VRAM is measured with `nvidia-smi` (plus ComfyUI's own unused torch cache), because ComfyUI's free-VRAM figure may not change when Ollama loads a model; non-NVIDIA GPUs fall back to ComfyUI's value. Targets Ollama on localhost — the default `127.0.0.1:11434` plus the AI TOOL / Prompt / Tagger AI settings and the Decision Model when they use Ollama (other hosts only via `WFS_ALLOWED_BACKEND_HOSTS`); LM Studio etc. and ComfyUI's own models are not touched. A toast reports what was unloaded, an unreachable target or a failure; generation continues either way. Running a workflow from the ComfyUI canvas itself is not covered. Server route: `POST /api/wfm/vram/prepare` (JSON only). Ported from ComfyUI Comic Creator
- **Video Playback Volume** (v0.5.4) — the video preview's volume is remembered here and shared across every video player in the plugin (Video tab, Gallery tab), instead of resetting to maximum whenever a different video is opened
- **Data Management** — export core settings/metadata/prompts/CivitAI cache to a single JSON file; import to restore data (useful when migrating or reinstalling); API keys are excluded from exports for security
- **Data Management** — export core settings/metadata/prompts/CivitAI cache/semantic search settings to a single JSON file; import to restore data (useful when migrating or reinstalling); API keys are excluded from exports for security
- **Full Backup (ZIP)** (v0.5.2) — additionally covers what the JSON bundle can't represent: folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets) and the Tagger SQLite database; two opt-in checkboxes can also include ComfyUI's default workflows folder (`user/default/workflows`) and the Impact Pack's wildcard folder in the export — both of those are export-only and stored under an `_external/` prefix in the ZIP that Restore always skips, since auto-overwriting files a different plugin/ComfyUI core manages would be unsafe; copy them back by hand if needed. A third opt-in checkbox (v0.7.6) bundles the clips/BGM/sounds/overlay clips that saved Video Edit projects reference in ComfyUI's input folder (the project JSON only stores references) under `_video_edit_media/`; unlike `_external/`, these are restored into the input folder, never overwriting a file that already exists there. Restoring overwrites existing files; restart ComfyUI afterward for either restore path
- **Browser-side settings** (v0.9.10) — both the JSON export and the Full Backup also carry the settings the page keeps in the browser's localStorage (Workflow / prompt preset groups, model badge colors, appearance, AI TOOL / Prompt / Tagger connection settings, decision model and VRAM settings, Latent size presets, Draw palette, ...); importing writes them back and offers a **Reload page** button
- **Caches in the Full Backup** (v0.9.10) — two more checkboxes: **Gallery semantic search index** (on by default — rebuilding it re-embeds every image, which costs API usage with Gemini) and **TagSpace cache** (off by default, rebuildable). Temporary `*.tmp` files and the `models/` folder left over from the ONNX EmbeddingGemma of v0.8.2–v0.8.13 are no longer included
- **Text Size** — one slider (10–28 px) adjusts font size for all prompt and chat textareas at once: Generate UI positive/negative prompts, AI Assistant chat input, Preset prompts, Wildcard prompt and file editor, and Metadata prompt full preview; takes effect immediately and saved with Save Settings
- **RAW JSON Colors** — customize the 6 syntax highlight colors for the Raw JSON editor in Generate UI: Default Text (base), Name/Scheduler (yellow), Title (pink), Width/Height (green), Prompt/Text (cyan), Image/File (red); changes apply immediately on color pick; Reset Defaults restores the original scheme; saved to `localStorage` under `wfm_settings.jsonColors` and applied on startup
- **GenerateUI Model Tab Highlight** (v0.3.98) — pick the color used to mark Checkpoint/VAE/Diffusion Model/Text Encoder/ControlNet/Hypernetwork labels and the LoRA column header in GenerateUI's Model tab when the loaded workflow actually contains that type of node; default bright green; changes apply immediately, Reset Defaults restores it; saved to `localStorage` under `wfm_settings.modelTabActiveColor`; the same color and mechanism also drives the Video tab's field highlighting (v0.5.4, see above)
- **Wildcard Integration** — link the WFS wildcard directory to ComfyUI-Impact-Pack's `wildcards/` directory (directory junction on Windows, symlink on other OS); existing WFS wildcard files are automatically migrated; requires [ComfyUI-Impact-Pack](https://github.com/ltdrdata/ComfyUI-Impact-Pack)
- **G'MIC-Qt Integration** — set the path to `gmic_qt.exe` for the Image Edit Filter tool; download G'MIC-Qt Standalone from `gmic.eu/download.html` (Windows: `gmic_qt-win64.zip`), extract anywhere, then enter the full path to `gmic_qt.exe` and click Save
- **Prompt Translation (native language → English)** (v0.9.9) — off by default. Adds a 🌐 button to the GenerateUI Positive/Negative prompts, the Lab prompt modal and the Video Plan block prompt that translates only the parts written in your own language into English with a local Ollama model, keeping prompt syntax as it is (commas, `(word:1.2)`, `[ ]`, `{a|b}`, `<lora:...>`, `__wildcards__`, `embedding:name`, `BREAK`); "Original" restores the text. Model: [PLaMo 3 Translate](https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF) 0.8B / 2B / 8B / 31B (Download button pulls it into Ollama; free for personal and non-commercial use under the PLaMo Community License) or any other Ollama model. Source language auto-detect or one of 51 languages; run on GPU (about 0.1 s per phrase, optionally unloaded after each translation) or **CPU kept loaded** (about 0.3 s per phrase, no VRAM, preloaded when GenerateUI opens). **Translate automatically when running**: GenerateUI Generate (replaces the prompt text), Lab Run and Video Plan Run (translate only what is sent; the plan keeps your text); if translation fails nothing is generated. Server routes: `POST /api/wfm/translate`, `GET /api/wfm/translate/config|models`, `POST /api/wfm/translate/pull|warmup|unload`
- **Prompt Translation (native language → English)** (v0.9.9) — off by default. Adds a 🌐 button to the GenerateUI Positive/Negative prompts, the Lab prompt modal and the Video Plan block prompt that translates only the parts written in your own language into English with a local Ollama model, keeping prompt syntax as it is (commas, `(word:1.2)`, `[ ]`, `{a|b}`, `<lora:...>`, `__wildcards__`, `embedding:name`, `BREAK`); "Original" restores the text. Model: [PLaMo 3 Translate](https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF) 0.8B / 2B / 8B / 31B (Download button pulls it into Ollama; free for personal and non-commercial use under the PLaMo Community License) or any other Ollama model. Source language auto-detect or one of 51 languages; run on GPU (about 0.1 s per phrase, optionally unloaded after each translation) or **CPU kept loaded** (about 0.3 s per phrase, no VRAM, about 2.7 GB of RAM for 2B, preloaded when a workflow is loaded into GenerateUI). **Translate automatically when running**: GenerateUI Generate (replaces the prompt text), Lab Run and Video Plan Run (translate only what is sent; the plan keeps your text); if translation fails nothing is generated. Server routes: `POST /api/wfm/translate`, `POST /api/wfm/translate/prompt`, `GET /api/wfm/translate/config|models`, `POST /api/wfm/translate/pull|warmup|unload` (see [Prompt Translation API](#prompt-translation-api))
- **Language** — English / Japanese / Chinese
</details>
@@ -437,6 +439,21 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
</details>
<details>
<summary><h3>Game Tab (v0.10.0 – v0.10.2, experimental)</h3></summary>
- **Play, then generate** — a tab for mini games that end in image generation. The games come from a separate pack, [ComfyUI-WFS-Games](https://github.com/ketle-man/ComfyUI-WFS-Games); the tab appears only when the pack is installed (Workflow Studio checks `/wfs_games/manifest` on start), so without it nothing changes
- **Star Formation** (first game) — a 1980s-style vertical shooter (arcade / MSX2 / PC-8801 look: pixel sprites, pixel font, scanlines, chiptune music) built on Phaser 4. 5 stages, each ending with a boss (WARNING, boss music; big and tough / fast with fast shots / radial bursts / flashing straight-line ram / a giant carrier launching small fighters). Navigator Rina talks between stages in an adventure-game style window
- **Turbo Heart** (second game, pack v0.2.0) — a 1980s-style behind-the-car racer with a pseudo-3D road and city-pop style chiptune music. 5 races (seaside highway, autumn mountain pass, desert canyon, neon city at night, tropical coast at dawn); 8 cars, start last, top 3 to advance. Nitro, speed lines, overtakes, tire squeal; obstacles (cardboard boxes, an oil slick, sometimes a person crossing — hitting them ends the game). Mechanic Misaki talks between races, and the images work the same way as in Star Formation
- **Prompt Typer** (third game, pack v0.3.0) — a 1980s-style typing game whose typing becomes the image prompt, typos included. 10 stages of 20 words, longer every 2 stages; 85% correct clears a stage, an image is generated after every stage either way, and you can retry. English, Japanese and Chinese (Japanese / Chinese through your IME). No music
- **Sky Heart** (fourth game, pack v0.3.0) — a 1980s-style into-the-screen flying shooter with a pseudo-3D ground. Hikari flies a jet pack through 5 stages with bosses; an altimeter, hearts in the air and near the ground, ground missile launchers, and power-ups (1UP, a 3-hit barrier, support mechs that fire with you). The images work the same way as in Star Formation
- **An image at every stage clear** — a card is added to the Result panel and a victory shot of Rina with that stage in the background is generated in the background while you keep playing (one at a time, in order). Five flashing enemies per stage drop hearts; catch all 5 and that stage's image becomes a private photo of Rina instead (more casual clothes each stage, up to a swimsuit — the game adds negative tags so it goes no further). Clearing all 5 stages adds the ending scene; a game over adds a defeat scene (screen darkens, her call goes unanswered)
- **Prompts from the game** — each card lists the prompts the game returned with their kind (Style / Heroine / Scene / Stage); uncheck or edit them and Regenerate, or **Open in GenerateUI**. The game's negative tags are added to the workflow's negative prompt
- **Settings** (the Settings tab of the right pane since v0.10.2; the left pane lists the games only) — the workflow used for generation (default `ws_game_sdxl_t2i.json`, an SDXL text-to-image workflow included in `workflows/` — import it and set your checkpoint; output in `output/WFS_Game`), base prompt, negative prompt, and whether to generate at each stage clear / the ending / on game over automatically; difficulty, music and sound effects. VRAM Management notices are not shown while the Game tab is open
- **For game authors** — a game is an ES module with `mount(container, host)`; it reports results through `host.stageClear()` / `host.finish()` and never calls ComfyUI itself — Workflow Studio builds the prompt and runs the generation. See the [pack's README](https://github.com/ketle-man/ComfyUI-WFS-Games)
</details>
<details>
<summary><h3>Image Edit Tab (v0.3.65)</h3></summary>
@@ -594,6 +611,8 @@ Sample workflows are included in the `workflows/` folder. You can open them dire
Samples for the Feeder tab: `ws_sdxl_image_feeder_i2i` / `ws_dwpose_image_feeder` (Image Loop mode, require the `comfyui-image-feeder` custom node) and `ws_sdxl_gallery_feeder_i2i` (v0.8.3, SDXL I2I with the bundled **WFS_GalleryFeeder** node — no extra custom node needed; put images in the `__Feeder__` Gallery group and use the Feeder tab's Gallery mode).
Sample for the Game tab: `ws_game_sdxl_t2i` (v0.10.0, SDXL text-to-image, 1216x832, saves to `output/WFS_Game`) — the Game tab's default workflow. Import it from the Workflow tab (or copy it into ComfyUI's `user/default/workflows`) and change the checkpoint to an SDXL model you have (the sample uses an Illustrious model, which suits the game's 1980s anime prompts).
> **Note:** Some sample workflows require additional custom nodes.
> If a node is shown as missing (red/unknown) after loading, install the required custom nodes via **ComfyUI Manager** or by cloning the repository from GitHub into your `ComfyUI/custom_nodes/` directory.
>
@@ -608,12 +627,12 @@ Samples for the Feeder tab: `ws_sdxl_image_feeder_i2i` / `ws_dwpose_image_feeder
## Manual
A beginner-oriented manual (covers v0.9.6, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
A beginner-oriented manual (covers v0.9.9, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.9.6_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.9.6.zip`
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.9.9_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.9.9.zip`
An EPUB edition with screenshots (Japanese and English, v0.9.6) is available on [Google Drive](https://drive.google.com/drive/folders/14mOHcnLYrFgNrOo6fy7ELyFjjWrAoU-_?usp=sharing).
An EPUB edition with screenshots (Japanese and English, v0.9.9) is available on [Google Drive](https://drive.google.com/drive/folders/14mOHcnLYrFgNrOo6fy7ELyFjjWrAoU-_?usp=sharing).
---
@@ -643,6 +662,20 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
---
## Prompt Translation API
Other front-ends on the same ComfyUI server (e.g. Comic Creator) can use the prompt translator through these endpoints. Other `/api/wfm/translate*` routes are for the Workflow Studio UI only and may change.
| Endpoint | Purpose |
| --- | --- |
| `GET /api/wfm/translate/config` | `{api, config, presets, languages}`. `api` is the API version (currently `1`); a 404 or a missing `api` means Workflow Studio is absent or older than this API. `config` holds the `prompt_translate_*` settings; `languages` maps the accepted language codes to names |
| `POST /api/wfm/translate/prompt` | Prompt-aware translation. Body: `{"text": "..."}` (or `{"texts": [...]}`, up to 200), optional `target_lang` (default `en`; any PLaMo 3 Translate code such as `ja`, `zh-hans`, `zh-hant`, `ko`; `zh` = `zh-hans`), `source_lang` (default: the Settings value; `auto` = detect), `protect_quotes` (default `false`; keeps the text inside 「」『』“”"" untranslated, for text drawn in the image). Returns `{"status": "success", "translated": "..."}` (or `translations`). Prompt syntax is kept as in the 🌐 button |
| `POST /api/wfm/translate/warmup` | Preloads the model when CPU-resident mode is selected. Send `{"ignore_enabled": true}` if your front-end has its own on/off switch |
- Settings (model, Ollama URL, GPU / CPU-resident, unload after translating) are shared with Workflow Studio. The server does **not** check `prompt_translate_enabled`: that switch only shows or hides the translation buttons in Workflow Studio, so a client decides on its own whether to offer translation.
- Errors: HTTP 400 for bad input (unsupported language, more than 30,000 characters in one request, a single sentence over 1,000 characters), HTTP 502 for Ollama errors, including a translation that would be cut at the output token limit. Long text is split at line breaks and sentence ends and translated chunk by chunk; nothing is cut silently.
- VRAM management (Settings → VRAM Management and the Ollama "Unload Model" buttons) never unloads a model that uses no VRAM (`size_vram == 0`, such as the CPU-resident translator); the response lists it in `kept_cpu`.
## Requirements
- **ComfyUI** — any recent version (v1.33.9+ recommended for action bar integration)
+3 -3
View File
@@ -2,12 +2,12 @@
ノードが苦手でも大丈夫 ― 画像生成をもっと手軽に、もっと整理して
- 対象バージョン:Workflow Studio v0.9.6
- 対象バージョン:Workflow Studio v0.9.9
- 著者:ketle-man
- © 2026 ketle-man
このマニュアルは、Kindle版をもとにした **画像なしのテキスト版** です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.6.md` です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.9.md` です。
画面の例は省略しているため、実際の画面はWorkflow Studioのヘルプタブとあわせてご覧ください。
## 目次
@@ -29,4 +29,4 @@
- [13_付録](chapters/13_付録.md)
- [14_おわりに](chapters/14_おわりに.md)
全章まとめ:[Workflow_Studio_Manual_v0.9.6.md](Workflow_Studio_Manual_v0.9.6.md)
全章まとめ:[Workflow_Studio_Manual_v0.9.9.md](Workflow_Studio_Manual_v0.9.9.md)
Binary file not shown.
@@ -2,12 +2,12 @@
ノードが苦手でも大丈夫 ― 画像生成をもっと手軽に、もっと整理して
- 対象バージョン:Workflow Studio v0.9.6
- 対象バージョン:Workflow Studio v0.9.9
- 著者:ketle-man
- © 2026 ketle-man
このマニュアルは、Kindle版をもとにした **画像なしのテキスト版** です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.6.md` です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.9.md` です。
画面の例は省略しているため、実際の画面はWorkflow Studioのヘルプタブとあわせてご覧ください。
---
@@ -143,7 +143,7 @@ ComfyUIの「自由さ」はそのままに、「分かりやすさ」と「手
## 本書の対象バージョンと環境
- **Workflow Studio**:v0.9.6
- **Workflow Studio**:v0.9.9
- **ComfyUI**:本書執筆時点の最新版
- **OS**:Windows(画面の例はWindowsのものです)
@@ -1547,12 +1547,127 @@ v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実
> 画像のメタデータを見るMetadataタブとサイドパネルの **I** タブでも、Nano Bananaで作った画像を読めます(v0.8.5〜)。
> プロンプトは、Positive/Negativeに分けずに全文が1件で表示されます。
## 5-10 日本語のままプロンプトを書く(プロンプト翻訳、v0.9.9〜)
多くの画像生成モデルは、英語のプロンプトで学習されています。
**プロンプト翻訳** をオンにすると、プロンプトを日本語で書き、ボタン1つで英語に直せます。
Stable Diffusion web UI(A1111)の翻訳拡張機能と同じように、プロンプトの中の **日本語の部分だけ** を翻訳します。
翻訳には、パソコンで動くAI(**Ollama**)と翻訳専用のモデル **PLaMo 3 Translate** を使います。
インターネット上の翻訳サービスにプロンプトを送ることはありません。
> **事前に必要なもの**
> **Ollama** をインストールして起動しておきます(第10章 10-1)。翻訳モデルのダウンロードは、設定画面からできます(下記)。
### 準備:設定でオンにする
1. **設定** タブの **プロンプト翻訳(自国語 → 英語)** を開きます。
2. **生成UIでプロンプト翻訳を使う** にチェックを入れます。
3. **翻訳モデル** で、使うモデルを選びます。まだOllamaに入っていないモデルには **(未取得)** と付いています。選んで **ダウンロード** を押すと、Ollamaに取り込まれます。
4. **テスト** を押して、見本のプロンプトが英語になれば準備完了です。
PLaMo 3 Translate には4つの大きさがあります。
| モデル | 大きさ | 特徴 |
| --- | --- | --- |
| 0.8B | 約0.6GB | 最速。短いタグの翻訳なら十分 |
| 2B | 約1.8GB | おすすめ。文章の翻訳も正確 |
| 8B | 約5.3GB | より高品質 |
| 31B | 約19.5GB | 最高品質。メモリに余裕がある人向け |
> **ポイント**
> 0.8Bは、文章の翻訳で意味がずれることがあります(例:「カメラは後ろから追いかける」が「her camera following behind」=「彼女のカメラが後ろについてくる」になった)。
> 動画のプロンプトのように文章で書くことが多いなら、2B以上を選びましょう。
設定のほかの項目は、次のとおりです。
| 項目 | 内容 |
| --- | --- |
| 入力する言語 | ふつうは **自動判定** のままでよい。日本語だけで書くなら「日本語」を選ぶと確実 |
| Ollama URL | Ollamaのアドレス。空欄なら `http://localhost:11434` |
| 翻訳モデルの実行場所 | **GPU** か **CPUで常駐** か(下記) |
| 実行時に自動で翻訳する | Generateなどを押したときに自動で翻訳する(下記) |
PLaMo以外のOllamaのモデル(ふだんチャットに使っているモデルなど)も、**その他のOllamaモデル** から選べます。その場合は「英語に翻訳して」という指示を付けて送ります。
### 翻訳モデルをどこで動かすか
| 実行場所 | 1語句あたりの時間 | 向いている人 |
| --- | --- | --- |
| GPU(1回の翻訳が最速・VRAMを使う) | 約0.1秒 | GPUのメモリに余裕がある |
| CPUで常駐(VRAMを使わず、再読み込みの待ちなし) | 約0.2〜0.3秒 | 画像生成にGPUのメモリをすべて使いたい |
GPUのときは、**翻訳後に翻訳モデルをVRAMから解放する** をオンにしておくと、画像生成の前にGPUのメモリを空けられます(初期値はオン)。
ただし、翻訳のたびにモデルの読み込み直しで **約4秒** 待つことになります。
**CPUで常駐** にすると、モデルをメインメモリに置いたままにします(2Bで約2.7GB)。
GPUのメモリを使わず、生成UIにワークフローを読み込んだときに裏で読み込んでおくので、最初の翻訳から待たされません。
> **ポイント**
> Ollamaは、ほかのモデル(AI TOOLのチャット用など)を読み込むときに、常駐させた翻訳モデルを外すことがあります。
> その場合は、次の翻訳のときに自動で読み込み直します(その1回だけ数秒かかります)。
### 使い方:🌐ボタンで翻訳する
プロンプト翻訳をオンにすると、InputタブのPositive Prompt・Negative Promptの **↺** ボタンの右に **🌐** ボタンが表示されます。
1. プロンプト欄に、日本語で書きます。英語のタグと混ぜてもかまいません。
```
masterpiece, 夕焼けの海辺に立つ少女、(長い黒髪:1.2), <lora:test_lora:0.8>, {猫耳|狐耳}, 水彩画風
```
2. **🌐** を押します。
3. 日本語の部分だけが英語になります。
```
masterpiece, A girl standing by the seaside at sunset, (long black hair:1.2), <lora:test_lora:0.8>, {cat ears|fox ears}, watercolor style
```
次のようなプロンプトの書き方(記法)は、翻訳せずにそのまま残します。
- カンマ・改行
- 重み付け `(語句:1.2)`、`[ ]`
- ランダムに選ぶ `{A|B}`、ワイルドカード `__名前__`
- LoRAの指定 `<lora:名前:0.8>`、`embedding:名前`
- `BREAK`、`AND`
翻訳したあとに **原文** ボタンが表示されます。押すと、翻訳する前の文に戻ります(Ctrl+Zでも戻せます)。
> **注意**
> 翻訳されるのは、英数字以外の文字を含む部分だけです。英語だけの部分は、そのまま残ります。
> 反対に、é などのアクセント付きの文字を含む英単語は、翻訳の対象になります。
### 実行時に自動で翻訳する
設定の **実行時に自動で翻訳する** で、どの実行のときに自動で翻訳するかを、チェックボックスで選べます。
| チェックボックス | 動き |
| --- | --- |
| 生成UI - Generate | Generateを押すと、Positive/Negativeの欄の日本語を英語に置き換えてから生成する |
| 生成UI Lab - Run | Labの実行で、送る内容だけを翻訳する。Labのプランには日本語が残る |
| Video Plan - Run | Videoタブ Planの実行で、送るプロンプトだけを翻訳する。プランには日本語が残る |
LabとVideo Planでは、プランを日本語のまま残すので、あとから日本語で書き直せます。
生成した画像や動画の情報(メタデータ)には、実際に送った英語のプロンプトが記録されます。
> **注意**
> 自動翻訳がオンのときに翻訳に失敗すると(Ollamaが起動していないなど)、日本語のまま生成しないよう、生成を止めます。
> LabとVideo Planでは、止まった理由が進行状況の欄に表示されます。
### Labのモーダルと、Video Planでも使える
🌐ボタンは、次の欄にもあります。使い方は同じです。
- Lab(5-7)のプロンプト列のセルをダブルクリックして開く画面の、Positive・Negativeの欄
- Videoタブ Planサブタブの、ブロックの **Prompt** の欄(第11章 11-4)
> **ポイント**
> PLaMo 3 Translate は、個人の利用や趣味、研究などの非商用の利用なら無料で使えます(PLaMoコミュニティライセンス)。
> 商用で使う場合は、ライセンスの条件を確認してください。
> **この章(後半)のまとめ**
> - Batchサブタブで、モデル・プロンプト・サンプラーなどを1種類ずつ変えながらまとめて生成できる
> - Batch Queueの列のチェックで種類を選び、Generateで開始。終わったらチェックを外す
> - Feederは、たくさんの画像を1枚ずつワークフローに送り込む機能。専用ノードが必要
> - Labは、複数の設定を別々のタイミングで切り替えられる上級者向けの機能
> - パートナーAPIノード(Nano Bananaなど)は、`.env` の `COMFY_API_KEY` を設定すれば実行できる。クレジットが消費される
> - プロンプト翻訳をオンにすると、日本語で書いたプロンプトを🌐ボタンで英語にできる。記法はそのまま残り、Generate・Lab・Video Planの実行時に自動で翻訳することもできる
---
@@ -1972,6 +2087,10 @@ Workflow Studioにはたくさんのスタイルが付属しています。
英語のプロンプトの意味を知りたいときは、反対に **EN→JA** で日本語に訳せます。
> **ポイント**
> 生成UIのプロンプト欄で直接翻訳したいときは、第5章 5-10 の **プロンプト翻訳**(🌐ボタン)が便利です。重み付けやLoRAの指定を残したまま、日本語の部分だけを英語にできます。
> AI Assistantの翻訳にも、翻訳専用のモデル **PLaMo 3 Translate** を選べます(v0.9.9〜。以前は指示文まで翻訳されたり、ZH→ENで日本語が出たりしていました)。
### AIと相談しながらプロンプトを作る
入力欄に質問を書いて **Send**(または Enter キー)を押すと、AIとチャットできます。
@@ -2621,6 +2740,11 @@ Workflow Studio本体の **AI TOOL** タブを開きます。
> 小さなモデルは、翻訳せずに元の文章をそのまま返してしまうことがあります。
> その場合は「モデルが原文をそのまま返しました」と表示されるので、別のモデルを試してください。
> **ポイント**
> 翻訳専用のモデル **PLaMo 3 Translate**(第5章 5-10)を、設定のモデルに選ぶこともできます(v0.9.9〜)。
> 日本語・英語・中国語のほか、Free(自由入力)では French・フランス語・français のような言語名で、PLaMoが対応する言語を指定できます。PLaMoが対応していない言語(ポルトガル語など)を翻訳先にすると、エラーになります。
> WS LibraryのAタブの翻訳も同じです。
### Chat
入力欄に話しかけて、**Enter** で送信します(**Shift+Enter** で改行)。
会話の流れを覚えているので、「もっと明るい雰囲気にして」のような続けての依頼もできます。
@@ -3107,6 +3231,14 @@ Image Editのいちばん便利な使い方が、**インペイント** です
そのほか、動画の好きな場面を静止画として保存する **Frame** や、動画をGIFアニメに変換する **GIF** の機能もあります。
> **ポイント**
> Planサブタブのブロックの **Prompt** の欄にも、プロンプト翻訳の **🌐** ボタンがあります(第5章 5-10)。
> 設定の **Video Plan - Run** をオンにすると、日本語のプロンプトのまま実行して、送る内容だけを英語にできます。
> **注意**
> v0.9.8までは、新しいComfyUIで保存したワークフローを使うと、Planで入力したプロンプト・長さ(Duration)・Turboの設定が反映されず、ワークフローに保存されている値のまま生成されていました(v0.9.9で修正)。
> 以前と同じPlanを実行しても、Planの値が反映されるようになったため、結果が変わることがあります。
### アセット登録と音声変換(v0.8.9〜)
- **アセット登録** - 左側の動画ソースパネルのボタンです。パソコン内の動画を、outputフォルダ(`output/video`)へコピーして「Video Assets」グループに登録します。
登録すると、Assetサブタブの一覧に出て、Editなどで使えるようになります。
@@ -3157,6 +3289,7 @@ Image Editのいちばん便利な使い方が、**インペイント** です
| CivitAI APIキー | Civitaiの情報取得用(省略可) | 第6章 |
| Eagle 連携 (オプション) | 生成画像をEagleに自動保存 | 第8章 |
| VRAM調整(Ollama) | 生成前にAIモデルをメモリから降ろす | 第10章 |
| プロンプト翻訳(自国語 → 英語) | 日本語のプロンプトを🌐ボタンや実行時の自動翻訳で英語にする | 第5章 5-10 |
| データ管理 | 設定やデータのバックアップ・復元 | 下記 |
### デフォルトワークフロー
@@ -3396,6 +3529,15 @@ Batchサブタブを開き、Batch Queueの列のチェックをすべてオフ
いつも同じモデルを使いたい場合は、設定タブの **デフォルトCheckpoint** を使うと便利です(第11章 11-5)。
### プロンプト翻訳の🌐ボタンが出ない・翻訳できない
| 症状 | 原因 | 対処 |
| --- | --- | --- |
| 🌐ボタンが表示されない | プロンプト翻訳がオフになっている | 設定タブの **プロンプト翻訳(自国語 → 英語)** で **生成UIでプロンプト翻訳を使う** にチェックを入れる(第5章 5-10) |
| 「翻訳エラー」と出る | Ollamaが起動していない、または翻訳モデルがOllamaに無い | Ollamaを起動する。設定の **翻訳モデル** に **(未取得)** と出ていれば **ダウンロード** を押す |
| 押しても何も変わらない(「翻訳する部分がありません」) | 英語(英数字)だけのプロンプトになっている | 翻訳されるのは英数字以外の文字を含む部分だけ。英語の部分はそのまま残る |
| 自動翻訳がオンのとき、生成が始まらない | 翻訳に失敗したので、日本語のまま生成しないよう止めた | 上の「翻訳エラー」と同じ対処をする。LabとVideo Planでは、理由が進行状況の欄に出る |
| 訳がおかしい | 小さいモデル(0.8B)は、文章で意味がずれることがある | 設定の **翻訳モデル** で2B以上を選ぶ |
### 同じ設定なのに、同じ画像にならない
生成パネルのシードのモードが **Random** になっていませんか?
同じ画像を作るには、シードを **Workflow**(ワークフローのシードをそのまま使う)か **Fixed**(Seed欄の値で固定)にする必要があります。
@@ -3595,6 +3737,7 @@ Workflow Studioの **ヘルプ** タブにも、トラブルシューティン
| LoRA | 絵柄やキャラクターなどを追加で覚えさせる小さなモデル | 第6章 |
| OCR | 画像に写っている文字を読み取ること | 第10章 |
| Ollama | ローカルAIを手軽に動かせるソフト | 第10章 |
| PLaMo 3 Translate | Preferred Networks(PFN)の翻訳専用AIモデル。プロンプト翻訳で使う | 第5章 |
| T2I(Text to Image) | 文章(プロンプト)から画像を作ること | 第5章 |
| TagSpace | タグ・プロンプト・生成画像を意味の近さで3Dの空間に並べて表示するタブ | 第11章 |
| VAE | 画像の色合いや細部を仕上げるモデル | 第6章 |
@@ -3668,6 +3811,7 @@ Workflow Studioの **ヘルプ** タブにも、トラブルシューティン
| --- | --- | --- |
| Civitai(https://civitai.com/) | モデルの入手・情報取得 | 第6章 |
| Ollama(https://ollama.com/) | ローカルAI | 第10章 |
| PLaMo 3 Translate(https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF) | プロンプト翻訳の翻訳モデル | 第5章 |
| LM Studio(https://lmstudio.ai/) | ローカルAI | 第10章 |
| Lemonade Server(https://lemonade-server.ai/) | ローカルAI | 第10章 |
| Eagle(https://eagle.cool/) | 画像管理ソフト | 第8章 |
Binary file not shown.
+1 -1
View File
@@ -129,7 +129,7 @@ ComfyUIの「自由さ」はそのままに、「分かりやすさ」と「手
## 本書の対象バージョンと環境
- **Workflow Studio**:v0.9.6
- **Workflow Studio**:v0.9.9
- **ComfyUI**:本書執筆時点の最新版
- **OS**:Windows(画面の例はWindowsのものです)
@@ -235,9 +235,124 @@ v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実
> 画像のメタデータを見るMetadataタブとサイドパネルの **I** タブでも、Nano Bananaで作った画像を読めます(v0.8.5〜)。
> プロンプトは、Positive/Negativeに分けずに全文が1件で表示されます。
## 5-10 日本語のままプロンプトを書く(プロンプト翻訳、v0.9.9〜)
多くの画像生成モデルは、英語のプロンプトで学習されています。
**プロンプト翻訳** をオンにすると、プロンプトを日本語で書き、ボタン1つで英語に直せます。
Stable Diffusion web UI(A1111)の翻訳拡張機能と同じように、プロンプトの中の **日本語の部分だけ** を翻訳します。
翻訳には、パソコンで動くAI(**Ollama**)と翻訳専用のモデル **PLaMo 3 Translate** を使います。
インターネット上の翻訳サービスにプロンプトを送ることはありません。
> **事前に必要なもの**
> **Ollama** をインストールして起動しておきます(第10章 10-1)。翻訳モデルのダウンロードは、設定画面からできます(下記)。
### 準備:設定でオンにする
1. **設定** タブの **プロンプト翻訳(自国語 → 英語)** を開きます。
2. **生成UIでプロンプト翻訳を使う** にチェックを入れます。
3. **翻訳モデル** で、使うモデルを選びます。まだOllamaに入っていないモデルには **(未取得)** と付いています。選んで **ダウンロード** を押すと、Ollamaに取り込まれます。
4. **テスト** を押して、見本のプロンプトが英語になれば準備完了です。
PLaMo 3 Translate には4つの大きさがあります。
| モデル | 大きさ | 特徴 |
| --- | --- | --- |
| 0.8B | 約0.6GB | 最速。短いタグの翻訳なら十分 |
| 2B | 約1.8GB | おすすめ。文章の翻訳も正確 |
| 8B | 約5.3GB | より高品質 |
| 31B | 約19.5GB | 最高品質。メモリに余裕がある人向け |
> **ポイント**
> 0.8Bは、文章の翻訳で意味がずれることがあります(例:「カメラは後ろから追いかける」が「her camera following behind」=「彼女のカメラが後ろについてくる」になった)。
> 動画のプロンプトのように文章で書くことが多いなら、2B以上を選びましょう。
設定のほかの項目は、次のとおりです。
| 項目 | 内容 |
| --- | --- |
| 入力する言語 | ふつうは **自動判定** のままでよい。日本語だけで書くなら「日本語」を選ぶと確実 |
| Ollama URL | Ollamaのアドレス。空欄なら `http://localhost:11434` |
| 翻訳モデルの実行場所 | **GPU** か **CPUで常駐** か(下記) |
| 実行時に自動で翻訳する | Generateなどを押したときに自動で翻訳する(下記) |
PLaMo以外のOllamaのモデル(ふだんチャットに使っているモデルなど)も、**その他のOllamaモデル** から選べます。その場合は「英語に翻訳して」という指示を付けて送ります。
### 翻訳モデルをどこで動かすか
| 実行場所 | 1語句あたりの時間 | 向いている人 |
| --- | --- | --- |
| GPU(1回の翻訳が最速・VRAMを使う) | 約0.1秒 | GPUのメモリに余裕がある |
| CPUで常駐(VRAMを使わず、再読み込みの待ちなし) | 約0.2〜0.3秒 | 画像生成にGPUのメモリをすべて使いたい |
GPUのときは、**翻訳後に翻訳モデルをVRAMから解放する** をオンにしておくと、画像生成の前にGPUのメモリを空けられます(初期値はオン)。
ただし、翻訳のたびにモデルの読み込み直しで **約4秒** 待つことになります。
**CPUで常駐** にすると、モデルをメインメモリに置いたままにします(2Bで約2.7GB)。
GPUのメモリを使わず、生成UIにワークフローを読み込んだときに裏で読み込んでおくので、最初の翻訳から待たされません。
> **ポイント**
> Ollamaは、ほかのモデル(AI TOOLのチャット用など)を読み込むときに、常駐させた翻訳モデルを外すことがあります。
> その場合は、次の翻訳のときに自動で読み込み直します(その1回だけ数秒かかります)。
### 使い方:🌐ボタンで翻訳する
プロンプト翻訳をオンにすると、InputタブのPositive Prompt・Negative Promptの **↺** ボタンの右に **🌐** ボタンが表示されます。
1. プロンプト欄に、日本語で書きます。英語のタグと混ぜてもかまいません。
```
masterpiece, 夕焼けの海辺に立つ少女、(長い黒髪:1.2), <lora:test_lora:0.8>, {猫耳|狐耳}, 水彩画風
```
2. **🌐** を押します。
3. 日本語の部分だけが英語になります。
```
masterpiece, A girl standing by the seaside at sunset, (long black hair:1.2), <lora:test_lora:0.8>, {cat ears|fox ears}, watercolor style
```
次のようなプロンプトの書き方(記法)は、翻訳せずにそのまま残します。
- カンマ・改行
- 重み付け `(語句:1.2)`、`[ ]`
- ランダムに選ぶ `{A|B}`、ワイルドカード `__名前__`
- LoRAの指定 `<lora:名前:0.8>`、`embedding:名前`
- `BREAK`、`AND`
翻訳したあとに **原文** ボタンが表示されます。押すと、翻訳する前の文に戻ります(Ctrl+Zでも戻せます)。
> **注意**
> 翻訳されるのは、英数字以外の文字を含む部分だけです。英語だけの部分は、そのまま残ります。
> 反対に、é などのアクセント付きの文字を含む英単語は、翻訳の対象になります。
### 実行時に自動で翻訳する
設定の **実行時に自動で翻訳する** で、どの実行のときに自動で翻訳するかを、チェックボックスで選べます。
| チェックボックス | 動き |
| --- | --- |
| 生成UI - Generate | Generateを押すと、Positive/Negativeの欄の日本語を英語に置き換えてから生成する |
| 生成UI Lab - Run | Labの実行で、送る内容だけを翻訳する。Labのプランには日本語が残る |
| Video Plan - Run | Videoタブ Planの実行で、送るプロンプトだけを翻訳する。プランには日本語が残る |
LabとVideo Planでは、プランを日本語のまま残すので、あとから日本語で書き直せます。
生成した画像や動画の情報(メタデータ)には、実際に送った英語のプロンプトが記録されます。
> **注意**
> 自動翻訳がオンのときに翻訳に失敗すると(Ollamaが起動していないなど)、日本語のまま生成しないよう、生成を止めます。
> LabとVideo Planでは、止まった理由が進行状況の欄に表示されます。
### Labのモーダルと、Video Planでも使える
🌐ボタンは、次の欄にもあります。使い方は同じです。
- Lab(5-7)のプロンプト列のセルをダブルクリックして開く画面の、Positive・Negativeの欄
- Videoタブ Planサブタブの、ブロックの **Prompt** の欄(第11章 11-4)
> **ポイント**
> PLaMo 3 Translate は、個人の利用や趣味、研究などの非商用の利用なら無料で使えます(PLaMoコミュニティライセンス)。
> 商用で使う場合は、ライセンスの条件を確認してください。
> **この章(後半)のまとめ**
> - Batchサブタブで、モデル・プロンプト・サンプラーなどを1種類ずつ変えながらまとめて生成できる
> - Batch Queueの列のチェックで種類を選び、Generateで開始。終わったらチェックを外す
> - Feederは、たくさんの画像を1枚ずつワークフローに送り込む機能。専用ノードが必要
> - Labは、複数の設定を別々のタイミングで切り替えられる上級者向けの機能
> - パートナーAPIノード(Nano Bananaなど)は、`.env` の `COMFY_API_KEY` を設定すれば実行できる。クレジットが消費される
> - プロンプト翻訳をオンにすると、日本語で書いたプロンプトを🌐ボタンで英語にできる。記法はそのまま残り、Generate・Lab・Video Planの実行時に自動で翻訳することもできる
@@ -227,6 +227,10 @@ Workflow Studioにはたくさんのスタイルが付属しています。
英語のプロンプトの意味を知りたいときは、反対に **EN→JA** で日本語に訳せます。
> **ポイント**
> 生成UIのプロンプト欄で直接翻訳したいときは、第5章 5-10 の **プロンプト翻訳**(🌐ボタン)が便利です。重み付けやLoRAの指定を残したまま、日本語の部分だけを英語にできます。
> AI Assistantの翻訳にも、翻訳専用のモデル **PLaMo 3 Translate** を選べます(v0.9.9〜。以前は指示文まで翻訳されたり、ZH→ENで日本語が出たりしていました)。
### AIと相談しながらプロンプトを作る
入力欄に質問を書いて **Send**(または Enter キー)を押すと、AIとチャットできます。
@@ -110,6 +110,11 @@ Workflow Studio本体の **AI TOOL** タブを開きます。
> 小さなモデルは、翻訳せずに元の文章をそのまま返してしまうことがあります。
> その場合は「モデルが原文をそのまま返しました」と表示されるので、別のモデルを試してください。
> **ポイント**
> 翻訳専用のモデル **PLaMo 3 Translate**(第5章 5-10)を、設定のモデルに選ぶこともできます(v0.9.9〜)。
> 日本語・英語・中国語のほか、Free(自由入力)では French・フランス語・français のような言語名で、PLaMoが対応する言語を指定できます。PLaMoが対応していない言語(ポルトガル語など)を翻訳先にすると、エラーになります。
> WS LibraryのAタブの翻訳も同じです。
### Chat
入力欄に話しかけて、**Enter** で送信します(**Shift+Enter** で改行)。
会話の流れを覚えているので、「もっと明るい雰囲気にして」のような続けての依頼もできます。
@@ -155,6 +155,14 @@ Image Editのいちばん便利な使い方が、**インペイント** です
そのほか、動画の好きな場面を静止画として保存する **Frame** や、動画をGIFアニメに変換する **GIF** の機能もあります。
> **ポイント**
> Planサブタブのブロックの **Prompt** の欄にも、プロンプト翻訳の **🌐** ボタンがあります(第5章 5-10)。
> 設定の **Video Plan - Run** をオンにすると、日本語のプロンプトのまま実行して、送る内容だけを英語にできます。
> **注意**
> v0.9.8までは、新しいComfyUIで保存したワークフローを使うと、Planで入力したプロンプト・長さ(Duration)・Turboの設定が反映されず、ワークフローに保存されている値のまま生成されていました(v0.9.9で修正)。
> 以前と同じPlanを実行しても、Planの値が反映されるようになったため、結果が変わることがあります。
### アセット登録と音声変換(v0.8.9〜)
- **アセット登録** - 左側の動画ソースパネルのボタンです。パソコン内の動画を、outputフォルダ(`output/video`)へコピーして「Video Assets」グループに登録します。
登録すると、Assetサブタブの一覧に出て、Editなどで使えるようになります。
@@ -205,6 +213,7 @@ Image Editのいちばん便利な使い方が、**インペイント** です
| CivitAI APIキー | Civitaiの情報取得用(省略可) | 第6章 |
| Eagle 連携 (オプション) | 生成画像をEagleに自動保存 | 第8章 |
| VRAM調整(Ollama) | 生成前にAIモデルをメモリから降ろす | 第10章 |
| プロンプト翻訳(自国語 → 英語) | 日本語のプロンプトを🌐ボタンや実行時の自動翻訳で英語にする | 第5章 5-10 |
| データ管理 | 設定やデータのバックアップ・復元 | 下記 |
### デフォルトワークフロー
@@ -88,6 +88,15 @@ Batchサブタブを開き、Batch Queueの列のチェックをすべてオフ
いつも同じモデルを使いたい場合は、設定タブの **デフォルトCheckpoint** を使うと便利です(第11章 11-5)。
### プロンプト翻訳の🌐ボタンが出ない・翻訳できない
| 症状 | 原因 | 対処 |
| --- | --- | --- |
| 🌐ボタンが表示されない | プロンプト翻訳がオフになっている | 設定タブの **プロンプト翻訳(自国語 → 英語)** で **生成UIでプロンプト翻訳を使う** にチェックを入れる(第5章 5-10) |
| 「翻訳エラー」と出る | Ollamaが起動していない、または翻訳モデルがOllamaに無い | Ollamaを起動する。設定の **翻訳モデル** に **(未取得)** と出ていれば **ダウンロード** を押す |
| 押しても何も変わらない(「翻訳する部分がありません」) | 英語(英数字)だけのプロンプトになっている | 翻訳されるのは英数字以外の文字を含む部分だけ。英語の部分はそのまま残る |
| 自動翻訳がオンのとき、生成が始まらない | 翻訳に失敗したので、日本語のまま生成しないよう止めた | 上の「翻訳エラー」と同じ対処をする。LabとVideo Planでは、理由が進行状況の欄に出る |
| 訳がおかしい | 小さいモデル(0.8B)は、文章で意味がずれることがある | 設定の **翻訳モデル** で2B以上を選ぶ |
### 同じ設定なのに、同じ画像にならない
生成パネルのシードのモードが **Random** になっていませんか?
同じ画像を作るには、シードを **Workflow**(ワークフローのシードをそのまま使う)か **Fixed**(Seed欄の値で固定)にする必要があります。
+2
View File
@@ -54,6 +54,7 @@
| LoRA | 絵柄やキャラクターなどを追加で覚えさせる小さなモデル | 第6章 |
| OCR | 画像に写っている文字を読み取ること | 第10章 |
| Ollama | ローカルAIを手軽に動かせるソフト | 第10章 |
| PLaMo 3 Translate | Preferred Networks(PFN)の翻訳専用AIモデル。プロンプト翻訳で使う | 第5章 |
| T2I(Text to Image) | 文章(プロンプト)から画像を作ること | 第5章 |
| TagSpace | タグ・プロンプト・生成画像を意味の近さで3Dの空間に並べて表示するタブ | 第11章 |
| VAE | 画像の色合いや細部を仕上げるモデル | 第6章 |
@@ -127,6 +128,7 @@
| --- | --- | --- |
| Civitai(https://civitai.com/) | モデルの入手・情報取得 | 第6章 |
| Ollama(https://ollama.com/) | ローカルAI | 第10章 |
| PLaMo 3 Translate(https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF) | プロンプト翻訳の翻訳モデル | 第5章 |
| LM Studio(https://lmstudio.ai/) | ローカルAI | 第10章 |
| Lemonade Server(https://lemonade-server.ai/) | ローカルAI | 第10章 |
| Eagle(https://eagle.cool/) | 画像管理ソフト | 第8章 |
+3 -3
View File
@@ -2,12 +2,12 @@
Don't Be Afraid of Nodes - Generate Images More Easily and Keep Them Organized
- Covers: Workflow Studio v0.9.6
- Covers: Workflow Studio v0.9.9
- Author: ketle-man
- (c) 2026 ketle-man
This is the **text-only edition** (without screenshots) of the Kindle book.
Chapter files are in the `chapters/` folder; the whole book in one file is `Workflow_Studio_Manual_v0.9.6_en.md`.
Chapter files are in the `chapters/` folder; the whole book in one file is `Workflow_Studio_Manual_v0.9.9_en.md`.
Screen examples are omitted, so please use the book together with Workflow Studio's Help tab.
## Contents
@@ -29,4 +29,4 @@ Screen examples are omitted, so please use the book together with Workflow Studi
- [13_Appendix](chapters/13_Appendix.md)
- [14_Afterword](chapters/14_Afterword.md)
Whole book: [Workflow_Studio_Manual_v0.9.6_en.md](Workflow_Studio_Manual_v0.9.6_en.md)
Whole book: [Workflow_Studio_Manual_v0.9.9_en.md](Workflow_Studio_Manual_v0.9.9_en.md)
Binary file not shown.
@@ -2,12 +2,12 @@
Don't Be Afraid of Nodes - Generate Images More Easily and Keep Them Organized
- Covers: Workflow Studio v0.9.6
- Covers: Workflow Studio v0.9.9
- Author: ketle-man
- (c) 2026 ketle-man
This is the **text-only edition** (without screenshots) of the Kindle book.
Chapter files are in the `chapters/` folder; the whole book in one file is `Workflow_Studio_Manual_v0.9.6_en.md`.
Chapter files are in the `chapters/` folder; the whole book in one file is `Workflow_Studio_Manual_v0.9.9_en.md`.
Screen examples are omitted, so please use the book together with Workflow Studio's Help tab.
---
@@ -143,7 +143,7 @@ It is written so that you can follow it if you know basic computer operations (c
## Version and environment covered
- **Workflow Studio**: v0.9.6
- **Workflow Studio**: v0.9.9
- **ComfyUI**: the latest version at the time of writing
- **OS**: Windows (screen examples are from Windows)
@@ -1542,12 +1542,125 @@ The workflows you can use in GenerateUI have increased as follows. They are used
> The Metadata tab and the side panel's **I** tab can also read images made with Nano Banana (v0.8.5 and later).
> The prompt appears as one whole entry, not split into Positive/Negative.
## 5-10 Writing prompts in your own language (Prompt Translation, v0.9.9 and later)
Most image generation models were trained on English prompts.
With **Prompt Translation** turned on, you can write a prompt in your own language and turn it into English with one button.
Like the translation extensions for Stable Diffusion web UI (A1111), it translates **only the parts written in your own language**.
Translation uses AI running on your PC (**Ollama**) and the translation model **PLaMo 3 Translate**, which supports 51 languages besides English (Japanese, Chinese, Korean, French, German, Spanish, Russian, Thai, Vietnamese and more).
Your prompts are not sent to an online translation service.
> **What you need first**
> Install and start **Ollama** (Chapter 10, section 10-1). The translation model can be downloaded from the Settings screen (see below).
### Preparation: turn it on in Settings
1. In the **Settings** tab, open **Prompt Translation (native language -> English)**.
2. Check **Enable prompt translation in GenerateUI**.
3. Choose the model in **Translation model**. Models not yet in Ollama are marked **(not downloaded)**; choose one and press **Download** to pull it into Ollama.
4. Press **Test**. When the sample prompt comes back in English, you are ready.
PLaMo 3 Translate comes in four sizes.
| Model | Size | Notes |
| --- | --- | --- |
| 0.8B | about 0.6 GB | Fastest. Enough for short tags |
| 2B | about 1.8 GB | Recommended. Translates sentences accurately too |
| 8B | about 5.3 GB | Higher quality |
| 31B | about 19.5 GB | Highest quality, for PCs with plenty of memory |
> **Tip**
> 0.8B sometimes shifts the meaning of a sentence (for example, "the camera follows from behind" in Japanese became "her camera following behind").
> If you often write prompts as sentences, such as video prompts, choose 2B or larger.
The other settings are:
| Setting | What it does |
| --- | --- |
| Source language | Usually leave it at **Auto-detect**. If you always write in one language, choosing it makes detection certain |
| Ollama URL | Ollama's address. Blank means `http://localhost:11434` |
| Where to run the translation model | **GPU** or **CPU, kept loaded** (see below) |
| Translate automatically when running | Translates automatically when you press Generate and so on (see below) |
Other Ollama models (such as the one you use for chat) can also be chosen under **Other Ollama models**. They are sent the text with a "translate into English" instruction.
### Where to run the translation model
| Where | Time per phrase | Good for |
| --- | --- | --- |
| GPU (fastest per translation, uses VRAM) | about 0.1 s | GPUs with VRAM to spare |
| CPU, kept loaded (no VRAM, no reload wait) | about 0.2-0.3 s | Keeping all VRAM for image generation |
On GPU, turning on **Unload the translation model from VRAM after translating** frees VRAM before image generation (on by default).
However, every translation then waits **about 4 seconds** while the model loads again.
**CPU, kept loaded** keeps the model in system RAM (about 2.7 GB for 2B).
It uses no VRAM and is loaded in the background when a workflow is loaded into GenerateUI, so even the first translation does not wait.
> **Tip**
> When Ollama loads another model (for example the AI TOOL chat model), it may drop the resident translation model.
> It then loads again automatically at the next translation (that one translation takes a few seconds).
### Using it: translate with the globe button
With Prompt Translation on, a **globe (🌐)** button appears to the right of the **↺** button of Positive Prompt and Negative Prompt on the Input tab.
1. Write the prompt in your own language. Mixing in English tags is fine.
```
masterpiece, 夕焼けの海辺に立つ少女、(長い黒髪:1.2), <lora:test_lora:0.8>, {猫耳|狐耳}, 水彩画風
```
2. Press the globe button.
3. Only the parts in your language become English.
```
masterpiece, A girl standing by the seaside at sunset, (long black hair:1.2), <lora:test_lora:0.8>, {cat ears|fox ears}, watercolor style
```
The following prompt syntax is kept as it is, without translating:
- Commas and line breaks
- Weights `(word:1.2)` and `[ ]`
- Random choice `{A|B}` and wildcards `__name__`
- LoRA `<lora:name:0.8>` and `embedding:name`
- `BREAK` and `AND`
After translating, an **Original** button appears. Press it to go back to the text before translation (Ctrl+Z also works).
> **Note**
> Only parts that contain letters outside ASCII are translated; English-only parts stay as they are.
> Conversely, an English word that contains an accented letter such as é is translated too.
### Translating automatically when running
Under **Translate automatically when running** in Settings, checkboxes choose when to translate automatically.
- **GenerateUI - Generate**: pressing Generate replaces the text of the Positive/Negative fields with the translation, then generates
- **GenerateUI Lab - Run**: a Lab run translates only what is sent. The Lab plan keeps your text
- **Video Plan - Run**: a Video tab Plan run translates only the prompts that are sent. The plan keeps your text
Because Lab and Video Plan keep your text, you can keep editing the plan in your own language.
The information saved with the generated images and videos (metadata) records the English prompt that was actually sent.
> **Note**
> If translation fails while automatic translation is on (for example, Ollama is not running), generation stops so that untranslated text is not sent.
> For Lab and Video Plan, the reason is shown in the progress line.
### Also in the Lab modal and Video Plan
The globe button is also on these fields, and works the same way:
- The Positive and Negative fields of the screen that opens when you double-click a cell in Lab's prompt column (5-7)
- The **Prompt** field of a block in the Video tab's Plan subtab (Chapter 11, section 11-4)
> **Tip**
> PLaMo 3 Translate is free for personal use, hobbies, research and other non-commercial use (PLaMo Community License).
> Check the license terms before using it commercially.
> **Summary of this chapter (second half)**
> - With the Batch subtab, you can generate in bulk while changing the model, prompt, sampler and so on, one kind at a time
> - Choose the kind with the Batch Queue column checkbox and start with Generate. Turn the check off when done
> - Feeder is a feature that feeds many images one at a time into a workflow. A dedicated node is required
> - Lab is an advanced feature that can switch several settings at separate timings
> - Partner API nodes (Nano Banana and others) run once `COMFY_API_KEY` is set in `.env`. They consume credits
> - With Prompt Translation on, the globe button turns a prompt written in your own language into English. Prompt syntax is kept, and Generate, Lab and Video Plan runs can translate automatically
---
@@ -1963,6 +2076,10 @@ With the buttons shown below the translation result, you can use the result.
When you want to know the meaning of an English prompt, you can conversely translate it with **EN->JA**.
> **Tip**
> To translate directly in GenerateUI's prompt fields, **Prompt Translation** (the globe button) in Chapter 5, section 5-10 is handy. It turns only the parts in your language into English and keeps weights and LoRA tags.
> The AI Assistant's translation can also use the translation model **PLaMo 3 Translate** (v0.9.9 and later; before that, the instruction text was translated too, and ZH->EN came out in Japanese).
### Making prompts while consulting the AI
Write a question in the input box and press **Send** (or the Enter key) to chat with the AI.
@@ -2611,6 +2728,11 @@ The screen is divided into four parts, all shown at the same time.
> Small models sometimes return the original text as it is without translating.
> In that case a message says the model returned the original text, so try another model.
> **Tip**
> You can also choose the translation model **PLaMo 3 Translate** (Chapter 5, section 5-10) as the model in Settings (v0.9.9 and later).
> Besides Japanese, English and Chinese, **Free** accepts language names such as French, フランス語 or français for any language PLaMo supports. A target language PLaMo does not support (such as Portuguese) gives an error.
> The same applies to the translation in WS Library's A tab.
### Chat
Talk in the input box and send with **Enter** (**Shift + Enter** for a line break).
It remembers the flow of the conversation, so follow-up requests such as "make it a brighter mood" also work.
@@ -3096,6 +3218,14 @@ You load a matching workflow with **Load in Video** in the Workflow tab and use
There are also the **Frame** feature, which saves a favorite scene of a video as a still image, and **GIF**, which converts a video to an animated GIF.
> **Tip**
> The **Prompt** field of a Plan block also has the Prompt Translation globe button (Chapter 5, section 5-10).
> With **Video Plan - Run** turned on in Settings, you can run the plan with prompts in your own language and send only English.
> **Note**
> Up to v0.9.8, with workflows saved by newer ComfyUI versions, the prompt, length (Duration) and Turbo settings entered in Plan were not applied, and the values saved in the workflow were used instead (fixed in v0.9.9).
> Because Plan values are applied now, running the same plan as before may give different results.
### Register as Asset and audio conversion (v0.8.9 and later)
- **Register as Asset** - a button in the Video Source panel on the left. It copies a video from your PC into the output folder (`output/video`) and registers it in the "Video Assets" group.
Once registered, it appears in the Asset subtab list and can be used in Edit and elsewhere.
@@ -3144,6 +3274,7 @@ Here we mainly introduce items not covered in earlier chapters.
| CivitAI API Key | For fetching Civitai information (optional) | Chapter 6 |
| Eagle integration (optional) | Automatically save generated images to Eagle | Chapter 8 |
| VRAM Management (Ollama) | Unload AI models from memory before generation | Chapter 10 |
| Prompt Translation (native language -> English) | Turn prompts in your own language into English with the globe button or automatic translation when running | Chapter 5, 5-10 |
| Data Management | Backing up and restoring settings and data | Below |
### Default Workflow
@@ -3379,6 +3510,15 @@ In the **Model** subtab of GenerateUI, choose the model you want to use again an
If you always want to use the same model, the **Default Checkpoint** in the Settings tab is handy (Chapter 11, section 11-5).
### The Prompt Translation globe button does not appear or translation fails
| Symptom | Cause | Fix |
| --- | --- | --- |
| No globe button | Prompt Translation is off | In the Settings tab, open **Prompt Translation (native language -> English)** and check **Enable prompt translation in GenerateUI** (Chapter 5, section 5-10) |
| "Translation error" appears | Ollama is not running, or the translation model is not in Ollama | Start Ollama. If **Translation model** shows **(not downloaded)**, press **Download** |
| Nothing changes ("Nothing to translate") | The prompt is English (ASCII) only | Only parts with letters outside ASCII are translated; English parts stay as they are |
| Generation does not start with automatic translation on | Translation failed, so generation stopped instead of sending untranslated text | Same fix as "Translation error". In Lab and Video Plan the reason is shown in the progress line |
| The translation is off | Small models (0.8B) can shift the meaning of sentences | Choose 2B or larger in **Translation model** |
### It does not become the same image even with the same settings
Is the seed mode in the generate panel set to **Random**?
To make the same image, you need to set the seed to **Workflow** (use the workflow's seed as it is) or **Fixed** (fix it to the value in the Seed field).
@@ -3558,6 +3698,7 @@ The main terms that appear in this book, in alphabetical order.
| Node set | Several nodes and their connections saved together | Chapter 9 |
| OCR | Reading the text shown in an image | Chapter 10 |
| Ollama | Software for running local AI easily | Chapter 10 |
| PLaMo 3 Translate | A translation AI model by Preferred Networks (PFN), used by Prompt Translation | Chapter 5 |
| Port number | A number for distinguishing which software to communicate with inside one computer | Chapter 2 |
| Positive prompt | A prompt where you write what you want drawn | Chapter 7 |
| Preset | A pair of positive and negative prompts saved together | Chapter 7 |
@@ -3646,6 +3787,7 @@ The main terms that appear in this book, in alphabetical order.
| --- | --- | --- |
| Civitai (https://civitai.com/) | Getting models, fetching information | Chapter 6 |
| Ollama (https://ollama.com/) | Local AI | Chapter 10 |
| PLaMo 3 Translate (https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF) | Translation model for Prompt Translation | Chapter 5 |
| LM Studio (https://lmstudio.ai/) | Local AI | Chapter 10 |
| Lemonade Server (https://lemonade-server.ai/) | Local AI | Chapter 10 |
| Eagle (https://eagle.cool/) | Image-management software | Chapter 8 |
Binary file not shown.
+1 -1
View File
@@ -129,7 +129,7 @@ It is written so that you can follow it if you know basic computer operations (c
## Version and environment covered
- **Workflow Studio**: v0.9.6
- **Workflow Studio**: v0.9.9
- **ComfyUI**: the latest version at the time of writing
- **OS**: Windows (screen examples are from Windows)
@@ -232,9 +232,122 @@ The workflows you can use in GenerateUI have increased as follows. They are used
> The Metadata tab and the side panel's **I** tab can also read images made with Nano Banana (v0.8.5 and later).
> The prompt appears as one whole entry, not split into Positive/Negative.
## 5-10 Writing prompts in your own language (Prompt Translation, v0.9.9 and later)
Most image generation models were trained on English prompts.
With **Prompt Translation** turned on, you can write a prompt in your own language and turn it into English with one button.
Like the translation extensions for Stable Diffusion web UI (A1111), it translates **only the parts written in your own language**.
Translation uses AI running on your PC (**Ollama**) and the translation model **PLaMo 3 Translate**, which supports 51 languages besides English (Japanese, Chinese, Korean, French, German, Spanish, Russian, Thai, Vietnamese and more).
Your prompts are not sent to an online translation service.
> **What you need first**
> Install and start **Ollama** (Chapter 10, section 10-1). The translation model can be downloaded from the Settings screen (see below).
### Preparation: turn it on in Settings
1. In the **Settings** tab, open **Prompt Translation (native language -> English)**.
2. Check **Enable prompt translation in GenerateUI**.
3. Choose the model in **Translation model**. Models not yet in Ollama are marked **(not downloaded)**; choose one and press **Download** to pull it into Ollama.
4. Press **Test**. When the sample prompt comes back in English, you are ready.
PLaMo 3 Translate comes in four sizes.
| Model | Size | Notes |
| --- | --- | --- |
| 0.8B | about 0.6 GB | Fastest. Enough for short tags |
| 2B | about 1.8 GB | Recommended. Translates sentences accurately too |
| 8B | about 5.3 GB | Higher quality |
| 31B | about 19.5 GB | Highest quality, for PCs with plenty of memory |
> **Tip**
> 0.8B sometimes shifts the meaning of a sentence (for example, "the camera follows from behind" in Japanese became "her camera following behind").
> If you often write prompts as sentences, such as video prompts, choose 2B or larger.
The other settings are:
| Setting | What it does |
| --- | --- |
| Source language | Usually leave it at **Auto-detect**. If you always write in one language, choosing it makes detection certain |
| Ollama URL | Ollama's address. Blank means `http://localhost:11434` |
| Where to run the translation model | **GPU** or **CPU, kept loaded** (see below) |
| Translate automatically when running | Translates automatically when you press Generate and so on (see below) |
Other Ollama models (such as the one you use for chat) can also be chosen under **Other Ollama models**. They are sent the text with a "translate into English" instruction.
### Where to run the translation model
| Where | Time per phrase | Good for |
| --- | --- | --- |
| GPU (fastest per translation, uses VRAM) | about 0.1 s | GPUs with VRAM to spare |
| CPU, kept loaded (no VRAM, no reload wait) | about 0.2-0.3 s | Keeping all VRAM for image generation |
On GPU, turning on **Unload the translation model from VRAM after translating** frees VRAM before image generation (on by default).
However, every translation then waits **about 4 seconds** while the model loads again.
**CPU, kept loaded** keeps the model in system RAM (about 2.7 GB for 2B).
It uses no VRAM and is loaded in the background when a workflow is loaded into GenerateUI, so even the first translation does not wait.
> **Tip**
> When Ollama loads another model (for example the AI TOOL chat model), it may drop the resident translation model.
> It then loads again automatically at the next translation (that one translation takes a few seconds).
### Using it: translate with the globe button
With Prompt Translation on, a **globe (🌐)** button appears to the right of the **↺** button of Positive Prompt and Negative Prompt on the Input tab.
1. Write the prompt in your own language. Mixing in English tags is fine.
```
masterpiece, 夕焼けの海辺に立つ少女、(長い黒髪:1.2), <lora:test_lora:0.8>, {猫耳|狐耳}, 水彩画風
```
2. Press the globe button.
3. Only the parts in your language become English.
```
masterpiece, A girl standing by the seaside at sunset, (long black hair:1.2), <lora:test_lora:0.8>, {cat ears|fox ears}, watercolor style
```
The following prompt syntax is kept as it is, without translating:
- Commas and line breaks
- Weights `(word:1.2)` and `[ ]`
- Random choice `{A|B}` and wildcards `__name__`
- LoRA `<lora:name:0.8>` and `embedding:name`
- `BREAK` and `AND`
After translating, an **Original** button appears. Press it to go back to the text before translation (Ctrl+Z also works).
> **Note**
> Only parts that contain letters outside ASCII are translated; English-only parts stay as they are.
> Conversely, an English word that contains an accented letter such as é is translated too.
### Translating automatically when running
Under **Translate automatically when running** in Settings, checkboxes choose when to translate automatically.
- **GenerateUI - Generate**: pressing Generate replaces the text of the Positive/Negative fields with the translation, then generates
- **GenerateUI Lab - Run**: a Lab run translates only what is sent. The Lab plan keeps your text
- **Video Plan - Run**: a Video tab Plan run translates only the prompts that are sent. The plan keeps your text
Because Lab and Video Plan keep your text, you can keep editing the plan in your own language.
The information saved with the generated images and videos (metadata) records the English prompt that was actually sent.
> **Note**
> If translation fails while automatic translation is on (for example, Ollama is not running), generation stops so that untranslated text is not sent.
> For Lab and Video Plan, the reason is shown in the progress line.
### Also in the Lab modal and Video Plan
The globe button is also on these fields, and works the same way:
- The Positive and Negative fields of the screen that opens when you double-click a cell in Lab's prompt column (5-7)
- The **Prompt** field of a block in the Video tab's Plan subtab (Chapter 11, section 11-4)
> **Tip**
> PLaMo 3 Translate is free for personal use, hobbies, research and other non-commercial use (PLaMo Community License).
> Check the license terms before using it commercially.
> **Summary of this chapter (second half)**
> - With the Batch subtab, you can generate in bulk while changing the model, prompt, sampler and so on, one kind at a time
> - Choose the kind with the Batch Queue column checkbox and start with Generate. Turn the check off when done
> - Feeder is a feature that feeds many images one at a time into a workflow. A dedicated node is required
> - Lab is an advanced feature that can switch several settings at separate timings
> - Partner API nodes (Nano Banana and others) run once `COMFY_API_KEY` is set in `.env`. They consume credits
> - With Prompt Translation on, the globe button turns a prompt written in your own language into English. Prompt syntax is kept, and Generate, Lab and Video Plan runs can translate automatically
@@ -223,6 +223,10 @@ With the buttons shown below the translation result, you can use the result.
When you want to know the meaning of an English prompt, you can conversely translate it with **EN->JA**.
> **Tip**
> To translate directly in GenerateUI's prompt fields, **Prompt Translation** (the globe button) in Chapter 5, section 5-10 is handy. It turns only the parts in your language into English and keeps weights and LoRA tags.
> The AI Assistant's translation can also use the translation model **PLaMo 3 Translate** (v0.9.9 and later; before that, the instruction text was translated too, and ZH->EN came out in Japanese).
### Making prompts while consulting the AI
Write a question in the input box and press **Send** (or the Enter key) to chat with the AI.
@@ -110,6 +110,11 @@ The screen is divided into four parts, all shown at the same time.
> Small models sometimes return the original text as it is without translating.
> In that case a message says the model returned the original text, so try another model.
> **Tip**
> You can also choose the translation model **PLaMo 3 Translate** (Chapter 5, section 5-10) as the model in Settings (v0.9.9 and later).
> Besides Japanese, English and Chinese, **Free** accepts language names such as French, フランス語 or français for any language PLaMo supports. A target language PLaMo does not support (such as Portuguese) gives an error.
> The same applies to the translation in WS Library's A tab.
### Chat
Talk in the input box and send with **Enter** (**Shift + Enter** for a line break).
It remembers the flow of the conversation, so follow-up requests such as "make it a brighter mood" also work.
@@ -155,6 +155,14 @@ You load a matching workflow with **Load in Video** in the Workflow tab and use
There are also the **Frame** feature, which saves a favorite scene of a video as a still image, and **GIF**, which converts a video to an animated GIF.
> **Tip**
> The **Prompt** field of a Plan block also has the Prompt Translation globe button (Chapter 5, section 5-10).
> With **Video Plan - Run** turned on in Settings, you can run the plan with prompts in your own language and send only English.
> **Note**
> Up to v0.9.8, with workflows saved by newer ComfyUI versions, the prompt, length (Duration) and Turbo settings entered in Plan were not applied, and the values saved in the workflow were used instead (fixed in v0.9.9).
> Because Plan values are applied now, running the same plan as before may give different results.
### Register as Asset and audio conversion (v0.8.9 and later)
- **Register as Asset** - a button in the Video Source panel on the left. It copies a video from your PC into the output folder (`output/video`) and registers it in the "Video Assets" group.
Once registered, it appears in the Asset subtab list and can be used in Edit and elsewhere.
@@ -203,6 +211,7 @@ Here we mainly introduce items not covered in earlier chapters.
| CivitAI API Key | For fetching Civitai information (optional) | Chapter 6 |
| Eagle integration (optional) | Automatically save generated images to Eagle | Chapter 8 |
| VRAM Management (Ollama) | Unload AI models from memory before generation | Chapter 10 |
| Prompt Translation (native language -> English) | Turn prompts in your own language into English with the globe button or automatic translation when running | Chapter 5, 5-10 |
| Data Management | Backing up and restoring settings and data | Below |
### Default Workflow
@@ -88,6 +88,15 @@ In the **Model** subtab of GenerateUI, choose the model you want to use again an
If you always want to use the same model, the **Default Checkpoint** in the Settings tab is handy (Chapter 11, section 11-5).
### The Prompt Translation globe button does not appear or translation fails
| Symptom | Cause | Fix |
| --- | --- | --- |
| No globe button | Prompt Translation is off | In the Settings tab, open **Prompt Translation (native language -> English)** and check **Enable prompt translation in GenerateUI** (Chapter 5, section 5-10) |
| "Translation error" appears | Ollama is not running, or the translation model is not in Ollama | Start Ollama. If **Translation model** shows **(not downloaded)**, press **Download** |
| Nothing changes ("Nothing to translate") | The prompt is English (ASCII) only | Only parts with letters outside ASCII are translated; English parts stay as they are |
| Generation does not start with automatic translation on | Translation failed, so generation stopped instead of sending untranslated text | Same fix as "Translation error". In Lab and Video Plan the reason is shown in the progress line |
| The translation is off | Small models (0.8B) can shift the meaning of sentences | Choose 2B or larger in **Translation model** |
### It does not become the same image even with the same settings
Is the seed mode in the generate panel set to **Random**?
To make the same image, you need to set the seed to **Workflow** (use the workflow's seed as it is) or **Fixed** (fix it to the value in the Seed field).
+2
View File
@@ -34,6 +34,7 @@ The main terms that appear in this book, in alphabetical order.
| Node set | Several nodes and their connections saved together | Chapter 9 |
| OCR | Reading the text shown in an image | Chapter 10 |
| Ollama | Software for running local AI easily | Chapter 10 |
| PLaMo 3 Translate | A translation AI model by Preferred Networks (PFN), used by Prompt Translation | Chapter 5 |
| Port number | A number for distinguishing which software to communicate with inside one computer | Chapter 2 |
| Positive prompt | A prompt where you write what you want drawn | Chapter 7 |
| Preset | A pair of positive and negative prompts saved together | Chapter 7 |
@@ -122,6 +123,7 @@ The main terms that appear in this book, in alphabetical order.
| --- | --- | --- |
| Civitai (https://civitai.com/) | Getting models, fetching information | Chapter 6 |
| Ollama (https://ollama.com/) | Local AI | Chapter 10 |
| PLaMo 3 Translate (https://huggingface.co/pfnet/plamo-3-translate-2b-GGUF) | Translation model for Prompt Translation | Chapter 5 |
| LM Studio (https://lmstudio.ai/) | Local AI | Chapter 10 |
| Lemonade Server (https://lemonade-server.ai/) | Local AI | Chapter 10 |
| Eagle (https://eagle.cool/) | Image-management software | Chapter 8 |
+88 -17
View File
@@ -6,6 +6,7 @@ import json
import logging
import shutil
import tempfile
import re
import zipfile
from pathlib import Path
@@ -29,8 +30,30 @@ _DATA_FILES = [
"gallery_metadata.json",
"tagger_settings.json",
"civitai_cache.json",
"semantic_settings.json",
]
# Browser-side settings (localStorage, same origin as ComfyUI) carried in both backups:
# workflow/preset groups, badge palette, appearance, AI/decision/VRAM settings, presets...
# The client collects and restores them; the server only validates and stores them as
# "__browser_storage" (JSON bundle) or _BROWSER_STORAGE_ENTRY (ZIP).
_BROWSER_STORAGE_KEY_RE = re.compile(r"^(?:wfm|ie)_[A-Za-z0-9_-]{1,100}$")
_BROWSER_STORAGE_TRANSIENT = {"wfm_pending_workflow", "wfm_library_filter_request"}
_BROWSER_STORAGE_MAX = 5 * 1024 * 1024 # localStorage itself is ~5 MB per origin
_BROWSER_STORAGE_ENTRY = "_browser_storage.json"
def _clean_browser_storage(obj) -> dict:
"""Keep only plugin keys with string values; drop transient keys. Raises on bad size."""
if not isinstance(obj, dict):
return {}
out = {k: v for k, v in obj.items()
if isinstance(k, str) and isinstance(v, str)
and _BROWSER_STORAGE_KEY_RE.match(k) and k not in _BROWSER_STORAGE_TRANSIENT}
if sum(len(k) + len(v) for k, v in out.items()) > _BROWSER_STORAGE_MAX:
raise ValueError("browser storage data is too large")
return out
def setup_routes(app: web.Application):
"""Register settings API routes."""
@@ -45,6 +68,7 @@ def setup_routes(app: web.Application):
app.router.add_get("/api/wfm/settings/export", handle_export)
app.router.add_post("/api/wfm/settings/import", handle_import)
app.router.add_get("/api/wfm/settings/export-full", handle_export_full)
app.router.add_post("/api/wfm/settings/export-full", handle_export_full)
app.router.add_post("/api/wfm/settings/import-full", handle_import_full)
app.router.add_get("/api/wfm/styles", handle_get_styles)
app.router.add_post("/api/wfm/styles", handle_create_style)
@@ -267,8 +291,11 @@ async def handle_export(request: web.Request) -> web.Response:
def _apply_import_bundle(bundle: dict) -> dict:
"""Write imported bundle back to individual data files. Returns summary."""
summary = {"imported": [], "skipped": []}
"""Write imported bundle back to individual data files. Returns summary.
"__browser_storage" (added by the client on export) is validated and returned for the
browser to write into localStorage."""
summary = {"imported": [], "skipped": [],
"browser_storage": _clean_browser_storage(bundle.get("__browser_storage"))}
DATA_DIR.mkdir(parents=True, exist_ok=True)
for filename in _DATA_FILES:
if filename not in bundle:
@@ -303,7 +330,18 @@ async def handle_import(request: web.Request) -> web.Response:
# style/) and the SQLite tagger.db that the JSON bundle can't represent. Excludes transient/cache
# dirs, and wildcard/ specifically because it's typically a symlink into a *different*
# custom_node's folder (comfyui-impact-pack) rather than this plugin's own data.
_FULL_BACKUP_EXCLUDE_NAMES = {"gmic_temp", "thumb_cache", "wildcard"}
# models/ held the ONNX EmbeddingGemma of v0.8.2-v0.8.13 (semantic search now runs on
# Ollama), so it is a 300 MB leftover, not data.
_FULL_BACKUP_EXCLUDE_NAMES = {"gmic_temp", "thumb_cache", "wildcard", "models"}
# Rebuildable caches, opt-in per group (see _build_full_backup_zip). The semantic index is
# on by default in the UI: rebuilding it re-embeds the whole gallery (Gemini API cost).
_SEMANTIC_CACHE_NAMES = {"semantic_index.npz"}
_TAGSPACE_CACHE_PREFIX = "tagspace_"
def _is_temp_file(name: str) -> bool:
# Atomic-write leftovers such as gallery_metadata.json.tmp / semantic_index.tmp.npz
return name.endswith(".tmp") or ".tmp." in name
def _add_file_to_zip(zf: zipfile.ZipFile, path: Path, base: Path):
@@ -413,23 +451,33 @@ def _add_video_edit_media_to_zip(zf: zipfile.ZipFile) -> None:
def _build_full_backup_zip(include_workflows: bool = False, include_wildcard: bool = False,
include_video_media: bool = False) -> bytes:
include_video_media: bool = False, include_semantic_index: bool = False,
include_tagspace: bool = False, browser_storage: dict = None) -> bytes:
"""Zips everything under DATA_DIR except the excluded names above. Walks
top-level entries first so an excluded symlinked directory (wildcard/) is never
even opened, rather than filtering after a recursive walk has already followed it.
Optionally also includes the two external folders above under "_external/"."""
Optionally also includes the two external folders above under "_external/", the
rebuildable caches, and the browser-side settings (_BROWSER_STORAGE_ENTRY)."""
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w", zipfile.ZIP_DEFLATED) as zf:
for top in sorted(DATA_DIR.iterdir()):
if top.name in _FULL_BACKUP_EXCLUDE_NAMES or top.is_symlink():
continue
if top.is_file():
if _is_temp_file(top.name):
continue
if top.name in _SEMANTIC_CACHE_NAMES and not include_semantic_index:
continue
if top.name.startswith(_TAGSPACE_CACHE_PREFIX) and not include_tagspace:
continue
_add_file_to_zip(zf, top, DATA_DIR)
elif top.is_dir():
for path in top.rglob("*"):
if path.is_dir() or path.is_symlink():
if path.is_dir() or path.is_symlink() or _is_temp_file(path.name):
continue
_add_file_to_zip(zf, path, DATA_DIR)
if browser_storage:
zf.writestr(_BROWSER_STORAGE_ENTRY, json.dumps(browser_storage, ensure_ascii=False, indent=2))
if include_workflows:
_add_external_dir_to_zip(zf, _default_workflows_dir(), "_external/default_workflows")
@@ -455,7 +503,8 @@ def _apply_full_backup_zip(zip_source) -> dict:
into ComfyUI's input dir instead, but never overwrite an existing file there — a file
with the same name is assumed to be the same upload (ComfyUI dedupes uploads by renaming),
and input/ is shared with every other workflow."""
summary = {"extracted": [], "skipped": [], "media_restored": [], "media_existing": []}
summary = {"extracted": [], "skipped": [], "media_restored": [], "media_existing": [],
"browser_storage": {}}
DATA_DIR.mkdir(parents=True, exist_ok=True)
base = DATA_DIR.resolve()
input_base = None
@@ -469,6 +518,18 @@ def _apply_full_backup_zip(zip_source) -> dict:
if info.filename.startswith("_external/"):
summary["skipped"].append(info.filename)
continue
if info.filename == _BROWSER_STORAGE_ENTRY:
# Handed back to the browser, which writes it into localStorage.
try:
if info.file_size > _BROWSER_STORAGE_MAX * 2:
raise ValueError("too large")
with zf.open(info) as src:
summary["browser_storage"] = _clean_browser_storage(
json.loads(src.read().decode("utf-8")))
except Exception as e:
logger.warning("Full backup: browser storage entry ignored: %s", e)
summary["skipped"].append(info.filename)
continue
if info.filename.startswith(_VIDEO_MEDIA_PREFIX):
media_rel = info.filename[len(_VIDEO_MEDIA_PREFIX):]
# ZIP エントリ名は細工できるため、UNC・絶対パス・「..」は結合・resolve() の前に
@@ -509,19 +570,29 @@ def _apply_full_backup_zip(zip_source) -> dict:
async def handle_export_full(request: web.Request) -> web.Response:
"""GET /api/wfm/settings/export-full - Download a ZIP of the entire data
"""GET|POST /api/wfm/settings/export-full - Download a ZIP of the entire data
directory, including data the flat JSON bundle (handle_export) can't represent.
Optional query params include_workflows=1 / include_wildcard=1 additionally bundle
ComfyUI's default workflows dir / the Impact Pack's wildcard dir (see
_build_full_backup_zip) — both restore-excluded, export-only, manual-copy-back.
include_video_media=1 adds the input-dir media referenced by Video Edit projects,
which *is* restored (into input/, without overwriting)."""
Options (query params for GET, JSON body for POST; "1"/true):
include_workflows / include_wildcard additionally bundle ComfyUI's default workflows
dir / the Impact Pack's wildcard dir (see _build_full_backup_zip) — both
restore-excluded, export-only, manual-copy-back. include_video_media adds the
input-dir media referenced by Video Edit projects, which *is* restored (into input/,
without overwriting). include_semantic_index / include_tagspace add the rebuildable
caches. POST may also carry browser_storage (the page's localStorage settings)."""
try:
include_workflows = request.rel_url.query.get("include_workflows") == "1"
include_wildcard = request.rel_url.query.get("include_wildcard") == "1"
include_video_media = request.rel_url.query.get("include_video_media") == "1"
browser_storage = None
if request.method == "POST":
body = await request.json()
if not isinstance(body, dict):
return web.json_response({"error": "body must be a JSON object"}, status=400)
opt = lambda k: body.get(k) in (True, 1, "1")
browser_storage = _clean_browser_storage(body.get("browser_storage"))
else:
opt = lambda k: request.rel_url.query.get(k) == "1"
zip_bytes = await asyncio.to_thread(
_build_full_backup_zip, include_workflows, include_wildcard, include_video_media)
_build_full_backup_zip, opt("include_workflows"), opt("include_wildcard"),
opt("include_video_media"), opt("include_semantic_index"), opt("include_tagspace"),
browser_storage)
return web.Response(
body=zip_bytes,
content_type="application/zip",
+65 -9
View File
@@ -1,4 +1,8 @@
"""Prompt translation routes (GenerateUI native-language prompt input)."""
"""Prompt translation routes (GenerateUI native-language prompt input).
Endpoints other front-ends (Comic Creator) may use — see README "Prompt translation API":
GET /api/wfm/translate/config, POST /api/wfm/translate/prompt, POST /api/wfm/translate/warmup.
"""
import asyncio
import logging
@@ -15,6 +19,7 @@ def setup_routes(app: web.Application):
app.router.add_get("/api/wfm/translate/config", handle_config)
app.router.add_get("/api/wfm/translate/models", handle_models)
app.router.add_post("/api/wfm/translate", handle_translate)
app.router.add_post("/api/wfm/translate/prompt", handle_translate_prompt)
app.router.add_post("/api/wfm/translate/pull", handle_pull)
app.router.add_post("/api/wfm/translate/warmup", handle_warmup)
app.router.add_post("/api/wfm/translate/unload", handle_unload)
@@ -23,7 +28,12 @@ def setup_routes(app: web.Application):
async def handle_config(request: web.Request) -> web.Response:
"""GET /api/wfm/translate/config - effective settings + PLaMo presets."""
cfg = await asyncio.to_thread(svc.get_config)
return web.json_response({"config": cfg, "presets": svc.PLAMO_PRESETS})
return web.json_response({
"api": svc.API_VERSION,
"config": cfg,
"presets": svc.PLAMO_PRESETS,
"languages": svc.LANGUAGES,
})
async def handle_models(request: web.Request) -> web.Response:
@@ -36,13 +46,23 @@ async def handle_models(request: web.Request) -> web.Response:
return web.json_response({"status": "error", "message": str(e), "presets": svc.PLAMO_PRESETS}, status=502)
async def _json_body(request):
body = await request.json()
if not isinstance(body, dict):
raise ValueError("body must be a JSON object")
return body
async def handle_translate(request: web.Request) -> web.Response:
"""POST /api/wfm/translate {texts: [...], model?, source_lang?} -> {translations: [...]}"""
"""POST /api/wfm/translate {texts: [...], model?, source_lang?, target_lang?} -> {translations: [...]}
Each text is translated as a whole (no prompt-syntax handling). Kept for compatibility.
"""
try:
body = await request.json()
texts = body.get("texts")
body = await _json_body(request)
translations, cached = await asyncio.to_thread(
svc.translate_texts, texts, body.get("model") or None, body.get("source_lang"),
svc.translate_texts, body.get("texts"), body.get("model") or None,
body.get("source_lang"), body.get("target_lang") or "en",
)
return web.json_response({"status": "success", "translations": translations, "cached": cached})
except ValueError as e:
@@ -52,10 +72,46 @@ async def handle_translate(request: web.Request) -> web.Response:
return web.json_response({"status": "error", "message": str(e)}, status=502)
async def handle_warmup(request: web.Request) -> web.Response:
"""POST /api/wfm/translate/warmup - preload the model when CPU-resident mode is on."""
async def handle_translate_prompt(request: web.Request) -> web.Response:
"""POST /api/wfm/translate/prompt - prompt-aware translation.
Body: {text | texts, target_lang? ("en"), source_lang? (settings), protect_quotes? (false), model?}
Returns {translated} for ``text`` or {translations} for ``texts``, plus ``cached``.
Prompt syntax (commas, weights, <lora:...>, {a|b}, __wildcards__, BREAK ...) is kept;
protect_quotes keeps the text inside 「」『』“”"" untranslated.
"""
try:
loaded = await asyncio.to_thread(svc.warmup)
body = await _json_body(request)
single = "text" in body
texts = [body.get("text")] if single else body.get("texts")
if single and not isinstance(texts[0], str):
raise ValueError("text must be a string")
translations, cached = await asyncio.to_thread(
svc.translate_prompt_texts, texts, body.get("model") or None, body.get("source_lang"),
body.get("target_lang") or "en", bool(body.get("protect_quotes")),
)
if single:
return web.json_response({"status": "success", "translated": translations[0], "cached": cached})
return web.json_response({"status": "success", "translations": translations, "cached": cached})
except ValueError as e:
return web.json_response({"status": "error", "message": str(e)}, status=400)
except Exception as e:
logger.error("Translate prompt error: %s", e)
return web.json_response({"status": "error", "message": str(e)}, status=502)
async def handle_warmup(request: web.Request) -> web.Response:
"""POST /api/wfm/translate/warmup {ignore_enabled?} - preload the model when CPU-resident mode is on.
ignore_enabled: for front-ends with their own on/off switch (Comic Creator).
"""
try:
try:
body = await request.json() if request.can_read_body else {}
except Exception:
body = {}
ignore = bool(body.get("ignore_enabled")) if isinstance(body, dict) else False
loaded = await asyncio.to_thread(svc.warmup, ignore)
return web.json_response({"status": "success", "loaded": loaded})
except Exception as e:
logger.warning("Translate warmup error: %s", e)
+12 -3
View File
@@ -143,13 +143,20 @@ def _ollama_bases(urls):
def _prepare(mode, target_mb, bases):
free_before, free_src = _free_vram_mb()
cands, unreachable = [], []
cands, unreachable, kept_cpu = [], [], []
for base in bases:
try:
_, raw = _ollama_json(base, "/api/ps", timeout=5)
for m in json.loads(raw.decode("utf-8")).get("models", []):
if m.get("name"):
cands.append({"base": base, "name": m["name"], "vram_mb": int(m.get("size_vram", 0) / _MB)})
if not m.get("name"):
continue
# size_vram == 0: loaded entirely in system RAM (e.g. the prompt translator's CPU
# mode). Unloading it frees no VRAM and only costs a reload on the next use.
# (A missing key — older Ollama — is still treated as a candidate.)
if "size_vram" in m and not m.get("size_vram"):
kept_cpu.append(m["name"])
continue
cands.append({"base": base, "name": m["name"], "vram_mb": int(m.get("size_vram", 0) / _MB)})
except Exception as e:
# Ollama not running etc. Normal for the default URL, so not a failure; keep the reason in the
# log only (the response doesn't reveal the state of caller-chosen local ports)
@@ -181,6 +188,7 @@ def _prepare(mode, target_mb, bases):
"free_before_mb": round(free_before), "free_after_mb": round(free_after),
"unloaded": strip(unloaded), "failed": [c["name"] for c in failed],
"unreachable": unreachable,
"kept_cpu": kept_cpu,
"reached": free_after >= target_mb,
}
@@ -193,6 +201,7 @@ async def handle_prepare(request: web.Request) -> web.Response:
"""POST {mode:'auto'|'all', target_gb, urls:[Ollama URLs]}.
auto: only when free VRAM is below target_gb, unload the models using the most VRAM until it is reached.
all: unload every loaded model.
Models using no VRAM (size_vram == 0, CPU-resident) are never unloaded; they are listed in kept_cpu.
The default 127.0.0.1:11434 is always included; other URLs must pass the backend URL guard."""
# JSON only, so another site can't unload models with a simple (preflight-free) text/plain request
if request.content_type != "application/json":
+319 -52
View File
@@ -1,10 +1,17 @@
"""Prompt translation service (native language -> English) via Ollama.
"""Prompt translation service (native language -> English or another language) via Ollama.
PLaMo 3 Translate (pfnet/plamo-3-translate-*-GGUF) models are driven with a raw
PFML3 prompt on /api/generate, which is the route the model card recommends for
Ollama. Any other Ollama model is used through /api/chat with a short
"translate into English" system prompt, so a general LLM or another MT model
"translate into <language>" system prompt, so a general LLM or another MT model
can be selected too.
Two entry points:
- translate_texts(): each string is translated as a whole.
- translate_prompt_texts(): prompt-aware. Only the pieces that contain non-ASCII
letters are sent to the model; prompt syntax such as commas, (weights:1.2),
[ ], {a|b}, <lora:...>, __wildcards__, embedding:name and BREAK/AND is kept,
and optionally the text inside 「」『』“”"" (text to be drawn in the image).
"""
import json
@@ -30,7 +37,11 @@ DEFAULTS = {
"prompt_translate_device": "gpu",
}
CPU_KEEP_ALIVE = -1 # stay loaded until Ollama restarts (about 2 GB RAM for 2B Q4_K_M)
CPU_KEEP_ALIVE = -1 # stay loaded until Ollama restarts (about 2.7 GB RAM for 2B Q4_K_M)
# Version of the HTTP API offered to other front-ends (Comic Creator). Bump when the
# /api/wfm/translate/prompt contract changes; clients feature-detect with it.
API_VERSION = 1
# Suggested PLaMo 3 Translate builds (shown in Settings even before they are pulled).
PLAMO_PRESETS = [
@@ -42,15 +53,34 @@ PLAMO_PRESETS = [
_PLAMO_STOP = ["<|plamo:tag|>", "<|plamo:bos|>"]
_PLAMO_SPECIAL = re.compile(r"<\|plamo:[a-z_]+\|>")
_LANG_RE = re.compile(r"^[a-z]{2,3}(-[A-Za-z]{2,4})?$")
_MAX_TEXT_LEN = 4000
_MAX_TEXTS = 200
# One model call gets at most this many characters; longer text is split at line
# breaks, then at sentence ends, and the translations are joined again.
_CHUNK_LEN = 1000
# Hard limit for one request (all texts together). Above it the request is rejected
# instead of being cut silently.
_MAX_TOTAL_LEN = 30000
_CHAT_SYSTEM = (
"You translate text for image generation prompts into English. "
"Output only the English translation, with no explanations, quotes or notes. "
"Keep proper nouns, numbers and any ASCII text unchanged."
)
# PLaMo 3 Translate languages (model card "Supported Languages"), code -> English name.
LANGUAGES = {
"en": "English", "ja": "Japanese", "zh-hans": "Simplified Chinese",
"zh-hant": "Traditional Chinese", "ko": "Korean", "ar": "Arabic", "az": "Azerbaijani",
"be": "Belarusian", "bg": "Bulgarian", "bn": "Bengali", "ca": "Catalan", "ceb": "Cebuano",
"de": "German", "es": "Spanish", "et": "Estonian", "eu": "Basque", "fa": "Persian",
"fr": "French", "gu": "Gujarati", "he": "Hebrew", "hi": "Hindi", "hr": "Croatian",
"hu": "Hungarian", "hy": "Armenian", "id": "Indonesian", "it": "Italian", "jv": "Javanese",
"ka": "Georgian", "kk": "Kazakh", "km": "Khmer", "lt": "Lithuanian", "lv": "Latvian",
"ml": "Malayalam", "mr": "Marathi", "ms": "Malay", "my": "Burmese", "ne": "Nepali",
"nl": "Dutch", "pa": "Punjabi", "pl": "Polish", "ru": "Russian", "si": "Sinhala",
"sk": "Slovak", "sl": "Slovenian", "sr": "Serbian", "sw": "Swahili", "ta": "Tamil",
"te": "Telugu", "th": "Thai", "tl": "Tagalog", "ur": "Urdu", "uz": "Uzbek", "vi": "Vietnamese",
}
_LANG_ALIASES = {
"zh": "zh-hans", "zh-cn": "zh-hans", "zh-sg": "zh-hans", "zh-tw": "zh-hant",
"zh-hk": "zh-hant", "zh-mo": "zh-hant",
}
# Targets whose script puts no space between sentences.
_NO_SPACE_LANGS = {"ja", "zh-hans", "zh-hant", "th", "km", "my"}
_cache: "OrderedDict[tuple, str]" = OrderedDict()
_CACHE_MAX = 1024
@@ -71,6 +101,28 @@ def is_plamo(model: str) -> bool:
return "plamo" in (model or "").lower()
def normalize_lang(code, allow_auto=False, field="language"):
"""Canonical PLaMo language code ("zh" -> "zh-hans"). "" means auto-detect."""
c = str(code or "").strip().lower().replace("_", "-")
if not c or c == "auto":
if allow_auto:
return ""
raise ValueError(f"{field} is required")
c = _LANG_ALIASES.get(c, c)
if c not in LANGUAGES:
raise ValueError(f"unsupported {field}: {code}")
return c
def _chat_system(target_lang):
name = LANGUAGES.get(target_lang, "English")
return (
f"You translate text for image generation prompts into {name}. "
f"Output only the {name} translation, with no explanations, quotes or notes. "
"Keep proper nouns, numbers and any ASCII text unchanged."
)
def build_pfml3(text: str, target_lang: str = "en", source_lang: str = "") -> str:
"""Build a PFML3 translation prompt (BOS is added by llama.cpp/Ollama)."""
src = _PLAMO_SPECIAL.sub("", text)
@@ -95,19 +147,20 @@ def _post_json(url: str, payload: dict, timeout: float):
def _num_predict(text: str) -> int:
# CJK -> English roughly doubles-to-triples the token count; leave headroom.
return max(64, min(2048, len(text) * 4))
# Chunks are at most _CHUNK_LEN characters, so the cap is not reached in practice.
return max(64, min(4096, len(text) * 4))
def _device_options(device):
return {"num_gpu": 0} if device == "cpu" else {}
def _translate_one(base_url, model, text, source_lang, keep_alive, device="gpu"):
def _translate_one(base_url, model, text, source_lang, keep_alive, device="gpu", target_lang="en"):
dev = _device_options(device)
if is_plamo(model):
data = _post_json(f"{base_url}/api/generate", {
"model": model,
"prompt": build_pfml3(text, "en", source_lang),
"prompt": build_pfml3(text, target_lang, source_lang),
"raw": True,
"stream": False,
"keep_alive": keep_alive,
@@ -118,7 +171,7 @@ def _translate_one(base_url, model, text, source_lang, keep_alive, device="gpu")
data = _post_json(f"{base_url}/api/chat", {
"model": model,
"messages": [
{"role": "system", "content": _CHAT_SYSTEM},
{"role": "system", "content": _chat_system(target_lang)},
{"role": "user", "content": text},
],
"stream": False,
@@ -127,6 +180,9 @@ def _translate_one(base_url, model, text, source_lang, keep_alive, device="gpu")
"options": {"temperature": 0, "num_predict": _num_predict(text), **dev},
}, timeout=180)
out = (data.get("message") or {}).get("content", "")
if data.get("done_reason") == "length":
# The output was cut at num_predict; half a translation would be silent data loss.
raise RuntimeError("translation output reached the token limit (text too long)")
out = _PLAMO_SPECIAL.sub("", out)
return out.strip()
@@ -138,66 +194,277 @@ def unload(base_url: str, model: str):
pass
def translate_texts(texts, model=None, source_lang=None):
"""Translate each string in ``texts`` into English. Blocking (run in a thread).
# ------------------------------------------------------------
# Translation session (settings, cache, chunking, unload)
# ------------------------------------------------------------
Returns (translations, cached_count). Identical inputs are served from a
bounded cache keyed by (model, source_lang, text).
_SENTENCE_END = re.compile(r"(?<=[。.!?!?.])\s*")
def _chunks(text):
"""Split long text into [(chunk, separator_after)] of at most _CHUNK_LEN characters.
Splits at line breaks first, then at sentence ends. The separator is the line
break(s) that followed the chunk, "" when a chunk was closed only for length, or
" " for a sentence break (the caller applies the target language's spacing).
A single sentence longer than _CHUNK_LEN raises ValueError rather than being cut.
"""
if not isinstance(texts, list) or len(texts) > _MAX_TEXTS:
raise ValueError(f"texts must be a list of at most {_MAX_TEXTS} strings")
cfg = get_config()
base_url = require_backend_url(cfg["prompt_translate_url"])
model = (model or cfg["prompt_translate_model"]).strip()
src = (source_lang if source_lang is not None else cfg["prompt_translate_source_lang"]) or "auto"
src = "" if src == "auto" else src
if src and not _LANG_RE.match(src):
raise ValueError("invalid source language")
device = "cpu" if cfg.get("prompt_translate_device") == "cpu" else "gpu"
keep_alive = CPU_KEEP_ALIVE if device == "cpu" else "5m"
results = []
cached = 0
used_model = False
for raw in texts:
text = str(raw or "")[:_MAX_TEXT_LEN]
if not text.strip():
results.append(text)
result = []
parts = re.split(r"(\n+)", text)
buf, buf_brk = "", ""
for k in range(0, len(parts), 2):
line = parts[k]
brk = parts[k + 1] if k + 1 < len(parts) else ""
if len(line) > _CHUNK_LEN:
if buf:
result.append((buf, buf_brk))
buf, buf_brk = "", ""
cur = ""
for sent in (x for x in _SENTENCE_END.split(line) if x):
if len(sent) > _CHUNK_LEN:
raise ValueError(
f"a sentence is longer than {_CHUNK_LEN} characters; add line breaks to split it")
if cur and len(cur) + len(sent) > _CHUNK_LEN:
result.append((cur, " "))
cur = ""
cur += sent
if cur:
result.append((cur, brk))
continue
key = (model, src, text)
if buf and len(buf) + len(buf_brk) + len(line) > _CHUNK_LEN:
result.append((buf, buf_brk))
buf, buf_brk = "", ""
buf = buf + buf_brk + line if buf else line
buf_brk = brk
if buf or buf_brk:
result.append((buf, buf_brk))
return result
def _check_total(texts):
total = sum(len(str(t or "")) for t in texts)
if total > _MAX_TOTAL_LEN:
raise ValueError(f"text is too long ({total} characters, limit {_MAX_TOTAL_LEN})")
class _Session:
"""One translation request: resolved settings, cache lookups, chunking, and the
VRAM unload (GPU mode) after the last model call."""
def __init__(self, model=None, source_lang=None, target_lang="en"):
cfg = get_config()
self.cfg = cfg
self.base_url = require_backend_url(cfg["prompt_translate_url"])
self.model = (model or cfg["prompt_translate_model"]).strip()
src = source_lang if source_lang is not None else cfg["prompt_translate_source_lang"]
self.src = normalize_lang(src, allow_auto=True, field="source language")
self.tgt = normalize_lang(target_lang or "en", field="target language")
self.device = "cpu" if cfg.get("prompt_translate_device") == "cpu" else "gpu"
self.keep_alive = CPU_KEEP_ALIVE if self.device == "cpu" else "5m"
self.cached = 0
self.used_model = False
def _one(self, text):
key = (self.model, self.src, self.tgt, text)
with _cache_lock:
hit = _cache.get(key)
if hit is not None:
_cache.move_to_end(key)
if hit is not None:
results.append(hit)
cached += 1
continue
out = _translate_one(base_url, model, text, src, keep_alive, device)
used_model = True
self.cached += 1
return hit
out = _translate_one(self.base_url, self.model, text, self.src, self.keep_alive,
self.device, self.tgt)
self.used_model = True
with _cache_lock:
_cache[key] = out
_cache.move_to_end(key)
while len(_cache) > _CACHE_MAX:
_cache.popitem(last=False)
results.append(out)
return out
if used_model and device == "gpu" and cfg.get("prompt_translate_unload", True):
# Free VRAM for the image model that usually runs right after.
unload(base_url, model)
return results, cached
def translate(self, text):
"""Translate one string; whitespace-only strings are returned unchanged."""
text = str(text or "")
if not text.strip():
return text
if len(text) <= _CHUNK_LEN:
return self._one(text)
sentence_sep = "" if self.tgt in _NO_SPACE_LANGS else " "
out = []
for chunk, sep in _chunks(text):
out.append(self._one(chunk) if chunk.strip() else chunk)
out.append(sentence_sep if sep == " " else sep)
return "".join(out)
def finish(self):
if self.used_model and self.device == "gpu" and self.cfg.get("prompt_translate_unload", True):
# Free VRAM for the image model that usually runs right after.
unload(self.base_url, self.model)
def warmup():
def _check_texts(texts):
if not isinstance(texts, list) or len(texts) > _MAX_TEXTS:
raise ValueError(f"texts must be a list of at most {_MAX_TEXTS} strings")
_check_total(texts)
def translate_texts(texts, model=None, source_lang=None, target_lang="en"):
"""Translate each string in ``texts`` as a whole (no prompt-syntax handling).
Blocking (run in a thread). Returns (translations, cached_count). Identical inputs
are served from a bounded cache keyed by (model, source_lang, target_lang, text).
"""
_check_texts(texts)
sess = _Session(model, source_lang, target_lang)
try:
return [sess.translate(t) for t in texts], sess.cached
finally:
sess.finish()
# ------------------------------------------------------------
# Prompt-aware translation
# ------------------------------------------------------------
# Spans that are never translated: prompt syntax and delimiters.
_PROTECTED_RE = re.compile(
r"(?<![A-Za-z0-9_])(?:BREAK|AND)(?![A-Za-z0-9_])"
r"|<[^<>\n]*>"
r"|__[^\s_]\S*?__"
r"|embedding:[^\s,()\[\]{}|]+"
r"|:\s*-?\d+(?:\.\d+)?"
r"|[,\n()\[\]{}|]"
)
# Text meant to be drawn in the image: 「」 『』 “” "" (one line, no nesting).
_QUOTE_RE = re.compile(r'「[^「」\n]*」|『[^『』\n]*』|“[^“”\n]*”|"[^"\n]*"')
# Placeholder for a quoted span while the prompt is split (private-use characters,
# which contain no delimiter and are not letters).
_PH_RE = re.compile("(\\d+)")
_PH_SPLIT_RE = re.compile("(\\d+)")
_TOKEN_RE = re.compile(r"QT(\d+)(?!\d)")
def needs_translation(text):
"""True when ``text`` contains a non-ASCII letter (CJK, Cyrillic, accented Latin, ...)."""
return any(ord(c) > 127 and c.isalpha() for c in text or "")
def split_prompt(text):
"""Split a prompt into [{"text", "translate"}]; joining every "text" gives back the input."""
pieces = []
last = 0
for m in _PROTECTED_RE.finditer(text):
if m.start() > last:
pieces.append((text[last:m.start()], False))
pieces.append((m.group(0), True))
last = m.end()
if last < len(text):
pieces.append((text[last:], False))
return [{"text": t, "translate": (not keep) and needs_translation(t)} for t, keep in pieces]
def _rebuild(source, translated):
"""Keep the surrounding whitespace of a piece and tidy the model output for prompt use."""
core = source.strip()
lead = source[:len(source) - len(source.lstrip())]
trail = source[len(source.rstrip()):]
out = re.sub(r"\s*\n+\s*", " ", translated or "").strip()
# A tag such as "赤いドレス" should not become "Red dress." — drop the final period
# unless the source itself was a full sentence.
if not re.search(r"[。..!?!?]$", core):
out = re.sub(r"[.。]+$", "", out)
# "少女、(" -> "girl, (" rather than "girl,(": an English comma needs a space after it.
if not trail and re.search(r"[,;:]$", out):
out += " "
return lead + out + trail
class _Quotes:
"""Swap quoted spans for placeholders so prompt splitting never cuts inside them."""
def __init__(self, text, enabled):
self.items = []
if not enabled:
self.text = text
return
def sub(m):
self.items.append(m.group(0))
return f"{len(self.items) - 1}"
self.text = _QUOTE_RE.sub(sub, text)
def restore(self, s):
return _PH_RE.sub(lambda m: self.items[int(m.group(1))], s) if self.items else s
def _translate_piece(sess, quotes, core):
"""Translate one prompt piece; quoted spans inside it go to the model as tokens."""
ids = [int(x) for x in _PH_RE.findall(core)]
if not ids:
return sess.translate(core)
# Send the sentence whole with each quote's content replaced by a token (『QT0』) so
# the words around it are translated naturally, then put the original content back.
def to_token(m):
q = quotes.items[int(m.group(1))]
return f"{q[0]}QT{m.group(1)}{q[-1]}"
out = sess.translate(_PH_RE.sub(to_token, core))
found = [int(x) for x in _TOKEN_RE.findall(out)]
if sorted(found) == sorted(ids):
return _TOKEN_RE.sub(lambda m: quotes.items[int(m.group(1))][1:-1], out)
# The model dropped or repeated a token: translate the text around each quote on its
# own and keep the quotes exactly as written.
res = []
for part in _PH_SPLIT_RE.split(core):
if _PH_RE.fullmatch(part):
res.append(quotes.restore(part))
elif needs_translation(part):
res.append(_rebuild(part, sess.translate(part.strip())))
else:
res.append(part)
return "".join(res)
def translate_prompt_texts(texts, model=None, source_lang=None, target_lang="en", protect_quotes=False):
"""Translate prompts, keeping prompt syntax (and with ``protect_quotes`` the text
inside 「」『』“”""). Blocking. Returns (translations, cached_count)."""
_check_texts(texts)
sess = _Session(model, source_lang, target_lang)
try:
results = []
for raw in texts:
text = str(raw or "")
if not needs_translation(text):
results.append(text)
continue
quotes = _Quotes(text, protect_quotes)
out = []
for p in split_prompt(quotes.text):
if not p["translate"] or not needs_translation(_PH_RE.sub("", p["text"])):
out.append(quotes.restore(p["text"]))
continue
translated = _translate_piece(sess, quotes, p["text"].strip())
out.append(_rebuild(p["text"], translated))
results.append("".join(out))
return results, sess.cached
finally:
sess.finish()
def warmup(ignore_enabled=False):
"""Load the translation model ahead of the first translation (CPU mode).
In CPU mode the model is kept resident, so loading it once in the background
when GenerateUI opens hides Ollama's ~4 s startup from the first translation.
Returns False when there is nothing to do.
``ignore_enabled`` is for other front-ends (Comic Creator) that keep their own
on/off switch. Returns False when there is nothing to do.
"""
cfg = get_config()
if not cfg.get("prompt_translate_enabled") or cfg.get("prompt_translate_device") != "cpu":
if cfg.get("prompt_translate_device") != "cpu":
return False
if not ignore_enabled and not cfg.get("prompt_translate_enabled"):
return False
base_url = require_backend_url(cfg["prompt_translate_url"])
model = cfg["prompt_translate_model"]
+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.9.9"
version = "0.10.2"
license = { file = "LICENSE" }
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+58
View File
@@ -0,0 +1,58 @@
/* Game タブ (実験的機能・ComfyUI-WFS-Games が必要) */
#wfm-tab-game.active { overflow: hidden; }
.wfm-game-layout { display: flex; height: 100%; min-height: 0; }
.wfm-game-layout [hidden] { display: none !important; }
.wfm-game-side,
.wfm-game-result { width: 290px; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow: auto; }
.wfm-game-side { border-right: 1px solid var(--wfm-border, #444); }
.wfm-game-result { border-left: 1px solid var(--wfm-border, #444); width: 320px; padding: 0; gap: 0; overflow: hidden; }
/* 右ペインのタブ (結果 / 設定)。タブ本体の見た目は main.css の .wfm-side-tab-nav / .wfm-side-tab-btn */
.wfm-game-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow: auto; }
.wfm-game-section { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--wfm-border, #444); border-radius: var(--wfm-radius, 6px); background: var(--wfm-surface, transparent); }
.wfm-game-section-title { font-size: 12px; font-weight: 600; color: var(--wfm-text-secondary, #aaa); text-transform: uppercase; letter-spacing: 0.04em; }
.wfm-game-list { display: flex; flex-direction: column; gap: 6px; }
.wfm-game-card { display: flex; flex-direction: column; gap: 3px; padding: 8px; text-align: left; border-radius: var(--wfm-radius-sm, 4px); cursor: pointer; color: var(--wfm-text, #ddd); background: var(--wfm-bg-secondary, #222); border: 1px solid var(--wfm-border, #444); }
.wfm-game-card:hover { border-color: var(--wfm-primary, #4a9eff); }
.wfm-game-card.active { border-color: var(--wfm-primary, #4a9eff); box-shadow: 0 0 0 1px var(--wfm-primary, #4a9eff) inset; }
.wfm-game-card img { width: 100%; max-height: 90px; object-fit: cover; border-radius: 3px; }
.wfm-game-card-name { font-weight: 600; font-size: 13px; }
.wfm-game-card-desc { font-size: 11px; color: var(--wfm-text-secondary, #aaa); line-height: 1.4; }
.wfm-game-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.wfm-game-field > span { color: var(--wfm-text-secondary, #aaa); }
.wfm-game-field textarea { width: 100%; resize: vertical; box-sizing: border-box; }
.wfm-game-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.wfm-game-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wfm-game-row select { flex: 1; min-width: 0; }
.wfm-game-note { font-size: 11px; color: var(--wfm-text-secondary, #aaa); line-height: 1.4; }
.wfm-game-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wfm-game-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--wfm-border, #444); }
.wfm-game-current { font-weight: 600; }
.wfm-game-spacer { flex: 1; }
.wfm-game-stage { flex: 1; min-height: 0; position: relative; background: #05060f; overflow: hidden; }
.wfm-game-stage canvas { display: block; }
.wfm-game-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: #94a3b8; }
.wfm-game-result-status { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.wfm-game-result-head { font-size: 20px; font-weight: 700; letter-spacing: 0.05em; }
.wfm-game-result-head.cleared { color: var(--wfm-success, #2ed573); }
.wfm-game-result-head.failed { color: var(--wfm-danger, #ff4757); }
.wfm-game-rewards { display: flex; flex-direction: column; gap: 4px; }
.wfm-game-reward { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; padding: 4px 6px; border-radius: var(--wfm-radius-sm, 4px); background: var(--wfm-bg-secondary, #222); cursor: pointer; }
.wfm-game-reward span { word-break: break-word; }
.wfm-game-reward-src { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; font-size: 10px; line-height: 16px; vertical-align: 1px; color: var(--wfm-text, #ddd); background: var(--wfm-bg-tertiary, #334); }
.wfm-game-progress { height: 6px; border-radius: 3px; overflow: hidden; background: var(--wfm-bg-secondary, #333); }
.wfm-game-progress-bar { height: 100%; width: 0; background: var(--wfm-primary, #4a9eff); transition: width 0.2s; }
.wfm-game-progress-text { font-size: 11px; color: var(--wfm-text-secondary, #aaa); word-break: break-all; min-height: 14px; }
.wfm-game-jobs { display: flex; flex-direction: column; gap: 8px; }
.wfm-game-job { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--wfm-border, #444); border-radius: var(--wfm-radius, 6px); background: var(--wfm-surface, transparent); }
.wfm-game-job-gameover { border-color: var(--wfm-danger, #ff4757); }
.wfm-game-job-gameover .wfm-game-job-title { color: var(--wfm-danger, #ff4757); }
.wfm-game-job-head { display: flex; align-items: baseline; gap: 8px; }
.wfm-game-job-title { flex: 1; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfm-game-job-status { flex: none; font-size: 11px; color: var(--wfm-text-secondary, #aaa); }
.wfm-game-job-status[data-status="done"] { color: var(--wfm-success, #2ed573); }
.wfm-game-job-status[data-status="failed"] { color: var(--wfm-danger, #ff4757); white-space: normal; }
.wfm-game-job-img { width: 100%; border-radius: var(--wfm-radius-sm, 4px); background: #000; }
.wfm-game-job-details summary { cursor: pointer; font-size: 12px; color: var(--wfm-text-secondary, #aaa); }
.wfm-game-job-details[open] { display: flex; flex-direction: column; gap: 6px; }
.wfm-game-job-private { border-color: #f472b6; }
.wfm-game-job-private .wfm-game-job-title { color: #f472b6; }
+4 -1
View File
@@ -112,7 +112,7 @@ function initTabs() {
function applyI18nToHtml() {
// Tab labels
const tabMap = { workflow: "tabWorkflow", nodes: "tabNodes", models: "tabModels", generate: "tabGenerate", prompt: "tabPrompt", gallery: "tabGallery", "image-edit": "tabImageEdit", video: "tabVideo", settings: "tabSettings", help: "tabHelp", ai: "tabAi", tagger: "tabTagger", tagspace: "tabTagSpace" };
const tabMap = { workflow: "tabWorkflow", nodes: "tabNodes", models: "tabModels", generate: "tabGenerate", prompt: "tabPrompt", gallery: "tabGallery", "image-edit": "tabImageEdit", video: "tabVideo", settings: "tabSettings", help: "tabHelp", ai: "tabAi", tagger: "tabTagger", tagspace: "tabTagSpace", game: "tabGame" };
document.querySelectorAll(".wfm-tab").forEach((tab) => {
const key = tabMap[tab.dataset.tab];
if (key) tab.textContent = t(key);
@@ -625,6 +625,7 @@ function applyI18nToHtml() {
"wfm-help-gallery-card-stylecatalog-title": "helpGalleryCardStylecatalog",
"wfm-help-tagger-title": "helpTaggerTitle",
"wfm-help-tagspace-title": "helpTagSpaceTitle", "wfm-help-tagspace-card-overview-title": "helpTagSpaceCardOverview", "wfm-help-tagspace-card-use-title": "helpTagSpaceCardUse", "wfm-help-tagspace-1": "helpTagSpace1", "wfm-help-tagspace-2": "helpTagSpace2", "wfm-help-tagspace-3": "helpTagSpace3", "wfm-help-tagspace-4": "helpTagSpace4", "wfm-help-tagspace-5": "helpTagSpace5", "wfm-help-tagspace-6": "helpTagSpace6", "wfm-help-tagspace-7": "helpTagSpace7", "wfm-help-tagspace-8": "helpTagSpace8", "wfm-help-tagspace-9": "helpTagSpace9", "wfm-help-tagspace-10": "helpTagSpace10",
"wfm-help-game-title": "helpGameTitle", "wfm-help-game-card-overview-title": "helpGameCardOverview", "wfm-help-game-card-gen-title": "helpGameCardGen", "wfm-help-game-1": "helpGame1", "wfm-help-game-2": "helpGame2", "wfm-help-game-3": "helpGame3", "wfm-help-game-4": "helpGame4", "wfm-help-game-5": "helpGame5", "wfm-help-game-6": "helpGame6", "wfm-help-game-7": "helpGame7", "wfm-help-game-8": "helpGame8", "wfm-help-game-9": "helpGame9", "wfm-help-game-10": "helpGame10", "wfm-help-game-11": "helpGame11",
"wfm-help-tagger-1": "helpTagger1", "wfm-help-tagger-2": "helpTagger2",
"wfm-help-tagger-3": "helpTagger3", "wfm-help-tagger-4": "helpTagger4",
"wfm-help-tagger-5": "helpTagger5", "wfm-help-tagger-6": "helpTagger6",
@@ -889,6 +890,7 @@ import { initMetadataTab } from "./metadata-tab.js";
import { initAiTab } from "./ai-tab.js";
import { initTaggerTab } from "./tagger-tab.js";
import { initTagSpaceTab } from "./tagspace-tab.js";
import { initGameTab } from "./game-tab.js";
import { imageEditTab } from "./image-edit-tab.js";
import { initVideoTab } from "./video-tab.js";
@@ -942,6 +944,7 @@ document.addEventListener("DOMContentLoaded", () => {
initAiTab();
initTaggerTab();
initTagSpaceTab();
initGameTab(); // ゲームパック(ComfyUI-WFS-Games)があるときだけタブを表示
imageEditTab.init();
initVideoTab();
+4 -4
View File
@@ -211,9 +211,9 @@ export const comfyUI = {
},
// Generation
async queuePrompt(workflow, extraData = null) {
async queuePrompt(workflow, extraData = null, { quietVram = false } = {}) {
// Settings tab "VRAM Management": unload Ollama models to free VRAM (no-op when off, never throws)
await prepareVramForGeneration();
await prepareVramForGeneration({ quiet: quietVram });
const body = {
prompt: workflow,
client_id: this.clientId,
@@ -349,7 +349,7 @@ export const comfyUI = {
// High-level generate
async generate(workflow, options = {}) {
const { seedMode = "random", seedValue = -1, onProgress, onComplete, onError, timeoutMs } = options;
const { seedMode = "random", seedValue = -1, onProgress, onComplete, onError, timeoutMs, quietVram = false } = options;
this.generating = true;
try {
@@ -379,7 +379,7 @@ export const comfyUI = {
}
// Queue prompt — pass workflow as extra_pnginfo so SaveImage embeds it in PNG metadata
const result = await this.queuePrompt(workflow, { extra_pnginfo: { workflow } });
const result = await this.queuePrompt(workflow, { extra_pnginfo: { workflow } }, { quietVram });
this.currentPromptId = result.prompt_id;
// Track progress
+641
View File
@@ -0,0 +1,641 @@
/**
* Game タブ (実験的機能)
*
* ゲーム本体は別パッケージ ComfyUI-WFS-Games が配信する。
* GET /wfs_games/manifest が応答したときだけタブを表示する (未インストールなら何もしない)。
* ゲームは manifest の entry を動的 import し、mount(container, host) で起動する。
* ゲームが host.finish(result) で返した報酬プロンプトから、WFS がワークフローを組み立てて生成する。
* ゲームは ComfyUI を直接操作しない。
*
* 契約の詳細は ComfyUI-WFS-Games の README を参照。
*/
import { showToast } from "./app.js";
import { t, getLang } from "./i18n.js";
import { escapeHtml, readJsonStorage } from "./util.js";
import { comfyUI } from "./comfyui-client.js";
import { comfyWorkflow } from "./comfyui-workflow.js";
import { _expandWildcardsInWorkflow } from "./generate-tab.js";
const HOST_API_VERSION = 1;
const MANIFEST_URL = "/wfs_games/manifest";
const ENTRY_PREFIX = "/wfs_games/static/";
const LS_SETTINGS = "wfm_game_settings";
const DEFAULT_SETTINGS = {
gameId: "",
difficulty: "normal",
sound: true,
bgm: true,
workflow: "ws_game_sdxl_t2i.json",
// 画風・キャラ・シーンはゲームが報酬プロンプトとして渡すので、ここは品質タグだけ
basePrompt: "masterpiece, best quality",
negativePrompt: "",
generateEachStage: true, // ステージクリアごとに画像を生成する
autoGenerateEnding: true, // 全クリア時のエンディング画像も自動で生成する
autoGenerateGameover: true, // ゲームオーバー時の敗北画像も自動で生成する
};
const state = {
manifest: null,
opened: false,
handle: null, // mount() の戻り値
mountToken: 0,
jobs: [], // 画像1枚ごとのカード { id, kind, title, result, selected, el, status, apiWf, imageUrl }
jobSeq: 0,
queue: Promise.resolve(), // 生成は1枚ずつ順番に行う
};
const $ = (id) => document.getElementById(id);
// ---------------------------------------------------------------------------
// settings
// ---------------------------------------------------------------------------
// 以前の既定値。保存値がこれと同じなら新しい既定値に置き換える(ユーザーが編集した値は残す)
const OLD_DEFAULT_BASE_PROMPTS = ["masterpiece, best quality, outer space scenery"];
function loadSettings() {
const s = { ...DEFAULT_SETTINGS, ...readJsonStorage(LS_SETTINGS, {}) };
if (OLD_DEFAULT_BASE_PROMPTS.includes(s.basePrompt)) s.basePrompt = DEFAULT_SETTINGS.basePrompt;
return s;
}
function saveSettings(patch) {
const next = { ...loadSettings(), ...patch };
try { localStorage.setItem(LS_SETTINGS, JSON.stringify(next)); } catch { /* storage unavailable */ }
return next;
}
// ---------------------------------------------------------------------------
// detection
// ---------------------------------------------------------------------------
function isSafeGamePath(p) {
return typeof p === "string" && p.startsWith(ENTRY_PREFIX) && !p.includes("..") && !p.includes("//", 1) && !/[\\?#]/.test(p);
}
async function fetchManifest() {
const ctrl = new AbortController();
const timer = setTimeout(() => ctrl.abort(), 5000);
try {
const res = await fetch(MANIFEST_URL, { signal: ctrl.signal, cache: "no-store" });
if (!res.ok) return null;
const data = await res.json();
if (data?.api_version !== HOST_API_VERSION) {
console.warn(`[WFS Game] unsupported game pack api_version: ${data?.api_version} (expected ${HOST_API_VERSION})`);
return null;
}
const games = (Array.isArray(data.games) ? data.games : []).filter((g) => g && typeof g.id === "string" && isSafeGamePath(g.entry));
if (!games.length) return null;
games.forEach((g) => { if (g.thumbnail && !isSafeGamePath(g.thumbnail)) delete g.thumbnail; });
return { ...data, games };
} catch {
return null; // 未インストール (404) / 接続不可
} finally {
clearTimeout(timer);
}
}
function localized(obj, fallback = "") {
if (!obj) return fallback;
if (typeof obj === "string") return obj;
return obj[getLang()] || obj.en || Object.values(obj)[0] || fallback;
}
function currentGame() {
const s = loadSettings();
const games = state.manifest?.games || [];
return games.find((g) => g.id === s.gameId) || games[0] || null;
}
// ---------------------------------------------------------------------------
// shell
// ---------------------------------------------------------------------------
function renderShell() {
const root = $("wfm-tab-game");
const s = loadSettings();
const games = state.manifest.games;
// 左ペイン: ゲーム選択のみ / 中央: ゲーム / 右ペイン: タブ (結果 / 設定 = プレイ設定 + 画像生成設定)
root.innerHTML = `
<div class="wfm-game-layout">
<aside class="wfm-game-side">
<div class="wfm-game-section">
<div class="wfm-game-section-title">${escapeHtml(t("gameListTitle"))}</div>
<div class="wfm-game-list" id="wfm-game-list">
${games.map((g) => `
<button type="button" class="wfm-game-card" data-game-id="${escapeHtml(g.id)}">
${g.thumbnail ? `<img src="${escapeHtml(g.thumbnail)}" alt="">` : ""}
<span class="wfm-game-card-name">${escapeHtml(localized(g.name, g.id))}</span>
<span class="wfm-game-card-desc">${escapeHtml(localized(g.description))}</span>
</button>`).join("")}
</div>
</div>
</aside>
<section class="wfm-game-main">
<div class="wfm-game-toolbar">
<span class="wfm-game-current" id="wfm-game-current"></span>
<span class="wfm-game-spacer"></span>
<button type="button" id="wfm-game-restart" class="wfm-btn wfm-btn-sm">${escapeHtml(t("gameRestart"))}</button>
</div>
<div class="wfm-game-stage" id="wfm-game-stage"></div>
</section>
<aside class="wfm-game-result" id="wfm-game-result">
<div class="wfm-side-tab-nav" id="wfm-game-pane-nav">
<button type="button" class="wfm-side-tab-btn active" data-game-pane="result">${escapeHtml(t("gameResultTitle"))}</button>
<button type="button" class="wfm-side-tab-btn" data-game-pane="settings">${escapeHtml(t("gameSettingsTab"))}</button>
</div>
<div class="wfm-game-pane" data-game-pane="result">
<div class="wfm-game-result-status" id="wfm-game-result-status">${escapeHtml(t("gameResultEmpty"))}</div>
<div class="wfm-game-row" id="wfm-game-end-row" hidden>
<button type="button" id="wfm-game-play-again" class="wfm-btn wfm-btn-sm">${escapeHtml(t("gamePlayAgain"))}</button>
</div>
<div class="wfm-game-jobs" id="wfm-game-jobs"></div>
</div>
<div class="wfm-game-pane" data-game-pane="settings" hidden>
<div class="wfm-game-section">
<div class="wfm-game-section-title">${escapeHtml(t("gamePlaySettings"))}</div>
<label class="wfm-game-field">
<span>${escapeHtml(t("gameDifficulty"))}</span>
<select id="wfm-game-difficulty" class="wfm-select">
<option value="easy">${escapeHtml(t("gameDifficultyEasy"))}</option>
<option value="normal">${escapeHtml(t("gameDifficultyNormal"))}</option>
<option value="hard">${escapeHtml(t("gameDifficultyHard"))}</option>
</select>
</label>
<label class="wfm-game-check"><input type="checkbox" id="wfm-game-bgm"> ${escapeHtml(t("gameBgm"))}</label>
<label class="wfm-game-check"><input type="checkbox" id="wfm-game-sound"> ${escapeHtml(t("gameSound"))}</label>
<div class="wfm-game-note">${escapeHtml(t("gamePlaySettingsNote"))}</div>
</div>
<div class="wfm-game-section">
<div class="wfm-game-section-title">${escapeHtml(t("gameGenSettings"))}</div>
<label class="wfm-game-field">
<span>${escapeHtml(t("gameWorkflow"))}</span>
<div class="wfm-game-row">
<select id="wfm-game-workflow" class="wfm-select"></select>
<button type="button" id="wfm-game-workflow-reload" class="wfm-btn wfm-btn-sm" title="${escapeHtml(t("gameWorkflowReload"))}">&#x21bb;</button>
</div>
</label>
<label class="wfm-game-field">
<span>${escapeHtml(t("gameBasePrompt"))}</span>
<textarea id="wfm-game-base-prompt" class="wfm-textarea" rows="3"></textarea>
</label>
<label class="wfm-game-field">
<span>${escapeHtml(t("gameNegativePrompt"))}</span>
<textarea id="wfm-game-negative-prompt" class="wfm-textarea" rows="2" placeholder="${escapeHtml(t("gameNegativePlaceholder"))}"></textarea>
</label>
<label class="wfm-game-check"><input type="checkbox" id="wfm-game-each-stage"> ${escapeHtml(t("gameEachStage"))}</label>
<label class="wfm-game-check"><input type="checkbox" id="wfm-game-auto-generate"> ${escapeHtml(t("gameAutoGenerate"))}</label>
<label class="wfm-game-check"><input type="checkbox" id="wfm-game-auto-gameover"> ${escapeHtml(t("gameAutoGameover"))}</label>
</div>
</div>
</aside>
</div>`;
$("wfm-game-difficulty").value = s.difficulty;
$("wfm-game-sound").checked = s.sound !== false;
$("wfm-game-bgm").checked = s.bgm !== false;
$("wfm-game-base-prompt").value = s.basePrompt;
$("wfm-game-negative-prompt").value = s.negativePrompt;
$("wfm-game-each-stage").checked = s.generateEachStage !== false;
$("wfm-game-auto-generate").checked = s.autoGenerateEnding !== false;
$("wfm-game-auto-gameover").checked = s.autoGenerateGameover !== false;
markSelectedGame();
}
function markSelectedGame() {
const g = currentGame();
document.querySelectorAll("#wfm-game-list .wfm-game-card").forEach((el) => {
el.classList.toggle("active", el.dataset.gameId === g?.id);
});
const cur = $("wfm-game-current");
if (cur) cur.textContent = g ? localized(g.name, g.id) : "";
}
async function loadWorkflowOptions() {
const sel = $("wfm-game-workflow");
if (!sel) return;
const s = loadSettings();
// 一覧の取得(全ワークフローの解析)は時間がかかるので、先に保存済みの選択だけ表示しておく
if (!sel.options.length && s.workflow) {
sel.innerHTML = `<option value="${escapeHtml(s.workflow)}">${escapeHtml(s.workflow)}</option>`;
sel.value = s.workflow;
}
let names = [];
try {
const res = await fetch("/api/wfm/workflows");
const list = await res.json();
names = (Array.isArray(list) ? list : [])
.filter((w) => ["api", "ui"].includes(w.analysis?.format) && (w.analysis?.inputs?.prompts ?? 1) > 0)
.map((w) => w.filename);
} catch { /* keep empty */ }
if (s.workflow && !names.includes(s.workflow)) names.unshift(s.workflow);
sel.innerHTML = names.map((n) => `<option value="${escapeHtml(n)}">${escapeHtml(n)}</option>`).join("");
sel.value = s.workflow;
}
// 右ペインのタブ (結果 / 設定)
function showPane(name) {
document.querySelectorAll("#wfm-game-pane-nav .wfm-side-tab-btn").forEach((b) => b.classList.toggle("active", b.dataset.gamePane === name));
document.querySelectorAll("#wfm-game-result .wfm-game-pane").forEach((p) => { p.hidden = p.dataset.gamePane !== name; });
}
function bindShell() {
$("wfm-game-pane-nav").addEventListener("click", (e) => {
const btn = e.target.closest("[data-game-pane]");
if (btn) showPane(btn.dataset.gamePane);
});
$("wfm-game-list").addEventListener("click", (e) => {
const card = e.target.closest(".wfm-game-card");
if (!card) return;
if (card.dataset.gameId === currentGame()?.id && state.handle) { state.handle.focus?.(); return; }
saveSettings({ gameId: card.dataset.gameId });
markSelectedGame();
mountCurrentGame();
});
// プレイ設定はゲーム起動時に渡すので、変更したら再起動して反映する
$("wfm-game-difficulty").addEventListener("change", (e) => { saveSettings({ difficulty: e.target.value }); mountCurrentGame(); });
$("wfm-game-sound").addEventListener("change", (e) => { saveSettings({ sound: e.target.checked }); mountCurrentGame(); });
$("wfm-game-bgm").addEventListener("change", (e) => { saveSettings({ bgm: e.target.checked }); mountCurrentGame(); });
$("wfm-game-workflow").addEventListener("change", (e) => saveSettings({ workflow: e.target.value }));
$("wfm-game-workflow-reload").addEventListener("click", loadWorkflowOptions);
$("wfm-game-base-prompt").addEventListener("change", (e) => {
saveSettings({ basePrompt: e.target.value });
state.jobs.forEach((job) => { if (job.status === "idle" || job.status === "queued") refreshJobPrompt(job); });
});
$("wfm-game-negative-prompt").addEventListener("change", (e) => saveSettings({ negativePrompt: e.target.value }));
$("wfm-game-each-stage").addEventListener("change", (e) => saveSettings({ generateEachStage: e.target.checked }));
$("wfm-game-auto-generate").addEventListener("change", (e) => saveSettings({ autoGenerateEnding: e.target.checked }));
$("wfm-game-auto-gameover").addEventListener("change", (e) => saveSettings({ autoGenerateGameover: e.target.checked }));
$("wfm-game-restart").addEventListener("click", restartGame);
$("wfm-game-play-again").addEventListener("click", restartGame);
const jobs = $("wfm-game-jobs");
jobs.addEventListener("change", (e) => {
const cb = e.target.closest("input[data-reward-idx]");
const job = jobOf(e.target);
if (!cb || !job) return;
const idx = Number(cb.dataset.rewardIdx);
if (cb.checked) job.selected.add(idx); else job.selected.delete(idx);
refreshJobPrompt(job);
});
jobs.addEventListener("click", (e) => {
const btn = e.target.closest("button[data-act]");
const job = jobOf(e.target);
if (!btn || !job) return;
if (btn.dataset.act === "generate") enqueueJob(job);
else if (btn.dataset.act === "open") openInGenerateUI(job);
});
}
// ---------------------------------------------------------------------------
// game lifecycle
// ---------------------------------------------------------------------------
function unmountGame() {
if (state.handle) {
try { state.handle.unmount?.(); } catch (e) { console.error("[WFS Game] unmount failed", e); }
state.handle = null;
}
}
function resetResult() {
// 生成中・待機中のジョブはそのまま続く(カードだけ消える)。画像は出力フォルダに残る
state.jobs.forEach((job) => { job.removed = true; if (job.imageUrl) URL.revokeObjectURL(job.imageUrl); });
state.jobs = [];
const jobs = $("wfm-game-jobs");
if (jobs) jobs.innerHTML = "";
const st = $("wfm-game-result-status");
if (st) st.textContent = t("gameResultEmpty");
const end = $("wfm-game-end-row");
if (end) end.hidden = true;
}
async function mountCurrentGame() {
const game = currentGame();
const stage = $("wfm-game-stage");
if (!game || !stage) return;
const token = ++state.mountToken;
unmountGame();
resetResult();
stage.innerHTML = `<div class="wfm-game-loading">${escapeHtml(t("gameLoading"))}</div>`;
try {
// ゲームパック更新後に古いモジュールがキャッシュから読まれないよう、バージョンを付ける
const ver = encodeURIComponent(game.version || state.manifest.package_version || "0");
const mod = await import(`${game.entry}?v=${ver}`);
if (token !== state.mountToken) return; // 読み込み中に別ゲームへ切り替わった
if (typeof mod.mount !== "function") throw new Error("mount() not found");
const s = loadSettings();
const host = {
apiVersion: HOST_API_VERSION,
lang: getLang(),
settings: { difficulty: s.difficulty, sound: s.sound !== false, bgm: s.bgm !== false },
runStart: () => { if (token === state.mountToken) resetResult(); },
stageClear: (result) => { if (token === state.mountToken) onStageClear(result); },
finish: (result) => { if (token === state.mountToken) onGameFinished(result); },
};
const handle = await mod.mount(stage, host);
if (token !== state.mountToken) { try { handle?.unmount?.(); } catch { /* ignore */ } return; }
state.handle = handle || null;
if (!isGameTabActive()) state.handle?.pause?.();
} catch (e) {
console.error("[WFS Game] failed to load game", e);
stage.innerHTML = `<div class="wfm-game-loading">${escapeHtml(t("gameLoadFailed", e.message))}</div>`;
}
}
function restartGame() {
resetResult();
if (state.handle?.restart) state.handle.restart();
else mountCurrentGame();
}
function isGameTabActive() {
return $("wfm-tab-game")?.classList.contains("active");
}
// ---------------------------------------------------------------------------
// result & generation
// ---------------------------------------------------------------------------
function sanitizeResult(raw) {
const r = raw && typeof raw === "object" ? raw : {};
const rewards = (Array.isArray(r.rewards) ? r.rewards : [])
.filter((x) => x && x.type === "prompt" && typeof x.text === "string" && x.text.trim())
.slice(0, 50)
.map((x) => ({
text: x.text.trim().slice(0, 500),
weight: Number.isFinite(Number(x.weight)) ? Number(x.weight) : 1,
source: typeof x.source === "string" ? x.source : "clear",
}));
const kind = ["stage", "ending", "gameover"].includes(r.kind) ? r.kind : (r.cleared ? "ending" : "gameover");
const num = (v) => (Number.isFinite(Number(v)) ? Number(v) : 0);
return {
kind,
bonus: !!r.bonus, // アイテムを全部取ったステージ(プライベート写真)
negative: typeof r.negative === "string" ? r.negative.trim().slice(0, 500) : "",
cleared: !!r.cleared,
score: num(r.score),
stage: num(r.stage),
stagesTotal: num(r.stagesTotal),
stageName: typeof r.stageName === "string" ? r.stageName.slice(0, 100) : "",
rewards,
};
}
function onStageClear(raw) {
const result = sanitizeResult(raw);
const job = result.bonus
? addJob(result, t("gameJobStagePrivate", result.stage, result.stageName), "private")
: addJob(result, t("gameJobStage", result.stage, result.stageName));
if (loadSettings().generateEachStage !== false) enqueueJob(job);
}
function onGameFinished(raw) {
const result = sanitizeResult(raw);
const cleared = result.kind === "ending";
$("wfm-game-result-status").innerHTML = `
<div class="wfm-game-result-head ${cleared ? "cleared" : "failed"}">${escapeHtml(cleared ? t("gameCleared") : t("gameOverLabel"))}</div>
<div>${escapeHtml(t("gameScore", result.score))}</div>`;
$("wfm-game-end-row").hidden = false;
const s = loadSettings();
if (cleared) {
const job = addJob(result, t("gameJobEnding"));
if (s.autoGenerateEnding !== false) enqueueJob(job);
} else if (result.rewards.length) {
// ゲームオーバー: 負けたステージを背景にした敗北の場面(クリア済みステージの画像は残る)
const job = addJob(result, t("gameJobGameover", result.stage, result.stageName), "gameover");
if (s.autoGenerateGameover !== false) enqueueJob(job);
}
}
// ---- image cards ----
function jobOf(el) {
const card = el.closest?.(".wfm-game-job");
return card ? state.jobs.find((j) => String(j.id) === card.dataset.jobId) : null;
}
function addJob(result, title, variant = "") {
const job = {
id: ++state.jobSeq, kind: result.kind, title, result,
selected: new Set(result.rewards.map((_, i) => i)),
status: "idle", apiWf: null, imageUrl: null, el: null,
};
const el = document.createElement("div");
el.className = variant ? `wfm-game-job wfm-game-job-${variant}` : "wfm-game-job";
el.dataset.jobId = String(job.id);
el.innerHTML = `
<div class="wfm-game-job-head">
<span class="wfm-game-job-title">${escapeHtml(title)}</span>
<span class="wfm-game-job-status" data-role="status"></span>
</div>
<div class="wfm-game-progress" data-role="progress" hidden><div class="wfm-game-progress-bar" data-role="bar"></div></div>
<img class="wfm-game-job-img" data-role="img" alt="" hidden>
<details class="wfm-game-job-details">
<summary>${escapeHtml(t("gamePromptDetails"))}</summary>
<div class="wfm-game-rewards">
${result.rewards.map((r, i) => `
<label class="wfm-game-reward">
<input type="checkbox" data-reward-idx="${i}" checked>
<span><span class="wfm-game-reward-src">${escapeHtml(sourceLabel(r.source))}</span>${escapeHtml(r.text)}</span>
</label>`).join("")}
${result.negative ? `<div class="wfm-game-note">${escapeHtml(t("gameNegativeFromGame"))}: ${escapeHtml(result.negative)}</div>` : ""}
</div>
<label class="wfm-game-field">
<span>${escapeHtml(t("gameFinalPrompt"))}</span>
<textarea class="wfm-textarea" data-role="prompt" rows="4"></textarea>
</label>
</details>
<div class="wfm-game-row">
<button type="button" class="wfm-btn wfm-btn-sm wfm-btn-primary" data-act="generate">${escapeHtml(t("gameGenerate"))}</button>
<button type="button" class="wfm-btn wfm-btn-sm" data-act="open" hidden>${escapeHtml(t("gameOpenInGenerateUI"))}</button>
</div>`;
job.el = el;
state.jobs.push(job);
$("wfm-game-jobs")?.prepend(el); // 新しいものを上に
showPane("result"); // 設定タブを開いていても、新しい画像カードが見えるようにする
refreshJobPrompt(job);
setJobStatus(job, "idle");
return job;
}
const part = (job, role) => job.el.querySelector(`[data-role="${role}"]`);
function setJobStatus(job, status, text = "") {
job.status = status;
const label = { idle: "", queued: t("gameJobQueued"), running: t("gameGenerating"), done: t("gameJobDone"), failed: t("gameGenerateFailed", "") }[status] ?? "";
const st = part(job, "status");
st.textContent = text || label;
st.dataset.status = status;
part(job, "progress").hidden = status !== "running";
const gen = job.el.querySelector('button[data-act="generate"]');
gen.disabled = status === "queued" || status === "running";
gen.textContent = job.imageUrl || status === "failed" ? t("gameRegenerate") : t("gameGenerate");
}
function buildPrompt(job) {
const s = loadSettings();
const parts = [];
const seen = new Set();
const push = (txt) => {
const v = (txt || "").trim();
if (!v) return;
const key = v.toLowerCase().replace(/\s+/g, " ");
if (seen.has(key)) return;
seen.add(key);
parts.push(v);
};
push(s.basePrompt);
job.result.rewards.forEach((r, i) => { if (job.selected.has(i)) push(formatReward(r)); });
return parts.join(", ");
}
function refreshJobPrompt(job) {
part(job, "prompt").value = buildPrompt(job);
}
function enqueueJob(job) {
if (job.status === "queued" || job.status === "running") return;
setJobStatus(job, "queued");
state.queue = state.queue.then(() => runJob(job)).catch(() => {});
}
async function runJob(job) {
if (job.removed) return;
const prompt = (part(job, "prompt").value || buildPrompt(job)).trim();
if (!prompt) { setJobStatus(job, "failed", t("gameEmptyPrompt")); return; }
setJobStatus(job, "running");
const bar = part(job, "bar");
bar.style.width = "0%";
try {
const wf = await buildWorkflow(prompt, job.result.negative);
job.apiWf = wf;
const expanded = await _expandWildcardsInWorkflow(wf);
const { images } = await comfyUI.generate(expanded, {
seedMode: "random",
quietVram: true, // VRAM 調整のトーストでゲーム画面を隠さない
onProgress: (pct) => {
bar.style.width = `${(pct * 100).toFixed(1)}%`;
part(job, "status").textContent = `${t("gameGenerating")} ${(pct * 100).toFixed(0)}%`;
},
});
const img = images.filter((x) => x.type !== "temp")[0] || images[0];
if (!img) throw new Error(t("gameNoImage"));
const blob = await comfyUI.getImageBlob(img);
if (job.imageUrl) URL.revokeObjectURL(job.imageUrl);
job.imageUrl = URL.createObjectURL(blob);
if (job.removed) { URL.revokeObjectURL(job.imageUrl); return; }
const el = part(job, "img");
el.src = job.imageUrl;
el.title = t("gameGenerated", [img.subfolder, img.filename].filter(Boolean).join("/"));
el.hidden = false;
job.el.querySelector('button[data-act="open"]').hidden = false;
setJobStatus(job, "done");
} catch (e) {
console.error("[WFS Game] generation failed", e);
if (!job.removed) {
setJobStatus(job, "failed", t("gameGenerateFailed", e.message));
showToast(t("gameGenerateFailed", e.message), "error");
}
}
}
function sourceLabel(src) {
const key = { style: "gameSrcStyle", character: "gameSrcCharacter", scene: "gameSrcScene", clear: "gameSrcClear", enemy: "gameSrcEnemy", bonus: "gameSrcBonus" }[src];
return key ? t(key) : src;
}
function joinUnique(...parts) {
const seen = new Set();
const out = [];
for (const p of parts) {
for (const tag of (p || "").split(",")) {
const v = tag.trim();
const k = v.toLowerCase();
if (v && !seen.has(k)) { seen.add(k); out.push(v); }
}
}
return out.join(", ");
}
function formatReward(r) {
return r.weight !== 1 ? `(${r.text}:${r.weight})` : r.text;
}
async function buildWorkflow(prompt, gameNegative) {
const s = loadSettings();
if (!s.workflow) throw new Error(t("gameNoWorkflow"));
const res = await fetch(`/api/wfm/workflows/raw?filename=${encodeURIComponent(s.workflow)}`);
if (!res.ok) throw new Error(t("gameWorkflowLoadFailed", s.workflow));
const raw = await res.json();
const format = comfyWorkflow.detectFormat(raw, s.workflow);
let wf;
if (format === "ui") wf = await comfyWorkflow.convertUiToApi(raw);
else if (format === "api") wf = structuredClone(raw);
else throw new Error(t("unknownWorkflowFormat"));
const analysis = comfyWorkflow.analyzeWorkflow(wf);
const pos = analysis.prompt_nodes?.find((n) => n.role === "positive");
const neg = analysis.prompt_nodes?.find((n) => n.role === "negative");
if (!pos || !wf[pos.id]) throw new Error(t("gameNoPositiveNode"));
wf[pos.id].inputs[pos.textKey || "text"] = prompt;
if (neg && wf[neg.id]) {
// 設定のネガティブ(空ならワークフロー自身のもの)に、ゲームが渡したネガティブを足す
const key = neg.textKey || "text";
const base = s.negativePrompt.trim() || (typeof wf[neg.id].inputs[key] === "string" ? wf[neg.id].inputs[key] : "");
wf[neg.id].inputs[key] = joinUnique(base, gameNegative);
}
return wf;
}
async function openInGenerateUI(job) {
if (!job?.apiWf) return;
const { loadWorkflowIntoEditor } = await import("./generate-tab.js");
const ok = await loadWorkflowIntoEditor(structuredClone(job.apiWf), loadSettings().workflow);
if (ok !== false) document.querySelector('.wfm-tab[data-tab="generate"]')?.click();
}
// ---------------------------------------------------------------------------
// tab visibility
// ---------------------------------------------------------------------------
function onTabsClicked(e) {
const tab = e.target.closest(".wfm-tab");
if (!tab) return;
if (tab.dataset.tab === "game") {
// app.js の表示切替が終わってから初期化する
setTimeout(onOpen, 0);
} else {
state.handle?.pause?.();
}
}
async function onOpen() {
if (!state.opened) {
state.opened = true;
renderShell();
bindShell();
loadWorkflowOptions();
await mountCurrentGame();
return;
}
state.handle?.resume?.();
}
export async function initGameTab() {
const btn = document.querySelector('.wfm-tab[data-tab="game"]');
if (!btn || !$("wfm-tab-game")) return;
const manifest = await fetchManifest();
if (!manifest) return; // ゲームパック未インストール: タブは hidden のまま
state.manifest = manifest;
btn.hidden = false;
document.querySelector('.wfm-help-nav-item[data-help-page="game"]')?.removeAttribute("hidden");
document.querySelector(".wfm-tabs")?.addEventListener("click", onTabsClicked);
document.addEventListener("visibilitychange", () => {
if (document.hidden) state.handle?.pause?.();
else if (isGameTabActive()) state.handle?.resume?.();
});
// 動作確認用 (DevTools から window._wfmGameTab.handle.debugClear() など)
window._wfmGameTab = state;
}
+258 -21
View File
@@ -753,6 +753,79 @@ const LANGUAGES = {
tabAi: "AI TOOL",
tabTagger: "Tagger",
tabTagSpace: "TagSpace",
// --- Game tab (experimental; needs the ComfyUI-WFS-Games pack) ---
tabGame: "Game",
helpGame9: "Turbo Heart: a 1980s-style behind-the-car racer with a pseudo-3D road. 5 races along the coast (seaside highway, autumn mountain pass, desert canyon at sunset, neon city at night, tropical coast at dawn). 8 cars: you start last and must finish in the top 3 to go on — 4th or worse is game over. Steer with ← →, gas with ↑ or Z, brake with ↓ or X, nitro with Space or C (3 per race), pause with Esc or P; a gamepad also works. Pick up the 5 hearts on the road. Mechanic Misaki talks between races, and the images work the same way as in Star Formation (a victory shot per race, a private photo with all 5 hearts, the ending, a defeat scene). Watch out for obstacles: stacked cardboard boxes (2 per race) block part of the road and hide what's behind — driving through them smashes them and slows you down; an oil slick (1 per race) spins you around twice; and there may be a person crossing the road (0 or 1, random each play) — hitting them ends the game.",
helpGame10: "Prompt Typer: a 1980s-style typing game (no music, sound effects only) whose typing becomes the image prompt. 10 stages of 20 words; the words get longer every 2 stages. What you type goes into the prompt as it is, typos included. Backspace fixes the current word, but a typo still counts as a miss. Type 85% of the characters correctly to clear a stage. An image is generated after every stage whether you clear it or not; after a stage, Enter goes on (or retries a failed stage), R retries and Q gives up. On the title, ↑ ↓ picks the typing language (English, Japanese or Chinese — Japanese and Chinese are typed through your IME into an input box; kanji words show their reading and hiragana / katakana count as the same) and ← → the start stage. Japanese and Chinese prompts need an image model that understands those languages",
helpGame11: "Sky Heart: a 1980s-style into-the-screen flying shooter with a pseudo-3D ground. Hikari of the sky patrol flies a jet pack through 5 stages (flower plains, crystal canyon, sunset sea, neon sky city, moon ruins), each ending with a boss. Your shots fly straight into the screen, so line up with an enemy to hit it; dodge bullets, ground missile launchers and the trees, crystals, rocks, towers and columns on the ground (fly over or around them; the stage 4 buildings break after 4 shots). Move with the arrow keys or WASD, hold Space or Z to shoot, pause with Esc or P; a gamepad also works. The altimeter on the left shows your height and the height of incoming items. Each stage has 5 hearts in the air and 5 near the ground — catch any 5 for the private photo. Power-up capsules come in the air and on the ground: 1UP (green), a barrier that blocks 3 hits (blue) and support mechs that fire with you for 15 seconds (orange). The images work the same way as in Star Formation",
gameJobStagePrivate: (n, name) => `STAGE ${n}${name ? " " + name : ""} - PRIVATE ♥`,
gameAutoGameover: "Also generate an image on game over",
gameJobGameover: (n, name) => `GAME OVER - STAGE ${n}${name ? " " + name : ""}`,
gameEachStage: "Generate an image at each stage clear",
gameJobEnding: "ENDING",
gameJobQueued: "Waiting",
gameJobDone: "Done",
gameRegenerate: "Regenerate",
gamePromptDetails: "Prompt",
gameJobStage: (n, name) => `STAGE ${n}${name ? " " + name : ""}`,
gameBgm: "Music",
gameSrcStyle: "Style",
gameSrcCharacter: "Heroine",
gameSrcScene: "Scene",
gameSrcClear: "Stage",
gameSrcEnemy: "Enemy",
gameSrcBonus: "Bonus",
gameNegativeFromGame: "Negative added by the game",
gameListTitle: "Games",
gamePlaySettings: "Play settings",
gameDifficulty: "Difficulty",
gameDifficultyEasy: "Easy",
gameDifficultyNormal: "Normal",
gameDifficultyHard: "Hard",
gameSound: "Sound effects",
gamePlaySettingsNote: "Changing these restarts the game.",
gameGenSettings: "Image generation",
gameWorkflow: "Workflow",
gameWorkflowReload: "Reload workflow list",
gameBasePrompt: "Base prompt (added before the prompts you earn)",
gameNegativePrompt: "Negative prompt",
gameNegativePlaceholder: "Empty = keep the workflow's negative prompt",
gameAutoGenerate: "Also generate the ending image automatically",
gameRestart: "Restart",
gameResultTitle: "Result",
gameSettingsTab: "Settings",
gameResultEmpty: "Each time you clear a stage, a victory shot of Rina is generated here. Clearing every stage adds the ending image; a game over adds a defeat scene.",
gameFinalPrompt: "Prompt to generate (editable)",
gameGenerate: "Generate",
gameOpenInGenerateUI: "Open in GenerateUI",
gamePlayAgain: "Play again",
gameLoading: "Loading game...",
gameLoadFailed: (msg) => `Failed to load the game: ${msg}`,
gameCleared: "CLEAR!",
gameOverLabel: "GAME OVER",
gameScore: (n) => `Score: ${n}`,
gameOverNoGenerate: "Game over: no ending image is generated. The images of the stages you cleared are kept.",
gameRewardsTitle: "Prompts earned (uncheck to leave out):",
gameNoRewards: "No prompts were earned. Only the base prompt is used.",
gameNoWorkflow: "No workflow is selected in the Game settings.",
gameWorkflowLoadFailed: (name) => `Could not load the workflow: ${name}`,
gameNoPositiveNode: "The workflow has no positive prompt node.",
gameEmptyPrompt: "The prompt is empty.",
gameGenerating: "Generating...",
gameNoImage: "The workflow returned no image.",
gameGenerated: (path) => `Saved: ${path}`,
gameGenerateFailed: (msg) => `Generation failed: ${msg}`,
helpGameTitle: "Game Tab (experimental)",
helpGameCardOverview: "Overview",
helpGameCardGen: "Image Generation",
helpGame1: "The Game tab appears only when the separate game pack ComfyUI-WFS-Games is installed (Workflow Studio checks /wfs_games/manifest on start). Without it, the tab and this help page stay hidden",
helpGame2: "Choose a game in the Games list on the left. The game runs in the center; click it to give it the keyboard (keys pressed there do not reach the rest of Workflow Studio). The game pauses when you switch to another tab or window. The right pane has two tabs: Result (the image cards) and Settings (play settings and image generation settings)",
helpGame3: "Star Formation: a vertical shooter in the style of 1980s arcade and home computer (MSX2 / PC-8801) games — pixel sprites, a pixel font, scanlines and chiptune music. 5 stages. Enemy squadrons fly in, line up, then dive at you. Five enemies in each stage flash yellow: shoot them down and they drop a memory heart — catch it before it falls off the screen (+500 points; the hearts at the top right show how many you have). When all enemies are down, WARNING appears, the music changes and the stage boss arrives (a red HP bar at the top) — each boss behaves differently: big and tough, fast with fast shots, radial bursts, a flashing straight-line ram, and a giant carrier that launches 5 small fighters 3 times. Move with ← → or A D, shoot with Space or Z, pause with Esc or P; a gamepad also works. Before and after each stage, Rina — the navigator guiding you from control — talks in an adventure-game style window (Space, Z, Enter or click to go on). When you lose your last ship, the screen darkens and her desperate call goes unanswered before GAME OVER. Diving enemies are worth double points",
helpGame4: "Play settings: Difficulty (Easy: 5 lives / Normal: 3 / Hard: 2, with fewer or more enemy shots and dives), Music and Sound effects. Changing them restarts the game. The high score is kept in this browser",
helpGame5: "Restart starts the game over from the title screen",
helpGame6: "Each time you clear a stage, a card for that stage is added to the Result panel (newest on top) and a victory shot of Rina (peace sign, waving, thumbs up ...) with that stage in the background is generated while you keep playing (images are made one at a time, in order). If you caught all 5 hearts in the stage, PERFECT! appears and the card (pink) becomes a private photo of Rina instead: off duty, in clothes that show a little more skin with each stage — casual clothes at a café, a sleeveless sundress, an off-shoulder top and shorts, a tank top and denim shorts, and a swimsuit on the beach (the swimsuit is the most; the game adds negative tags to keep it there). Clearing all 5 stages adds the ENDING card. On game over, a GAME OVER card (red) is added with a defeat scene: Rina crying in the dark control room under red warning lights, with the stage where you fell in the background. Open \"Prompt\" on a card to see the prompts the game gave, each marked with its kind: Style (1980s PC graphics), Heroine (Rina's look), Scene and Stage. Uncheck any you don't want or edit the prompt, then press Regenerate",
helpGame7: "Workflow: the workflow used for generation (default ws_game_sdxl_t2i.json, an SDXL (Illustrious) text-to-image workflow made for the Game tab, 1216x832; output goes to output/WFS_Game). The prompt is written into the workflow's positive prompt node. The negative prompt is your Negative prompt setting (or, when empty, the workflow's own) plus the game's negative tags. The seed is random each time",
helpGame8: "\"Generate an image at each stage clear\", \"Also generate the ending image automatically\" and \"Also generate an image on game over\" can be turned off; then press Generate on the card when you want the image. \"Open in GenerateUI\" loads that card's workflow with its prompt into GenerateUI. Starting a new game from the title clears the cards (the images stay in output/WFS_Game). The VRAM Management notices are not shown while the Game tab is open. Settings are kept in the browser and included in backups",
tsBuild: "Build / Update",
tsCancel: "Stop",
tsMaxTags: "Tags:",
@@ -1177,9 +1250,9 @@ const LANGUAGES = {
helpSettings5: "AI Assistant settings have moved out of this tab — the Prompt tab, Tagger tab, and AI TOOL tab each have their own ⚙ Settings button (backend, URL, model, Thinking mode, Max tokens, unload model), saved independently",
helpSettings6: "Default workflow setting",
helpSettings7: "Eagle integration URL and auto-save toggle",
helpSettings8: "Data Management: export core settings, metadata, and prompts to a JSON file, or import to restore. After importing, restart ComfyUI.",
helpSettings15: "Full Backup (ZIP): unlike the JSON export above, also includes folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets) and the Tagger database — everything the JSON export can't represent. Restoring overwrites existing files; restart ComfyUI afterward.",
helpSettings16: "Two opt-in checkboxes above the Full Backup buttons additionally include ComfyUI's default workflows folder and the Impact Pack's wildcard folder in the export — both export-only, never restored automatically; copy the ZIP's _external/ folder back by hand if you want them. A third checkbox includes the clips, BGM, sounds and overlay clips referenced by saved Video Edit projects (projects only store references to files in ComfyUI's input folder) — unlike the other two, these are restored into the input folder, skipping any file that already exists there.",
helpSettings8: "Data Management: export core settings, metadata, and prompts to a JSON file, or import to restore. The browser-side settings (workflow and preset groups, badge colors, appearance, AI / decision model / VRAM settings, presets) are included too and restored on import — reload the page afterward. Restart ComfyUI after importing.",
helpSettings15: "Full Backup (ZIP): unlike the JSON export above, also includes folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets), the Tagger database, the Gallery semantic search settings, and the browser-side settings. Temporary files and the unused models/ folder of older versions are left out. Restoring overwrites existing files and writes the browser-side settings back (reload the page); restart ComfyUI afterward.",
helpSettings16: "Checkboxes above the Full Backup buttons: ComfyUI's default workflows folder and the Impact Pack's wildcard folder (export-only, never restored automatically; copy the ZIP's _external/ folder back by hand if you want them); the clips, BGM, sounds and overlay clips referenced by saved Video Edit projects (projects only store references to files in ComfyUI's input folder — restored into the input folder, skipping files that already exist); the Gallery semantic search index (on by default: rebuilding it re-embeds every image, which costs API usage with Gemini); and the TagSpace cache (off by default: it can be rebuilt from the TagSpace tab).",
helpSettings17: "Decision Model: its own section, independent of the AI TOOL / Tagger LLM/VLM backends so it can be used alongside them — backend, URL, model and a default probability threshold (answers below it are treated as suggestions to confirm). Unsloth: Laya models (laya / laya-multilingual / laya-english / laya-typed-decisions); requires Settings → API → Decision API → Serve requests in Unsloth Desktop (otherwise HTTP 404 \"The Decision API is off\") and either UNSLOTH_API_KEY in .env or Keyless API access → \"Chat and inference\". Ollama (0.35+): lists installed models whose capabilities include \"decision\" (tev1, tev1:0.8b, nimble — ollama pull first; ↻ refreshes the list); no key needed. Test sends one yes/no question with the unsaved form values; the first request loads the model.",
helpSettings18: "Video Volume: one slider (0–100%) sets the playback volume of the Video tab preview and the Gallery detail / lightbox / compare video players; the level set here (or changed with any video's own controls) carries over to the next video opened anywhere in the app",
helpSettings19: "Gallery Output Folder: the ComfyUI output folder the Gallery tab browses — leave blank to use ComfyUI's default output directory; Apply takes effect immediately, Default resets it, and the folder currently in use is shown below the field",
@@ -1189,7 +1262,7 @@ const LANGUAGES = {
helpSettings23: "Models Folder: add extra model root folders (e.g. Stability Matrix's Models) — their subfolders (StableDiffusion / Lora / VAE / ControlNet / TextEncoders / DiffusionModels / Embeddings / HyperNetworks, or ComfyUI names like checkpoints / loras) are listed in the Models tab in addition to ComfyUI's own folders; separate several roots with ; — Apply saves, Default clears",
helpSettings24: "Windows Stability: \"Use the Selector event loop on Windows\" switches ComfyUI's asyncio loop from Proactor to Selector (applied at the next ComfyUI start). Turn it on if ComfyUI freezes entirely after switching Models lists that load many preview images; the trade-offs are no asyncio subprocess support and a connection limit of about 512. The same switch is available through the WFS_SELECTOR_LOOP=1 environment variable",
helpSettings25: "VRAM Management (Ollama): right before every image generation from Workflow Studio (GenerateUI, Lab, batches, Video, AI TOOL chat generation, etc.), unload the models Ollama has loaded to free VRAM. Before generating: \"Do nothing\" (default) / \"Unload only as much as needed when free VRAM is below the target\" (unloads the models using the most VRAM one at a time and stops once the target is reached) / \"Unload everything every time\". Free VRAM is measured with nvidia-smi (ComfyUI's own figure may not change when Ollama loads a model; non-NVIDIA GPUs use ComfyUI's value). Targets Ollama on localhost — the default 127.0.0.1:11434 plus the AI TOOL / Prompt / Tagger AI settings and the Decision Model when they use Ollama (other hosts only if allowed by WFS_ALLOWED_BACKEND_HOSTS); LM Studio etc. and ComfyUI's own models are not touched. Unloaded models reload the next time they are used; a toast appears when models are unloaded, the target can't be reached, or the step fails, and generation continues either way. \"Unload all now\" unloads every loaded Ollama model immediately; the same \"Unload all now\" is also in the sidepanel A tab → Settings → VRAM (Ollama). Running a workflow from the ComfyUI canvas itself is not covered",
helpSettings26: "Prompt Translation (native language → English): off by default. Translates prompts with a local Ollama model — PLaMo 3 Translate (0.8B / 2B / 8B / 31B; models not yet in Ollama can be fetched with the Download button) or any other Ollama model through a translation instruction. Options: source language (auto-detect or one of the 51 languages PLaMo supports), Ollama URL, where to run the model — GPU (about 0.1 s per phrase; with \"Unload after translating\" on, each translation first waits about 4 s for the model to reload) or CPU kept loaded (about 0.3 s per phrase, no VRAM, loaded in the background when GenerateUI opens) — and \"Translate automatically when running\" for GenerateUI Generate (replaces the prompt text with the translation), Lab Run and Video Plan Run (translate only what is sent; the plan keeps your text). If translation fails, nothing is generated. Test translates a sample prompt. 2B translates sentences more accurately than 0.8B. PLaMo 3 Translate is free for personal and non-commercial use (PLaMo Community License). PLaMo models also work for the AI TOOL / Prompt tab AI Assistant / sidepanel A tab translation buttons (the languages are passed in the format PLaMo expects)",
helpSettings26: "Prompt Translation (native language → English): off by default. Translates prompts with a local Ollama model — PLaMo 3 Translate (0.8B / 2B / 8B / 31B; models not yet in Ollama can be fetched with the Download button) or any other Ollama model through a translation instruction. Options: source language (auto-detect or one of the 51 languages PLaMo supports), Ollama URL, where to run the model — GPU (about 0.1 s per phrase; with \"Unload after translating\" on, each translation first waits about 4 s for the model to reload) or CPU kept loaded (about 0.3 s per phrase, no VRAM, loaded in the background when a workflow is loaded into GenerateUI) — and \"Translate automatically when running\" for GenerateUI Generate (replaces the prompt text with the translation), Lab Run and Video Plan Run (translate only what is sent; the plan keeps your text). If translation fails, nothing is generated. Test translates a sample prompt. 2B translates sentences more accurately than 0.8B. PLaMo 3 Translate is free for personal and non-commercial use (PLaMo Community License). PLaMo models also work for the AI TOOL / Prompt tab AI Assistant / sidepanel A tab translation buttons (the languages are passed in the format PLaMo expects)",
helpSettings9: "All sections are collapsible accordion panels",
helpSettings10: "Wildcard Integration: link WFS wildcard dir to ComfyUI-Impact-Pack wildcards (directory junction on Windows / symlink on other OS); existing files migrated automatically",
helpSettings11: "Text Size: one slider (10–28 px) adjusts font size for all prompt and chat textareas at once — Generate UI positive/negative prompts, AI Assistant chat input, Preset positive/negative, Wildcard prompt and file editor, and Metadata prompt full preview; takes effect immediately and saved with Save Settings",
@@ -1564,7 +1637,7 @@ const LANGUAGES = {
promptTranslateDevice: "Where to run the translation model",
promptTranslateDeviceGpu: "GPU (fastest per translation, uses VRAM)",
promptTranslateDeviceCpu: "CPU, kept loaded (no VRAM, no reload wait)",
promptTranslateDeviceHint: "CPU mode keeps the model in system RAM (about 2 GB for 2B) and loads it in the background when GenerateUI opens, so translations take about 0.3 s per phrase with no VRAM use and no ~4 s reload. GPU mode is faster per phrase (about 0.1 s) but, when unloading after translation is on, every translation waits about 4 s for the model to reload.",
promptTranslateDeviceHint: "CPU mode keeps the model in system RAM (about 2.7 GB for 2B) and loads it in the background when a workflow is loaded into GenerateUI, so translations take about 0.3 s per phrase with no VRAM use and no ~4 s reload. GPU mode is faster per phrase (about 0.1 s) but, when unloading after translation is on, every translation waits about 4 s for the model to reload.",
promptTranslateError: (msg) => `Translation error: ${msg}`,
promptTranslateModelsError: (msg) => `Could not get the model list: ${msg}`,
settingsTitle: "Settings",
@@ -1622,6 +1695,7 @@ const LANGUAGES = {
vramEnough: (a, tgt) => `Free ${a} GB (at least the ${tgt} GB target, nothing to unload)`,
vramShort: (a, tgt) => `Free ${a} GB is below the ${tgt} GB target (no Ollama model left to unload)`,
vramNothingLoaded: (a) => `No Ollama models are loaded (free ${a} GB)`,
vramKeptCpu: (names) => `kept CPU-resident (no VRAM): ${names}`,
vramUnreachable: (urls) => `Cannot reach Ollama: ${urls}`,
vramPrepareFailed: (msg) => `VRAM management failed (generation continues): ${msg}`,
compatCheck: "GenerateUI Check",
@@ -1654,7 +1728,7 @@ const LANGUAGES = {
eagleUrl: "Eagle URL",
eagleAutoSave: "Auto-save generated images to Eagle",
dataManagement: "Data Management",
dataManagementHint: "Export core settings, metadata, and prompts to a JSON file, or import a previously exported file to restore them. After importing, restart ComfyUI to apply changes.",
dataManagementHint: "Export core settings, metadata, prompts and the browser-side settings (groups, badge colors, appearance, AI / VRAM settings, presets) to a JSON file, or import a previously exported file to restore them. After importing, reload the page and restart ComfyUI to apply changes.",
exportData: "Export",
importData: "Import",
exportSuccess: "Export complete",
@@ -1663,11 +1737,16 @@ const LANGUAGES = {
importError: "Import failed",
exportFullBackup: "Full Backup (ZIP)",
importFullBackup: "Restore Full Backup (ZIP)",
fullBackupHint: "Full Backup (ZIP) additionally includes folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets) and the Tagger database — everything the JSON export above can't represent. Restoring overwrites existing files; restart ComfyUI afterward.",
fullBackupHint: "Full Backup (ZIP) additionally includes folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets), the Tagger database and the semantic search settings — everything the JSON export above can't represent. Restoring overwrites existing files; reload the page and restart ComfyUI afterward.",
fullBackupFilesUnit: "files",
fullBackupIncludeWorkflows: "Include default workflows folder (user/default/workflows)",
fullBackupIncludeWildcard: "Include Impact Pack wildcard folder (if present)",
fullBackupIncludeVideoMedia: "Include media used by Video Edit projects (clips, BGM, sounds and overlay clips in the input folder; restored into input without overwriting)",
browserStorageRestored: (n) => `${n} browser settings restored — reload the page to apply`,
reloadPage: "Reload page",
fullBackupBuilding: "Building the backup…",
fullBackupIncludeTagspace: "Include the TagSpace cache (large; can be rebuilt from the TagSpace tab)",
fullBackupIncludeSemantic: "Include the Gallery semantic search index (rebuilding it re-embeds every image; with Gemini this costs API usage)",
fullBackupMediaResult: "Video Edit media: {restored} restored, {existing} already present",
fullBackupExternalHint: "These are export-only — restoring a backup never touches them; copy the _external/ folder back manually if needed.",
saveSettings: "Save Settings",
@@ -2700,6 +2779,79 @@ const LANGUAGES = {
tabAi: "AI TOOL",
tabTagger: "Tagger",
tabTagSpace: "TagSpace",
// --- Game タブ (実験的機能・ComfyUI-WFS-Games が必要) ---
tabGame: "Game",
helpGame9: "Turbo Heart: 80年代風の、後ろから見る疑似3Dのレースゲームです。海岸線を巡る全5レース(海岸ハイウェイ・紅葉の峠・夕陽の渓谷・夜のネオンシティ・夜明けの海岸)。8台で走り、最後尾からスタートして3位以内でゴールすると次のレースへ進めます(4位以下はゲームオーバー)。ハンドルは ← →、アクセルは ↑ または Z、ブレーキは ↓ または X、ニトロは Space または C(1レース3回)、一時停止は Esc または P。ゲームパッドも使えます。コース上のハート5個を拾ってください。レースの合間にメカニックのミサキが話し、画像の仕組みは Star Formation と同じです(レースごとの勝利の記念カット、ハート全部でプライベート写真、エンディング、敗北の場面)。障害物にも注意: 積み上げたダンボール(1レース2か所)は道の一部をふさいで向こうを見えにくくし、突っ込むと粉々になって減速します。オイル(1か所)に乗るとスピンして2回転します。道を渡る人(プレイのたびにランダムで0人か1人)をはねるとゲームオーバーです。",
helpGame10: "Prompt Typer: 打った文字がそのまま画像のプロンプトになる、80年代風のタイピングゲームです(BGMなし・効果音のみ)。全10ステージ・各20ワードで、2ステージごとに文字数が増えます。打った文字は打ち間違いも含めてそのままプロンプトに入ります。バックスペースで今のワードを直せますが、打ち間違えた数は減りません。85%以上正しく入力できればステージクリア。クリアしてもしなくても毎ステージ画像を生成します。ステージの後は Enter で次へ(クリアできなかったときはリトライ)、R でリトライ、Q であきらめます。タイトルの ↑ ↓ でタイピングする言語(英語・日本語・中国語。日本語と中国語は入力欄に IME で入力し、漢字のワードには読みがなが出て、ひらがなとカタカナは同じ文字として扱います)、← → でスタートステージを選べます。日本語・中国語のプロンプトは、その言語がわかる画像モデルで使ってください",
helpGame11: "Sky Heart: 画面の奥へ向かって飛ぶ、80年代風の疑似3Dシューティングです。空のパトロール隊のヒカリがジェットパックで全5ステージ(花の平原・水晶の渓谷・夕焼けの海・ネオンの空中都市・月の遺跡)を飛び、各ステージの最後にボスが出ます。弾は画面の奥へまっすぐ飛ぶので、敵と重なる位置で撃ちます。敵の弾、地上のミサイル発射台、地上の木・水晶・岩・ビル・柱をよけてください(上か横へよけます。ステージ4のビルは4発で壊せます)。移動は矢印キーまたは WASD、ショットは Space または Z を押しっぱなし、一時停止は Esc または P。ゲームパッドも使えます。左の高度計で自機と、近づいてくるアイテムの高さがわかります。ハートは各ステージ空中に5個・地上すれすれに5個あり、合わせて5個取るとプライベート写真になります。パワーアップのカプセルが空中と地上に出ます: 1UP(緑)、3発まで防ぐバリア(青)、15秒間一緒に撃つサポートメカ(オレンジ)。画像の仕組みは Star Formation と同じです",
gameJobStagePrivate: (n, name) => `STAGE ${n}${name ? " " + name : ""} - プライベート♥`,
gameAutoGameover: "ゲームオーバー時も画像を生成する",
gameJobGameover: (n, name) => `GAME OVER - STAGE ${n}${name ? " " + name : ""}`,
gameEachStage: "ステージクリアごとに画像を生成する",
gameJobEnding: "ENDING",
gameJobQueued: "待機中",
gameJobDone: "完了",
gameRegenerate: "再生成",
gamePromptDetails: "プロンプト",
gameJobStage: (n, name) => `STAGE ${n}${name ? " " + name : ""}`,
gameBgm: "BGM",
gameSrcStyle: "画風",
gameSrcCharacter: "ヒロイン",
gameSrcScene: "シーン",
gameSrcClear: "ステージ",
gameSrcEnemy: "撃破",
gameSrcBonus: "ボーナス",
gameNegativeFromGame: "ゲームが追加するネガティブ",
gameListTitle: "ゲーム",
gamePlaySettings: "プレイ設定",
gameDifficulty: "難易度",
gameDifficultyEasy: "やさしい",
gameDifficultyNormal: "ふつう",
gameDifficultyHard: "むずかしい",
gameSound: "効果音",
gamePlaySettingsNote: "変更するとゲームが最初からになります。",
gameGenSettings: "画像生成",
gameWorkflow: "ワークフロー",
gameWorkflowReload: "ワークフロー一覧を再読み込み",
gameBasePrompt: "ベースプロンプト(獲得したプロンプトの前に付きます)",
gameNegativePrompt: "ネガティブプロンプト",
gameNegativePlaceholder: "空欄ならワークフローのネガティブをそのまま使います",
gameAutoGenerate: "エンディング画像も自動で生成する",
gameRestart: "リスタート",
gameResultTitle: "結果",
gameSettingsTab: "設定",
gameResultEmpty: "ステージをクリアするたびに、リナの勝利の記念カットがここに生成されます。全ステージをクリアするとエンディング画像、ゲームオーバーになると敗北の場面が生成されます。",
gameFinalPrompt: "生成するプロンプト(編集できます)",
gameGenerate: "生成",
gameOpenInGenerateUI: "GenerateUIで開く",
gamePlayAgain: "もう一度遊ぶ",
gameLoading: "ゲームを読み込み中...",
gameLoadFailed: (msg) => `ゲームを読み込めませんでした: ${msg}`,
gameCleared: "CLEAR!",
gameOverLabel: "GAME OVER",
gameScore: (n) => `スコア: ${n}`,
gameOverNoGenerate: "ゲームオーバーのため、エンディング画像は生成しません。クリアしたステージの画像は残ります。",
gameRewardsTitle: "獲得したプロンプト(使わないものはチェックを外してください):",
gameNoRewards: "獲得したプロンプトはありません。ベースプロンプトだけで生成します。",
gameNoWorkflow: "Game の設定でワークフローが選ばれていません。",
gameWorkflowLoadFailed: (name) => `ワークフローを読み込めませんでした: ${name}`,
gameNoPositiveNode: "ワークフローにポジティブプロンプトのノードがありません。",
gameEmptyPrompt: "プロンプトが空です。",
gameGenerating: "生成中...",
gameNoImage: "ワークフローから画像が返りませんでした。",
gameGenerated: (path) => `保存しました: ${path}`,
gameGenerateFailed: (msg) => `生成に失敗しました: ${msg}`,
helpGameTitle: "Gameタブ(実験的機能)",
helpGameCardOverview: "概要",
helpGameCardGen: "画像生成",
helpGame1: "Gameタブは、別パッケージのゲームパック ComfyUI-WFS-Games をインストールしているときだけ表示されます(起動時に /wfs_games/manifest を確認します)。入っていないときはタブもこのヘルプページも表示されません",
helpGame2: "左の「ゲーム」一覧から遊ぶゲームを選びます。ゲームは中央で動きます。クリックするとキー操作がゲームに入ります(そこで押したキーは Workflow Studio の他の操作に影響しません)。他のタブやウィンドウに切り替えると一時停止します。右のペインは「結果」(画像のカード)と「設定」(プレイ設定と画像生成の設定)のタブに分かれています",
helpGame3: "Star Formation: 80年代のアーケードゲームやパソコン(MSX2 / PC-8801)風の縦シューティングです。ドット絵・ドットフォント・走査線・チップチューン風のBGM。全5ステージ。敵は編隊で飛んできて整列し、急降下して攻撃してきます。各ステージで5機の敵が黄色く点滅しています。倒すと「思い出のハート」が落ちてくるので、画面の下に落ちる前に取ってください(+500点。右上のハートが獲得数)。敵を全滅させると WARNING が出てBGMが変わり、ステージのボスが登場します(画面上部に赤い耐久力ゲージ)。ボスはそれぞれ特徴があります: 大きくて硬い、速くて弾も速い、放射状に弾を撃つ、点滅したあと一直線に体当たり、小型機を5機ずつ3回出す巨大母艦。移動は ← → または A D、ショットは Space または Z、一時停止は Esc または P。ゲームパッドも使えます。各ステージの前後に、管制から誘導してくれるナビゲーターのリナがアドベンチャーゲーム風のウィンドウで話します(Space・Z・Enter・クリックで進みます)。最後の自機がやられると画面が暗くなり、リナの呼びかけに応答がないまま GAME OVER になります。急降下中の敵を倒すと得点2倍です",
helpGame4: "プレイ設定: 難易度(やさしい: 残機5 / ふつう: 3 / むずかしい: 2。敵の弾や急降下の頻度も変わります)、BGM、効果音。変更するとゲームが最初からになります。ハイスコアはこのブラウザに保存されます",
helpGame5: "「リスタート」でタイトル画面からやり直します",
helpGame6: "ステージをクリアするたびに、右の「結果」にそのステージのカードが追加され(新しいものが上)、そのステージを背景にしたリナの勝利の記念カット(ピース・手を振る・サムズアップなど)がバックグラウンドで生成されます。生成中もプレイを続けられます(画像は1枚ずつ順番に作ります)。そのステージでハートを5つ全部取っていた場合は PERFECT! と表示され、カード(ピンク)は勝利の記念カットの代わりにプライベートのリナの写真になります。ステージが進むごとに肌の露出が少しずつ増えます: カフェでの私服 → ノースリーブのワンピース → オフショルダーとショートパンツ → タンクトップとデニムのショートパンツ → 海辺の水着(水着までです。ゲームがネガティブのタグを足して、それ以上にならないようにしています)。5ステージすべてクリアすると ENDING のカードが追加されます。ゲームオーバーになると赤い GAME OVER のカードが追加され、負けたステージを背景に、赤い警告灯の暗い管制室で泣き崩れるリナの敗北の場面が生成されます。カードの「プロンプト」を開くと、ゲームから渡されたプロンプトが種類つきで並びます: 画風(80年代のパソコングラフィック風)・ヒロイン(リナの外見)・シーン・ステージ。使わないものはチェックを外すかプロンプトを編集し、「再生成」を押してください",
helpGame7: "ワークフロー: 生成に使うワークフローです(既定は ws_game_sdxl_t2i.json。Gameタブ用に用意した SDXL(Illustrious)の T2I ワークフローで、1216x832、出力先は output/WFS_Game)。プロンプトはワークフローのポジティブプロンプトのノードに書き込みます。ネガティブは「ネガティブプロンプト」設定(空ならワークフロー自身のもの)にゲームのネガティブタグを足したものです。seed は毎回ランダムです",
helpGame8: "「ステージクリアごとに画像を生成する」「エンディング画像も自動で生成する」「ゲームオーバー時も画像を生成する」はオフにできます。オフのときは、カードの「生成」を押したときに生成します。「GenerateUIで開く」は、そのカードのプロンプトを入れたワークフローを GenerateUI に読み込みます。タイトルから新しくゲームを始めるとカードは消えます(画像は output/WFS_Game に残ります)。Game タブを開いている間は、VRAM調整のメッセージを表示しません。設定はブラウザに保存され、バックアップにも含まれます",
tsBuild: "作成 / 更新",
tsCancel: "中止",
tsMaxTags: "タグ数:",
@@ -3124,9 +3276,9 @@ const LANGUAGES = {
helpSettings5: "AI Assistant設定はこのタブから移動しました——Promptタブ・Taggerタブ・AI TOOLタブそれぞれが独自の⚙設定ボタン(バックエンド・URL・モデル・Thinking mode・Max tokens・モデルのアンロード)を持ち、個別に保存されます",
helpSettings6: "デフォルトワークフローの設定・解除",
helpSettings7: "Eagle連携URL、自動保存の有効/無効",
helpSettings8: "データ管理:設定・メタデータ・プロンプトなど主要データをJSONにエクスポート、またはインポートして復元。インポート後はComfyUIを再起動してください。",
helpSettings15: "フルバックアップ (ZIP):上記のJSONエクスポートと異なり、フォルダ形式のデータ(AI Skills、Lab Plan、Video Plan、Video Editプロジェクト、Styleプリセット)とTaggerデータベースも含みます。復元すると既存ファイルは上書きされます。復元後はComfyUIを再起動してください。",
helpSettings16: "フルバックアップのボタン上にある2つのチェックボックスで、デフォルトワークフローフォルダーとImpact Packのwildcardフォルダーもエクスポートに含められます。どちらもエクスポート専用で自動復元はされません。必要な場合はZIP内の_external/フォルダから手動でコピーしてください。3つ目のチェックボックスでは、保存済みVideo Editプロジェクトが参照するクリップ・BGM・追加サウンド・オーバーレイクリップも含められます(プロジェクトにはComfyUIのinputフォルダ内ファイルへの参照しか保存されないため)。こちらは他の2つと異なり、復元時にinputフォルダへ戻されます(同名ファイルが既にある場合はスキップ)。",
helpSettings8: "データ管理:設定・メタデータ・プロンプトなど主要データをJSONファイルにエクスポート、またはインポートして復元します。ブラウザ側に保存している設定(ワークフロー/プリセットのグループ、バッジの色、外観、AI・意思決定モデル・VRAM調整の設定、各種プリセット)も含まれ、インポート時に復元されます(その後ページを再読み込み)。インポート後はComfyUIを再起動してください。",
helpSettings15: "フルバックアップ (ZIP):上記のJSONエクスポートと異なり、フォルダ形式のデータ(AI Skills、Lab Plan、Video Plan、Video Editプロジェクト、Styleプリセット)、Taggerデータベース、Galleryセマンティック検索の設定、ブラウザ側に保存している設定も含みます。一時ファイルと旧バージョンの使われていないmodels/フォルダは含めません。復元すると既存ファイルは上書きされ、ブラウザ側の設定も書き戻されます(ページを再読み込み)。復元後はComfyUIを再起動してください。",
helpSettings16: "フルバックアップのボタン上のチェックボックス:ComfyUIのデフォルトワークフローフォルダーとImpact Packのwildcardフォルダー(エクスポート専用で自動復元はされません。必要な場合はZIP内の_external/フォルダから手動でコピー)、保存済みVideo Editプロジェクトが参照するクリップ・BGM・追加サウンド・オーバーレイクリップ(プロジェクトにはinputフォルダ内ファイルへの参照しか保存されないため。復元時はinputフォルダへ戻し、同名ファイルがあればスキップ)、Galleryセマンティック検索のインデックス(既定オン:作り直すと全画像を埋め込み直すため、Geminiでは API 利用料がかかります)、TagSpaceのキャッシュ(既定オフ:TagSpaceタブから作り直せます)。",
helpSettings17: "意思決定モデル:AI TOOL/TaggerのLLM・VLMと併用できるよう、それらとは独立したセクションで設定します — バックエンド、URL、モデル、既定の確率しきい値(これ未満の回答は確認用の提案として扱う)。Unsloth:Laya系モデル(laya / laya-multilingual / laya-english / laya-typed-decisions)。Unsloth Desktopで Settings → API → Decision API → Serve requests の有効化(無効だとHTTP 404「The Decision API is off」)と、.envのUNSLOTH_API_KEY(またはKeyless API access →「Chat and inference」の有効化)が必要です。Ollama(0.35以降):capabilitiesに「decision」を持つインストール済みモデルを一覧表示します(tev1、tev1:0.8b、nimble — 先にollama pullが必要、↻で一覧を更新)。キーは不要です。テストボタンは保存前のフォーム値でyes/no質問を1問送ります(初回はモデル読み込みに時間がかかります)",
helpSettings18: "Video Volume(動画の音量):スライダー1本(0〜100%)で、Videoタブのプレビューと、Galleryの詳細・ライトボックス・比較表示の動画プレーヤーの再生音量を設定します。ここで設定した音量(または各動画のコントロールで変えた音量)は、アプリ内で次に開く動画にも引き継がれます",
helpSettings19: "Gallery出力フォルダ:Galleryタブで閲覧するComfyUIの出力フォルダ。空欄ならComfyUIの既定の出力ディレクトリを使います。「適用」で即時反映、「デフォルト」で元に戻し、現在使用中のフォルダは入力欄の下に表示されます",
@@ -3136,7 +3288,7 @@ const LANGUAGES = {
helpSettings23: "モデルフォルダ:追加のモデルルートフォルダ(例: Stability Matrix の Models)を指定すると、その中のサブフォルダ(StableDiffusion / Lora / VAE / ControlNet / TextEncoders / DiffusionModels / Embeddings / HyperNetworks、またはcheckpoints / lorasなどComfyUI名)がComfyUI本来のフォルダに加えてModelsタブに表示されます。複数のルートは ; 区切り。「適用」で保存、「デフォルト」でクリア",
helpSettings24: "Windowsの安定性:「WindowsでSelectorイベントループを使用する」をオンにすると、ComfyUIのasyncioループがProactorからSelectorに切り替わります(次回のComfyUI起動時に反映)。プレビュー画像を多数読み込むModelsの一覧を切り替えたあとにComfyUIが完全に固まる場合にオンにしてください。トレードオフとして、asyncioのサブプロセス機能が使えず、同時接続数は約512が上限です。環境変数 WFS_SELECTOR_LOOP=1 でも同じ切り替えができます",
helpSettings25: "VRAM調整(Ollama):Workflow Studioからの画像生成(GenerateUI・Lab・バッチ・Video・AI TOOLのChat生成など、どこから実行しても同じ)の直前に、Ollamaでロード中のモデルをアンロードして空きVRAMを作ります。生成前の動作は「何もしない」(既定)/「空きが目標未満のときだけ必要な分をアンロード」(VRAM使用量の大きいモデルから1台ずつアンロードし、目標の空きに届いたら止める)/「毎回すべてアンロード」。空きVRAMはnvidia-smiの実測で判定します(ComfyUIが示す空きは、Ollamaがモデルを読み込んでも変わらないことがあるため。NVIDIA以外のGPUではComfyUIの値を使用)。対象はローカルホストのOllamaで、既定の127.0.0.1:11434と、Ollamaを使っているAI TOOL・Prompt・TaggerのAI設定および意思決定モデルです(他のホストはWFS_ALLOWED_BACKEND_HOSTSで許可した場合のみ)。LM Studio等のモデルやComfyUI自身のモデルは対象外です。アンロードしたモデルは次に使うときに読み込み直しになります。アンロードしたとき・目標に届かないとき・失敗したときはトーストで通知し、失敗しても生成は続けます。「今すぐすべてアンロード」でロード中のOllamaのモデルをその場でアンロードできます。サイドパネルのAタブ → Settings →「VRAM (Ollama)」にも同じ「Unload all now」ボタンがあります。ComfyUIのキャンバスで直接実行する生成は対象外です",
helpSettings26: "プロンプト翻訳(自国語 → 英語):既定はオフ。ローカルのOllamaモデルでプロンプトを翻訳します。PLaMo 3 Translate(0.8B/2B/8B/31B。Ollamaに未取得のモデルは「ダウンロード」ボタンで取得)のほか、他のOllamaモデルも翻訳指示付きで使えます。設定項目は、入力する言語(自動判定、またはPLaMoが対応する51言語)、Ollama URL、翻訳モデルの実行場所(GPU:1語句約0.1秒。「翻訳後にVRAMから解放」がオンだと毎回モデルの再読み込みで約4秒待つ/CPUで常駐:1語句約0.3秒・VRAMを使わず、生成UIを開いたときに裏で読み込む)、「実行時に自動で翻訳する」(生成UIのGenerate:欄の文を翻訳結果に置き換え/Lab Run・Video Plan Run:送信する内容だけ翻訳し、プランには元の文が残る)です。翻訳に失敗した場合は生成しません。「テスト」で見本のプロンプトを翻訳します。文章の翻訳は0.8Bより2Bのほうが正確です。PLaMo 3 Translateは個人・非商用利用なら無料です(PLaMoコミュニティライセンス)。PLaMoのモデルは、AI TOOL・PromptタブのAIアシスタント・サイドパネルAタブの翻訳でも使えます(PLaMoが求める形式で言語を指定して送ります)",
helpSettings26: "プロンプト翻訳(自国語 → 英語):既定はオフ。ローカルのOllamaモデルでプロンプトを翻訳します。PLaMo 3 Translate(0.8B/2B/8B/31B。Ollamaに未取得のモデルは「ダウンロード」ボタンで取得)のほか、他のOllamaモデルも翻訳指示付きで使えます。設定項目は、入力する言語(自動判定、またはPLaMoが対応する51言語)、Ollama URL、翻訳モデルの実行場所(GPU:1語句約0.1秒。「翻訳後にVRAMから解放」がオンだと毎回モデルの再読み込みで約4秒待つ/CPUで常駐:1語句約0.3秒・VRAMを使わず、生成UIにワークフローを読み込んだときに裏で読み込む)、「実行時に自動で翻訳する」(生成UIのGenerate:欄の文を翻訳結果に置き換え/Lab Run・Video Plan Run:送信する内容だけ翻訳し、プランには元の文が残る)です。翻訳に失敗した場合は生成しません。「テスト」で見本のプロンプトを翻訳します。文章の翻訳は0.8Bより2Bのほうが正確です。PLaMo 3 Translateは個人・非商用利用なら無料です(PLaMoコミュニティライセンス)。PLaMoのモデルは、AI TOOL・PromptタブのAIアシスタント・サイドパネルAタブの翻訳でも使えます(PLaMoが求める形式で言語を指定して送ります)",
helpSettings9: "各セクションはアコーディオン式で折りたたみ可能",
helpSettings10: "Wildcard Integration:WFSのワイルドカードディレクトリをComfyUI-Impact-Packのwildcardsディレクトリへリンク(Windowsはジャンクション、他OSはシンボリックリンク)。既存ファイルは自動で移行されます",
helpSettings11: "テキストサイズ:スライダー1本(10〜28px)でプロンプト・チャット全テキストエリアのフォントサイズを一括調整 — GenerateUI ポジティブ/ネガティブプロンプト、AIアシスタントチャット入力、プリセット ポジティブ/ネガティブ、ワイルドカードプロンプト・ファイルエディタ、メタデータプロンプト全文プレビュー;即時反映・保存で確定",
@@ -3511,7 +3663,7 @@ const LANGUAGES = {
promptTranslateDevice: "翻訳モデルの実行場所",
promptTranslateDeviceGpu: "GPU(1回の翻訳が最速・VRAMを使う)",
promptTranslateDeviceCpu: "CPUで常駐(VRAMを使わず、再読み込みの待ちなし)",
promptTranslateDeviceHint: "CPUモードではモデルをメインメモリに常駐させ(2Bで約2GB)、生成UIを開いたときに裏で読み込んでおきます。VRAMを使わず約4秒の再読み込みも発生しないため、1語句あたり約0.3秒で翻訳できます。GPUモードは1語句あたり約0.1秒と速い反面、「翻訳後にVRAMから解放」がオンだと毎回モデルの再読み込みで約4秒待ちます。",
promptTranslateDeviceHint: "CPUモードではモデルをメインメモリに常駐させ(2Bで約2.7GB)、生成UIにワークフローを読み込んだときに裏で読み込んでおきます。VRAMを使わず約4秒の再読み込みも発生しないため、1語句あたり約0.3秒で翻訳できます。GPUモードは1語句あたり約0.1秒と速い反面、「翻訳後にVRAMから解放」がオンだと毎回モデルの再読み込みで約4秒待ちます。",
promptTranslateError: (msg) => `翻訳エラー: ${msg}`,
promptTranslateModelsError: (msg) => `モデル一覧を取得できません: ${msg}`,
settingsTitle: "設定",
@@ -3569,6 +3721,7 @@ const LANGUAGES = {
vramEnough: (a, tgt) => `空き ${a} GB(目標 ${tgt} GB 以上のためアンロード不要)`,
vramShort: (a, tgt) => `空き ${a} GB が目標 ${tgt} GB に届きません(アンロードできるOllamaのモデルがありません)`,
vramNothingLoaded: (a) => `ロード中のOllamaのモデルはありません(空き ${a} GB)`,
vramKeptCpu: (names) => `CPU常駐のため残しました(VRAM不使用): ${names}`,
vramUnreachable: (urls) => `Ollamaに接続できません: ${urls}`,
vramPrepareFailed: (msg) => `VRAM調整に失敗しました(生成は続行): ${msg}`,
compatCheck: "GenerateUIチェック",
@@ -3601,7 +3754,7 @@ const LANGUAGES = {
eagleUrl: "Eagle URL",
eagleAutoSave: "生成画像をEagleに自動保存",
dataManagement: "データ管理",
dataManagementHint: "設定・メタデータ・プロンプトなど主要データをJSONファイルにエクスポート、またはインポートして復元できます。インポート後はComfyUIを再起動してください。",
dataManagementHint: "設定・メタデータ・プロンプトなど主要データと、ブラウザ側に保存している設定(グループ、バッジの色、外観、AI・VRAM調整の設定、各種プリセット)をJSONファイルにエクスポート、またはインポートして復元できます。インポート後はページを再読み込みし、ComfyUIを再起動してください。",
exportData: "エクスポート",
importData: "インポート",
exportSuccess: "エクスポート完了",
@@ -3610,11 +3763,16 @@ const LANGUAGES = {
importError: "インポート失敗",
exportFullBackup: "フルバックアップ (ZIP)",
importFullBackup: "フルバックアップを復元 (ZIP)",
fullBackupHint: "フルバックアップ(ZIP)は上記のJSONエクスポートでは表現できないフォルダ形式のデータ(AI Skills、Lab Plan、Video Plan、Video Editプロジェクト、Styleプリセット)とTaggerデータベースも含みます。復元すると既存ファイルは上書きされます。復元後はComfyUIを再起動してください。",
fullBackupHint: "フルバックアップ(ZIP)は上記のJSONエクスポートでは表現できないフォルダ形式のデータ(AI Skills、Lab Plan、Video Plan、Video Editプロジェクト、Styleプリセット)、Taggerデータベース、セマンティック検索の設定も含みます。復元すると既存ファイルは上書きされます。復元後はページを再読み込みし、ComfyUIを再起動してください。",
fullBackupFilesUnit: "件",
fullBackupIncludeWorkflows: "デフォルトワークフローフォルダーを含める (user/default/workflows)",
fullBackupIncludeWildcard: "Impact Packのwildcardフォルダーを含める(存在する場合)",
fullBackupIncludeVideoMedia: "Video Editプロジェクトの素材を含める(inputフォルダ内のクリップ・BGM・追加サウンド・オーバーレイクリップ。復元時はinputへ戻し、既存ファイルは上書きしません)",
browserStorageRestored: (n) => `ブラウザ側の設定 ${n} 件を復元しました(ページの再読み込みで反映)`,
reloadPage: "ページを再読み込み",
fullBackupBuilding: "バックアップを作成中…",
fullBackupIncludeTagspace: "TagSpaceのキャッシュを含める(大きい。TagSpaceタブから作り直せます)",
fullBackupIncludeSemantic: "Galleryセマンティック検索のインデックスを含める(作り直すと全画像を埋め込み直します。Geminiでは API 利用料がかかります)",
fullBackupMediaResult: "Video Edit素材: {restored}件復元、{existing}件は既存",
fullBackupExternalHint: "これらはエクスポート専用です。復元時には一切触れません。必要な場合はZIP内の_external/フォルダから手動でコピーしてください。",
saveSettings: "設定を保存",
@@ -4647,6 +4805,79 @@ const LANGUAGES = {
tabAi: "AI TOOL",
tabTagger: "Tagger",
tabTagSpace: "TagSpace",
// --- Game 标签页 (实验性功能,需要 ComfyUI-WFS-Games) ---
tabGame: "Game",
helpGame9: "Turbo Heart: 80年代风格的后视角伪3D赛车游戏。沿海岸线共 5 场比赛(海岸公路、红叶山道、夕阳峡谷、夜晚的霓虹城市、黎明海岸)。8 辆车同场竞速,你从最后一位起跑,以前三名完赛才能进入下一场(第四名及以后则游戏结束)。用 ← → 转向,↑ 或 Z 加速,↓ 或 X 刹车,Space 或 C 使用氮气(每场 3 次),Esc 或 P 暂停;也支持手柄。请收集赛道上的 5 颗心。比赛之间机械师美咲会说话,图像机制与 Star Formation 相同(每场的胜利纪念画面、集齐 5 颗心的私人照片、结局、败北场景). 注意障碍物: 堆起来的纸箱(每场 2 处)会挡住部分道路和视线,撞上会被撞得粉碎并减速;油渍(每场 1 处)会让赛车打转两圈;路上可能有行人横穿(每次游戏随机 0 或 1 人),撞到就会游戏结束。",
helpGame10: "Prompt Typer: 输入的文字会原样成为图像提示词的 80 年代风格打字游戏(无背景音乐,仅有音效)。共 10 关、每关 20 个词,每 2 关字数增加。输入的文字(包括打错的)会原样进入提示词。退格可以修改当前的词,但打错的次数不会减少。正确率达到 85% 即可过关。无论是否过关,每关都会生成图像;每关结束后按 Enter 继续(未过关时为重试),R 重试,Q 放弃。在标题画面用 ↑ ↓ 选择打字语言(英语、日语、中文。日语和中文用输入法在输入框中输入,含汉字的词会显示读音,平假名和片假名视为相同),用 ← → 选择开始关卡。日语和中文提示词需要使用能理解该语言的图像模型",
helpGame11: "Sky Heart: 向画面深处飞行的 80 年代风格伪 3D 射击游戏。天空巡逻队的光背着喷气背包飞越全部 5 关(花之平原、水晶峡谷、夕阳之海、霓虹空中都市、月之遗迹),每关最后有首领。子弹会笔直地飞向画面深处,请对准敌人射击;躲开子弹、地面的导弹发射台以及地面上的树木、水晶、岩石、大楼和柱子(从上方或旁边躲开;第 4 关的大楼打 4 发即可摧毁)。用方向键或 WASD 移动,按住 Space 或 Z 射击,Esc 或 P 暂停;也支持手柄。左侧的高度计显示自机和接近中道具的高度。每关空中有 5 颗心、贴近地面也有 5 颗,合计收集 5 颗即可获得私人照片。强化胶囊会出现在空中和地面: 1UP(绿)、可抵挡 3 次攻击的护盾(蓝)、15 秒内一起射击的支援机(橙)。图像机制与 Star Formation 相同",
gameJobStagePrivate: (n, name) => `STAGE ${n}${name ? " " + name : ""} - 私人♥`,
gameAutoGameover: "游戏结束时也生成图像",
gameJobGameover: (n, name) => `GAME OVER - STAGE ${n}${name ? " " + name : ""}`,
gameEachStage: "每通过一关生成一张图像",
gameJobEnding: "ENDING",
gameJobQueued: "等待中",
gameJobDone: "完成",
gameRegenerate: "重新生成",
gamePromptDetails: "提示词",
gameJobStage: (n, name) => `STAGE ${n}${name ? " " + name : ""}`,
gameBgm: "背景音乐",
gameSrcStyle: "画风",
gameSrcCharacter: "女主角",
gameSrcScene: "场景",
gameSrcClear: "关卡",
gameSrcEnemy: "击落",
gameSrcBonus: "奖励",
gameNegativeFromGame: "游戏追加的负面提示词",
gameListTitle: "游戏",
gamePlaySettings: "游戏设置",
gameDifficulty: "难度",
gameDifficultyEasy: "简单",
gameDifficultyNormal: "普通",
gameDifficultyHard: "困难",
gameSound: "音效",
gamePlaySettingsNote: "更改后游戏将重新开始。",
gameGenSettings: "图像生成",
gameWorkflow: "工作流",
gameWorkflowReload: "重新加载工作流列表",
gameBasePrompt: "基础提示词(加在获得的提示词之前)",
gameNegativePrompt: "负面提示词",
gameNegativePlaceholder: "留空则使用工作流自带的负面提示词",
gameAutoGenerate: "结局图像也自动生成",
gameRestart: "重新开始",
gameResultTitle: "结果",
gameSettingsTab: "设置",
gameResultEmpty: "每通过一关,都会在这里生成莉娜的胜利纪念画面。通过全部关卡后生成结局图像,游戏结束时生成败北场景。",
gameFinalPrompt: "用于生成的提示词(可编辑)",
gameGenerate: "生成",
gameOpenInGenerateUI: "在 GenerateUI 中打开",
gamePlayAgain: "再玩一次",
gameLoading: "正在加载游戏...",
gameLoadFailed: (msg) => `无法加载游戏: ${msg}`,
gameCleared: "CLEAR!",
gameOverLabel: "GAME OVER",
gameScore: (n) => `得分: ${n}`,
gameOverNoGenerate: "游戏结束,不生成结局图像。已通过关卡的图像会保留。",
gameRewardsTitle: "获得的提示词(取消勾选可排除):",
gameNoRewards: "没有获得提示词。仅使用基础提示词生成。",
gameNoWorkflow: "Game 设置中未选择工作流。",
gameWorkflowLoadFailed: (name) => `无法加载工作流: ${name}`,
gameNoPositiveNode: "工作流中没有正面提示词节点。",
gameEmptyPrompt: "提示词为空。",
gameGenerating: "生成中...",
gameNoImage: "工作流没有返回图像。",
gameGenerated: (path) => `已保存: ${path}`,
gameGenerateFailed: (msg) => `生成失败: ${msg}`,
helpGameTitle: "Game 标签页(实验性功能)",
helpGameCardOverview: "概述",
helpGameCardGen: "图像生成",
helpGame1: "只有安装了单独的游戏包 ComfyUI-WFS-Games 时才会显示 Game 标签页(启动时检查 /wfs_games/manifest)。未安装时,该标签页和本帮助页都不会显示",
helpGame2: "在左侧的“游戏”列表中选择游戏。游戏在中间运行;点击游戏画面后键盘输入只进入游戏(不会影响 Workflow Studio 的其他操作)。切换到其他标签页或窗口时游戏会暂停。右侧窗格分为“结果”(图像卡片)和“设置”(游戏设置和图像生成设置)两个标签页",
helpGame3: "Star Formation: 80年代街机和电脑(MSX2 / PC-8801)风格的纵向射击游戏——像素画、像素字体、扫描线和芯片音乐风格的背景音乐。共 5 关。敌机编队飞入、列阵,然后俯冲攻击。每关有 5 架敌机闪烁黄色,击落后会掉落“回忆之心”,请在它掉出画面前接住(+500 分;右上角的心形显示获得数)。消灭所有敌机后会出现 WARNING,背景音乐改变,关卡首领登场(画面上方的红色耐久条)。每个首领各有特点: 体型大且耐打、速度快且子弹快、放射状射击、闪烁后直线冲撞、分 3 次每次放出 5 架小型机的巨大母舰。用 ← → 或 A D 移动,Space 或 Z 射击,Esc 或 P 暂停;也支持手柄。在每关的前后,从管制室为你导航的莉娜会在冒险游戏风格的窗口中说话(按 Space、Z、Enter 或点击继续)。最后一架机体被击落后画面变暗,莉娜的呼唤得不到回应,随后 GAME OVER。击落俯冲中的敌机得分翻倍",
helpGame4: "游戏设置: 难度(简单: 5 条命 / 普通: 3 / 困难: 2,敌机射击和俯冲的频率也会变化)、背景音乐和音效。更改后游戏将重新开始。最高分保存在此浏览器中",
helpGame5: "“重新开始”会从标题画面重新开始游戏",
helpGame6: "每通过一关,右侧“结果”中就会添加该关的卡片(最新的在上面),并在后台生成以该关为背景的莉娜胜利纪念画面(比耶、挥手、竖大拇指等);生成期间可以继续游戏(图像按顺序一张一张生成)。如果在该关收集了全部 5 颗心,会显示 PERFECT!,卡片(粉色)会变成莉娜的私人照片,代替胜利纪念画面。随着关卡推进,露出会逐渐增加: 咖啡馆的便服 → 无袖连衣裙 → 露肩上衣和短裤 → 背心和牛仔短裤 → 海边的泳装(最多到泳装;游戏会追加负面标签,不会超过这个程度)。通过全部 5 关后会添加 ENDING 卡片。游戏结束时会添加红色的 GAME OVER 卡片,以失败的关卡为背景,生成莉娜在红色警示灯下昏暗的管制室里哭泣的败北场景。展开卡片的“提示词”可以看到游戏给出的提示词及其种类: 画风(80年代电脑图像风格)、女主角(莉娜的外观)、场景、关卡。取消勾选不需要的提示词或编辑提示词,然后按“重新生成”",
helpGame7: "工作流: 用于生成的工作流(默认 ws_game_sdxl_t2i.json,为 Game 标签页准备的 SDXL(Illustrious)文生图工作流,1216x832,输出到 output/WFS_Game)。提示词写入工作流的正面提示词节点。负面提示词为“负面提示词”设置(为空时使用工作流自带的)加上游戏的负面标签。seed 每次随机",
helpGame8: "可以关闭“每通过一关生成一张图像”“结局图像也自动生成”和“游戏结束时也生成图像”;关闭时,按卡片上的“生成”才会生成。“在 GenerateUI 中打开”会把带有该卡片提示词的工作流加载到 GenerateUI。从标题画面开始新游戏时卡片会被清除(图像保留在 output/WFS_Game)。打开 Game 标签页时不显示 VRAM 调整的提示。设置保存在浏览器中,并包含在备份中",
tsBuild: "创建 / 更新",
tsCancel: "停止",
tsMaxTags: "标签数:",
@@ -5071,9 +5302,9 @@ const LANGUAGES = {
helpSettings5: "AI助手设置已从此标签页移出——Prompt标签页、Tagger标签页、AI TOOL标签页现在各自拥有独立的⚙设置按钮(后端、URL、模型、Thinking mode、Max tokens、卸载模型),分别单独保存",
helpSettings6: "默认工作流设置/取消",
helpSettings7: "Eagle集成URL、自动保存开关",
helpSettings8: "数据管理:将设置、元数据、提示词等主要数据导出为JSON文件,或导入以恢复。导入后请重启ComfyUI。",
helpSettings15: "完整备份 (ZIP):与上方的JSON导出不同,还包含文件夹型数据(AI Skills、Lab Plan、Video Plan、Video Edit项目、Style预设)以及Tagger数据库。恢复会覆盖现有文件,恢复后请重启ComfyUI。",
helpSettings16: "完整备份按钮上方的两个复选框可将ComfyUI默认工作流文件夹和Impact Pack的wildcard文件夹一并导出。两者均仅用于导出,不会自动恢复。如需要,请从ZIP中的_external/文件夹手动复制回去。第三个复选框可包含已保存的Video Edit项目所引用的片段、BGM、附加音效和叠加片段(项目中只保存对ComfyUI input文件夹内文件的引用)。与另外两项不同,这些文件在恢复时会放回input文件夹(已存在同名文件时跳过)。",
helpSettings8: "数据管理:将设置、元数据、提示词等主要数据导出为JSON文件,或导入以恢复。浏览器端保存的设置(工作流/预设分组、徽章颜色、外观、AI·决策模型·显存调整设置、各类预设)也会一并导出,并在导入时恢复(之后请刷新页面)。导入后请重启ComfyUI。",
helpSettings15: "完整备份 (ZIP):与上方的JSON导出不同,还包含文件夹型数据(AI Skills、Lab Plan、Video Plan、Video Edit项目、Style预设)、Tagger数据库、Gallery语义搜索设置以及浏览器端保存的设置。临时文件和旧版本中已不再使用的models/文件夹不会包含在内。恢复会覆盖现有文件,并写回浏览器端设置(请刷新页面);恢复后请重启ComfyUI。",
helpSettings16: "完整备份按钮上方的复选框:ComfyUI默认工作流文件夹和Impact Pack的wildcard文件夹(仅用于导出,不会自动恢复;如需要,请从ZIP中的_external/文件夹手动复制回去);已保存的Video Edit项目所引用的片段、BGM、附加音效和叠加片段(项目只保存对input文件夹内文件的引用;恢复时放回input文件夹,已存在同名文件时跳过);Gallery语义搜索索引(默认开启:重建需要重新嵌入所有图片,使用Gemini时会产生API费用);TagSpace缓存(默认关闭:可在TagSpace标签中重建)。",
helpSettings17: "决策模型:独立的设置区块,与 AI TOOL / Tagger 的 LLM/VLM 后端分开,可同时使用 — 后端、URL、模型以及默认概率阈值(低于该值的回答作为待确认的建议)。Unsloth:Laya 系列模型(laya / laya-multilingual / laya-english / laya-typed-decisions);需要在 Unsloth Desktop 中启用 Settings → API → Decision API → Serve requests(否则返回 HTTP 404“The Decision API is off”),并在 .env 中设置 UNSLOTH_API_KEY(或开启 Keyless API access →「Chat and inference」)。Ollama(0.35+):列出 capabilities 含「decision」的已安装模型(tev1、tev1:0.8b、nimble — 需先 ollama pull,↻ 刷新列表);无需密钥。测试按钮使用未保存的表单值发送一个是/否问题(首次请求需加载模型)。",
helpSettings18: "Video Volume(视频音量):用一个滑块(0–100%)设置 Video 标签预览以及 Gallery 详情 / 灯箱 / 对比视图中视频播放器的音量;此处设置的音量(或在任一视频自身控件中调整的音量)会沿用到应用内下一个打开的视频",
helpSettings19: "Gallery 输出文件夹:Gallery 标签浏览的 ComfyUI 输出文件夹——留空则使用 ComfyUI 默认输出目录;「应用」即时生效,「默认」恢复默认,当前使用的文件夹显示在输入框下方",
@@ -5083,7 +5314,7 @@ const LANGUAGES = {
helpSettings23: "模型文件夹:可添加额外的模型根文件夹(例如 Stability Matrix 的 Models),其中的子文件夹(StableDiffusion / Lora / VAE / ControlNet / TextEncoders / DiffusionModels / Embeddings / HyperNetworks,或 checkpoints / loras 等ComfyUI名称)会与ComfyUI自带文件夹一起显示在Models标签页;多个根文件夹用 ; 分隔,“应用”保存,“默认”清除",
helpSettings24: "Windows 稳定性:开启“在Windows上使用Selector事件循环”会把ComfyUI的asyncio循环从Proactor切换为Selector(下次启动ComfyUI时生效)。如果切换加载大量预览图的Models列表后ComfyUI完全卡死,请开启。代价是不支持asyncio子进程,并发连接数上限约为512。也可通过环境变量 WFS_SELECTOR_LOOP=1 切换",
helpSettings25: "显存调整(Ollama):在 Workflow Studio 每次生成图像之前(GenerateUI・Lab・批量・Video・AI TOOL 的 Chat 生成等,无论从哪里执行都相同),卸载 Ollama 已加载的模型以腾出显存。生成前的操作:“不做任何操作”(默认)/“仅在空闲显存低于目标时卸载所需的部分”(从显存占用最大的模型开始逐个卸载,达到目标后停止)/“每次全部卸载”。空闲显存以 nvidia-smi 的实测值判断(ComfyUI 显示的空闲显存在 Ollama 加载模型后可能不变;非 NVIDIA GPU 使用 ComfyUI 的值)。对象为本机的 Ollama:默认的 127.0.0.1:11434,以及使用 Ollama 的 AI TOOL・Prompt・Tagger 的 AI 设置和决策模型(其他主机仅在 WFS_ALLOWED_BACKEND_HOSTS 允许时)。LM Studio 等的模型和 ComfyUI 自身的模型不在范围内。卸载的模型在下次使用时会重新加载;卸载时、未达到目标时或失败时会以提示通知,失败也会继续生成。“立即全部卸载”可当场卸载所有已加载的 Ollama 模型。侧面板的 A 标签 → Settings →“VRAM (Ollama)”中也有相同的“Unload all now”按钮。直接在 ComfyUI 画布上运行的生成不在范围内",
helpSettings26: "提示词翻译(母语 → 英语):默认关闭。使用本地 Ollama 模型翻译提示词:PLaMo 3 Translate(0.8B/2B/8B/31B;Ollama 中尚未下载的模型可用“下载”按钮获取),也可通过翻译指令使用其他 Ollama 模型。设置项包括:输入语言(自动检测或 PLaMo 支持的 51 种语言)、Ollama URL、翻译模型的运行位置(GPU:每个短语约 0.1 秒;开启“翻译后从显存卸载”时,每次都要等待约 4 秒重新加载模型/CPU 常驻:每个短语约 0.3 秒,不占显存,打开生成UI时在后台加载),以及“运行时自动翻译”(生成UI 的 Generate:用翻译结果替换栏中文本/Lab Run・Video Plan Run:只翻译发送的内容,计划中保留原文)。翻译失败时不会生成。“测试”会翻译一段示例提示词。翻译句子时 2B 比 0.8B 更准确。PLaMo 3 Translate 可免费用于个人和非商业用途(PLaMo 社区许可证)。PLaMo 模型也可用于 AI TOOL、Prompt 标签的 AI 助手和侧面板 A 标签的翻译(以 PLaMo 要求的格式指定语言)",
helpSettings26: "提示词翻译(母语 → 英语):默认关闭。使用本地 Ollama 模型翻译提示词:PLaMo 3 Translate(0.8B/2B/8B/31B;Ollama 中尚未下载的模型可用“下载”按钮获取),也可通过翻译指令使用其他 Ollama 模型。设置项包括:输入语言(自动检测或 PLaMo 支持的 51 种语言)、Ollama URL、翻译模型的运行位置(GPU:每个短语约 0.1 秒;开启“翻译后从显存卸载”时,每次都要等待约 4 秒重新加载模型/CPU 常驻:每个短语约 0.3 秒,不占显存,在生成UI中载入工作流时于后台加载),以及“运行时自动翻译”(生成UI 的 Generate:用翻译结果替换栏中文本/Lab Run・Video Plan Run:只翻译发送的内容,计划中保留原文)。翻译失败时不会生成。“测试”会翻译一段示例提示词。翻译句子时 2B 比 0.8B 更准确。PLaMo 3 Translate 可免费用于个人和非商业用途(PLaMo 社区许可证)。PLaMo 模型也可用于 AI TOOL、Prompt 标签的 AI 助手和侧面板 A 标签的翻译(以 PLaMo 要求的格式指定语言)",
helpSettings9: "各部分可折叠展开",
helpSettings10: "Wildcard Integration:将WFS通配符目录链接到ComfyUI-Impact-Pack的wildcards目录(Windows为目录联结,其他OS为符号链接);现有文件自动迁移",
helpSettings11: "文字大小:单个滑块(10–28 px)可一次性调整所有提示词和聊天文本框的字体大小 — GenerateUI正/负向提示词、AI助手聊天输入、预设正/负向提示、通配符提示和文件编辑器、元数据提示词全文预览;即时生效并通过「保存设置」保存",
@@ -5458,7 +5689,7 @@ const LANGUAGES = {
promptTranslateDevice: "翻译模型的运行位置",
promptTranslateDeviceGpu: "GPU(单次翻译最快,占用显存)",
promptTranslateDeviceCpu: "CPU常驻(不占显存,无需等待重新加载)",
promptTranslateDeviceHint: "CPU模式将模型常驻在内存中(2B约2GB),并在打开生成UI时于后台加载。由于不占用显存,也不会发生约4秒的重新加载,每个短语约0.3秒即可完成翻译。GPU模式每个短语约0.1秒更快,但开启“翻译后从显存卸载”时,每次翻译都要等待约4秒重新加载模型。",
promptTranslateDeviceHint: "CPU模式将模型常驻在内存中(2B约2.7GB),并在生成UI中载入工作流时于后台加载。由于不占用显存,也不会发生约4秒的重新加载,每个短语约0.3秒即可完成翻译。GPU模式每个短语约0.1秒更快,但开启“翻译后从显存卸载”时,每次翻译都要等待约4秒重新加载模型。",
promptTranslateError: (msg) => `翻译错误: ${msg}`,
promptTranslateModelsError: (msg) => `无法获取模型列表: ${msg}`,
settingsTitle: "设置",
@@ -5516,6 +5747,7 @@ const LANGUAGES = {
vramEnough: (a, tgt) => `空闲 ${a} GB(已达到目标 ${tgt} GB,无需卸载)`,
vramShort: (a, tgt) => `空闲 ${a} GB 未达到目标 ${tgt} GB(没有可卸载的 Ollama 模型)`,
vramNothingLoaded: (a) => `没有已加载的 Ollama 模型(空闲 ${a} GB)`,
vramKeptCpu: (names) => `CPU 常驻模型已保留(不占用显存): ${names}`,
vramUnreachable: (urls) => `无法连接 Ollama:${urls}`,
vramPrepareFailed: (msg) => `显存调整失败(继续生成):${msg}`,
compatCheck: "GenerateUI 检查",
@@ -5548,7 +5780,7 @@ const LANGUAGES = {
eagleUrl: "Eagle URL",
eagleAutoSave: "自动保存生成图片到Eagle",
dataManagement: "数据管理",
dataManagementHint: "将设置、元数据、提示词等主要数据导出为JSON文件,或导入之前导出的文件以恢复数据。导入后请重启ComfyUI以使更改生效。",
dataManagementHint: "将设置、元数据、提示词等主要数据以及浏览器端保存的设置(分组、徽章颜色、外观、AI·显存调整设置、各类预设)导出为JSON文件,或导入之前导出的文件以恢复数据。导入后请刷新页面并重启ComfyUI。",
exportData: "导出",
importData: "导入",
exportSuccess: "导出完成",
@@ -5557,11 +5789,16 @@ const LANGUAGES = {
importError: "导入失败",
exportFullBackup: "完整备份 (ZIP)",
importFullBackup: "恢复完整备份 (ZIP)",
fullBackupHint: "完整备份(ZIP)还包含上方JSON导出无法表示的文件夹型数据(AI Skills、Lab Plan、Video Plan、Video Edit项目、Style预设)以及Tagger数据库。恢复会覆盖现有文件,恢复后请重启ComfyUI。",
fullBackupHint: "完整备份(ZIP)还包含上方JSON导出无法表示的文件夹型数据(AI Skills、Lab Plan、Video Plan、Video Edit项目、Style预设)、Tagger数据库和语义搜索设置。恢复会覆盖现有文件,恢复后请刷新页面并重启ComfyUI。",
fullBackupFilesUnit: "个文件",
fullBackupIncludeWorkflows: "包含默认工作流文件夹 (user/default/workflows)",
fullBackupIncludeWildcard: "包含Impact Pack的wildcard文件夹(如存在)",
fullBackupIncludeVideoMedia: "包含Video Edit项目使用的素材(input文件夹中的片段/BGM/附加音效/叠加片段;恢复到input,不覆盖已有文件)",
browserStorageRestored: (n) => `已恢复 ${n} 项浏览器端设置(刷新页面后生效)`,
reloadPage: "刷新页面",
fullBackupBuilding: "正在创建备份…",
fullBackupIncludeTagspace: "包含TagSpace缓存(体积较大;可在TagSpace标签中重建)",
fullBackupIncludeSemantic: "包含Gallery语义搜索索引(重建需要重新嵌入所有图片;使用Gemini时会产生API费用)",
fullBackupMediaResult: "Video Edit素材:已恢复 {restored} 个,{existing} 个已存在",
fullBackupExternalHint: "这些仅用于导出,恢复备份时不会处理它们。如需要,请从ZIP中的_external/文件夹手动复制回去。",
saveSettings: "保存设置",
+36 -49
View File
@@ -2,7 +2,8 @@
* Prompt Translate — type GenerateUI prompts in your own language and translate
* them into English with a local Ollama model (PLaMo 3 Translate by default).
*
* Works like the A1111 prompt-translator extensions: only the parts of a prompt
* Works like the A1111 prompt-translator extensions (the splitting runs on the
* server, POST /api/wfm/translate/prompt): only the parts of a prompt
* that contain non-ASCII letters are sent to the model. Prompt syntax such as
* commas, (weights:1.2), [ ], {a|b}, <lora:...>, __wildcards__,
* embedding:name and BREAK/AND is kept as it is, so a mixed prompt like
@@ -45,65 +46,46 @@ export function setTranslateConfig(patch) {
}
// ------------------------------------------------------------
// Prompt splitting
// Translation (prompt splitting lives on the server: translate_service.split_prompt)
// ------------------------------------------------------------
// Spans that are never translated: prompt syntax and delimiters.
const PROTECTED_RE = /\b(?:BREAK|AND)\b|<[^<>\n]*>|__[^\s_][^\s]*?__|embedding:[^\s,()[\]{}|]+|:\s*-?\d+(?:\.\d+)?|[,\n()[\]{}|]/g;
// A piece needs translation when it contains a non-ASCII letter (CJK, Cyrillic, accented Latin, ...).
const NEEDS_TRANSLATION_RE = /(?![\x00-\x7F])\p{L}/u;
/** Split a prompt into [{ text, translate }] pieces. Joining all .text gives back the input. */
export function splitPrompt(text) {
const pieces = [];
let last = 0;
for (const m of text.matchAll(PROTECTED_RE)) {
if (m.index > last) pieces.push(text.slice(last, m.index));
pieces.push({ keep: m[0] });
last = m.index + m[0].length;
}
if (last < text.length) pieces.push(text.slice(last));
return pieces.map((p) => {
if (typeof p !== "string") return { text: p.keep, translate: false };
return { text: p, translate: NEEDS_TRANSLATION_RE.test(p) };
});
}
// Cheap client-side check before calling the server: any non-ASCII letter at all.
// The server decides which pieces really go to the model (prompt syntax is skipped).
const NON_ASCII_LETTER_RE = /(?![\x00-\x7F])\p{L}/u;
export function needsTranslation(text) {
return splitPrompt(text || "").some((p) => p.translate);
return NON_ASCII_LETTER_RE.test(text || "");
}
// Keep the surrounding whitespace of a piece and tidy the model output for prompt use.
function _rebuild(source, translated) {
const lead = source.match(/^\s*/)[0];
const trail = source.match(/\s*$/)[0];
const core = source.trim();
let out = (translated || "").replace(/\s*\n+\s*/g, " ").trim();
// A tag such as "赤いドレス" should not become "Red dress." — drop the final period
// unless the source itself was a full sentence.
if (!/[。..!?!?]$/.test(core)) out = out.replace(/[.。]+$/, "");
// "少女、(" -> "girl, (" rather than "girl,(" — a Japanese comma needs no space, an English one does.
if (!trail && /[,;:]$/.test(out)) out += " ";
return lead + out + trail;
}
/** Translate a whole prompt string. Throws on backend errors. */
export async function translatePrompt(text) {
const pieces = splitPrompt(text || "");
const cores = [...new Set(pieces.filter((p) => p.translate).map((p) => p.text.trim()))];
if (cores.length === 0) return text;
const res = await fetch("/api/wfm/translate", {
async function _postPrompt(body) {
const res = await fetch("/api/wfm/translate/prompt", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ texts: cores }),
body: JSON.stringify(body),
});
const data = await res.json().catch(() => ({}));
if (!res.ok || data.status !== "success") {
throw new Error(data.message || `HTTP ${res.status}`);
}
const map = new Map(cores.map((c, i) => [c, data.translations[i] ?? c]));
return pieces.map((p) => (p.translate ? _rebuild(p.text, map.get(p.text.trim())) : p.text)).join("");
return data;
}
/** Translate a whole prompt string, keeping prompt syntax. Throws on backend errors. */
export async function translatePrompt(text) {
if (!needsTranslation(text)) return text;
const data = await _postPrompt({ text });
return data.translated ?? text;
}
/** Translate several prompt strings in one request (same order). */
export async function translatePrompts(texts) {
const idx = [];
texts.forEach((x, i) => { if (needsTranslation(x)) idx.push(i); });
if (idx.length === 0) return texts.slice();
const data = await _postPrompt({ texts: idx.map((i) => texts[i]) });
const out = texts.slice();
idx.forEach((i, k) => { out[i] = data.translations?.[k] ?? texts[i]; });
return out;
}
// Replace textarea text while keeping the browser's Ctrl+Z history where possible.
@@ -179,13 +161,17 @@ export async function isAutoTranslateOn(kind) {
* Throws on translation failure so the caller can stop the batch.
*/
export async function translateWorkflowPrompts(workflow, promptNodes) {
const targets = [];
for (const n of promptNodes || []) {
const inputs = workflow?.[n.id]?.inputs;
const key = n.textKey || "text";
if (inputs && typeof inputs[key] === "string" && needsTranslation(inputs[key])) {
inputs[key] = await translatePrompt(inputs[key]);
targets.push({ inputs, key });
}
}
if (targets.length === 0) return workflow;
const out = await translatePrompts(targets.map((x) => x.inputs[x.key]));
targets.forEach((x, i) => { x.inputs[x.key] = out[i]; });
return workflow;
}
@@ -226,7 +212,8 @@ export function attachTranslateButtons(root = document) {
const label = btn.textContent;
btn.textContent = "…";
try {
await translateTextarea(ta);
// false = only prompt syntax / unchanged (e.g. a non-ASCII <lora:...> name)
if (!(await translateTextarea(ta))) showToast(t("promptTranslateNothing"), "info");
} catch (err) {
showToast(t("promptTranslateError", err.message), "error");
} finally {
+81 -15
View File
@@ -430,6 +430,56 @@ export function getSavedTheme() {
return loadLocalSettings().theme || "";
}
// ---- Browser-side settings in backups ----
// Settings kept in localStorage (groups, badge palette, appearance, AI / decision / VRAM
// settings, presets, ...) travel with both the JSON export and the full backup. Same key
// rule as the server (_clean_browser_storage in settings_routes.py).
const BROWSER_STORAGE_KEY_RE = /^(?:wfm|ie)_[A-Za-z0-9_-]{1,100}$/;
const BROWSER_STORAGE_TRANSIENT = new Set(["wfm_pending_workflow", "wfm_library_filter_request"]);
function collectBrowserStorage() {
const out = {};
try {
for (let i = 0; i < localStorage.length; i++) {
const k = localStorage.key(i);
if (k && BROWSER_STORAGE_KEY_RE.test(k) && !BROWSER_STORAGE_TRANSIENT.has(k)) {
out[k] = localStorage.getItem(k);
}
}
} catch { /* storage unavailable: back up server data only */ }
return out;
}
/** Write restored keys into localStorage; returns how many were written. */
function restoreBrowserStorage(data) {
let n = 0;
for (const [k, v] of Object.entries(data || {})) {
if (typeof v !== "string" || !BROWSER_STORAGE_KEY_RE.test(k) || BROWSER_STORAGE_TRANSIENT.has(k)) continue;
try { localStorage.setItem(k, v); n++; } catch { /* quota: skip */ }
}
return n;
}
/** Append "N browser settings restored — Reload" to the data status line. */
function appendBrowserRestoreNote(statusEl, count) {
if (!count) return;
statusEl.append(" / " + t("browserStorageRestored", count) + " ");
const btn = document.createElement("button");
btn.className = "wfm-btn wfm-btn-sm";
btn.textContent = t("reloadPage");
btn.addEventListener("click", () => location.reload());
statusEl.append(btn);
}
function downloadBlob(blob, filename) {
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
a.click();
URL.revokeObjectURL(url);
}
export async function initSettingsTab() {
const container = document.querySelector("#wfm-tab-settings .wfm-settings-container");
if (!container) return;
@@ -952,6 +1002,14 @@ export async function initSettingsTab() {
<input type="checkbox" id="wfm-settings-backup-include-video-media">
${t("fullBackupIncludeVideoMedia")}
</label>
<label class="wfm-lab-checkbox-label" style="font-size:12px;">
<input type="checkbox" id="wfm-settings-backup-include-semantic" checked>
${t("fullBackupIncludeSemantic")}
</label>
<label class="wfm-lab-checkbox-label" style="font-size:12px;">
<input type="checkbox" id="wfm-settings-backup-include-tagspace">
${t("fullBackupIncludeTagspace")}
</label>
<span style="font-size:11px;color:var(--wfm-text-secondary);">${t("fullBackupExternalHint")}</span>
</div>
<div style="display:flex;gap:8px;flex-wrap:wrap;">
@@ -1678,13 +1736,10 @@ export async function initSettingsTab() {
try {
const res = await fetch("/api/wfm/settings/export");
if (!res.ok) throw new Error(await res.text());
const blob = await res.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "wfm-data-export.json";
a.click();
URL.revokeObjectURL(url);
const bundle = await res.json();
bundle.__browser_storage = collectBrowserStorage();
downloadBlob(new Blob([JSON.stringify(bundle, null, 2)], { type: "application/json" }),
"wfm-data-export.json");
statusEl.textContent = t("exportSuccess");
statusEl.style.color = "var(--wfm-success, #4caf50)";
} catch (e) {
@@ -1711,6 +1766,7 @@ export async function initSettingsTab() {
const imported = result.imported?.join(", ") || "-";
statusEl.textContent = t("importSuccess") + ": " + imported;
statusEl.style.color = "var(--wfm-success, #4caf50)";
appendBrowserRestoreNote(statusEl, restoreBrowserStorage(result.browser_storage));
} catch (e) {
statusEl.textContent = t("importError") + ": " + e.message;
statusEl.style.color = "var(--wfm-error, #f44336)";
@@ -1724,15 +1780,24 @@ export async function initSettingsTab() {
const includeWorkflows = document.getElementById("wfm-settings-backup-include-workflows")?.checked ? "1" : "0";
const includeWildcard = document.getElementById("wfm-settings-backup-include-wildcard")?.checked ? "1" : "0";
const includeVideoMedia = document.getElementById("wfm-settings-backup-include-video-media")?.checked ? "1" : "0";
const res = await fetch(`/api/wfm/settings/export-full?include_workflows=${includeWorkflows}&include_wildcard=${includeWildcard}&include_video_media=${includeVideoMedia}`);
const includeSemantic = document.getElementById("wfm-settings-backup-include-semantic")?.checked ? "1" : "0";
const includeTagspace = document.getElementById("wfm-settings-backup-include-tagspace")?.checked ? "1" : "0";
statusEl.textContent = t("fullBackupBuilding");
statusEl.style.color = "var(--wfm-text-secondary)";
const res = await fetch("/api/wfm/settings/export-full", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
include_workflows: includeWorkflows,
include_wildcard: includeWildcard,
include_video_media: includeVideoMedia,
include_semantic_index: includeSemantic,
include_tagspace: includeTagspace,
browser_storage: collectBrowserStorage(),
}),
});
if (!res.ok) throw new Error(await res.text());
const blob = await res.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "wfm-full-backup.zip";
a.click();
URL.revokeObjectURL(url);
downloadBlob(await res.blob(), "wfm-full-backup.zip");
statusEl.textContent = t("exportSuccess");
statusEl.style.color = "var(--wfm-success, #4caf50)";
} catch (e) {
@@ -1763,6 +1828,7 @@ export async function initSettingsTab() {
}
statusEl.textContent = msg;
statusEl.style.color = "var(--wfm-success, #4caf50)";
appendBrowserRestoreNote(statusEl, restoreBrowserStorage(result.browser_storage));
} catch (e) {
statusEl.textContent = t("importError") + ": " + e.message;
statusEl.style.color = "var(--wfm-error, #f44336)";
+13 -1
View File
@@ -13,6 +13,8 @@
import { t } from "./i18n.js";
import { showToast } from "./app.js";
const _showToast = showToast;
import { readJsonStorage, getAiBackendDefaultUrl } from "./util.js";
import { getDecisionSettings } from "./decision-client.js";
@@ -68,6 +70,12 @@ const gb = (mb) => (mb / 1024).toFixed(1);
/** One-line summary of a result (Settings tab status and pre-generation toast) */
export function describeVramResult(d) {
const msg = _describeVramMain(d);
// CPU-resident models (size_vram 0, e.g. the prompt translator) are left loaded on purpose.
return d.kept_cpu?.length ? msg + " / " + t("vramKeptCpu", d.kept_cpu.join(", ")) : msg;
}
function _describeVramMain(d) {
if (d.unloaded.length) {
let msg = t("vramUnloaded", d.unloaded.map((u) => u.name).join(", "), gb(d.free_before_mb), gb(d.free_after_mb));
if (d.failed.length) msg += " / " + t("vramFailedModels", d.failed.join(", "));
@@ -141,10 +149,14 @@ let _lastShortNote = "";
* Call right before queuing a generation. Does nothing when the mode is off; never throws.
* Shows a toast only when something was unloaded, the target can't be reached, or it failed
* (the same "can't reach target" note isn't repeated across a batch).
* quiet: no toast, console only. Used for generation from the Game tab, and whenever the Game
* tab is open (the toast would cover the game screen).
*/
export async function prepareVramForGeneration() {
export async function prepareVramForGeneration({ quiet = false } = {}) {
const settings = getVramSettings();
if (settings.mode === "off") return null;
if (!quiet && document.getElementById("wfm-tab-game")?.classList.contains("active")) quiet = true;
const showToast = quiet ? (msg) => console.info("[WFS] vram:", msg) : _showToast;
try {
const d = await requestVramPrepare(settings.mode, settings.targetGb);
const short = d.mode === "auto" && !d.reached;
+39 -4
View File
@@ -12,6 +12,7 @@
<link rel="stylesheet" href="/wfm_static/css/lab-tab.css">
<link rel="stylesheet" href="/wfm_static/css/video-tab.css">
<link rel="stylesheet" href="/wfm_static/css/tagspace-tab.css">
<link rel="stylesheet" href="/wfm_static/css/game-tab.css">
</head>
<body>
<!-- Header -->
@@ -30,6 +31,8 @@
<button class="wfm-tab" data-tab="video">Video</button>
<button class="wfm-tab" data-tab="tagger">Tagger</button>
<button class="wfm-tab" data-tab="tagspace">TagSpace</button>
<!-- Game: ComfyUI-WFS-Games がインストールされているときだけ game-tab.js が表示する -->
<button class="wfm-tab" data-tab="game" hidden>Game</button>
<button class="wfm-tab" data-tab="settings">Settings</button>
<button class="wfm-tab" data-tab="help">Help</button>
<button class="wfm-tab" data-tab="ai">AI TOOL</button>
@@ -1359,6 +1362,7 @@
<button class="wfm-help-nav-item" data-help-page="tagspace">TagSpace Tab</button>
<button class="wfm-help-nav-item" data-help-page="imageedit">Image Edit Tab</button>
<button class="wfm-help-nav-item" data-help-page="video">Video Tab</button>
<button class="wfm-help-nav-item" data-help-page="game" hidden>Game Tab</button>
<button class="wfm-help-nav-item" data-help-page="shortcuts">Keyboard Shortcuts</button>
<button class="wfm-help-nav-item" data-help-page="trouble">Troubleshooting</button>
</div>
@@ -1695,7 +1699,7 @@
<li id="wfm-help-settings-22">G'MIC-Qt Integration: path to the G'MIC-Qt executable (gmic_qt.exe) used by the Image Edit tab's G'MIC filter (Edit with G'MIC); Save stores it — see the Image Edit help for installing G'MIC-Qt</li>
<li id="wfm-help-settings-17">Decision Model: its own section, independent of the AI TOOL / Tagger LLM/VLM backends so it can be used alongside them — backend, URL, model and a default probability threshold (answers below it are treated as suggestions to confirm). Unsloth: Laya models (laya / laya-multilingual / laya-english / laya-typed-decisions); requires Settings → API → Decision API → Serve requests in Unsloth Desktop (otherwise HTTP 404 "The Decision API is off") and either UNSLOTH_API_KEY in .env or Keyless API access → "Chat and inference". Ollama (0.35+): lists installed models whose capabilities include "decision" (tev1, tev1:0.8b, nimble — ollama pull first; ↻ refreshes the list); no key needed. Test sends one yes/no question with the unsaved form values; the first request loads the model.</li>
<li id="wfm-help-settings-25">VRAM Management (Ollama): right before every image generation from Workflow Studio, unload the models Ollama has loaded to free VRAM (off / only as much as needed to reach a target free VRAM / everything every time); free VRAM is measured with nvidia-smi; &quot;Unload all now&quot; unloads them immediately; the same "Unload all now" is also in the sidepanel A tab → Settings → VRAM (Ollama). Running a workflow from the ComfyUI canvas itself is not covered</li>
<li id="wfm-help-settings-26">Prompt Translation (native language → English): off by default. Translates prompts with a local Ollama model — PLaMo 3 Translate (0.8B / 2B / 8B / 31B; models not yet in Ollama can be fetched with the Download button) or any other Ollama model through a translation instruction. Options: source language (auto-detect or one of the 51 languages PLaMo supports), Ollama URL, where to run the model — GPU (about 0.1 s per phrase; with &quot;Unload after translating&quot; on, each translation first waits about 4 s for the model to reload) or CPU kept loaded (about 0.3 s per phrase, no VRAM, loaded in the background when GenerateUI opens) — and &quot;Translate automatically when running&quot; for GenerateUI Generate (replaces the prompt text with the translation), Lab Run and Video Plan Run (translate only what is sent; the plan keeps your text). If translation fails, nothing is generated. Test translates a sample prompt. 2B translates sentences more accurately than 0.8B. PLaMo 3 Translate is free for personal and non-commercial use (PLaMo Community License). PLaMo models also work for the AI TOOL / Prompt tab AI Assistant / sidepanel A tab translation buttons (the languages are passed in the format PLaMo expects)</li>
<li id="wfm-help-settings-26">Prompt Translation (native language → English): off by default. Translates prompts with a local Ollama model — PLaMo 3 Translate (0.8B / 2B / 8B / 31B; models not yet in Ollama can be fetched with the Download button) or any other Ollama model through a translation instruction. Options: source language (auto-detect or one of the 51 languages PLaMo supports), Ollama URL, where to run the model — GPU (about 0.1 s per phrase; with &quot;Unload after translating&quot; on, each translation first waits about 4 s for the model to reload) or CPU kept loaded (about 0.3 s per phrase, no VRAM, loaded in the background when a workflow is loaded into GenerateUI) — and &quot;Translate automatically when running&quot; for GenerateUI Generate (replaces the prompt text with the translation), Lab Run and Video Plan Run (translate only what is sent; the plan keeps your text). If translation fails, nothing is generated. Test translates a sample prompt. 2B translates sentences more accurately than 0.8B. PLaMo 3 Translate is free for personal and non-commercial use (PLaMo Community License). PLaMo models also work for the AI TOOL / Prompt tab AI Assistant / sidepanel A tab translation buttons (the languages are passed in the format PLaMo expects)</li>
</ul>
</div>
<div class="wfm-help-card">
@@ -1721,9 +1725,9 @@
<div class="wfm-help-card">
<h3 id="wfm-help-settings-card-misc-title">Data &amp; Misc</h3>
<ul>
<li id="wfm-help-settings-8">Data Management: export core settings, metadata, and prompts to a JSON file, or import to restore. After importing, restart ComfyUI.</li>
<li id="wfm-help-settings-15">Full Backup (ZIP): unlike the JSON export above, also includes folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets) and the Tagger database — everything the JSON export can't represent. Restoring overwrites existing files; restart ComfyUI afterward.</li>
<li id="wfm-help-settings-16">Two opt-in checkboxes above the Full Backup buttons additionally include ComfyUI's default workflows folder and the Impact Pack's wildcard folder in the export — both export-only, never restored automatically; copy the ZIP's _external/ folder back by hand if you want them. A third checkbox includes the clips, BGM, sounds and overlay clips referenced by saved Video Edit projects (projects only store references to files in ComfyUI's input folder) — unlike the other two, these are restored into the input folder, skipping any file that already exists there.</li>
<li id="wfm-help-settings-8">Data Management: export core settings, metadata, and prompts to a JSON file, or import to restore. The browser-side settings (workflow and preset groups, badge colors, appearance, AI / decision model / VRAM settings, presets) are included too and restored on import — reload the page afterward. Restart ComfyUI after importing.</li>
<li id="wfm-help-settings-15">Full Backup (ZIP): unlike the JSON export above, also includes folder-based data (AI Skills, Lab Plans, Video Plans, Video Edit projects, Style presets), the Tagger database, the Gallery semantic search settings, and the browser-side settings. Temporary files and the unused models/ folder of older versions are left out. Restoring overwrites existing files and writes the browser-side settings back (reload the page); restart ComfyUI afterward.</li>
<li id="wfm-help-settings-16">Checkboxes above the Full Backup buttons: ComfyUI's default workflows folder and the Impact Pack's wildcard folder (export-only, never restored automatically; copy the ZIP's _external/ folder back by hand if you want them); the clips, BGM, sounds and overlay clips referenced by saved Video Edit projects (projects only store references to files in ComfyUI's input folder — restored into the input folder, skipping files that already exist); the Gallery semantic search index (on by default: rebuilding it re-embeds every image, which costs API usage with Gemini); and the TagSpace cache (off by default: it can be rebuilt from the TagSpace tab).</li>
<li id="wfm-help-settings-13">CivitAI Host: choose between civitai.com (SFW only) and civitai.red (unrestricted) — determines which site opens when clicking a model link in the Models tab CivitAI panel</li>
<li id="wfm-help-settings-21">CivitAI API Key: optional key for authenticated CivitAI access from the Models tab (get it at civitai.com → Account Settings → API Keys); stored in settings.json but left out of the JSON export and Full Backup, and the CIVITAI_API_KEY environment variable takes priority when set</li>
<li id="wfm-help-settings-24">Windows Stability: "Use the Selector event loop on Windows" switches ComfyUI's asyncio loop from Proactor to Selector (applied at the next ComfyUI start). Turn it on if ComfyUI freezes entirely after switching Models lists that load many preview images; the trade-offs are no asyncio subprocess support and a connection limit of about 512. The same switch is available through the WFS_SELECTOR_LOOP=1 environment variable</li>
@@ -2050,6 +2054,34 @@
</div>
</div>
<div class="wfm-help-page" id="wfm-help-page-game">
<div class="wfm-help-article-header">
<h2 id="wfm-help-game-title">Game Tab (experimental)</h2>
<button type="button" class="wfm-btn wfm-btn-sm wfm-help-jump-btn" data-jump-tab="game">Open tab &rarr;</button>
</div>
<div class="wfm-help-card">
<h3 id="wfm-help-game-card-overview-title">Overview</h3>
<ul>
<li id="wfm-help-game-1"></li>
<li id="wfm-help-game-2"></li>
<li id="wfm-help-game-3"></li>
<li id="wfm-help-game-4"></li>
<li id="wfm-help-game-5"></li>
<li id="wfm-help-game-9"></li>
<li id="wfm-help-game-10"></li>
<li id="wfm-help-game-11"></li>
</ul>
</div>
<div class="wfm-help-card">
<h3 id="wfm-help-game-card-gen-title">Image Generation</h3>
<ul>
<li id="wfm-help-game-6"></li>
<li id="wfm-help-game-7"></li>
<li id="wfm-help-game-8"></li>
</ul>
</div>
</div>
<div class="wfm-help-page" id="wfm-help-page-imageedit">
<div class="wfm-help-article-header">
<h2 id="wfm-help-imageedit-title">Image Edit Tab</h2>
@@ -3451,6 +3483,9 @@
<!-- TagSpace Tab (内容は tagspace-tab.js が生成) -->
<section id="wfm-tab-tagspace" class="wfm-tab-content"></section>
<!-- Game Tab (内容は game-tab.js が生成。ゲームパック未インストール時は使われない) -->
<section id="wfm-tab-game" class="wfm-tab-content"></section>
<!-- AI Tab -->
<section id="wfm-tab-ai" class="wfm-tab-content">
<!-- Translation pane -->
+116
View File
@@ -0,0 +1,116 @@
{
"3": {
"class_type": "KSampler",
"inputs": {
"model": [
"4",
0
],
"positive": [
"6",
0
],
"negative": [
"7",
0
],
"latent_image": [
"5",
0
],
"seed": 636718080453780,
"steps": 20,
"cfg": 8,
"sampler_name": "euler",
"scheduler": "normal",
"denoise": 1
},
"_meta": {
"title": "KSampler"
}
},
"4": {
"class_type": "CheckpointLoaderSimple",
"inputs": {
"ckpt_name": "Illustrious\\IllustriousStyle_v22.safetensors"
},
"_meta": {
"title": "CheckpointLoaderSimple"
}
},
"5": {
"class_type": "EmptyLatentImage",
"inputs": {
"width": 1216,
"height": 832,
"batch_size": 1
},
"_meta": {
"title": "EmptyLatentImage"
}
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"4",
1
],
"text": "masterpiece, best quality, outer space scenery"
},
"_meta": {
"title": "Positive Prompt (Game)"
}
},
"7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"4",
1
],
"text": "lowres, worst quality, bad quality, text, watermark, signature"
},
"_meta": {
"title": "Negative Prompt (Game)"
}
},
"8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"3",
0
],
"vae": [
"10",
0
]
},
"_meta": {
"title": "VAEDecode"
}
},
"9": {
"class_type": "SaveImage",
"inputs": {
"images": [
"8",
0
],
"filename_prefix": "WFS_Game/game"
},
"_meta": {
"title": "SaveImage"
}
},
"10": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "sdxl_vae.safetensors"
},
"_meta": {
"title": "VAELoader"
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB