Compare commits

...
22 Commits
Author SHA1 Message Date
ketle-manandClaude Opus 5.5 db1e834f86 release: v0.9.2 — fix corrupted image transfers with selector event loop
- With windows_selector_event_loop enabled, Gallery previews/downloads could
  arrive corrupted (same size, one 32KB block replaced by the next block).
  Set AIOHTTP_NOSENDFILE when switching to the selector loop.
- DEVLOG updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:54:23 +09:00
ketle-manandClaude Opus 5.5 1db6fda6f1 fix: corrupted file transfers with selector event loop on Windows
With windows_selector_event_loop enabled, aiohttp FileResponse goes through
asyncio's _sendfile_fallback, which reuses a 16KB buffer while the selector
transport queues unsent data without copying. Under backpressure later reads
overwrite queued blocks, so Gallery previews/downloads arrived corrupted
(same size, shifted 32KB block). Set AIOHTTP_NOSENDFILE when switching loops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:53:22 +09:00
ketle-manandClaude Opus 5.5 6cdf4919e4 release: v0.9.1 — TagSpace: add selected tags, Open in Gallery
- Add only the tags picked in the Selection panel ("Add selected (N)")
- Tag / Gallery-image chips re-escape parentheses (no accidental emphasis)
- "Open in Gallery" for a selected Gallery point (revealInGallery)
- Manual (ja/en) renamed to v0.9.1; DEVLOG updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:50:13 +09:00
ketle-manandClaude Opus 5.5 d9fc3bfcda feat(tagspace): "Open in Gallery" for a selected Gallery point
New gallery-tab export revealInGallery(path): switches to the Gallery /
Output subtab, clears search/favorite/tag/group filters and similar mode,
expands the folder tree down to the image's folder, loads it, renders
thumbnail pages up to the image (keeping the infinite-scroll sentinel at
the end) and selects it like a normal click. Returns false for paths
outside the output folder or not in the list; TagSpace shows a toast.
Help tagspace-10 (en/ja/zh), README, manual 11-7 (ja/en, combined/ZIP
rebuilt), DEVLOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 16:48:49 +09:00
ketle-manandClaude Opus 5.5 410fdbc1bb feat(tagspace): add only the selected tags; escape parentheses in tag chips
- With tags picked in the Selection panel, Add becomes "Add selected (N)"
  and adds just those tags (prompt order) as one chip; with none picked it
  adds the whole item as before.
- Tags are stored unescaped, so "rapunzel (disney)" went into prompts as an
  emphasis group. Tag and Gallery-image chips now re-escape parentheses
  (\( \)), matching card prompts so duplicates still collapse.
- Help tagspace-10 (en/ja/zh), README, manual 11-7 (ja/en, combined/ZIP
  rebuilt), DEVLOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 14:44:31 +09:00
ketle-manandClaude Opus 5.5 fc635f0618 release: v0.9.0 — TagSpace tab
- New TagSpace tab: tags, ImagePrompt cards and Gallery images laid out
  in EmbeddingGemma 2 space (3D), with Tagger fill, All tags / Min uses /
  Wildcards options, tag picking from cards and Gallery images, prompt
  building into GenerateUI
- Wildcard YAML parsed with PyYAML (multi-line items)
- Ollama embedding: retry on local port exhaustion
- Manual (text-only, ja/en) updated to v0.9.0
- DEVLOG / README updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:53:51 +09:00
ketle-manandClaude Opus 5.5 9cdfa44130 docs: update manual to v0.9.0 (TagSpace, Ollama semantic search, Reference to Video)
Revise the Japanese and English text-only manuals from v0.8.9 to v0.9.0:
new TagSpace section (11-7), Gallery semantic search on Ollama, PixAI
Tagger and GPU check, GenerateUI Input tab layout and Raw JSON folding,
Fibo 2.0 / FastH3 / Pika-H3-Flex, Video Plan Reference Image, Comic
Creator multi-reference runs, and troubleshooting entries. Combined MD,
ZIP and README rebuilt from the chapter files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:51:54 +09:00
ketle-manandClaude Opus 5.5 30ccd838fb Merge branch 'feature/tagspace-tab'
TagSpace tab (unreleased). DEVLOG: TagSpace notes moved into a new
"unreleased" section above v0.8.14 (the auto-merge had put them inside the
released v0.8.14 section); the duplicated Ollama migration notes stay under
v0.8.14 only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:45:40 +09:00
ketle-manandClaude Opus 5.5 6dd7f7523b feat(tagspace): pick a card's tags and search the space with them
Cards get normalized `tags` at build time (same split_tags as Gallery
points); the detail panel shares one tagPicker() for cards and Gallery
images, with the card's full prompt kept in a collapsible "Full prompt".
Cards without tags (or spaces built before this) still show the full text.
Help tagspace-10 (en/ja/zh), README, DEVLOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:35:25 +09:00
ketle-manandClaude Opus 5.5 645dbd8283 feat(tagspace): pick a Gallery image's tags and search the space with them
The selected Gallery point's prompt tags are shown as toggle buttons; the
chosen ones (kept until another item is selected) are joined in prompt
order and passed to the existing space search. The action row sticks to
the bottom of the detail panel so it stays reachable with many tags.
Help tagspace-10 (en/ja/zh, helpIdMap), README, DEVLOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:30:41 +09:00
ketle-manandClaude Opus 5.5 95b3627bd5 fix(tagspace): pick the point nearest the cursor on screen when zoomed in
The raycaster used a fixed world-space threshold (0.12) and took the first
hit, i.e. the one nearest the camera, so after zooming into the cloud a
single near point stayed "hovered" across a wide area and clicks kept
selecting it. Widen the candidate threshold, project each hit to the
screen, and choose the one closest to the cursor (within 8px, or the
drawn radius of enlarged points).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:22:03 +09:00
ketle-manandClaude Opus 5.5 cd35f7bdd2 feat(tagspace): All tags / Min uses / Wildcards options, cleaner tags, Ollama port-exhaustion retry
- Toolbar: All tags (max_tags=0, capped at 20,000), Min uses (1/2/3/5,
  total count over all sources), Wildcards on/off as a tag source; build
  meta records them plus tags_available, shown as "(of N candidates)".
  Defaults reproduce the previous 2000-tag result exactly.
- normalize_tag: drop JSON fragments embedded in prompts ("key": — MOSS-Image
  bbox layouts / text specs formed an isolated cluster of 234 tags) and model
  file names, strip stray double quotes, drop embedding: revealed after
  unwrapping parentheses.
- semantic_ollama: treat "Only one usage of each socket address" (loopback
  TIME_WAIT exhaustion from Ollama's per-input runner connections) as
  transient and wait 30s before retrying.
- Help tagspace-9 (en/ja/zh, helpIdMap), README, DEVLOG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:06:19 +09:00
ketle-manandClaude Opus 5.5 24e082ecc2 feat(tagspace): parse wildcard YAML with PyYAML (block scalars, escapes)
The line-based reader took "- >-" as an item and dropped the block scalar's
body, and kept escapes like \u2019 literally. Read YAML with CSafeLoader
(SafeLoader fallback), take only string leaves (no keys, no bool/number
values), and fall back to the line reader for files that fail to parse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:05:49 +09:00
ketle-manandClaude Opus 5.5 91d096b69b docs(tagspace): help/README/DEVLOG for glow, twinkle and hover preview
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 21:33:08 +09:00
ketle-manandClaude Opus 5.5 73cfaca0bc feat(tagspace): glowing/twinkling points, hover zoom, click-to-select
- Points glow like stars (additive glow texture on a night-sky background);
  Gallery points are dimmed so dense areas don't wash out. "Glow" toggle.
- Twinkle: per-point phase/speed brightness modulation injected into
  PointsMaterial (onBeforeCompile). "Twinkle" toggle (effective with Glow).
- Hovering images in Selection / Nearby shows a 360px enlarged preview.
- Add/Remove button moved to the sticky title row of Selection.
- Clicking a point only selects it; double-click (or Add / +) adds/removes.
  Hint, empty-prompt text, help (en/ja/zh) and README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 21:29:01 +09:00
ketle-manandClaude Opus 5.5 75269ce38d feat(tagspace): list neighbors for Gallery points
Selecting a Gallery point used to leave the previous list in place:
select() skipped the request and the neighbor matrix had no background
vectors. The background vectors are now saved with the space, centered
matrices are cached per kind, and a Gallery point lists similar Gallery
images, tags and cards interleaved. Cards, tags and searches still list
cards and tags only. Gallery images get round thumbnails in the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 19:05:28 +09:00
ketle-manandClaude Opus 5.5 9958000d25 docs(tagspace): record Tagger fill speed on GPU after onnxruntime-gpu fix
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 18:07:39 +09:00
ketle-manandClaude Opus 5.5 2c513bb8bd feat(tagspace): Tagger fill for Gallery images without a prompt
- "Tagger fill" toolbar option: ONNX model from the Tagger tab, scope
  "Gallery points only" or "All images without a prompt"
- TaggerService.tag_image(): default thresholds (WD 0.35/0.85, PixAI
  recommended), rating labels dropped
- results cached per image and model (tagspace_tagger.json), saved every
  100 images so stopping keeps finished work; model unloaded afterwards
  unless the Tagger tab had it loaded
- new "Tagger fill" source; Gallery points fall back to Tagger tags,
  marked "(Tagger fill)"; progress shows CUDA/CPU
- help (en/ja/zh), README, DEVLOG

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 17:35:22 +09:00
ketle-manandClaude Opus 5.5 1011af7261 feat(tagspace): show or hide tags by source
The legend (ImagePrompt / Gallery prompts / Tagger DB / Prompt library /
Wildcards) becomes checkboxes. A tag stays visible while any of its sources
is on and takes the color of its first visible source; hidden tags are also
left out of the nearby/search lists, highlights and labels. Remembered in
localStorage. Help (en/ja/zh) and README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 16:18:11 +09:00
ketle-manandClaude Opus 5.5 7c4899cc65 style(tagspace): move the Prompt panel to its own column on the right
The output textarea now fills the column height; chips take only the
height they need (up to 40%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 16:10:12 +09:00
ketle-manandClaude Opus 5.5 2ef13a6662 feat(tagspace): add tags from Gallery image prompts, clickable Gallery points
- read the positive prompt embedded in indexed Gallery images (upstream from the
  sampler's positive input, never the negative), cached in tagspace_prompts.json
- prompts split at commas only; new "Gallery prompts" tag source
- tags picked round-robin across sources (ranked by number of prompts using the
  tag) so the many Gallery prompts do not crowd out the other sources
- Gallery points carry their prompt tags; clicking adds them as one chip
- fix: background points had no kind (hover/click showed undefined)
- fix: skip images deleted after indexing (thumbnail 404s)
- help (en/ja/zh), README, DEVLOG

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 16:04:11 +09:00
ketle-manandClaude Opus 5.5 d861d8c76d feat: add TagSpace tab - choose tags visually in a 3D latent space
- ImagePrompt cards (thumbnails), tags split from ImagePrompt / wildcards /
  Tagger DB / Prompt library, and sampled Gallery images placed in the
  EmbeddingGemma 2 space and projected to 3D with PCA
- card vectors reuse the Gallery semantic index (missing ones are indexed on
  build); tag vectors embedded with Ollama and cached (tagspace_tags.npz)
- images and text centered on their own means (cards for images) to remove
  the modality gap so cards overlap their matching tags
- click to add/remove, neighbors list (cards and tags interleaved), text search
  with probe marker, prompt composed with duplicates removed, append to
  GenerateUI Positive / copy
- three.js r187 subset + OrbitControls bundled (static/lib/three, MIT),
  loaded on first tab open
- /wfm/tagspace/{status,space,build,cancel,search,neighbors}
- help page (en/ja/zh), README, DEVLOG

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 14:36:14 +09:00
47 changed files with 7326 additions and 88 deletions
+3
View File
@@ -2,6 +2,9 @@
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.9.2(2026-11-03)** — Selectorイベントループ有効時に画像が壊れて届く不具合を修正
- **v0.9.1(2026-11-03)** — TagSpace: 選んだタグだけを追加 / タグのカッコをエスケープして追加
- **v0.9.0(2026-11-03)** — マニュアル(画像なし配布版)を v0.9.0 に改訂
- **v0.8.14(2026-11-03)** — Fibo 2.0 Edit / FastH3 OmniRef / Pika-H3-Flex 対応(GenerateUI・Metadata・Videoタブ)
- **v0.8.13(2026-10-27)** — Edit in Mask Editor One: 送信画像をノードへ永続化(Mask Editor One v0.1.12 対応)
- **v0.8.12(2026-10-27)** — Comic Creator向け複数画像I2Iブリッジ + GenerateUI Inputタブ: Prompt/Image統合・Raw JSON折りたたみ
+105
View File
@@ -2,6 +2,111 @@
---
## v0.9.2(2026-11-03)
### Selectorイベントループ有効時に画像が壊れて届く不具合を修正
- 症状: 設定「Selectorイベントループ」(`windows_selector_event_loop`)が有効だと、ギャラリーのプレビューと Download ボタンで取得した画像が壊れる(元ファイルと同サイズのまま、32KB 分のブロックが直後のブロックの内容に置き換わる)。出力フォルダのファイル自体は正常。
- 原因: Selector 方式では aiohttp の `FileResponse` が asyncio の `_sendfile_fallback` を通る。これは 16KB のバッファを使い回しながら、送り切れなかった分をトランスポートにコピーせず積むため(Python 3.12)、送信が詰まると次の読み込みで上書きされる。ギャラリーは多数の画像を同時に読むので詰まりやすい。
- 修正: `prestartup_script.py` で Selector に切り替えるとき `AIOHTTP_NOSENDFILE=1` も設定し、aiohttp がチャンクごとに新しい bytes を読んで送る経路を使うようにした(aiohttp 読み込み済みの場合はモジュール定数も上書き)。プロセス全体に効くので ComfyUI 本体の `/view` なども対象。
- 検証: 受信を遅くしたクライアントで、修正前は 5/5 回破損、修正後は 5/5 回ハッシュ一致。再起動後の実サーバー(ギャラリー配信 URL)でも 5/5 回一致。
- 壊れた応答は `Cache-Control: max-age=3600` でブラウザに残ることがあるので、更新後は再読み込み(Ctrl+F5)が必要。
---
## v0.9.1(2026-11-03)
### TagSpace: 選んだタグだけを追加 / タグのカッコをエスケープして追加
- 選択中パネルでタグを1つ以上選んでいると、「追加」ボタンが「選択したタグを追加(N)」になり、選んだタグだけ(プロンプト中の順)を1つのチップ(名前は「rapunzel(2タグ)」)として追加する。選んでいなければ従来どおり全体(カードはプロンプト全文、Gallery点は全タグ)。3D画面のダブルクリックと一覧の+は常に全体。
- 不具合修正: タグは分解時にエスケープを外している(`rapunzel \(disney\)` → `rapunzel (disney)`)ため、タグ・Gallery点のチップをそのままプロンプトに入れると `(disney)` が強調指定になっていた。プロンプトに入れるときにカッコを `\(` `\)` に戻す(表示はそのまま)。カード全文の `\(...\)` と同じ形になるので、重複除去でも1つにまとまる。
- 検証(Playwright): rapunzel カードで未選択の「追加」→全文、2つ選んで「選択したタグを追加(2)」→ `rapunzel \(disney\), braided ponytail`、一覧の+で同じタグを追加しても重複せず。
- ヘルプ(tagspace-10 英/日/中)、README、マニュアル第11章 11-7(日英、全章まとめ・ZIP 再作成)。
### TagSpace: Gallery点から「Galleryで開く」
- 選択中パネル(Gallery点)に「Galleryで開く」ボタン。`gallery-tab.js` に `revealInGallery(path)` を新設(export): ギャラリータブ/Output サブタブへ切り替え(初回はここで出力フォルダとツリーを読み込むので `state.folderTree` を待つ)→ 絞り込み(検索・お気に入り・タグ・グループ・類似表示)を「Clear filters」と同じ要領で解除 → ツリーを根から目的のフォルダまで矢印クリックで展開(子は展開時に描画される遅延描画のため)→ フォルダを選んで `await loadImages()` → 一覧で `[data-path]` の要素をクリック(通常クリックと同じ選択・詳細表示)して中央へスクロール。
- サムネイル表示は50件ずつ描くので、目的の画像まで `_appendNextPage` で描き足し、無限スクロールの目印を末尾へ戻す(全件描いたら外す)。パスは `\` / 大文字小文字の違いを無視して比較。出力フォルダ外・一覧に無い画像は false を返し、TagSpace 側でトーストを出す。
- 検証(Playwright): 検索語を入れた状態から TagSpace の Gallery 点で押す → 0.3秒でギャラリーに切り替わり、ツリー「2026-06-07」選択・一覧で目的の画像が選択されて画面内・検索欄クリア・詳細表示。456枚のフォルダの453枚目でも 0.6秒で表示(全件描画・目印も解除)。出力フォルダ外/存在しないパスは false。コンソールエラーなし。
- ヘルプ(tagspace-10 英/日/中)、README、マニュアル第11章 11-7(日英、全章まとめ・ZIP 再作成)。
---
## v0.9.0(2026-11-03)
### マニュアル(画像なし配布版)を v0.9.0 に改訂
- 日本語・英語の `docs/manual/` を v0.8.9 → v0.9.0 に更新(全章まとめ・ZIP・README を作り直し、v0.8.9 のファイルは削除)。
- 反映した変更: TagSpace タブ(第11章に 11-7 を新設、第3章のタブ一覧・付録の用語集・第12章のトラブル表)、Gallery セマンティック検索の Ollama 化(第8章 8-6・第2章・第12章。ONNX の GPU 設定の記述を Tagger 側へ移動)、Tagger の PixAI 対応と GPU 確認(第11章 11-2・第12章)、GenerateUI の Input タブ横並び・Raw JSON 折りたたみ(第5章)、Fibo 2.0 Edit/FastH3 OmniRef/Pika-H3-Flex(第5章 5-9)、Video Plan の Reference Image(第11章 11-4)、Comic Creator からの複数参照画像の実行(第11章 11-6)。
- 前回の全章まとめは v0.8.11 の章ファイル修正(Send CC)を取り込んでいなかった。今回は章ファイルから全章まとめを作り直したので解消。
- 英語版の Raw JSON 折りたたみボタンは、実際の表示(»)ではなく ASCII の `>>` と書いた。
### TagSpace タブ新設(latenttag-3d の WFS 統合)
- **目的**: latenttag-3d(単独アプリは別途継続)を WFS に組み込み、WFS のデータだけでタグを視覚的に選んでプロンプトを作る。
- **材料**: カード=ImagePrompt(`ws_image_prompt`、`.txt` または ponyxlWildcardsVault の YAML から `_read_sidecar_prompt` でプロンプト解決、プロンプトのある951枚)/タグ=ImagePrompt・ワイルドカード(`.txt` 行・YAML の `- ` 行)・Tagger DB・`prompts.json` の文を `, \n | { } BREAK` で分解し正規化(重み・括弧・Dynamic Prompts の `n::`・LoRA・`__wildcard__`・`rating:` を除去、`_`→空白、2〜40文字・5語以内)。出典の種類数→出現回数の順で上位 N(既定2000)/背景=Gallery 索引から seed 固定で間引いた画像(既定4000)。
- **ベクトル**: カードは Gallery セマンティック索引の画像ベクトルを流用(未索引分は構築時に `SemanticService.start_index(..., "missing")` で追加)。タグは Ollama でテキスト埋め込み(`task: search result | query:` 付き)し `tagspace_tags.npz` にキャッシュ。索引が Gemini のときはエラーにする。
- **modality gap**: 同じ空間でも画像とテキストは別の塊になる。実測で、そのまま PCA すると第1・第2軸が画像/テキストの分離に使われた(|Δ平均|/標準偏差 2.99・4.43)。画像とテキストを別々の平均で中心化すると 0 になり、画像→近いタグも改善(例 `alley`: 中心化前 anime, twintails… → 後 street, neon lights, city lights, night)。
- 画像側の平均を「カード+背景」で取ると、数の多い背景に引っ張られてカードがタグの塊から離れた(中心間距離 5.06)。カードの平均に変えて 0.00 にした。
- 近傍・検索も同じ中心化コサイン。同種どうしのスコアが高く出るため、カードとタグを別々に順位付けして交互に並べる。
- **3D**: three.js r187(MIT)から使う部品+OrbitControls だけを esbuild で束ねた `static/lib/three/three-tagspace.min.js`(559KB)を同梱し、タブを初めて開いたときに動的 import。カードは Sprite(サムネイルを6並列で順次読み込み)、タグ・背景は Points、選択/近傍/検索は重ね描き、ラベルは HTML オーバーレイ。タブが非表示の間は描画ループを止める。
- **API**: `/wfm/tagspace/{status,space,build,cancel,search,neighbors}`(`tagspace_routes.py`。Gallery と同じ GalleryService/SemanticService を共有)。生成物は `tagspace_space.json`(表示用)・`tagspace_space.npz`(近傍/検索用)・`tagspace_tags.npz`(タグのベクトル)。
- **検証**(ComfyUI_5 / 8189): 初回構築 約2.5分(カード画像1,054枚の索引追加+タグ2,000件)、キャッシュありの再構築 7秒。英語・日本語の検索、キャンバスのホバー/クリック(タグ・カード)、チップのトグル、重複除去、GenerateUI の Positive への追記(`wfs_sdxl_gallery.json`)、ワークフロー未読込時のトーストを確認。コンソールエラー0。
- 注意: Git Bash の curl で日本語の JSON を送ると文字化けして空の検索になる(API 側の問題ではない)。ヘルプ(TagSpace ページ 英/日/中)と README を追加。マニュアルは未更新。
- **追加: Gallery 画像のプロンプト由来タグ**(Tagger による補完は次の段階で検討)
- 表示自体にタグは不要(背景点は画像ベクトルで配置)。目的は、自分の生成画像の語をタグの材料にすることと、Gallery 点をクリックしてその画像のタグを入れること。
- 抽出: 埋め込みの API 形式グラフで、サンプラー/ガイダーの `positive`(無ければ Guider 系の `conditioning`)から上流をたどり、`text` / `prompt` / `clip_l` 等の文字列入力を集める。`negative` 系の入力はたどらない(ControlNet 等の両方を持つノード経由で negative が混ざるのを防ぐ)。UI 形式しか無い画像は対象外。
- 実測: 2.9万枚中 64%(18,723枚)で取得、初回 約2〜3分・キャッシュ(`tagspace_prompts.json`、size/mtime 一致)で 0.7秒。典型的なネガティブ語が3つ以上混ざるのは5件で、いずれも利用者がプロンプト欄に画面テキストを貼っていたもの。区切りはカンマ等のみ(スペース区切りは「blue eyes」が分かれるため不採用)。
- **出典の偏り**: タグを「出典の種類数→出現数」で選ぶと、Gallery が上位2000件中1982件を占めた。出典ごとに「そのタグを含む文の数」で並べ、出典を順番に1件ずつ取る方式に変更(Gallery 682・ImagePrompt 639・ワイルドカード 476・Tagger DB 199・Prompt ライブラリ 4)。
- 背景点に `tags` を持たせ、クリックでまとめて1チップ(`kind: image`)。プロンプトが無い画像(背景4000中 約41%)は追加不可で、詳細に「タグなし」と表示。
- バグ修正: 背景の点(`userData.items`)が `kind` を付ける前の生データだったため、ホバー/クリックで種類と名前が undefined になっていた。同じオブジェクトに `kind` を付けるよう修正。
- バグ修正: セマンティック索引に削除済み画像が残っており、背景のサムネイルが 404 になった。背景は多めに取って実在するファイルだけに絞り、プロンプト読み取りでも削除済みは除外。
- 既知: 画像編集モデルの指示文(例 `do not use the colors`)も5語以内ならタグとして残る。
- 検証(ComfyUI_5 再起動後): 構築148秒(プロンプト読み取り111秒)→キャッシュ有りで15〜16秒。背景4000点で存在しないファイル0件・サムネイル404は40件抽出で0件。Gallery 点のクリック(タグありは1チップで追加、タグなしは追加不可)と、ホバー331回でコンソールエラー0を確認。
- **追加: Tagger 補完**(プロンプトを取り出せない Gallery 画像、2.9万枚中 10,652枚)
- ツールバー「Tagger補完: [OFF/モデル] [Gallery点のみ/プロンプトの無い全画像]」。モデルは Tagger タブの ONNX モデル(`.onnx` の無い `wd-vit-tagger-v3` は出ない)。`TaggerService.tag_image()` を追加し、しきい値は既定値(WD 0.35/0.85、PixAI は推奨値 0.17/0.27)、評価ラベル(general/sensitive/questionable/explicit)は除外。
- 背景点の選択をタグ集めより前に移し、「Gallery点のみ」はその中のプロンプト由来タグが無い画像だけを処理。結果は `tagspace_tagger.json`(path→size/mtime/model/tags)にキャッシュし、100件ごとと終了時に保存(中止しても残る)。補完のために読み込んだモデルは終了後に Tagger のキャッシュから外す(Tagger タブで読み込み済みなら残す)。
- 新出典 `tagger_auto`(「Tagger補完」、黄緑)。背景点は `tag_src: prompt|tagger` を持ち、Tagger 由来はツールチップ/詳細に「(Tagger補完)」。進み具合に実行先(CUDA/CPU)を表示。
- **環境の問題(再発)**: ComfyUI_5 の venv で `onnxruntime` 1.31.0(CPU)と `onnxruntime-gpu` 1.30.0 が共存し CUDA が無効。CPU では wd-v1-4-convnext 465ms/枚・wd-v1-4-vit 641ms/枚(全画像なら約1.5時間)。修復は ComfyUI 停止→`fix_onnxruntime_gpu.bat`(外側リポジトリ、v0.8.10 と同じ)。今回は未実施。
- 検証(CPU): Gallery点600・Gallery点のみ・convnext で 288枚を142秒(0.49秒/枚)、全600点にタグ(プロンプト312・Tagger 288・なし0)。`tagger_auto` を含むタグ571件(うち補完でしか出ないもの180件: 1boy, multiple girls, scenery 等)。キャッシュで再構築17秒。UI(選択欄の有効/無効、凡例、「(Tagger補完)」表示、クリックで1チップ)とコンソールエラー0を確認。確認後は Gallery点4000・補完OFFで作り直し済み。
- GPU 修復後(利用者が `fix_onnxruntime_gpu.bat` を実行、`onnxruntime-gpu` 1.30.0 のみ・CUDA/TensorRT 有効): Gallery点4000・Gallery点のみ・convnext で 1,918枚を約136秒(約0.07秒/枚、画像読み込み込み。CPU の約7倍)、全4000点にタグ(プロンプト2,082・Tagger 1,918)。全画像(10,652枚)なら約12〜13分の見込み。
- **追加: Gallery 点の近傍**
- 以前は Gallery 点を選んでも `select()` が近傍を問い合わせずに抜け、直前の一覧が残っていた(ファイル名とは無関係)。近傍用 `tagspace_space.npz` にも背景のベクトルが無かった。
- 背景のベクトル(`bg_ids` / `bg_vecs`、4000×768 で約12MB)を保存し、カード/タグ/画像の中心化行列を読み込み時にキャッシュ。Gallery 点を基準にしたときだけ「画像→タグ→カード」を交互に並べる。カード・タグ・検索では画像を混ぜない(利用者の指定)。一覧の Gallery 画像は丸いサムネイル、タグの無い画像は「+」なし。
- 検証: `ComfyUI_00510_.png` → 似た画像(0.69〜0.71)・pink body suits 等のタグ・カードが交互、57ms。タグ/カード/検索の一覧は card・tag のみ。画面でも Tagger 補完の Gallery 点で確認。
- 未解明: 再起動直後の最初の構築が146秒かかり `tagspace_tagger.json` が書き換えられた(2回目以降は13秒・書き換えなし、ログに警告なし)。再現したら段階ごとの時間を記録して調べる。
- **追加: 表示と操作の改善**
- 発光: 放射グラデーションのテクスチャ(明るい芯+にじみ)を加算合成(`blending: 2`。同梱サブセットに `AdditiveBlending` が無いため数値で指定)、`depthWrite: false`、点サイズ×2.4。背景は夜空色 `#05070d`。Gallery点2万点だと重なりで中心が白く飛んだので、発光時は Gallery点の不透明度を 0.55→0.3。
- またたき: `PointsMaterial.onBeforeCompile` で頂点シェーダーに `twinkle`(位相・速さ。添字から決まる疑似乱数で再構築しても同じ)と時刻 uniform を差し込み、`vColor` を 0.15〜1.25 倍(`pow(0.5+0.5 sin, 2)` で暗い時間を長く・ピークを鋭く)。タグ・カード・Gallery点のみで、選択・近傍の強調は瞬かない。検証: 0.9秒で変化した画素 約2.6万(オフ時0)。
- 拡大表示: 「選択中」の画像と「近く」の一覧の画像に `data-ts-zoom`。マウスを乗せるとサイド列の左に 360px で表示(読み込み済みの小画像を先に出し 720px に差し替え、`pointer-events: none`)。
- 追加/削除ボタンを「選択中」の名前の行(`position: sticky`)へ移動。本文をスクロールしても押せる。
- クリックは選択のみ(`e.detail > 1` は無視)、ダブルクリックで追加/削除。「追加」ボタンと一覧の+は従来どおり。ヒント・空欄の案内・ヘルプ(英/日/中)・README を更新し、ヘルプに表示の項目(tagspace-8)を追加。
- **追加: ワイルドカード YAML をパーサーで読む**
- 従来は「`- ` で始まる行」を1項目として読んでいたため、`- >-` 等のブロックスカラー(本文が次行以降)は `>-` だけになり本文を取りこぼしていた(billions_of_all_in_one.yaml、corn-flakes-doll.yaml)。二重引用符内の `’` もエスケープのまま残っていた。
- PyYAML(ComfyUI 本体の依存)の `CSafeLoader`(無ければ `SafeLoader`)で読み、文字列の葉だけを取る(キー=カテゴリ名、yes/no・数値に変換された葉は除く)。YAML として読めないファイルは従来の行読みにフォールバック。4.2万行で 0.19 秒(純 Python の safe_load は 1.86 秒)。
- 実測(ワイルドカード7ファイル): 異なるタグ 28,861 → 30,130(+1,269。female / wings / dress / lace 等)。他5ファイルは不変。
- 実機(ComfyUI_5 再起動後、2000タグ・背景20000で再構築): ワイルドカード由来 748 → 762、入れ替わり22件(male / benevolent / pointed ears 等が入り、出典を順番に取る方式なので他出典の下位が抜ける)。female の出現数 164 → 208 等。
- **追加: 全タグ・最低出現回数・ワイルドカードのオン/オフ**
- 背景: 「全部の点を表示したい」。タグの種類は全出典で約4.8万、うち約3.7万がワイルドカードにしか無い語(1回だけの語が大半)。ワイルドカードを除くと約1.1万。
- ツールバーに「全タグ」(`max_tags=0`、上限 `ALL_TAGS_LIMIT`=20,000)、「最低出現回数」(1/2/3/5。全出典合計の出現数で候補から外す)、「ワイルドカード」(材料に含めるか)。meta に `max_tags` / `min_count` / `wildcard` / `tags_available` を記録し、一部だけ使ったときは状態表示に「(候補 N)」。既定値(ワイルドカードあり・最低1回)は従来と同じ結果(2000タグの集合・出現数・出典が完全一致を確認)。
- **正規化の追加**: 全タグにすると、MOSS-Image のレイアウト指定(`{"bbox":[...],"label":"text"}`)や文字入れ指定の JSON 断片が Gallery プロンプトから大量に入り、`bbox":-8` 等 234件が空間の外に孤立した塊を作った。`"key":` を含む断片とモデルのファイル名(`.safetensors` 等)を除外し、片側だけ残った `"` は取り除く。括弧を外した後の `embedding:` も除外。ワイルドカードなし全タグ 11,406 → 10,435(2回以上 7,383 → 6,843)。
- **Ollama の一時ポート枯渇**: 9,056件を連続で埋め込んだところ 6,880件目で `HTTP 400 ... dial tcp 127.0.0.1:NNNNN: connectex: Only one usage of each socket address` で失敗。Ollama はテキストごとにランナーへ新しい接続を張るため、ループバックの TIME_WAIT が 14,228 / 16,384 に達していた。このエラーを一時的扱いにし、30秒待って再試行(最大5回、Windows の TIME_WAIT は約2分で解放)。単体テスト(2回失敗→3回目で回復、失敗が続けば6回で諦める)で確認。実構築では以後枯渇せず(新規5,203件で TIME_WAIT 最大 11,968)、本番経路での再試行は未発生。
- 実測(ComfyUI_5、Gallery点20,000・Tagger補完あり): ワイルドカードなし全タグ 79秒(新規埋め込み 2,656件)、最低2回 22秒、ワイルドカードあり全タグ・最低2回(14,188件)127秒(新規 5,203件)。空間データ 9.4MB(2000タグ)→ 10.8MB(11,406タグ)。ブラウザで約3.2万点を表示し、毎フレームのホバー判定込みで 60fps・JSヒープ 35MB。PCA 寄与率は 10.5% → 7.9%(タグの種類が増えて軸が分散)。
- **追加: Gallery点のタグを選んで空間検索**
- 選択中パネルで Gallery 画像のプロンプト(またはTagger補完)のタグを、文ではなくタグごとのボタンで表示。クリックで選択/解除(複数可、`state.picked` に画像IDと Set で保持し、別の要素を選ぶとリセット)。「選択したタグで空間検索(N)」で、選んだタグをプロンプト中の順に `, ` でつないだ文を既存の `runSearch()` に渡す(検索欄にも入れる)。
- タグが多いとパネル(最大260px)からボタンがはみ出したため、ボタン行を `position: sticky; bottom: 0` で下端に固定。
- 検証(Playwright): 33タグの画像で2つ選択→ボタン有効化→「brown hair, east asian」で検索し、east asian 0.67 / brown hair 0.67 / dark brown hair 0.62 等が並ぶ。検索後も選択を保持。15タグの画像でパネルがスクロールする状態でもボタンが見えることを確認。
- **追加: カードのタグも選んで空間検索**
- カードはプロンプトを文で持つだけだったので、構築時に `split_tags`(Gallery点と同じ正規化)で `tags` を付ける。詳細パネルの表示処理を `tagPicker()` に共通化し、カードはタグのボタン+「プロンプト全文」(`<details>`)+カテゴリ。タグが無いカード・作り直し前の空間(`tags` 無し)は従来どおり全文表示。
- 検証(ComfyUI_5 再起動・再構築後): 951枚中948枚にタグ(平均3.4個)。無いのは `zero two \(darling in the franxx\)` のように1語が5語を超えるもの等3枚。「resentful」カードで angry / evil smile を選んで検索 → evil smile 0.89、evil grin 0.84、arrogant smile 0.64。
- **修正: ズーム時に広い範囲で同じ点が反応する(ホバー・クリック)**
- 原因: `Raycaster.params.Points.threshold` が3D空間の固定値 0.12 で、しかも結果はカメラに近い順に並ぶのに先頭を採用していた。ズームして点群に入ると、手前の1点が画面の広い範囲で「当たり幅の内側」になり続ける。
- 修正(`pick()`): 候補は広めに取り(注視点の3倍の奥行きで 8px になる幅と、描かれた点の3D上の半径の大きい方)、各点を画面へ投影してカーソルとの距離(px)が最小のものを選ぶ。点はカーソルから 8px 以内、拡大で大きく描かれた点は見た目の半径(発光時は芯)まで。カードのサムネイル(Sprite)は従来どおり当たれば候補。
- 検証(Playwright、ホイールで大きくズーム、10×10 の格子でホバー): 修正前 100か所すべてで反応し2種類(boke 55回)→ 修正後(適度なズーム)73か所で反応し72種類、点の無い場所は無反応。4か所のクリックもそれぞれ別の要素を選択。カメラがカードの中に入るほどズームするとサムネイルが画面全体を覆うので、そのカードが反応するのは正しい。
---
## v0.8.14(2026-11-03)
### Fibo 2.0 Edit / FastH3 OmniRef / Pika-H3-Flex 対応(GenerateUI・Metadata・Videoタブ)
+8 -4
View File
@@ -73,6 +73,9 @@ Model Browser, Thumbnail / Table views, Table column sort, Search & Filter, User
### Tagger Tab (v0.3.38)
3 sub-tabs, Model support, Threshold sliders, VLM tagging, Single tab, Single output options, Batch tab, DB tab, Dependencies
### 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
### 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
@@ -125,10 +128,10 @@ Samples for the Feeder tab: `ws_sdxl_image_feeder_i2i` / `ws_dwpose_image_feeder
## Manual
A beginner-oriented manual (covers v0.8.9, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
A beginner-oriented manual (covers v0.9.1, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.8.9_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.8.9.zip`
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.9.1_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.9.1.zip`
---
@@ -210,7 +213,8 @@ ComfyUI-Workflow-Studio/
│ │ ├── settings_routes.py # Settings API
│ │ ├── ollama_routes.py # Ollama proxy API
│ │ ├── eagle_routes.py # Eagle integration API
│ │ └── gallery_routes.py # Gallery tab API (Output + ImagePrompt + Style_Catalog sub-tabs)
│ │ ├── gallery_routes.py # Gallery tab API (Output + ImagePrompt + Style_Catalog sub-tabs)
│ │ └── tagspace_routes.py # TagSpace tab API (build / space / search / neighbors)
│ └── services/
│ ├── workflow_service.py # Workflow file operations
│ ├── nodes_service.py # Node metadata & node sets
+21 -4
View File
@@ -416,6 +416,22 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
</details>
<details>
<summary><h3>TagSpace Tab (v0.9.0)</h3></summary>
- **Choose tags visually in a 3D latent space** — WFS's own data is placed in the EmbeddingGemma 2 vector space and shown in 3D (three.js, bundled): **Cards** (ImagePrompt images with their prompt, drawn as thumbnails), **Tags** (words split out of ImagePrompt prompts, the positive prompts embedded in Gallery images, wildcards, the Tagger DB and the Prompt library, colored by source) and **Gallery points** (a sample of indexed Gallery images as a faint background, each carrying the tags from its own prompt). Nearby items have similar meanings
- **Build / Update** — collects the cards, adds card images that are not yet indexed to the Gallery semantic index, reads the positive prompt embedded in each indexed Gallery image (followed upstream from the sampler's `positive` input, never the negative; cached in `tagspace_prompts.json`, deleted images are skipped), embeds new tags with Ollama (cached in `tagspace_tags.npz`) and projects everything to 3D with PCA. Prompts are split only at commas (and `|` `{}` `BREAK`), not at spaces; phrases over 5 words are dropped. **Tags** sets how many tags are kept — each source is ranked by how many prompts use a tag and the sources take turns, so the many Gallery prompts do not crowd out the others; **Gallery points** sets how many Gallery images are shown. Images and text form two separate clusters in the same space (modality gap), so each is centered on its own mean (images: the cards) before PCA, which makes cards and their matching tags overlap. First build: about 2.5 min for ~1,000 cards plus about 2 min to read the prompts of 29,000 Gallery images (64% had a readable positive prompt); rebuilds with caches: about 15 s
- **Choosing tags** — **All tags** uses every candidate tag instead of the Tags number (up to 20,000); **Min uses** drops tags used in fewer prompts than that (all sources combined); **Wildcards** turns wildcard files on or off as a tag source. Words found only in wildcards are most of the distinct tags (about 37,000 of 47,600 in testing), so All tags without wildcards gives about 10,400 tags (about 6,800 with Min uses 2); ~32,000 points still render at 60 fps. Wildcard YAML is read with a YAML parser, so multi-line (`- >-`) items are included; JSON fragments embedded in prompts (e.g. MOSS-Image bbox layouts) and model file names are not turned into tags
- **Explore** — drag to rotate, right-drag to pan, wheel to zoom; hover shows name, thumbnail and prompt/sources; layer checkboxes for Cards / Thumbnails / Tags / Gallery, and source checkboxes (ImagePrompt / Gallery prompts / Tagger DB / Prompt library / Wildcards) that show or hide tags by origin — a tag stays visible while any of its sources is on, and hidden tags are left out of the nearby/search lists. The search box (Enter, any language) places a marker for the text and lists the nearest items
- **Search with a card's or Gallery image's tags** — a selected card or Gallery point lists its prompt tags as buttons; pick some and search the space with them (joined in prompt order); while tags are picked, the Add button becomes "Add selected (N)" and adds only those tags. A selected Gallery point also has **Open in Gallery**, which opens its folder in the Gallery tab with the image selected (filters are cleared)
- **Make a prompt** — click a card or tag to select it and list nearby items (clicking does not change the prompt); double-click it, press **Add** next to its name under Selection, or press **+** in the list to add it (again to remove); cards and tags are ranked separately and interleaved, so a card also shows its closest tags. Adding a Gallery point adds all tags from that image's prompt as one chip (images without readable tags cannot be added); clicking one lists similar Gallery images together with nearby tags and cards (cards, tags and searches never list Gallery images). The prompt joins the chips with duplicates removed; **Add to GenerateUI (Positive)** appends it to the loaded workflow's positive prompt, **Copy** puts it on the clipboard
- **Tagger fill** — Gallery images without a readable prompt (about a third) can be tagged with a Tagger model (ONNX models from the Tagger tab) during Build / Update — either only the sampled Gallery points or every indexed image without prompt tags. Default thresholds, rating labels dropped, results cached per image and model in `tagspace_tagger.json` (stopping keeps finished images). The tags form the **Tagger fill** source and become the tags of those Gallery points. The status shows CUDA/CPU: on the CPU it is about 0.5 s per image, so make sure `onnxruntime-gpu` is active before tagging everything
- **Glow / Twinkle** — points are drawn as glowing stars on a night-sky background (Gallery points dimmed so dense areas don't wash out); **Twinkle** makes tags, cards and Gallery points twinkle slowly with individual rhythms (selection/nearby highlights stay steady). Both are toolbar toggles; turning Glow off restores the plain dots
- **Hover preview** — hovering the image under Selection or a thumbnail in the Nearby list shows an enlarged preview without changing the selection; the Add / Remove button sits on Selection's title row so it stays reachable while the text scrolls
- **Requirements** — Ollama with EmbeddingGemma 2 (Gallery > Semantic settings > Model); a Gallery semantic index built with Gemini must be rebuilt with EmbeddingGemma 2 first
</details>
<details>
<summary><h3>Image Edit Tab (v0.3.65)</h3></summary>
@@ -579,10 +595,10 @@ Samples for the Feeder tab: `ws_sdxl_image_feeder_i2i` / `ws_dwpose_image_feeder
## Manual
A beginner-oriented manual (covers v0.8.9, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
A beginner-oriented manual (covers v0.9.1, text-only edition without screenshots) is available in [`docs/manual/`](docs/manual/):
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.8.9_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.8.9.zip`
- English: [`docs/manual/en/`](docs/manual/en/) — ZIP: `Workflow_Studio_Manual_v0.9.1_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.9.1.zip`
---
@@ -664,7 +680,8 @@ ComfyUI-Workflow-Studio/
│ │ ├── settings_routes.py # Settings API
│ │ ├── ollama_routes.py # Ollama proxy API
│ │ ├── eagle_routes.py # Eagle integration API
│ │ └── gallery_routes.py # Gallery tab API (Output + ImagePrompt + Style_Catalog sub-tabs)
│ │ ├── gallery_routes.py # Gallery tab API (Output + ImagePrompt + Style_Catalog sub-tabs)
│ │ └── tagspace_routes.py # TagSpace tab API (build / space / search / neighbors)
│ └── services/
│ ├── workflow_service.py # Workflow file operations
│ ├── nodes_service.py # Node metadata & node sets
+3 -3
View File
@@ -2,12 +2,12 @@
ノードが苦手でも大丈夫 ― 画像生成をもっと手軽に、もっと整理して
- 対象バージョン:Workflow Studio v0.8.9
- 対象バージョン:Workflow Studio v0.9.1
- 著者:ketle-man
- © 2026 ketle-man
このマニュアルは、Kindle版をもとにした **画像なしのテキスト版** です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.8.9.md` です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.1.md` です。
画面の例は省略しているため、実際の画面はWorkflow Studioのヘルプタブとあわせてご覧ください。
## 目次
@@ -29,4 +29,4 @@
- [13_付録](chapters/13_付録.md)
- [14_おわりに](chapters/14_おわりに.md)
全章まとめ:[Workflow_Studio_Manual_v0.8.9.md](Workflow_Studio_Manual_v0.8.9.md)
全章まとめ:[Workflow_Studio_Manual_v0.9.1.md](Workflow_Studio_Manual_v0.9.1.md)
Binary file not shown.
@@ -2,12 +2,12 @@
ノードが苦手でも大丈夫 ― 画像生成をもっと手軽に、もっと整理して
- 対象バージョン:Workflow Studio v0.8.9
- 対象バージョン:Workflow Studio v0.9.1
- 著者:ketle-man
- © 2026 ketle-man
このマニュアルは、Kindle版をもとにした **画像なしのテキスト版** です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.8.9.md` です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.1.md` です。
画面の例は省略しているため、実際の画面はWorkflow Studioのヘルプタブとあわせてご覧ください。
---
@@ -97,6 +97,7 @@ Workflow Studioは、そうして作り上げたワークフローを **素早
- **画像編集(Image Edit)** - レイヤー付きの簡易編集、マスクを使った部分的な描き直し(インペイント)
- **ローカルAI連携** - 日本語からのプロンプト翻訳、画像からのプロンプト・タグ作成
- **Tagger・Video** - 画像からのタグ自動生成、動画の生成と簡単な編集
- **TagSpace** - 手持ちのプロンプト・タグ・生成画像を「意味の近さ」で3Dの空間に並べ、眺めながらタグを選ぶ
---
@@ -142,7 +143,7 @@ ComfyUIの「自由さ」はそのままに、「分かりやすさ」と「手
## 本書の対象バージョンと環境
- **Workflow Studio**:v0.8.9
- **Workflow Studio**:v0.9.1
- **ComfyUI**:本書執筆時点の最新版
- **OS**:Windows(画面の例はWindowsのものです)
@@ -358,7 +359,8 @@ Workflow Studioの基本機能は、ComfyUIが動いていれば追加の準備
### あとから必要に応じて
次のものは、特定の機能を使うときだけ必要です。最初は気にしなくてかまいません。
- **Ollama / LM Studio など** - プロンプトの翻訳やAIチャットなどのAI補助機能(第10章)
- **Ollama / LM Studio など** - プロンプトの翻訳やAIチャットなどのAI補助機能(第10章)。
ギャラリーのセマンティック検索をローカルで行うとき(第8章)と、TagSpaceタブ(第11章)には **Ollama** が必要です
- **Eagle** - 生成画像を画像管理ソフトEagleに自動保存する機能(第8章)
- **追加のPythonパッケージ** - Tagger(画像からのタグ生成)やPSD書き出しなど(第11章)
@@ -619,6 +621,7 @@ Workflow Studioを開くと、画面の上部にタブが横一列に並んで
| Image Edit | Image Edit | 画像の簡易編集・マスク作成 | | 第11章 |
| Video | Video | 動画生成・動画編集 | | 第11章 |
| Tagger | Tagger | 画像からタグ(プロンプト)を自動生成 | | 第11章 |
| TagSpace | TagSpace | タグ・プロンプト・生成画像を意味の近さで3D表示し、タグを選ぶ | | 第11章 |
| 設定 | Settings | 言語・テーマ・フォルダなどの設定 | | 本章・第11章 |
| ヘルプ | Help | 機能一覧・ショートカット・トラブル対処 | | 本章 |
| AI TOOL | AI TOOL | ローカルAIによる翻訳・チャット・画像解析 | | 第10章 |
@@ -630,7 +633,7 @@ Workflow Studioを開くと、画面の上部にタブが横一列に並んで
手持ちの素材を一覧にして、探しやすくするタブです。
- **作る** - 生成UI/Image Edit/Video
実際に画像や動画を作ったり、手を加えたりするタブです。
- **補助する** - AI TOOL/Tagger/設定/ヘルプ
- **補助する** - AI TOOL/Tagger/TagSpace/設定/ヘルプ
他のタブでの作業を助けたり、全体の設定をしたりするタブです。
> **ポイント**
@@ -1123,6 +1126,9 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
フォームで値を変えると、ここにも反映されます。
慣れないうちは、ここは「見るだけ」にしておきましょう。
Inputサブタブでは、Raw JSONの上端にある **»** ボタンで、Raw JSONを右端の細い帯に折りたためます(v0.8.12〜)。
プロンプトや画像の欄が広くなります。もう一度押すと元に戻り、折りたたんだ状態は次回も記憶されます。
---
## 5-3 はじめての1枚を生成する
@@ -1130,7 +1136,7 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
いよいよ生成です。最低限、次の3つを確認・設定します。
1. どのモデルで描くか(Model)
2. 何を描くか(Input → Prompt)
2. 何を描くか(Input)
3. 生成する(Generate)
### 手順1:モデルを選ぶ(Model)
@@ -1163,7 +1169,9 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
> 緑色でない項目は、変更してもこのワークフローには影響しません。
### 手順2:プロンプトを書く(Input)
1. サブタブの **Input** を開き、その中の **Prompt** を選びます。
1. サブタブの **Input** を開きます。
左側にプロンプト(Prompt)の欄、右側に入力画像(Image)の欄が並んでいます(v0.8.12〜。それまではPrompt/Imageを切り替える形でした)。
画面の幅が狭いときは、Imageの欄はプロンプトの下に回ります。
2. **Positive Prompt** の欄に、描いてほしい内容を英語で入力します。
```
@@ -1482,8 +1490,8 @@ v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実
### 使い方
1. ワークフロータブで、Nano Bananaのサンプル(`ws_nano_banana_2_1_t2i`)を生成UIに読み込みます。
2. **Prompt** サブタブでプロンプトを編集し、**Apply** を押します。
3. 参考画像を使うときは、**Image** サブタブの画像カードで指定します。
2. **Input** サブタブの左側(Prompt)でプロンプトを編集し、**Apply** を押します。
3. 参考画像を使うときは、**Input** サブタブの右側(Image)の画像カードで指定します。
4. **Generate** を押します。
> **ポイント**
@@ -1500,6 +1508,8 @@ v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実
| Qwen Image 2.1 Turbo | ComfyUI公式テンプレートの文章から画像(T2I)・画像から画像(I2I)。プロンプトエンハンサー(プロンプトを自動で補う機能)の入力欄にも、編集が反映される |
| Flux.3 Klein | 公式テンプレート4種(KleinとKlein SDのT2IとImage Edit) |
| MOSS-Image | Base/SFTのT2Iと、枠で位置を指定するバウンディングボックス版 |
| Fibo 2.0 Edit(v0.8.14〜) | 画像編集のワークフロー。プロンプト強化(PE)を使う構成でも、プロンプト欄の編集がPEのオン・オフどちらにも反映される。ネガティブの欄にはVGL形式(JSON)の説明文がそのまま入る。幅・高さ(Settings)は0で自動 |
| FastH3 OmniRef/Pika-H3-Flex(v0.8.14〜) | MiniMax H3の「参照画像から動画」(Reference to Video)。動画のワークフローとして扱われ、Videoタブ(第11章)でも使える |
| ネイティブLoRAスタック | ComfyUI v0.40のLoRAをまとめて読み込むノード(LoadLoraModel/LoadLoraTextEncoder)。Apply・バイパス・Metadata表示に対応 |
> **注意**
@@ -2119,7 +2129,8 @@ ComfyUIのノード画面に、その画像を作ったワークフローが読
| Send GenUI Image | 選んだ画像を、生成UIのワークフローの入力画像(LoadImageノード)にセットする |
| Send to LI node | 選んだ画像を、ComfyUIのノード画面で選んでいる画像読み込みノードにセットする |
| Image Edit | 選んだ画像を Image Edit タブで開く(第11章) |
| Send CC | 選んだ画像を Comic Creator のコマに送る(Comic Creatorの中でギャラリーを開いたときだけ表示。第11章 11-6) |
| Send CC Layout | 選んだ画像を Comic Creator のレイアウトタブ(選択中のコマ/オーバーレイ)に送る(Comic Creatorの中でギャラリーを開いたときだけ表示。第11章 11-6) |
| Send CC Image | 選んだ画像を Comic Creator の Image タブに送る(作業中のレイヤーがあれば新規レイヤー、なければ新規キャンバス。動画は未対応。表示条件は Send CC Layout と同じ) |
I2I(画像から画像を作る)ワークフローで、生成した画像をさらに描き直していくときに便利です。
@@ -2204,7 +2215,7 @@ Eagleで画像を管理している方は、試してみてください。
| モデル | 特徴 | 準備 |
| --- | --- | --- |
| Gemini Embedding 2 | Googleのサービスで計算する。速い。画像をGoogleに送る | APIキーを取得し、プラグインの `.env` に `GEMINI_API_KEY=キー` と書いて、ComfyUIを再起動する |
| EmbeddingGemma 2 | パソコンの中で計算する(ローカル)。外部に送らない | 追加の準備は不要。初回だけモデルが自動でダウンロードされる |
| EmbeddingGemma 2 | パソコンの中で、**Ollama** を使って計算する(ローカル・無料)。外部に送らない | Ollamaをインストールして起動し、`ollama pull embeddinggemma-2:740m`(または軽量版の `embeddinggemma-2:440m`)を実行する。モデル設定タブで **Ollama URL**(通常は変更不要)と **モデルサイズ** を選ぶ |
> **注意:Geminiを使うとき**
> 画像がGoogleのサービスに送られます。無料枠で送った内容は、Googleの製品改善に使われる場合があります。
@@ -2216,13 +2227,14 @@ Eagleで画像を管理している方は、試してみてください。
2. 「新規のみ」か「全件再作成」を選んで開始します。進み具合が表示され、途中で停止もできます。
3. インデックスは全フォルダで共通の1つです。フォルダごとに少しずつ作っても構いません。
モデルやベクトル次元、画像の精度を変えたときは、**全件再作成** が必要です。
モデルやベクトル次元を変えたときは、**全件再作成** が必要です。
### 速さの目安と設定
- ローカルのEmbeddingGemma 2は、初期設定ではCPUで動き、1枚あたり数秒かかります。
**画像の精度** を「標準」や「軽量」にすると速くなります(変えたら全件再作成)。
**CPUスレッド数** を減らすと、画像生成中のパソコンの負荷が軽くなります。
- NVIDIAのGPUがあれば、ComfyUIのPythonに `onnxruntime-gpu` を入れると、1枚あたり約0.1秒になります(対処は第12章 12-5)。
- ローカルのEmbeddingGemma 2は、v0.8.14からOllamaで動くようになりました(それまでの、ComfyUIのPythonで動かす方式は廃止)。
NVIDIAのGPUなら1枚あたり約0.1〜0.2秒です。インデックスを作り終えると、モデルはGPUメモリから自動で降ろされます。
- インデックスを作るときと、検索するときは、Ollamaが起動している必要があります。
- モデルサイズの740m(テキスト+画像+音声)と440m(テキスト+画像・軽量)は同じ結果を返すので、切り替えても全件再作成は不要です。
v0.8.13以前に作ったインデックスも、そのまま使えます。
- **検索設定** タブで、類似画像・文章検索それぞれの「最小スコア」と最大表示件数を決められます。
スコアの水準はモデルによって違うため、モデルごとに保存されます。
@@ -2702,6 +2714,9 @@ Taggerを使うには、次の準備が必要です。
1. **タグ付け用のモデル**(WD Tagger など)を、ComfyUIの `models/tagger/(モデル名)/` フォルダに置きます。
フォルダには、`.onnx` ファイルと `selected_tags.csv` を入れます。
**PixAI Tagger v1.0**(v0.8.10〜)も使えます。Hugging Faceのコミュニティ変換版(`Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8`)から、
`.onnx` を1つ(GPUなら `model_fp16.onnx` がおすすめ)と、`selected_tags.csv`・`preprocess.json` を同じフォルダに入れると、自動で判別されます。
PixAIのモデルを選ぶと、しきい値のスライダーが、PixAIの推奨値(0.17/0.27)に切り替わります。
2. **追加のPythonパッケージ** をインストールします。
Workflow Studioのフォルダにある `requirements.txt` を使います。
@@ -2717,6 +2732,10 @@ Taggerを使うには、次の準備が必要です。
> 必ず、**ComfyUIが使っているPython** にインストールしてください。
> 分からない場合は、ComfyUI Managerの機能でパッケージをインストールする方法もあります。
> **注意:GPUで動いているか確認する**
> Taggerは、NVIDIAのGPUで動かすと1枚あたり1秒かからないのに対し、CPUで動くとPixAIでは1枚あたり20秒ほどかかります。
> とても遅いときは、GPU用のパッケージが正しく入っているか確認してください(第12章 12-5)。
> **ポイント**
> ローカルAI(第10章)の画像読み取り(VLM)と組み合わせて、両方の結果をまとめたタグを作ることもできます。
@@ -2767,6 +2786,7 @@ Image Editのいちばん便利な使い方が、**インペイント** です
- **MiniMax H3**(画像から動画)
- **LTX-2.5**(文章から動画、画像から動画、最初と最後の画像を指定して動画)
- **Wan2.2**(文章から動画)
- **FastH3 OmniRef/Pika-H3-Flex**(MiniMax H3の参照画像から動画。v0.8.14〜)
対応するワークフローを、ワークフロータブの **Videoに読み込み** で読み込んで使います(第4章 4-6)。
@@ -2790,6 +2810,21 @@ Image Editのいちばん便利な使い方が、**インペイント** です
- 動画ソースパネルは少し広くなり、ファイル名が1行で表示され、ボタンも横一列に並ぶようになりました。
### 参照画像から動画(FastH3 OmniRef/Pika-H3-Flex)(v0.8.14〜)
このタイプのワークフローは、最初と最後の画像ではなく、**参照画像** をもとに動画を作ります。
そのため、Planサブタブの画像の欄は、次のように名前が変わります。
| 欄 | このタイプでの意味 |
| --- | --- |
| Reference Image | 1枚目の参照画像(ふだんの First Image の欄) |
| Reference Image 2 (optional) | 2枚目の参照画像(ふだんの Last Image の欄) |
- プロンプト・長さ(秒)・縦横比などは、ほかの動画ワークフローと同じように使えます。
- 画像の欄を **None** や **Clear** で空にしたブロックは、ワークフローに参照画像が設定されていても、その画像を使わずに生成します。
「+ Block」で追加したブロックは画像が空の状態で始まるので、参照画像が必要なブロックでは、それぞれ画像を指定してください。
- 画像の選び方で **Use previous block's last frame**(前のブロックの最後のフレームを使う)を選ぶと、前のブロックで実際に生成された動画の最後のフレームが、そのブロックの1枚目の参照画像になります。
- Assetサブタブのボタンも「Reference Imageに設定」「Reference Image 2に設定」に変わります。
> **注意**
> 動画生成は、画像生成よりもはるかに多くのGPUメモリと時間を使います。
> 使うモデルの必要スペックを確認してから試しましょう。
@@ -2857,11 +2892,12 @@ Workflow Studioとは別にインストールするソフトですが、両方
両方をインストールすると、次のような連携ができます。
- **Comic Creatorの中でWorkflow Studioのギャラリーを使う**
Comic Creatorの中にWorkflow Studioのギャラリーが表示され、生成した画像を選んで **Send CC** ボタンでコマに送れます。
Comic Creatorの中にWorkflow Studioのギャラリーが表示され、生成した画像を選んで **Send CC Layout**(レイアウトタブのコマ/オーバーレイへ)または **Send CC Image**(Imageタブへ)ボタンで送れます。
(Send CCボタンは、Comic Creatorの中で開いたギャラリーにだけ表示されます)
- **Comic Creatorから画像を生成する**
Comic Creatorの画面から、Workflow Studio(生成UI)を通して、コマに入れる画像を生成したり(T2I)、
描いたラフや配置した画像をもとに描き直したり(I2I・インペイント)できます。
Comic CreatorのNanobanana+タブ(ローカルモード)からは、複数の参照画像を使う画像編集のワークフロー(Flux.3 Klein、Qwen Image 2.1 など)も実行できます(v0.8.12〜)。
「Workflow Studioで画像を作る → Comic Creatorでマンガにまとめる」という流れで、
画像生成からマンガの完成までを、ComfyUIの中だけで行えます。
@@ -2883,6 +2919,74 @@ Workflow Studioとは別にインストールするソフトですが、両方
---
## 11-7 TagSpace - タグとプロンプトを「意味の地図」から選ぶ(v0.9.0〜)
**TagSpace** タブは、Workflow Studioの中にあるプロンプトやタグ、生成した画像を、
**意味の近さ** にしたがって3Dの空間に並べて表示する機能です。
近くにあるものほど意味が近いので、「この雰囲気に近いタグは何だろう」と眺めながら、タグを選んでプロンプトを作れます。
### 空間に並ぶもの
| 種類 | 中身 | 表示 |
| --- | --- | --- |
| カード | ギャラリーの **ImagePrompt**(第8章 8-4)の見本画像と、そのプロンプト | サムネイル |
| タグ | ImagePromptのプロンプト・生成画像に埋め込まれたプロンプト・ワイルドカード・Tagger DB・Promptライブラリの文を、カンマで区切った語 | 出典ごとに色分けした点 |
| Gallery点 | ギャラリーの生成画像の一部(それぞれ、自分のプロンプトのタグを持つ) | 薄い点 |
### 準備
ギャラリーのセマンティック検索(第8章 8-6)と同じく、**Ollama** と **EmbeddingGemma 2** が必要です。
ギャラリーのセマンティック検索の索引を、Gemini Embedding 2で作っている場合は、先にEmbeddingGemma 2で作り直してください。
### 空間を作る
ツールバーで設定を選び、**作成 / 更新** を押します。
| 項目 | 内容 |
| --- | --- |
| タグ数 | 空間に入れるタグの数。出典ごとに、よく使われている順に交互に選ぶ |
| 全タグ | オンにすると、タグ数の代わりに候補のタグをすべて使う(上限2万件) |
| 最低出現回数 | この回数未満しか使われていないタグを除く。2にすると、1回だけの表記ゆれなどが消える |
| ワイルドカード | ワイルドカードをタグの材料に含めるかどうか |
| Gallery点数 | 表示する生成画像の数(0で表示なし) |
| Tagger補完 | プロンプトを取り出せない生成画像に、Taggerのモデルでタグを付ける(OFF/モデル名。「Gallery点のみ」か「プロンプトの無い全画像」を選ぶ) |
- 1回目は、画像のプロンプトの読み取りやタグの準備に数分かかります。2回目からは、前回の結果を使うので数秒〜数十秒で終わります。
- 状態表示に、カード・タグ・Gallery点の数が出ます。候補の一部だけを使ったときは「(候補 N)」と出ます。
> **ポイント**
> タグの種類の大半は、ワイルドカードにしか出てこない語です。
> 「ワイルドカード」をオフにして「全タグ」をオンにすると、自分が実際に使ってきたタグだけを全部並べられます(検証環境では約1万種)。
> **注意**
> Tagger補完は、CPUで動くと1枚あたり0.5秒ほどかかります。「プロンプトの無い全画像」を選ぶ前に、TaggerがGPUで動いているか確認してください(第12章 12-5)。
### 見る・探す
- **ドラッグ** で回転、**右ドラッグ** で移動、**ホイール** でズームします。
- 点にカーソルを合わせると、名前・サムネイル・プロンプトや出典が表示されます。
- ツールバーのチェックボックスで、カード・サムネイル・タグ・Galleryの表示や、**発光**(夜空に光る星のような表示)・**またたき** を切り替えます。
出典ごとのチェックボックスで、タグを出典ごとに表示・非表示にできます。
- 右上の検索欄に言葉や文章を入れて **Enter** を押すと(日本語も可)、その意味の位置に白い印が付き、近いカードやタグが一覧に出ます。
### タグを選んでプロンプトを作る
1. カードやタグをクリックすると選択され、右の **近くの要素** に、意味の近いカード・タグが並びます。
(Gallery点をクリックすると、似ている生成画像も並びます)
2. プロンプトに入れたいものを **ダブルクリック** するか、**選択中** の **追加**、または一覧の **+** を押します。
カードはプロンプト全体、タグはタグそのもの、Gallery点はその画像のタグが、右端の **プロンプト** 欄に入ります。
3. **GenerateUIへ追記(Positive)** で、生成UIに読み込んだワークフローのポジティブプロンプトに追記します(先に生成UIでワークフローを読み込んでおきます)。
**コピー** でクリップボードにコピーすることもできます。
### カードや生成画像のタグで探す
カードやGallery点を選ぶと、**選択中** に、そのプロンプトのタグがボタンで並びます。
タグをクリックして選び(もう一度で解除)、**選択したタグで空間検索** を押すと、選んだタグで空間を検索します。
「この画像の、髪型と服装だけに近いものを探したい」といったときに便利です。
タグを選んでいる間は、**選択中** の **追加** ボタンが **選択したタグを追加(N)** に変わり、選んだタグだけをプロンプト欄に追加できます。
タグを選んでいなければ、これまでどおり全体(カードはプロンプト全文、Gallery点はすべてのタグ)が追加されます。
Gallery点を選んでいるときは、**選択中** に **Galleryで開く** ボタンも表示されます。
押すとギャラリータブに切り替わり、その画像のフォルダが選ばれ、画像一覧でその画像が選択された状態になります(右の詳細も開きます)。
画像が一覧に必ず出るよう、ギャラリーの検索・お気に入り・タグ・グループの絞り込みは解除されます。
カードのプロンプト全文は、**プロンプト全文** を開くと読めます。
---
> **この章のまとめ**
> - ノードタブでインストール済みのノードを一覧・整理でき、WS Libraryで使える
> - Taggerは画像からタグを自動生成する。モデルと追加パッケージの準備が必要
@@ -2890,6 +2994,7 @@ Workflow Studioとは別にインストールするソフトですが、両方
> - Videoタブで、対応する動画生成モデルを使った動画作りと簡単な編集ができる
> - 設定タブの「デフォルトCheckpoint」と「データ管理(バックアップ)」は特に便利
> - 同じ作者の Comic Creator と組み合わせると、生成した画像でマンガを作れる
> - TagSpaceでは、手持ちのタグ・プロンプト・生成画像を意味の近さで3Dに並べ、眺めながらタグを選んでプロンプトを作れる
---
@@ -3038,6 +3143,11 @@ Ollamaの場合は `ollama pull (モデル名)` でモデルをダウンロ
- `ComfyUI/models/tagger/(モデル名)/` フォルダに、`.onnx` ファイル(と `selected_tags.csv`)が入っているか確認します。
- 追加のPythonパッケージ(onnxruntime)が、**ComfyUIが使っているPython** にインストールされているか確認します(第11章 11-2)。
### Taggerがとても遅い(GPUが使われない)
ComfyUIのPythonに、CPU版の `onnxruntime` とGPU版の `onnxruntime-gpu` が両方入っていると、GPUが使われなくなります。
(ほかのカスタムノードのインストールで、CPU版が入ることがあります)
ComfyUIを停止し、ComfyUIのPythonで `pip uninstall -y onnxruntime onnxruntime-gpu` のあと `pip install onnxruntime-gpu` を実行して、ComfyUIを再起動してください(DirectMLは非対応)。
### PSD関連の機能がエラーになる
追加のPythonパッケージ(psd-tools)が必要です。
エラーメッセージに表示されるインストール用のコマンドを、ComfyUIが使っているPythonで実行してから、ComfyUIを再起動してください。
@@ -3045,9 +3155,18 @@ Ollamaの場合は `ollama pull (モデル名)` でモデルをダウンロ
### セマンティック検索(Gallery)がうまく動かない
| 症状 | 原因 | 対処 |
| --- | --- | --- |
| GPUが検出されない(設定に「GPU未検出」と出る、実行がCPUになる) | ComfyUIのPythonに入っているonnxruntimeがCPU版 | ComfyUIを停止し、ComfyUIのPythonで `pip uninstall -y onnxruntime onnxruntime-gpu` のあと `pip install onnxruntime-gpu` を実行して、ComfyUIを再起動する(DirectMLは非対応) |
| 「Ollamaに接続できません」と出る | Ollamaが起動していない、またはOllama URLが違う | Ollamaを起動する(インデックス作成中と検索時に必要)。歯車ボタンのモデル設定タブでOllama URLを確認する |
| 「Ollamaのモデルが未取得です」と出る | EmbeddingGemma 2をダウンロードしていない | `ollama pull embeddinggemma-2:740m`(または `embeddinggemma-2:440m`)を実行する |
| インデックス作成が「connection was forcibly closed」などでときどき失敗する | セキュリティソフト(AdGuardなど)がOllamaの通信に割り込んでいる | Ollamaをフィルタの対象から外す。失敗した画像は、次回の「新規・変更された画像のみ」で作り直される |
| Geminiで「GEMINI_API_KEYが未設定」と出る・キーが拒否される | `.env` にキーが無い、または行頭に `#` が付いている | プラグインの `.env`(`.env.example` をコピー)に `GEMINI_API_KEY=キー` と書き、ComfyUIを再起動する。`.env` は起動時にしか読み込まれない |
| 検索やSimilarの結果が出ない | 選んだフォルダにインデックス済みの画像が無い | 歯車ボタンでインデックスを作る。緑の点があるフォルダを選ぶ。モデルや精度を変えたときは「全件再作成」 |
| 検索やSimilarの結果が出ない | 選んだフォルダにインデックス済みの画像が無い | 歯車ボタンでインデックスを作る。緑の点があるフォルダを選ぶ。モデルやベクトル次元を変えたときは「全件再作成」 |
### TagSpaceの空間が作れない
| 症状 | 原因 | 対処 |
| --- | --- | --- |
| 「OllamaのEmbeddingGemma 2が必要です」と出る | Ollamaが起動していない、またはモデルが無い | セマンティック検索と同じ準備をする(上の表) |
| 「Galleryのセマンティック索引は … で作られています」と出る | ギャラリーの索引をGeminiで作っている | ギャラリーのセマンティック設定でEmbeddingGemma 2を選び、「全件再作成」する |
| 作成にとても時間がかかる | 1回目は、画像のプロンプトの読み取りと、新しいタグの準備に時間がかかる | 2回目からは速くなる。Tagger補完を使うときは、TaggerがGPUで動いているか確認する(上の「Taggerがとても遅い」) |
### パートナーAPI(Nano Banana)が「認証に失敗しました」と出る
`.env` にComfy APIキーが無いのが原因です。プラグインの `.env` に `COMFY_API_KEY=キー`(platform.comfy.orgで発行)を書き、ComfyUIを再起動してください(第5章 5-8)。
@@ -3141,6 +3260,7 @@ Workflow Studioの **ヘルプ** タブにも、トラブルシューティン
| LoRA | 絵柄やキャラクターなどを追加で覚えさせる小さなモデル | 第6章 |
| Ollama | ローカルAIを手軽に動かせるソフト | 第10章 |
| T2I(Text to Image) | 文章(プロンプト)から画像を作ること | 第5章 |
| TagSpace | タグ・プロンプト・生成画像を意味の近さで3Dの空間に並べて表示するタブ | 第11章 |
| VAE | 画像の色合いや細部を仕上げるモデル | 第6章 |
| VLM | 画像を読み取れるAIモデル | 第10章 |
| VRAM | GPU(グラフィックボード)のメモリ | 第10章 |
Binary file not shown.
+2 -1
View File
@@ -83,6 +83,7 @@ Workflow Studioは、そうして作り上げたワークフローを **素早
- **画像編集(Image Edit)** - レイヤー付きの簡易編集、マスクを使った部分的な描き直し(インペイント)
- **ローカルAI連携** - 日本語からのプロンプト翻訳、画像からのプロンプト・タグ作成
- **Tagger・Video** - 画像からのタグ自動生成、動画の生成と簡単な編集
- **TagSpace** - 手持ちのプロンプト・タグ・生成画像を「意味の近さ」で3Dの空間に並べ、眺めながらタグを選ぶ
---
@@ -128,7 +129,7 @@ ComfyUIの「自由さ」はそのままに、「分かりやすさ」と「手
## 本書の対象バージョンと環境
- **Workflow Studio**:v0.8.9
- **Workflow Studio**:v0.9.1
- **ComfyUI**:本書執筆時点の最新版
- **OS**:Windows(画面の例はWindowsのものです)
@@ -19,7 +19,8 @@ Workflow Studioの基本機能は、ComfyUIが動いていれば追加の準備
### あとから必要に応じて
次のものは、特定の機能を使うときだけ必要です。最初は気にしなくてかまいません。
- **Ollama / LM Studio など** - プロンプトの翻訳やAIチャットなどのAI補助機能(第10章)
- **Ollama / LM Studio など** - プロンプトの翻訳やAIチャットなどのAI補助機能(第10章)。
ギャラリーのセマンティック検索をローカルで行うとき(第8章)と、TagSpaceタブ(第11章)には **Ollama** が必要です
- **Eagle** - 生成画像を画像管理ソフトEagleに自動保存する機能(第8章)
- **追加のPythonパッケージ** - Tagger(画像からのタグ生成)やPSD書き出しなど(第11章)
@@ -24,6 +24,7 @@ Workflow Studioを開くと、画面の上部にタブが横一列に並んで
| Image Edit | Image Edit | 画像の簡易編集・マスク作成 | | 第11章 |
| Video | Video | 動画生成・動画編集 | | 第11章 |
| Tagger | Tagger | 画像からタグ(プロンプト)を自動生成 | | 第11章 |
| TagSpace | TagSpace | タグ・プロンプト・生成画像を意味の近さで3D表示し、タグを選ぶ | | 第11章 |
| 設定 | Settings | 言語・テーマ・フォルダなどの設定 | | 本章・第11章 |
| ヘルプ | Help | 機能一覧・ショートカット・トラブル対処 | | 本章 |
| AI TOOL | AI TOOL | ローカルAIによる翻訳・チャット・画像解析 | | 第10章 |
@@ -35,7 +36,7 @@ Workflow Studioを開くと、画面の上部にタブが横一列に並んで
手持ちの素材を一覧にして、探しやすくするタブです。
- **作る** - 生成UI/Image Edit/Video
実際に画像や動画を作ったり、手を加えたりするタブです。
- **補助する** - AI TOOL/Tagger/設定/ヘルプ
- **補助する** - AI TOOL/Tagger/TagSpace/設定/ヘルプ
他のタブでの作業を助けたり、全体の設定をしたりするタブです。
> **ポイント**
@@ -72,6 +72,9 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
フォームで値を変えると、ここにも反映されます。
慣れないうちは、ここは「見るだけ」にしておきましょう。
Inputサブタブでは、Raw JSONの上端にある **»** ボタンで、Raw JSONを右端の細い帯に折りたためます(v0.8.12〜)。
プロンプトや画像の欄が広くなります。もう一度押すと元に戻り、折りたたんだ状態は次回も記憶されます。
---
## 5-3 はじめての1枚を生成する
@@ -79,7 +82,7 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
いよいよ生成です。最低限、次の3つを確認・設定します。
1. どのモデルで描くか(Model)
2. 何を描くか(Input → Prompt)
2. 何を描くか(Input)
3. 生成する(Generate)
### 手順1:モデルを選ぶ(Model)
@@ -112,7 +115,9 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
> 緑色でない項目は、変更してもこのワークフローには影響しません。
### 手順2:プロンプトを書く(Input)
1. サブタブの **Input** を開き、その中の **Prompt** を選びます。
1. サブタブの **Input** を開きます。
左側にプロンプト(Prompt)の欄、右側に入力画像(Image)の欄が並んでいます(v0.8.12〜。それまではPrompt/Imageを切り替える形でした)。
画面の幅が狭いときは、Imageの欄はプロンプトの下に回ります。
2. **Positive Prompt** の欄に、描いてほしい内容を英語で入力します。
```
@@ -196,8 +196,8 @@ v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実
### 使い方
1. ワークフロータブで、Nano Bananaのサンプル(`ws_nano_banana_2_1_t2i`)を生成UIに読み込みます。
2. **Prompt** サブタブでプロンプトを編集し、**Apply** を押します。
3. 参考画像を使うときは、**Image** サブタブの画像カードで指定します。
2. **Input** サブタブの左側(Prompt)でプロンプトを編集し、**Apply** を押します。
3. 参考画像を使うときは、**Input** サブタブの右側(Image)の画像カードで指定します。
4. **Generate** を押します。
> **ポイント**
@@ -214,6 +214,8 @@ v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実
| Qwen Image 2.1 Turbo | ComfyUI公式テンプレートの文章から画像(T2I)・画像から画像(I2I)。プロンプトエンハンサー(プロンプトを自動で補う機能)の入力欄にも、編集が反映される |
| Flux.3 Klein | 公式テンプレート4種(KleinとKlein SDのT2IとImage Edit) |
| MOSS-Image | Base/SFTのT2Iと、枠で位置を指定するバウンディングボックス版 |
| Fibo 2.0 Edit(v0.8.14〜) | 画像編集のワークフロー。プロンプト強化(PE)を使う構成でも、プロンプト欄の編集がPEのオン・オフどちらにも反映される。ネガティブの欄にはVGL形式(JSON)の説明文がそのまま入る。幅・高さ(Settings)は0で自動 |
| FastH3 OmniRef/Pika-H3-Flex(v0.8.14〜) | MiniMax H3の「参照画像から動画」(Reference to Video)。動画のワークフローとして扱われ、Videoタブ(第11章)でも使える |
| ネイティブLoRAスタック | ComfyUI v0.40のLoRAをまとめて読み込むノード(LoadLoraModel/LoadLoraTextEncoder)。Apply・バイパス・Metadata表示に対応 |
> **注意**
@@ -240,7 +240,7 @@ Eagleで画像を管理している方は、試してみてください。
| モデル | 特徴 | 準備 |
| --- | --- | --- |
| Gemini Embedding 2 | Googleのサービスで計算する。速い。画像をGoogleに送る | APIキーを取得し、プラグインの `.env` に `GEMINI_API_KEY=キー` と書いて、ComfyUIを再起動する |
| EmbeddingGemma 2 | パソコンの中で計算する(ローカル)。外部に送らない | 追加の準備は不要。初回だけモデルが自動でダウンロードされる |
| EmbeddingGemma 2 | パソコンの中で、**Ollama** を使って計算する(ローカル・無料)。外部に送らない | Ollamaをインストールして起動し、`ollama pull embeddinggemma-2:740m`(または軽量版の `embeddinggemma-2:440m`)を実行する。モデル設定タブで **Ollama URL**(通常は変更不要)と **モデルサイズ** を選ぶ |
> **注意:Geminiを使うとき**
> 画像がGoogleのサービスに送られます。無料枠で送った内容は、Googleの製品改善に使われる場合があります。
@@ -252,13 +252,14 @@ Eagleで画像を管理している方は、試してみてください。
2. 「新規のみ」か「全件再作成」を選んで開始します。進み具合が表示され、途中で停止もできます。
3. インデックスは全フォルダで共通の1つです。フォルダごとに少しずつ作っても構いません。
モデルやベクトル次元、画像の精度を変えたときは、**全件再作成** が必要です。
モデルやベクトル次元を変えたときは、**全件再作成** が必要です。
### 速さの目安と設定
- ローカルのEmbeddingGemma 2は、初期設定ではCPUで動き、1枚あたり数秒かかります。
**画像の精度** を「標準」や「軽量」にすると速くなります(変えたら全件再作成)。
**CPUスレッド数** を減らすと、画像生成中のパソコンの負荷が軽くなります。
- NVIDIAのGPUがあれば、ComfyUIのPythonに `onnxruntime-gpu` を入れると、1枚あたり約0.1秒になります(対処は第12章 12-5)。
- ローカルのEmbeddingGemma 2は、v0.8.14からOllamaで動くようになりました(それまでの、ComfyUIのPythonで動かす方式は廃止)。
NVIDIAのGPUなら1枚あたり約0.1〜0.2秒です。インデックスを作り終えると、モデルはGPUメモリから自動で降ろされます。
- インデックスを作るときと、検索するときは、Ollamaが起動している必要があります。
- モデルサイズの740m(テキスト+画像+音声)と440m(テキスト+画像・軽量)は同じ結果を返すので、切り替えても全件再作成は不要です。
v0.8.13以前に作ったインデックスも、そのまま使えます。
- **検索設定** タブで、類似画像・文章検索それぞれの「最小スコア」と最大表示件数を決められます。
スコアの水準はモデルによって違うため、モデルごとに保存されます。
@@ -54,6 +54,9 @@ Taggerを使うには、次の準備が必要です。
1. **タグ付け用のモデル**(WD Tagger など)を、ComfyUIの `models/tagger/(モデル名)/` フォルダに置きます。
フォルダには、`.onnx` ファイルと `selected_tags.csv` を入れます。
**PixAI Tagger v1.0**(v0.8.10〜)も使えます。Hugging Faceのコミュニティ変換版(`Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8`)から、
`.onnx` を1つ(GPUなら `model_fp16.onnx` がおすすめ)と、`selected_tags.csv`・`preprocess.json` を同じフォルダに入れると、自動で判別されます。
PixAIのモデルを選ぶと、しきい値のスライダーが、PixAIの推奨値(0.17/0.27)に切り替わります。
2. **追加のPythonパッケージ** をインストールします。
Workflow Studioのフォルダにある `requirements.txt` を使います。
@@ -69,6 +72,10 @@ Taggerを使うには、次の準備が必要です。
> 必ず、**ComfyUIが使っているPython** にインストールしてください。
> 分からない場合は、ComfyUI Managerの機能でパッケージをインストールする方法もあります。
> **注意:GPUで動いているか確認する**
> Taggerは、NVIDIAのGPUで動かすと1枚あたり1秒かからないのに対し、CPUで動くとPixAIでは1枚あたり20秒ほどかかります。
> とても遅いときは、GPU用のパッケージが正しく入っているか確認してください(第12章 12-5)。
> **ポイント**
> ローカルAI(第10章)の画像読み取り(VLM)と組み合わせて、両方の結果をまとめたタグを作ることもできます。
@@ -119,6 +126,7 @@ Image Editのいちばん便利な使い方が、**インペイント** です
- **MiniMax H3**(画像から動画)
- **LTX-2.5**(文章から動画、画像から動画、最初と最後の画像を指定して動画)
- **Wan2.2**(文章から動画)
- **FastH3 OmniRef/Pika-H3-Flex**(MiniMax H3の参照画像から動画。v0.8.14〜)
対応するワークフローを、ワークフロータブの **Videoに読み込み** で読み込んで使います(第4章 4-6)。
@@ -142,6 +150,21 @@ Image Editのいちばん便利な使い方が、**インペイント** です
- 動画ソースパネルは少し広くなり、ファイル名が1行で表示され、ボタンも横一列に並ぶようになりました。
### 参照画像から動画(FastH3 OmniRef/Pika-H3-Flex)(v0.8.14〜)
このタイプのワークフローは、最初と最後の画像ではなく、**参照画像** をもとに動画を作ります。
そのため、Planサブタブの画像の欄は、次のように名前が変わります。
| 欄 | このタイプでの意味 |
| --- | --- |
| Reference Image | 1枚目の参照画像(ふだんの First Image の欄) |
| Reference Image 2 (optional) | 2枚目の参照画像(ふだんの Last Image の欄) |
- プロンプト・長さ(秒)・縦横比などは、ほかの動画ワークフローと同じように使えます。
- 画像の欄を **None** や **Clear** で空にしたブロックは、ワークフローに参照画像が設定されていても、その画像を使わずに生成します。
「+ Block」で追加したブロックは画像が空の状態で始まるので、参照画像が必要なブロックでは、それぞれ画像を指定してください。
- 画像の選び方で **Use previous block's last frame**(前のブロックの最後のフレームを使う)を選ぶと、前のブロックで実際に生成された動画の最後のフレームが、そのブロックの1枚目の参照画像になります。
- Assetサブタブのボタンも「Reference Imageに設定」「Reference Image 2に設定」に変わります。
> **注意**
> 動画生成は、画像生成よりもはるかに多くのGPUメモリと時間を使います。
> 使うモデルの必要スペックを確認してから試しましょう。
@@ -214,6 +237,7 @@ Workflow Studioとは別にインストールするソフトですが、両方
- **Comic Creatorから画像を生成する**
Comic Creatorの画面から、Workflow Studio(生成UI)を通して、コマに入れる画像を生成したり(T2I)、
描いたラフや配置した画像をもとに描き直したり(I2I・インペイント)できます。
Comic CreatorのNanobanana+タブ(ローカルモード)からは、複数の参照画像を使う画像編集のワークフロー(Flux.3 Klein、Qwen Image 2.1 など)も実行できます(v0.8.12〜)。
「Workflow Studioで画像を作る → Comic Creatorでマンガにまとめる」という流れで、
画像生成からマンガの完成までを、ComfyUIの中だけで行えます。
@@ -235,6 +259,74 @@ Workflow Studioとは別にインストールするソフトですが、両方
---
## 11-7 TagSpace - タグとプロンプトを「意味の地図」から選ぶ(v0.9.0〜)
**TagSpace** タブは、Workflow Studioの中にあるプロンプトやタグ、生成した画像を、
**意味の近さ** にしたがって3Dの空間に並べて表示する機能です。
近くにあるものほど意味が近いので、「この雰囲気に近いタグは何だろう」と眺めながら、タグを選んでプロンプトを作れます。
### 空間に並ぶもの
| 種類 | 中身 | 表示 |
| --- | --- | --- |
| カード | ギャラリーの **ImagePrompt**(第8章 8-4)の見本画像と、そのプロンプト | サムネイル |
| タグ | ImagePromptのプロンプト・生成画像に埋め込まれたプロンプト・ワイルドカード・Tagger DB・Promptライブラリの文を、カンマで区切った語 | 出典ごとに色分けした点 |
| Gallery点 | ギャラリーの生成画像の一部(それぞれ、自分のプロンプトのタグを持つ) | 薄い点 |
### 準備
ギャラリーのセマンティック検索(第8章 8-6)と同じく、**Ollama** と **EmbeddingGemma 2** が必要です。
ギャラリーのセマンティック検索の索引を、Gemini Embedding 2で作っている場合は、先にEmbeddingGemma 2で作り直してください。
### 空間を作る
ツールバーで設定を選び、**作成 / 更新** を押します。
| 項目 | 内容 |
| --- | --- |
| タグ数 | 空間に入れるタグの数。出典ごとに、よく使われている順に交互に選ぶ |
| 全タグ | オンにすると、タグ数の代わりに候補のタグをすべて使う(上限2万件) |
| 最低出現回数 | この回数未満しか使われていないタグを除く。2にすると、1回だけの表記ゆれなどが消える |
| ワイルドカード | ワイルドカードをタグの材料に含めるかどうか |
| Gallery点数 | 表示する生成画像の数(0で表示なし) |
| Tagger補完 | プロンプトを取り出せない生成画像に、Taggerのモデルでタグを付ける(OFF/モデル名。「Gallery点のみ」か「プロンプトの無い全画像」を選ぶ) |
- 1回目は、画像のプロンプトの読み取りやタグの準備に数分かかります。2回目からは、前回の結果を使うので数秒〜数十秒で終わります。
- 状態表示に、カード・タグ・Gallery点の数が出ます。候補の一部だけを使ったときは「(候補 N)」と出ます。
> **ポイント**
> タグの種類の大半は、ワイルドカードにしか出てこない語です。
> 「ワイルドカード」をオフにして「全タグ」をオンにすると、自分が実際に使ってきたタグだけを全部並べられます(検証環境では約1万種)。
> **注意**
> Tagger補完は、CPUで動くと1枚あたり0.5秒ほどかかります。「プロンプトの無い全画像」を選ぶ前に、TaggerがGPUで動いているか確認してください(第12章 12-5)。
### 見る・探す
- **ドラッグ** で回転、**右ドラッグ** で移動、**ホイール** でズームします。
- 点にカーソルを合わせると、名前・サムネイル・プロンプトや出典が表示されます。
- ツールバーのチェックボックスで、カード・サムネイル・タグ・Galleryの表示や、**発光**(夜空に光る星のような表示)・**またたき** を切り替えます。
出典ごとのチェックボックスで、タグを出典ごとに表示・非表示にできます。
- 右上の検索欄に言葉や文章を入れて **Enter** を押すと(日本語も可)、その意味の位置に白い印が付き、近いカードやタグが一覧に出ます。
### タグを選んでプロンプトを作る
1. カードやタグをクリックすると選択され、右の **近くの要素** に、意味の近いカード・タグが並びます。
(Gallery点をクリックすると、似ている生成画像も並びます)
2. プロンプトに入れたいものを **ダブルクリック** するか、**選択中** の **追加**、または一覧の **+** を押します。
カードはプロンプト全体、タグはタグそのもの、Gallery点はその画像のタグが、右端の **プロンプト** 欄に入ります。
3. **GenerateUIへ追記(Positive)** で、生成UIに読み込んだワークフローのポジティブプロンプトに追記します(先に生成UIでワークフローを読み込んでおきます)。
**コピー** でクリップボードにコピーすることもできます。
### カードや生成画像のタグで探す
カードやGallery点を選ぶと、**選択中** に、そのプロンプトのタグがボタンで並びます。
タグをクリックして選び(もう一度で解除)、**選択したタグで空間検索** を押すと、選んだタグで空間を検索します。
「この画像の、髪型と服装だけに近いものを探したい」といったときに便利です。
タグを選んでいる間は、**選択中** の **追加** ボタンが **選択したタグを追加(N)** に変わり、選んだタグだけをプロンプト欄に追加できます。
タグを選んでいなければ、これまでどおり全体(カードはプロンプト全文、Gallery点はすべてのタグ)が追加されます。
Gallery点を選んでいるときは、**選択中** に **Galleryで開く** ボタンも表示されます。
押すとギャラリータブに切り替わり、その画像のフォルダが選ばれ、画像一覧でその画像が選択された状態になります(右の詳細も開きます)。
画像が一覧に必ず出るよう、ギャラリーの検索・お気に入り・タグ・グループの絞り込みは解除されます。
カードのプロンプト全文は、**プロンプト全文** を開くと読めます。
---
> **この章のまとめ**
> - ノードタブでインストール済みのノードを一覧・整理でき、WS Libraryで使える
> - Taggerは画像からタグを自動生成する。モデルと追加パッケージの準備が必要
@@ -242,3 +334,4 @@ Workflow Studioとは別にインストールするソフトですが、両方
> - Videoタブで、対応する動画生成モデルを使った動画作りと簡単な編集ができる
> - 設定タブの「デフォルトCheckpoint」と「データ管理(バックアップ)」は特に便利
> - 同じ作者の Comic Creator と組み合わせると、生成した画像でマンガを作れる
> - TagSpaceでは、手持ちのタグ・プロンプト・生成画像を意味の近さで3Dに並べ、眺めながらタグを選んでプロンプトを作れる
@@ -143,6 +143,11 @@ Ollamaの場合は `ollama pull (モデル名)` でモデルをダウンロ
- `ComfyUI/models/tagger/(モデル名)/` フォルダに、`.onnx` ファイル(と `selected_tags.csv`)が入っているか確認します。
- 追加のPythonパッケージ(onnxruntime)が、**ComfyUIが使っているPython** にインストールされているか確認します(第11章 11-2)。
### Taggerがとても遅い(GPUが使われない)
ComfyUIのPythonに、CPU版の `onnxruntime` とGPU版の `onnxruntime-gpu` が両方入っていると、GPUが使われなくなります。
(ほかのカスタムノードのインストールで、CPU版が入ることがあります)
ComfyUIを停止し、ComfyUIのPythonで `pip uninstall -y onnxruntime onnxruntime-gpu` のあと `pip install onnxruntime-gpu` を実行して、ComfyUIを再起動してください(DirectMLは非対応)。
### PSD関連の機能がエラーになる
追加のPythonパッケージ(psd-tools)が必要です。
エラーメッセージに表示されるインストール用のコマンドを、ComfyUIが使っているPythonで実行してから、ComfyUIを再起動してください。
@@ -150,9 +155,18 @@ Ollamaの場合は `ollama pull (モデル名)` でモデルをダウンロ
### セマンティック検索(Gallery)がうまく動かない
| 症状 | 原因 | 対処 |
| --- | --- | --- |
| GPUが検出されない(設定に「GPU未検出」と出る、実行がCPUになる) | ComfyUIのPythonに入っているonnxruntimeがCPU版 | ComfyUIを停止し、ComfyUIのPythonで `pip uninstall -y onnxruntime onnxruntime-gpu` のあと `pip install onnxruntime-gpu` を実行して、ComfyUIを再起動する(DirectMLは非対応) |
| 「Ollamaに接続できません」と出る | Ollamaが起動していない、またはOllama URLが違う | Ollamaを起動する(インデックス作成中と検索時に必要)。歯車ボタンのモデル設定タブでOllama URLを確認する |
| 「Ollamaのモデルが未取得です」と出る | EmbeddingGemma 2をダウンロードしていない | `ollama pull embeddinggemma-2:740m`(または `embeddinggemma-2:440m`)を実行する |
| インデックス作成が「connection was forcibly closed」などでときどき失敗する | セキュリティソフト(AdGuardなど)がOllamaの通信に割り込んでいる | Ollamaをフィルタの対象から外す。失敗した画像は、次回の「新規・変更された画像のみ」で作り直される |
| Geminiで「GEMINI_API_KEYが未設定」と出る・キーが拒否される | `.env` にキーが無い、または行頭に `#` が付いている | プラグインの `.env`(`.env.example` をコピー)に `GEMINI_API_KEY=キー` と書き、ComfyUIを再起動する。`.env` は起動時にしか読み込まれない |
| 検索やSimilarの結果が出ない | 選んだフォルダにインデックス済みの画像が無い | 歯車ボタンでインデックスを作る。緑の点があるフォルダを選ぶ。モデルや精度を変えたときは「全件再作成」 |
| 検索やSimilarの結果が出ない | 選んだフォルダにインデックス済みの画像が無い | 歯車ボタンでインデックスを作る。緑の点があるフォルダを選ぶ。モデルやベクトル次元を変えたときは「全件再作成」 |
### TagSpaceの空間が作れない
| 症状 | 原因 | 対処 |
| --- | --- | --- |
| 「OllamaのEmbeddingGemma 2が必要です」と出る | Ollamaが起動していない、またはモデルが無い | セマンティック検索と同じ準備をする(上の表) |
| 「Galleryのセマンティック索引は … で作られています」と出る | ギャラリーの索引をGeminiで作っている | ギャラリーのセマンティック設定でEmbeddingGemma 2を選び、「全件再作成」する |
| 作成にとても時間がかかる | 1回目は、画像のプロンプトの読み取りと、新しいタグの準備に時間がかかる | 2回目からは速くなる。Tagger補完を使うときは、TaggerがGPUで動いているか確認する(上の「Taggerがとても遅い」) |
### パートナーAPI(Nano Banana)が「認証に失敗しました」と出る
`.env` にComfy APIキーが無いのが原因です。プラグインの `.env` に `COMFY_API_KEY=キー`(platform.comfy.orgで発行)を書き、ComfyUIを再起動してください(第5章 5-8)。
+1
View File
@@ -52,6 +52,7 @@
| LoRA | 絵柄やキャラクターなどを追加で覚えさせる小さなモデル | 第6章 |
| Ollama | ローカルAIを手軽に動かせるソフト | 第10章 |
| T2I(Text to Image) | 文章(プロンプト)から画像を作ること | 第5章 |
| TagSpace | タグ・プロンプト・生成画像を意味の近さで3Dの空間に並べて表示するタブ | 第11章 |
| VAE | 画像の色合いや細部を仕上げるモデル | 第6章 |
| VLM | 画像を読み取れるAIモデル | 第10章 |
| VRAM | GPU(グラフィックボード)のメモリ | 第10章 |
+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.8.9
- Covers: Workflow Studio v0.9.1
- 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.8.9_en.md`.
Chapter files are in the `chapters/` folder; the whole book in one file is `Workflow_Studio_Manual_v0.9.1_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.8.9_en.md](Workflow_Studio_Manual_v0.8.9_en.md)
Whole book: [Workflow_Studio_Manual_v0.9.1_en.md](Workflow_Studio_Manual_v0.9.1_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.8.9
- Covers: Workflow Studio v0.9.1
- 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.8.9_en.md`.
Chapter files are in the `chapters/` folder; the whole book in one file is `Workflow_Studio_Manual_v0.9.1_en.md`.
Screen examples are omitted, so please use the book together with Workflow Studio's Help tab.
---
@@ -97,6 +97,7 @@ Together with the supporting features, it makes moving between the two screens s
- **Image Edit** - simple layer-based editing, and redrawing parts with a mask (inpainting)
- **Local AI integration** - translating prompts from Japanese, creating prompts and tags from images
- **Tagger and Video** - automatic tag generation from images, and video generation with simple editing
- **TagSpace** - lays out your own prompts, tags and generated images in a 3D space by closeness of meaning, so you can browse it and pick tags
---
@@ -142,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.8.9
- **Workflow Studio**: v0.9.1
- **ComfyUI**: the latest version at the time of writing
- **OS**: Windows (screen examples are from Windows)
@@ -355,7 +356,8 @@ The basic features of Workflow Studio work with no extra preparation as long as
### Later, as needed
The following are needed only when you use particular features. You can ignore them at first.
- **Ollama, LM Studio and similar** - AI support features such as prompt translation and AI chat (Chapter 10)
- **Ollama, LM Studio and similar** - AI support features such as prompt translation and AI chat (Chapter 10).
**Ollama** is also needed for local semantic search in the Gallery (Chapter 8) and for the TagSpace tab (Chapter 11)
- **Eagle** - a feature that automatically saves generated images to the image-management software Eagle (Chapter 8)
- **Extra Python packages** - Tagger (tag generation from images), PSD export and the like (Chapter 11)
@@ -616,6 +618,7 @@ It is enough to learn the tabs marked with a star under "Often used" first.
| Image Edit | Simple image editing, making masks | | Chapter 11 |
| Video | Video generation and video editing | | Chapter 11 |
| Tagger | Automatically generating tags (prompts) from images | | Chapter 11 |
| TagSpace | Showing tags, prompts and generated images in 3D by closeness of meaning, and picking tags | | Chapter 11 |
| Settings | Language, theme, folders and other settings | | This chapter, Chapter 11 |
| Help | Feature list, shortcuts, troubleshooting | | This chapter |
| AI TOOL | Translation, chat and image analysis with local AI | | Chapter 10 |
@@ -627,7 +630,7 @@ If the number of tabs makes you lose your way, it helps to think of them in thes
Tabs that list your materials so they are easy to find.
- **Create** - GenerateUI / Image Edit / Video
Tabs for actually making images and videos, or touching them up.
- **Support** - AI TOOL / Tagger / Settings / Help
- **Support** - AI TOOL / Tagger / TagSpace / Settings / Help
Tabs that help with work in other tabs, or hold overall settings.
> **Tip**
@@ -1121,6 +1124,9 @@ To the right of Input, Model and Settings, the contents of the workflow are show
When you change values in the form, they are reflected here too.
Until you are used to it, treat this as "view only".
On the Input subtab, the **>>** button at the top of the Raw JSON folds it into a thin strip at the right edge (v0.8.12 and later),
which gives the prompt and image areas more room. Press it again to unfold it; the folded state is remembered.
---
## 5-3 Generating your first image
@@ -1128,7 +1134,7 @@ Until you are used to it, treat this as "view only".
Now, to generate. At minimum, you check and set these three things.
1. Which model to draw with (Model)
2. What to draw (Input -> Prompt)
2. What to draw (Input)
3. Generate (Generate)
### Step 1: Choose a model (Model)
@@ -1161,7 +1167,9 @@ Now, to generate. At minimum, you check and set these three things.
> Items that are not green have no effect on this workflow even if you change them.
### Step 2: Write a prompt (Input)
1. Open the **Input** subtab and choose **Prompt** inside it.
1. Open the **Input** subtab.
The prompt area (Prompt) is on the left and the input image area (Image) is on the right (v0.8.12 and later; before that you switched between Prompt and Image).
When the screen is narrow, the Image area moves below the prompts.
2. In the **Positive Prompt** field, enter in English what you want drawn.
```
@@ -1479,8 +1487,8 @@ If you run without a key, a message says that partner API authentication failed
### How to use
1. In the Workflow tab, load the Nano Banana sample (`ws_nano_banana_2_1_t2i`) into GenerateUI.
2. Edit the prompt in the **Prompt** subtab and press **Apply**.
3. To use reference images, specify them on the image cards in the **Image** subtab.
2. Edit the prompt on the left side (Prompt) of the **Input** subtab and press **Apply**.
3. To use reference images, specify them on the image cards on the right side (Image) of the **Input** subtab.
4. Press **Generate**.
> **Tip**
@@ -1495,6 +1503,8 @@ The workflows you can use in GenerateUI have increased as follows. They are used
- **Qwen Image 2.1 Turbo** - ComfyUI's official templates for text to image (T2I) and image to image (I2I). Edits also carry over to the prompt enhancer's input (the feature that expands your prompt automatically).
- **Flux.3 Klein** - the four official templates (T2I and Image Edit, for Klein and Klein SD).
- **MOSS-Image** - Base/SFT T2I, and the bounding-box versions that specify positions with frames.
- **Fibo 2.0 Edit** (v0.8.14 and later) - an image-editing workflow. With the prompt enhancer (PE) setup, edits in the prompt area apply whether PE is on or off. The negative area holds a VGL-format (JSON) description as is. Width and height (Settings) of 0 mean automatic.
- **FastH3 OmniRef / Pika-H3-Flex** (v0.8.14 and later) - MiniMax H3 reference to video. Treated as video workflows, and also usable in the Video tab (Chapter 11).
- **Native LoRA stack** - ComfyUI v0.40's nodes that load several LoRAs at once (LoadLoraModel / LoadLoraTextEncoder). Apply, bypass and the Metadata display are supported.
> **Caution**
@@ -2109,7 +2119,8 @@ You can also use a Gallery image as an "input image" for generation.
| Send GenUI Image | Sets the chosen image as the input image (LoadImage node) of the GenerateUI workflow |
| Send to LI node | Sets the chosen image on the image-loading node currently selected on ComfyUI's node screen |
| Image Edit | Opens the chosen image in the Image Edit tab (Chapter 11) |
| Send CC | Sends the chosen image to a panel in Comic Creator (shown only when the Gallery is opened inside Comic Creator; Chapter 11, section 11-6) |
| Send CC Layout | Sends the chosen image to Comic Creator's Layout tab (the selected panel / overlay) (shown only when the Gallery is opened inside Comic Creator; Chapter 11, section 11-6) |
| Send CC Image | Sends the chosen image to Comic Creator's Image tab (as a new layer if a document is open, otherwise as a new canvas; videos are not supported; shown under the same condition as Send CC Layout) |
Handy when redrawing a generated image further with an I2I (image to image) workflow.
@@ -2194,7 +2205,7 @@ You can also bring up a list of **similar images** to the one you choose.
| Model | Characteristics | Preparation |
| --- | --- | --- |
| Gemini Embedding 2 | Computed on Google's service. Fast. Images are sent to Google | Get an API key, write `GEMINI_API_KEY=key` in the plugin's `.env`, and restart ComfyUI |
| EmbeddingGemma 2 | Computed inside your computer (local). Nothing is sent outside | No extra preparation. The model is downloaded automatically only the first time |
| EmbeddingGemma 2 | Computed inside your computer with **Ollama** (local, free). Nothing is sent outside | Install and start Ollama, then run `ollama pull embeddinggemma-2:740m` (or the lighter `embeddinggemma-2:440m`). On the Model tab, choose the **Ollama URL** (usually unchanged) and the **Model size** |
> **Caution: when using Gemini**
> Images are sent to Google's service. Content sent under the free tier may be used by Google to improve its products.
@@ -2206,13 +2217,14 @@ You can also bring up a list of **similar images** to the one you choose.
2. Choose "new only" or "rebuild all" and start. Progress is shown, and you can stop partway.
3. The index is one shared across all folders. You may build it a little at a time, folder by folder.
When you change the model, the vector dimension or the image precision, a **rebuild of everything** is needed.
When you change the model or the vector dimension, a **rebuild of everything** is needed.
### Speed guidelines and settings
- The local EmbeddingGemma 2 runs on the CPU by default and takes a few seconds per image.
Setting the **image precision** to "standard" or "light" makes it faster (rebuild everything after changing it).
Reducing the **number of CPU threads** lightens the computer's load while generating images.
- If you have an NVIDIA GPU, installing `onnxruntime-gpu` into ComfyUI's Python brings it to about 0.1 second per image (the fix is in Chapter 12, section 12-5).
- Since v0.8.14 the local EmbeddingGemma 2 runs in Ollama (the earlier way of running it in ComfyUI's Python was removed).
On an NVIDIA GPU it takes about 0.1 to 0.2 second per image. When indexing finishes, the model is unloaded from GPU memory automatically.
- Ollama must be running while you build the index and while you search.
- The 740m (text + image + audio) and 440m (text + image, lighter) model sizes return the same results, so switching does not need a rebuild.
Indexes made with v0.8.13 or earlier keep working as they are.
- In the **Search** tab, you can decide the "minimum score" for similar-image and text search, and the maximum number of results.
Because the score level differs by model, it is saved per model.
@@ -2692,6 +2704,9 @@ To use Tagger, you need the following preparation.
1. Put a **model for tagging** (such as WD Tagger) in ComfyUI's `models/tagger/(model name)/` folder.
Put a `.onnx` file and `selected_tags.csv` in the folder.
**PixAI Tagger v1.0** (v0.8.10 and later) also works. From the community conversion on Hugging Face (`Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8`),
put one `.onnx` file (`model_fp16.onnx` is recommended for a GPU) together with `selected_tags.csv` and `preprocess.json` in one folder, and it is detected automatically.
When you choose a PixAI model, the threshold sliders switch to PixAI's recommended values (0.17 / 0.27).
2. Install the **extra Python packages**.
Use the `requirements.txt` in the Workflow Studio folder.
@@ -2707,6 +2722,10 @@ To use Tagger, you need the following preparation.
> Always install into **the Python that ComfyUI uses**.
> If you are not sure, there is also a method of installing packages with a ComfyUI Manager feature.
> **Caution: check that it runs on the GPU**
> On an NVIDIA GPU, Tagger takes less than a second per image, but on the CPU, PixAI takes about 20 seconds per image.
> If it is very slow, check that the GPU package is installed correctly (Chapter 12, section 12-5).
> **Tip**
> You can also combine it with the local AI image reading (VLM) from Chapter 10 to make tags that combine both results.
@@ -2757,6 +2776,7 @@ The **Video** tab is a dedicated screen for making short videos from images or t
- **MiniMax H3** (image to video)
- **LTX-2.5** (text to video, image to video, and video from specified first and last images)
- **Wan2.2** (text to video)
- **FastH3 OmniRef / Pika-H3-Flex** (MiniMax H3 reference to video, v0.8.14 and later)
You load a matching workflow with **Load in Video** in the Workflow tab and use it (Chapter 4, section 4-6).
@@ -2780,6 +2800,19 @@ There are also the **Frame** feature, which saves a favorite scene of a video as
- The Video Source panel is a little wider, the file name shows on one line, and the buttons sit in a single row.
### Reference to video (FastH3 OmniRef / Pika-H3-Flex) (v0.8.14 and later)
These workflows make a video from **reference images** instead of a first and last frame,
so the image fields in the Plan subtab are renamed:
- **Reference Image** - the first reference image (the usual First Image field)
- **Reference Image 2 (optional)** - the second reference image (the usual Last Image field)
- Prompt, duration (seconds), aspect ratio and so on work the same as for other video workflows.
- A block whose image field is left empty with **None** or **Clear** is generated without that image, even if the workflow has a reference image wired in.
Blocks added with "+ Block" start with empty images, so set an image on each block that needs a reference.
- Choosing **Use previous block's last frame** makes the last frame of the video actually generated by the previous block the first reference image of that block.
- The Asset subtab buttons also change to "Set as Reference Image" and "Set as Reference Image 2".
> **Caution**
> Video generation uses far more GPU memory and time than image generation.
> Check the required specs of the model before trying it.
@@ -2847,11 +2880,12 @@ It is software you install separately from Workflow Studio, but if you install b
If you install both, the following integrations are possible.
- **Use Workflow Studio's Gallery inside Comic Creator**
Workflow Studio's Gallery appears inside Comic Creator, and you can choose generated images and send them to panels with the **Send CC** button.
(The Send CC button is shown only in a Gallery opened inside Comic Creator)
Workflow Studio's Gallery appears inside Comic Creator, and you can choose generated images and send them to panels with **Send CC Layout** (Layout tab panel / overlay) or to the Image tab with **Send CC Image**.
(The Send CC buttons are shown only in a Gallery opened inside Comic Creator)
- **Generate images from Comic Creator**
From the Comic Creator screen, through Workflow Studio (GenerateUI), you can generate images to put in panels (T2I),
or redraw based on a rough you drew or an image you placed (I2I and inpainting).
From Comic Creator's Nanobanana+ tab (local mode), you can also run image-editing workflows that use several reference images (Flux.3 Klein, Qwen Image 2.1 and so on) (v0.8.12 and later).
With the flow "make images in Workflow Studio -> put them together as manga in Comic Creator",
you can go from image generation to finished manga entirely inside ComfyUI.
@@ -2873,6 +2907,70 @@ you can go from image generation to finished manga entirely inside ComfyUI.
---
## 11-7 TagSpace - picking tags and prompts from a "map of meaning" (v0.9.0 and later)
The **TagSpace** tab lays out the prompts, tags and generated images inside Workflow Studio in a 3D space
according to **closeness of meaning**. Things close together mean similar things, so you can browse the space
("which tags are close to this mood?") and pick tags to build a prompt.
### What is in the space
- **Cards** - the sample images of the Gallery's **ImagePrompt** (Chapter 8, section 8-4) with their prompts, shown as thumbnails
- **Tags** - words taken (split at commas) from ImagePrompt prompts, prompts embedded in generated images, wildcards, the Tagger DB and the Prompt library, shown as dots colored by source
- **Gallery points** - some of your generated images, shown as faint dots (each carries the tags of its own prompt)
### Preparation
As with the Gallery's semantic search (Chapter 8, section 8-6), **Ollama** and **EmbeddingGemma 2** are needed.
If the Gallery's semantic index was made with Gemini Embedding 2, rebuild it with EmbeddingGemma 2 first.
### Building the space
Choose the settings in the toolbar and press **Build / Update**.
- **Tags** - how many tags to include. The sources take turns, each in order of how often a tag is used
- **All tags** - when on, every candidate tag is used instead of the Tags number (up to 20,000)
- **Min uses** - leaves out tags used fewer times than this. 2 removes one-off spelling variants and the like
- **Wildcards** - whether wildcards are used as a tag source
- **Gallery points** - how many generated images to show (0 = none)
- **Tagger fill** - tags generated images whose prompt cannot be read, using a Tagger model (OFF / a model name; choose "Gallery points only" or "All images without a prompt")
- The first build takes a few minutes to read image prompts and prepare tags. Later builds reuse the previous results and finish in seconds to tens of seconds.
- The status line shows the numbers of cards, tags and Gallery points. When only part of the candidates is used, "(of N candidates)" is shown.
> **Tip**
> Most distinct tags are words that only appear in wildcards.
> Turning "Wildcards" off and "All tags" on lays out every tag you have actually used (about 10,000 in testing).
> **Caution**
> Tagger fill takes about 0.5 second per image on the CPU. Before choosing "All images without a prompt", check that Tagger runs on the GPU (Chapter 12, section 12-5).
### Looking and searching
- **Drag** to rotate, **right-drag** to pan, and use the **wheel** to zoom.
- Hovering over a point shows its name, thumbnail and prompt or sources.
- The toolbar checkboxes switch Cards, Thumbnails, Tags and Gallery on or off, as well as **Glow** (stars shining in a night sky) and **Twinkle**.
The checkboxes for each source show or hide tags by source.
- Type words or a sentence in the search box at the top right and press **Enter** (any language). A white mark is placed at that meaning, and nearby cards and tags are listed.
### Picking tags to build a prompt
1. Click a card or tag to select it. Cards and tags close in meaning are listed under **Nearby** on the right.
(Clicking a Gallery point also lists similar generated images)
2. **Double-click** what you want in the prompt, or press **Add** in **Selection**, or the **+** in the list.
A card adds its whole prompt, a tag adds the tag itself, and a Gallery point adds that image's tags to the **Prompt** area at the far right.
3. **Add to GenerateUI (Positive)** appends it to the positive prompt of the workflow loaded in GenerateUI (load a workflow in GenerateUI first).
You can also **Copy** it to the clipboard.
### Searching with the tags of a card or generated image
When you select a card or Gallery point, its prompt tags are shown as buttons under **Selection**.
Click tags to choose them (click again to deselect) and press **Search with selected** to search the space with them.
This helps when you want to find things close to, say, only the hairstyle and clothing of an image.
While tags are selected, the **Add** button in **Selection** becomes **Add selected (N)** and adds only those tags to the prompt area.
With no tags selected it adds the whole item as before (a card's whole prompt, or all tags of a Gallery point).
When a Gallery point is selected, **Selection** also shows an **Open in Gallery** button.
It switches to the Gallery tab, selects the image's folder, and selects the image in the list (its details open on the right).
So that the image is sure to appear, the Gallery's search, favorite, tag and group filters are cleared.
A card's whole prompt can be read under **Full prompt**.
---
> **Summary of this chapter**
> - In the Nodes tab you can list and organize installed nodes, and use them in the WS Library
> - Tagger automatically generates tags from images. A model and extra packages must be prepared
@@ -2880,6 +2978,7 @@ you can go from image generation to finished manga entirely inside ComfyUI.
> - In the Video tab, you can make videos with supported video-generation models and do simple editing
> - "Default Checkpoint" and "Data Management (backup)" in the Settings tab are especially handy
> - Combined with Comic Creator by the same author, you can make manga from generated images
> - TagSpace lays out your tags, prompts and generated images in 3D by closeness of meaning, so you can browse it and pick tags for a prompt
---
@@ -3028,6 +3127,11 @@ You need to set the environment variable `WFS_ALLOWED_BACKEND_HOSTS` (Chapter 10
- Check that a `.onnx` file (and `selected_tags.csv`) is in the `ComfyUI/models/tagger/(model name)/` folder.
- Check that the extra Python package (onnxruntime) is installed in **the Python that ComfyUI uses** (Chapter 11, section 11-2).
### Tagger is very slow (the GPU is not used)
If ComfyUI's Python has both the CPU package `onnxruntime` and the GPU package `onnxruntime-gpu`, the GPU stops being used.
(Installing other custom nodes can bring in the CPU package.)
Stop ComfyUI, then in ComfyUI's Python run `pip uninstall -y onnxruntime onnxruntime-gpu` followed by `pip install onnxruntime-gpu`, and restart ComfyUI (DirectML is not supported).
### PSD-related features give an error
An extra Python package (psd-tools) is needed.
Run the installation command shown in the error message in the Python that ComfyUI uses, then restart ComfyUI.
@@ -3035,9 +3139,18 @@ Run the installation command shown in the error message in the Python that Comfy
### Semantic search (Gallery) does not work well
| Symptom | Cause | What to do |
| --- | --- | --- |
| The GPU is not detected (settings say no GPU detected, or runs on the CPU) | The onnxruntime in ComfyUI's Python is the CPU version | Stop ComfyUI, then in ComfyUI's Python run `pip uninstall -y onnxruntime onnxruntime-gpu` followed by `pip install onnxruntime-gpu`, and restart ComfyUI (DirectML is not supported) |
| "Cannot reach Ollama" is shown | Ollama is not running, or the Ollama URL is wrong | Start Ollama (it is needed while indexing and searching). Check the Ollama URL on the gear button's Model tab |
| "The Ollama model is not downloaded" is shown | EmbeddingGemma 2 has not been downloaded | Run `ollama pull embeddinggemma-2:740m` (or `embeddinggemma-2:440m`) |
| Indexing sometimes fails with "connection was forcibly closed" or similar | Security software (such as AdGuard) is intercepting Ollama's traffic | Exclude Ollama from filtering. Failed images are processed again by the next "New / changed images only" run |
| Gemini says "GEMINI_API_KEY is not set", or the key is rejected | There is no key in `.env`, or the line starts with `#` | Write `GEMINI_API_KEY=key` in the plugin's `.env` (copy `.env.example`) and restart ComfyUI. `.env` is only read at startup |
| Search or Similar gives no results | The selected folder has no indexed images | Build the index with the gear button. Choose a folder with a green dot. When you change the model or precision, "rebuild all" |
| Search or Similar gives no results | The selected folder has no indexed images | Build the index with the gear button. Choose a folder with a green dot. When you change the model or vector dimension, "rebuild all" |
### The TagSpace space cannot be built
| Symptom | Cause | What to do |
| --- | --- | --- |
| "EmbeddingGemma 2 in Ollama is required" is shown | Ollama is not running, or the model is missing | Prepare the same way as for semantic search (table above) |
| "The Gallery semantic index was made with ..." is shown | The Gallery index was made with Gemini | Choose EmbeddingGemma 2 in the Gallery's semantic settings and rebuild all |
| Building takes a very long time | The first build reads image prompts and prepares new tags | Later builds are faster. When using Tagger fill, check that Tagger runs on the GPU ("Tagger is very slow" above) |
### A partner API (Nano Banana) says authentication failed
The cause is a missing Comfy API key in `.env`. Write `COMFY_API_KEY=your key` (issued at platform.comfy.org) in the plugin's `.env` and restart ComfyUI (Chapter 5, section 5-8).
@@ -3123,6 +3236,7 @@ The main terms that appear in this book, in alphabetical order.
| Steps | The number of times drawing is repeated | Chapter 5 |
| Style | A mood template added to a prompt | Chapter 7 |
| T2I (Text to Image) | Making an image from text (a prompt) | Chapter 5 |
| TagSpace | A tab that lays out tags, prompts and generated images in 3D by closeness of meaning | Chapter 11 |
| Trigger word | A word to put in the prompt to bring out a LoRA's effect | Chapter 6 |
| VAE | The model that finishes an image's colors and fine details | Chapter 6 |
| VLM | An AI model that can read images | Chapter 10 |
Binary file not shown.
+2 -1
View File
@@ -83,6 +83,7 @@ Together with the supporting features, it makes moving between the two screens s
- **Image Edit** - simple layer-based editing, and redrawing parts with a mask (inpainting)
- **Local AI integration** - translating prompts from Japanese, creating prompts and tags from images
- **Tagger and Video** - automatic tag generation from images, and video generation with simple editing
- **TagSpace** - lays out your own prompts, tags and generated images in a 3D space by closeness of meaning, so you can browse it and pick tags
---
@@ -128,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.8.9
- **Workflow Studio**: v0.9.1
- **ComfyUI**: the latest version at the time of writing
- **OS**: Windows (screen examples are from Windows)
@@ -19,7 +19,8 @@ The basic features of Workflow Studio work with no extra preparation as long as
### Later, as needed
The following are needed only when you use particular features. You can ignore them at first.
- **Ollama, LM Studio and similar** - AI support features such as prompt translation and AI chat (Chapter 10)
- **Ollama, LM Studio and similar** - AI support features such as prompt translation and AI chat (Chapter 10).
**Ollama** is also needed for local semantic search in the Gallery (Chapter 8) and for the TagSpace tab (Chapter 11)
- **Eagle** - a feature that automatically saves generated images to the image-management software Eagle (Chapter 8)
- **Extra Python packages** - Tagger (tag generation from images), PSD export and the like (Chapter 11)
@@ -24,6 +24,7 @@ It is enough to learn the tabs marked with a star under "Often used" first.
| Image Edit | Simple image editing, making masks | | Chapter 11 |
| Video | Video generation and video editing | | Chapter 11 |
| Tagger | Automatically generating tags (prompts) from images | | Chapter 11 |
| TagSpace | Showing tags, prompts and generated images in 3D by closeness of meaning, and picking tags | | Chapter 11 |
| Settings | Language, theme, folders and other settings | | This chapter, Chapter 11 |
| Help | Feature list, shortcuts, troubleshooting | | This chapter |
| AI TOOL | Translation, chat and image analysis with local AI | | Chapter 10 |
@@ -35,7 +36,7 @@ If the number of tabs makes you lose your way, it helps to think of them in thes
Tabs that list your materials so they are easy to find.
- **Create** - GenerateUI / Image Edit / Video
Tabs for actually making images and videos, or touching them up.
- **Support** - AI TOOL / Tagger / Settings / Help
- **Support** - AI TOOL / Tagger / TagSpace / Settings / Help
Tabs that help with work in other tabs, or hold overall settings.
> **Tip**
@@ -72,6 +72,9 @@ To the right of Input, Model and Settings, the contents of the workflow are show
When you change values in the form, they are reflected here too.
Until you are used to it, treat this as "view only".
On the Input subtab, the **>>** button at the top of the Raw JSON folds it into a thin strip at the right edge (v0.8.12 and later),
which gives the prompt and image areas more room. Press it again to unfold it; the folded state is remembered.
---
## 5-3 Generating your first image
@@ -79,7 +82,7 @@ Until you are used to it, treat this as "view only".
Now, to generate. At minimum, you check and set these three things.
1. Which model to draw with (Model)
2. What to draw (Input -> Prompt)
2. What to draw (Input)
3. Generate (Generate)
### Step 1: Choose a model (Model)
@@ -112,7 +115,9 @@ Now, to generate. At minimum, you check and set these three things.
> Items that are not green have no effect on this workflow even if you change them.
### Step 2: Write a prompt (Input)
1. Open the **Input** subtab and choose **Prompt** inside it.
1. Open the **Input** subtab.
The prompt area (Prompt) is on the left and the input image area (Image) is on the right (v0.8.12 and later; before that you switched between Prompt and Image).
When the screen is narrow, the Image area moves below the prompts.
2. In the **Positive Prompt** field, enter in English what you want drawn.
```
@@ -195,8 +195,8 @@ If you run without a key, a message says that partner API authentication failed
### How to use
1. In the Workflow tab, load the Nano Banana sample (`ws_nano_banana_2_1_t2i`) into GenerateUI.
2. Edit the prompt in the **Prompt** subtab and press **Apply**.
3. To use reference images, specify them on the image cards in the **Image** subtab.
2. Edit the prompt on the left side (Prompt) of the **Input** subtab and press **Apply**.
3. To use reference images, specify them on the image cards on the right side (Image) of the **Input** subtab.
4. Press **Generate**.
> **Tip**
@@ -211,6 +211,8 @@ The workflows you can use in GenerateUI have increased as follows. They are used
- **Qwen Image 2.1 Turbo** - ComfyUI's official templates for text to image (T2I) and image to image (I2I). Edits also carry over to the prompt enhancer's input (the feature that expands your prompt automatically).
- **Flux.3 Klein** - the four official templates (T2I and Image Edit, for Klein and Klein SD).
- **MOSS-Image** - Base/SFT T2I, and the bounding-box versions that specify positions with frames.
- **Fibo 2.0 Edit** (v0.8.14 and later) - an image-editing workflow. With the prompt enhancer (PE) setup, edits in the prompt area apply whether PE is on or off. The negative area holds a VGL-format (JSON) description as is. Width and height (Settings) of 0 mean automatic.
- **FastH3 OmniRef / Pika-H3-Flex** (v0.8.14 and later) - MiniMax H3 reference to video. Treated as video workflows, and also usable in the Video tab (Chapter 11).
- **Native LoRA stack** - ComfyUI v0.40's nodes that load several LoRAs at once (LoadLoraModel / LoadLoraTextEncoder). Apply, bypass and the Metadata display are supported.
> **Caution**
@@ -239,7 +239,7 @@ You can also bring up a list of **similar images** to the one you choose.
| Model | Characteristics | Preparation |
| --- | --- | --- |
| Gemini Embedding 2 | Computed on Google's service. Fast. Images are sent to Google | Get an API key, write `GEMINI_API_KEY=key` in the plugin's `.env`, and restart ComfyUI |
| EmbeddingGemma 2 | Computed inside your computer (local). Nothing is sent outside | No extra preparation. The model is downloaded automatically only the first time |
| EmbeddingGemma 2 | Computed inside your computer with **Ollama** (local, free). Nothing is sent outside | Install and start Ollama, then run `ollama pull embeddinggemma-2:740m` (or the lighter `embeddinggemma-2:440m`). On the Model tab, choose the **Ollama URL** (usually unchanged) and the **Model size** |
> **Caution: when using Gemini**
> Images are sent to Google's service. Content sent under the free tier may be used by Google to improve its products.
@@ -251,13 +251,14 @@ You can also bring up a list of **similar images** to the one you choose.
2. Choose "new only" or "rebuild all" and start. Progress is shown, and you can stop partway.
3. The index is one shared across all folders. You may build it a little at a time, folder by folder.
When you change the model, the vector dimension or the image precision, a **rebuild of everything** is needed.
When you change the model or the vector dimension, a **rebuild of everything** is needed.
### Speed guidelines and settings
- The local EmbeddingGemma 2 runs on the CPU by default and takes a few seconds per image.
Setting the **image precision** to "standard" or "light" makes it faster (rebuild everything after changing it).
Reducing the **number of CPU threads** lightens the computer's load while generating images.
- If you have an NVIDIA GPU, installing `onnxruntime-gpu` into ComfyUI's Python brings it to about 0.1 second per image (the fix is in Chapter 12, section 12-5).
- Since v0.8.14 the local EmbeddingGemma 2 runs in Ollama (the earlier way of running it in ComfyUI's Python was removed).
On an NVIDIA GPU it takes about 0.1 to 0.2 second per image. When indexing finishes, the model is unloaded from GPU memory automatically.
- Ollama must be running while you build the index and while you search.
- The 740m (text + image + audio) and 440m (text + image, lighter) model sizes return the same results, so switching does not need a rebuild.
Indexes made with v0.8.13 or earlier keep working as they are.
- In the **Search** tab, you can decide the "minimum score" for similar-image and text search, and the maximum number of results.
Because the score level differs by model, it is saved per model.
@@ -54,6 +54,9 @@ To use Tagger, you need the following preparation.
1. Put a **model for tagging** (such as WD Tagger) in ComfyUI's `models/tagger/(model name)/` folder.
Put a `.onnx` file and `selected_tags.csv` in the folder.
**PixAI Tagger v1.0** (v0.8.10 and later) also works. From the community conversion on Hugging Face (`Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8`),
put one `.onnx` file (`model_fp16.onnx` is recommended for a GPU) together with `selected_tags.csv` and `preprocess.json` in one folder, and it is detected automatically.
When you choose a PixAI model, the threshold sliders switch to PixAI's recommended values (0.17 / 0.27).
2. Install the **extra Python packages**.
Use the `requirements.txt` in the Workflow Studio folder.
@@ -69,6 +72,10 @@ To use Tagger, you need the following preparation.
> Always install into **the Python that ComfyUI uses**.
> If you are not sure, there is also a method of installing packages with a ComfyUI Manager feature.
> **Caution: check that it runs on the GPU**
> On an NVIDIA GPU, Tagger takes less than a second per image, but on the CPU, PixAI takes about 20 seconds per image.
> If it is very slow, check that the GPU package is installed correctly (Chapter 12, section 12-5).
> **Tip**
> You can also combine it with the local AI image reading (VLM) from Chapter 10 to make tags that combine both results.
@@ -119,6 +126,7 @@ The **Video** tab is a dedicated screen for making short videos from images or t
- **MiniMax H3** (image to video)
- **LTX-2.5** (text to video, image to video, and video from specified first and last images)
- **Wan2.2** (text to video)
- **FastH3 OmniRef / Pika-H3-Flex** (MiniMax H3 reference to video, v0.8.14 and later)
You load a matching workflow with **Load in Video** in the Workflow tab and use it (Chapter 4, section 4-6).
@@ -142,6 +150,19 @@ There are also the **Frame** feature, which saves a favorite scene of a video as
- The Video Source panel is a little wider, the file name shows on one line, and the buttons sit in a single row.
### Reference to video (FastH3 OmniRef / Pika-H3-Flex) (v0.8.14 and later)
These workflows make a video from **reference images** instead of a first and last frame,
so the image fields in the Plan subtab are renamed:
- **Reference Image** - the first reference image (the usual First Image field)
- **Reference Image 2 (optional)** - the second reference image (the usual Last Image field)
- Prompt, duration (seconds), aspect ratio and so on work the same as for other video workflows.
- A block whose image field is left empty with **None** or **Clear** is generated without that image, even if the workflow has a reference image wired in.
Blocks added with "+ Block" start with empty images, so set an image on each block that needs a reference.
- Choosing **Use previous block's last frame** makes the last frame of the video actually generated by the previous block the first reference image of that block.
- The Asset subtab buttons also change to "Set as Reference Image" and "Set as Reference Image 2".
> **Caution**
> Video generation uses far more GPU memory and time than image generation.
> Check the required specs of the model before trying it.
@@ -214,6 +235,7 @@ If you install both, the following integrations are possible.
- **Generate images from Comic Creator**
From the Comic Creator screen, through Workflow Studio (GenerateUI), you can generate images to put in panels (T2I),
or redraw based on a rough you drew or an image you placed (I2I and inpainting).
From Comic Creator's Nanobanana+ tab (local mode), you can also run image-editing workflows that use several reference images (Flux.3 Klein, Qwen Image 2.1 and so on) (v0.8.12 and later).
With the flow "make images in Workflow Studio -> put them together as manga in Comic Creator",
you can go from image generation to finished manga entirely inside ComfyUI.
@@ -235,6 +257,70 @@ you can go from image generation to finished manga entirely inside ComfyUI.
---
## 11-7 TagSpace - picking tags and prompts from a "map of meaning" (v0.9.0 and later)
The **TagSpace** tab lays out the prompts, tags and generated images inside Workflow Studio in a 3D space
according to **closeness of meaning**. Things close together mean similar things, so you can browse the space
("which tags are close to this mood?") and pick tags to build a prompt.
### What is in the space
- **Cards** - the sample images of the Gallery's **ImagePrompt** (Chapter 8, section 8-4) with their prompts, shown as thumbnails
- **Tags** - words taken (split at commas) from ImagePrompt prompts, prompts embedded in generated images, wildcards, the Tagger DB and the Prompt library, shown as dots colored by source
- **Gallery points** - some of your generated images, shown as faint dots (each carries the tags of its own prompt)
### Preparation
As with the Gallery's semantic search (Chapter 8, section 8-6), **Ollama** and **EmbeddingGemma 2** are needed.
If the Gallery's semantic index was made with Gemini Embedding 2, rebuild it with EmbeddingGemma 2 first.
### Building the space
Choose the settings in the toolbar and press **Build / Update**.
- **Tags** - how many tags to include. The sources take turns, each in order of how often a tag is used
- **All tags** - when on, every candidate tag is used instead of the Tags number (up to 20,000)
- **Min uses** - leaves out tags used fewer times than this. 2 removes one-off spelling variants and the like
- **Wildcards** - whether wildcards are used as a tag source
- **Gallery points** - how many generated images to show (0 = none)
- **Tagger fill** - tags generated images whose prompt cannot be read, using a Tagger model (OFF / a model name; choose "Gallery points only" or "All images without a prompt")
- The first build takes a few minutes to read image prompts and prepare tags. Later builds reuse the previous results and finish in seconds to tens of seconds.
- The status line shows the numbers of cards, tags and Gallery points. When only part of the candidates is used, "(of N candidates)" is shown.
> **Tip**
> Most distinct tags are words that only appear in wildcards.
> Turning "Wildcards" off and "All tags" on lays out every tag you have actually used (about 10,000 in testing).
> **Caution**
> Tagger fill takes about 0.5 second per image on the CPU. Before choosing "All images without a prompt", check that Tagger runs on the GPU (Chapter 12, section 12-5).
### Looking and searching
- **Drag** to rotate, **right-drag** to pan, and use the **wheel** to zoom.
- Hovering over a point shows its name, thumbnail and prompt or sources.
- The toolbar checkboxes switch Cards, Thumbnails, Tags and Gallery on or off, as well as **Glow** (stars shining in a night sky) and **Twinkle**.
The checkboxes for each source show or hide tags by source.
- Type words or a sentence in the search box at the top right and press **Enter** (any language). A white mark is placed at that meaning, and nearby cards and tags are listed.
### Picking tags to build a prompt
1. Click a card or tag to select it. Cards and tags close in meaning are listed under **Nearby** on the right.
(Clicking a Gallery point also lists similar generated images)
2. **Double-click** what you want in the prompt, or press **Add** in **Selection**, or the **+** in the list.
A card adds its whole prompt, a tag adds the tag itself, and a Gallery point adds that image's tags to the **Prompt** area at the far right.
3. **Add to GenerateUI (Positive)** appends it to the positive prompt of the workflow loaded in GenerateUI (load a workflow in GenerateUI first).
You can also **Copy** it to the clipboard.
### Searching with the tags of a card or generated image
When you select a card or Gallery point, its prompt tags are shown as buttons under **Selection**.
Click tags to choose them (click again to deselect) and press **Search with selected** to search the space with them.
This helps when you want to find things close to, say, only the hairstyle and clothing of an image.
While tags are selected, the **Add** button in **Selection** becomes **Add selected (N)** and adds only those tags to the prompt area.
With no tags selected it adds the whole item as before (a card's whole prompt, or all tags of a Gallery point).
When a Gallery point is selected, **Selection** also shows an **Open in Gallery** button.
It switches to the Gallery tab, selects the image's folder, and selects the image in the list (its details open on the right).
So that the image is sure to appear, the Gallery's search, favorite, tag and group filters are cleared.
A card's whole prompt can be read under **Full prompt**.
---
> **Summary of this chapter**
> - In the Nodes tab you can list and organize installed nodes, and use them in the WS Library
> - Tagger automatically generates tags from images. A model and extra packages must be prepared
@@ -242,3 +328,4 @@ you can go from image generation to finished manga entirely inside ComfyUI.
> - In the Video tab, you can make videos with supported video-generation models and do simple editing
> - "Default Checkpoint" and "Data Management (backup)" in the Settings tab are especially handy
> - Combined with Comic Creator by the same author, you can make manga from generated images
> - TagSpace lays out your tags, prompts and generated images in 3D by closeness of meaning, so you can browse it and pick tags for a prompt
@@ -143,6 +143,11 @@ You need to set the environment variable `WFS_ALLOWED_BACKEND_HOSTS` (Chapter 10
- Check that a `.onnx` file (and `selected_tags.csv`) is in the `ComfyUI/models/tagger/(model name)/` folder.
- Check that the extra Python package (onnxruntime) is installed in **the Python that ComfyUI uses** (Chapter 11, section 11-2).
### Tagger is very slow (the GPU is not used)
If ComfyUI's Python has both the CPU package `onnxruntime` and the GPU package `onnxruntime-gpu`, the GPU stops being used.
(Installing other custom nodes can bring in the CPU package.)
Stop ComfyUI, then in ComfyUI's Python run `pip uninstall -y onnxruntime onnxruntime-gpu` followed by `pip install onnxruntime-gpu`, and restart ComfyUI (DirectML is not supported).
### PSD-related features give an error
An extra Python package (psd-tools) is needed.
Run the installation command shown in the error message in the Python that ComfyUI uses, then restart ComfyUI.
@@ -150,9 +155,18 @@ Run the installation command shown in the error message in the Python that Comfy
### Semantic search (Gallery) does not work well
| Symptom | Cause | What to do |
| --- | --- | --- |
| The GPU is not detected (settings say no GPU detected, or runs on the CPU) | The onnxruntime in ComfyUI's Python is the CPU version | Stop ComfyUI, then in ComfyUI's Python run `pip uninstall -y onnxruntime onnxruntime-gpu` followed by `pip install onnxruntime-gpu`, and restart ComfyUI (DirectML is not supported) |
| "Cannot reach Ollama" is shown | Ollama is not running, or the Ollama URL is wrong | Start Ollama (it is needed while indexing and searching). Check the Ollama URL on the gear button's Model tab |
| "The Ollama model is not downloaded" is shown | EmbeddingGemma 2 has not been downloaded | Run `ollama pull embeddinggemma-2:740m` (or `embeddinggemma-2:440m`) |
| Indexing sometimes fails with "connection was forcibly closed" or similar | Security software (such as AdGuard) is intercepting Ollama's traffic | Exclude Ollama from filtering. Failed images are processed again by the next "New / changed images only" run |
| Gemini says "GEMINI_API_KEY is not set", or the key is rejected | There is no key in `.env`, or the line starts with `#` | Write `GEMINI_API_KEY=key` in the plugin's `.env` (copy `.env.example`) and restart ComfyUI. `.env` is only read at startup |
| Search or Similar gives no results | The selected folder has no indexed images | Build the index with the gear button. Choose a folder with a green dot. When you change the model or precision, "rebuild all" |
| Search or Similar gives no results | The selected folder has no indexed images | Build the index with the gear button. Choose a folder with a green dot. When you change the model or vector dimension, "rebuild all" |
### The TagSpace space cannot be built
| Symptom | Cause | What to do |
| --- | --- | --- |
| "EmbeddingGemma 2 in Ollama is required" is shown | Ollama is not running, or the model is missing | Prepare the same way as for semantic search (table above) |
| "The Gallery semantic index was made with ..." is shown | The Gallery index was made with Gemini | Choose EmbeddingGemma 2 in the Gallery's semantic settings and rebuild all |
| Building takes a very long time | The first build reads image prompts and prepares new tags | Later builds are faster. When using Tagger fill, check that Tagger runs on the GPU ("Tagger is very slow" above) |
### A partner API (Nano Banana) says authentication failed
The cause is a missing Comfy API key in `.env`. Write `COMFY_API_KEY=your key` (issued at platform.comfy.org) in the plugin's `.env` and restart ComfyUI (Chapter 5, section 5-8).
+1
View File
@@ -44,6 +44,7 @@ The main terms that appear in this book, in alphabetical order.
| Steps | The number of times drawing is repeated | Chapter 5 |
| Style | A mood template added to a prompt | Chapter 7 |
| T2I (Text to Image) | Making an image from text (a prompt) | Chapter 5 |
| TagSpace | A tab that lays out tags, prompts and generated images in 3D by closeness of meaning | Chapter 11 |
| Trigger word | A word to put in the prompt to bring out a LoRA's effect | Chapter 6 |
| VAE | The model that finishes an image's colors and fine details | Chapter 6 |
| VLM | An AI model that can read images | Chapter 10 |
+9
View File
@@ -52,6 +52,15 @@ def _maybe_use_selector_event_loop():
print("[Workflow Studio] Using WindowsSelectorEventLoopPolicy (windows_selector_event_loop enabled)")
except Exception as e:
print(f"[WARNING] Workflow Studio: failed to switch to selector event loop: {e}")
return
# Selector方式ではloop.sendfileがasyncioの_sendfile_fallbackになるが、これは16KBバッファを
# 使い回しつつ未送信分をコピーせずトランスポートに積むため、送信が詰まると後続ブロックで
# 上書きされ画像等が壊れて届く(Python 3.12で確認)。aiohttpのsendfileを無効化し、
# チャンクごとに新しいbytesを読む自前フォールバックを使わせる
os.environ["AIOHTTP_NOSENDFILE"] = "1"
fileresponse = sys.modules.get("aiohttp.web_fileresponse")
if fileresponse is not None:
fileresponse.NOSENDFILE = True
_maybe_use_selector_event_loop()
+83
View File
@@ -0,0 +1,83 @@
"""
TagSpace Routes - タグ/ImagePromptカード/Gallery画像を3D潜在空間に並べるタブ用API
"""
import asyncio
import logging
from aiohttp import web
from ..config import DATA_DIR
from ..services.tagspace_service import TagSpaceService, DEFAULT_MAX_TAGS, DEFAULT_BG, MAX_TAGS_LIMIT, MIN_COUNT_LIMIT
from ..services.semantic_service import SemanticError
from .gallery_routes import _service as _gallery, _semantic, _semantic_error, _num, _json_body
from .tagger_routes import _svc as _tagger
logger = logging.getLogger(__name__)
_tagspace = TagSpaceService(DATA_DIR, _gallery, _semantic, _tagger)
def setup_routes(app: web.Application):
app.router.add_get("/wfm/tagspace/status", tagspace_status)
app.router.add_get("/wfm/tagspace/space", tagspace_space)
app.router.add_post("/wfm/tagspace/build", tagspace_build)
app.router.add_post("/wfm/tagspace/cancel", tagspace_cancel)
app.router.add_post("/wfm/tagspace/search", tagspace_search)
app.router.add_post("/wfm/tagspace/neighbors", tagspace_neighbors)
async def _call(fn, *args) -> web.Response:
try:
return web.json_response(await asyncio.to_thread(fn, *args))
except SemanticError as e:
return _semantic_error(e)
except Exception as e:
logger.error("tagspace %s error: %s", getattr(fn, "__name__", fn), e)
return web.json_response({"error": str(e)}, status=500)
async def tagspace_status(request: web.Request) -> web.Response:
return await _call(_tagspace.status)
async def tagspace_space(request: web.Request) -> web.Response:
return await _call(_tagspace.space)
async def tagspace_build(request: web.Request) -> web.Response:
body = await _json_body(request)
try:
# max_tags=0 は全タグ(サービス側で ALL_TAGS_LIMIT まで)
max_tags = _num(body, "max_tags", DEFAULT_MAX_TAGS, 0, MAX_TAGS_LIMIT)
bg = _num(body, "background", DEFAULT_BG, 0, 20000)
min_count = _num(body, "min_count", 1, 1, MIN_COUNT_LIMIT)
except SemanticError as e:
return _semantic_error(e)
tagger_model = str(body.get("tagger_model", "") or "")
tagger_scope = str(body.get("tagger_scope", "background") or "background")
wildcard = body.get("wildcard", True) is not False
return await _call(lambda: (_tagspace.start_build(max_tags, bg, tagger_model, tagger_scope, min_count, wildcard),
{"ok": True})[1])
async def tagspace_cancel(request: web.Request) -> web.Response:
_tagspace.cancel()
return web.json_response({"ok": True})
async def tagspace_search(request: web.Request) -> web.Response:
body = await _json_body(request)
try:
k = _num(body, "k", 20, 1, 200)
except SemanticError as e:
return _semantic_error(e)
return await _call(_tagspace.search, str(body.get("query", "")), k)
async def tagspace_neighbors(request: web.Request) -> web.Response:
body = await _json_body(request)
try:
k = _num(body, "k", 20, 1, 200)
except SemanticError as e:
return _semantic_error(e)
return await _call(_tagspace.neighbors, str(body.get("id", "")), k)
+21 -2
View File
@@ -33,6 +33,10 @@ QUERY_PREFIX = "task: search result | query: "
BATCH = 4 # 1リクエストで送る画像数(1枚ずつより約1.8倍速い)
_TIMEOUT = 120
_RETRIES = 5 # Ollama内部の接続切断(HTTP 400 "forcibly closed"等)は再試行で回復する
# Ollama はテキストごとに内部のランナーへ新しい接続を張るため、数千件を続けて埋め込むと
# Windows の一時ポートが TIME_WAIT で埋まり "Only one usage of each socket address" で失敗する
# (実測: ループバックの TIME_WAIT 14,228 / 16,384)。ポートが空くまで長めに待って再試行する
_PORT_WAIT = 30.0
_TAGS_TTL = 5.0 # /api/tags の結果をキャッシュする秒数(進捗ポーリングのたびに問い合わせない)
_opts = {"url": DEFAULT_URL, "tag": DEFAULT_TAG}
@@ -82,7 +86,13 @@ def _transient(code: int, msg: str) -> bool:
return False # 壊れた画像。再試行しても直らない
if code >= 500:
return True
return code == 400 and any(k in low for k in ("forcibly closed", "wsarecv", "connection", "eof"))
return code == 400 and (_ports_exhausted(msg)
or any(k in low for k in ("forcibly closed", "wsarecv", "connection", "eof")))
def _ports_exhausted(msg: str) -> bool:
low = msg.lower()
return "only one usage of each socket address" in low or "wsaeaddrinuse" in low
def installed_tags(force: bool = False) -> tuple[list[str] | None, str]:
@@ -152,6 +162,10 @@ def _embed(inputs: list) -> list[np.ndarray]:
raise OllamaError("ollama_model_missing", model)
if not _transient(e.code, msg) or attempt >= _RETRIES:
raise OllamaError("local_error", last)
if _ports_exhausted(msg):
logger.warning("Ollama: local ports exhausted, waiting %.0fs before retry", _PORT_WAIT)
time.sleep(_PORT_WAIT)
continue
except (urllib.error.URLError, TimeoutError, ConnectionError) as e:
last = str(getattr(e, "reason", e))
if attempt >= _RETRIES:
@@ -173,7 +187,12 @@ def _image_b64(image) -> str:
def embed_text(text: str, dim: int) -> np.ndarray:
return _finish(_embed([QUERY_PREFIX + text[:8000].strip()])[0], dim)
return embed_texts([text], dim)[0]
def embed_texts(texts: list[str], dim: int) -> list[np.ndarray]:
"""検索文(クエリ)として複数のテキストをまとめて埋め込む"""
return [_finish(v, dim) for v in _embed([QUERY_PREFIX + t[:8000].strip() for t in texts])]
def embed_images(images: list, dim: int) -> list[np.ndarray]:
+36
View File
@@ -455,6 +455,42 @@ class SemanticService:
raise SemanticError(e.code, str(e))
return embed_text(text, dim)
# ── 他機能(TagSpace)向けの読み出し ─────────────────────
def index_info(self) -> dict:
self._ensure_loaded()
with self._lock:
return {"model": self._model, "dim": self._dim, "count": len(self._vecs)}
def job_status(self) -> dict:
return dict(self._job)
def vectors_for(self, entries: list) -> dict[str, np.ndarray]:
"""entries([(name, abs_path, size, mtime)])のうち、索引済みで最新のもののベクトル"""
self._ensure_loaded()
with self._lock:
return {ap: self._vecs[ap] for _, ap, sz, mt in entries
if ap in self._vecs and self._is_fresh(ap, sz, mt)}
def indexed_entries(self, exclude_prefix: str = "") -> list[tuple[str, int, float]]:
"""索引済みの (path, size, mtime) 一覧。exclude_prefix配下は除く"""
self._ensure_loaded()
with self._lock:
return [(p, *self._stamp[p]) for p in self._vecs
if not (exclude_prefix and p.startswith(exclude_prefix))]
def sample_vectors(self, n: int, exclude_prefix: str = "", seed: int = 0) -> tuple[list[str], np.ndarray]:
"""索引から最大n件を無作為に(seed固定で)取り出す。exclude_prefix配下は除く"""
self._ensure_loaded()
with self._lock:
paths = [p for p in self._vecs if not (exclude_prefix and p.startswith(exclude_prefix))]
if len(paths) > n:
pick = np.random.default_rng(seed).choice(len(paths), n, replace=False)
paths = [paths[i] for i in sorted(pick)]
mat = (np.stack([self._vecs[p] for p in paths]) if paths
else np.zeros((0, max(self._dim, 1)), np.float32))
return paths, mat
# ── 検索 ───────────────────────────────────────────────
def _matrix(self):
+23
View File
@@ -210,6 +210,29 @@ class TaggerService:
logger.error("predict error: %s", e)
return {"error": str(e)}
# WD Tagger の評価(rating)ラベル。TagSpace の補完では除く
_RATING_LABELS = {"general", "sensitive", "questionable", "explicit"}
def tag_image(self, img: Image.Image, model_name: str) -> list:
"""他機能(TagSpace)向け: ONNXモデルで画像1枚にタグを付ける。しきい値は既定値
(WD 0.35/0.85、PixAIは推奨値)。評価ラベルは除く。読み込めなければ RuntimeError。"""
data = self._load_model(model_name)
if data is None or data.get("type") != "onnx":
raise RuntimeError(f"Model '{model_name}' could not be loaded")
if data.get("pixai_categories"):
thr, char_thr = self._PIXAI_BASE["general"], self._PIXAI_BASE["character"]
else:
thr, char_thr = 0.35, 0.85
return [t for t in self._predict_onnx(img, data, thr, char_thr) if t not in self._RATING_LABELS]
def model_provider(self, model_name: str) -> str:
"""読み込み済みモデルの実行先(CUDA / CPU)。未読み込みなら空文字"""
data = self._cache.get(model_name)
try:
return data["session"].get_providers()[0].replace("ExecutionProvider", "") if data else ""
except Exception:
return ""
# PixAI Tagger v1.0 推奨しきい値(category番号 -> しきい値)。meta/ratingはタグに含めない。
# UIの2本のスライダーは推奨値(general 0.17 / character 0.27)を基準にした相対指定で、
# general側(0,1)はthreshold、character側(3,4)はchar_thresholdに追従する。
+686
View File
@@ -0,0 +1,686 @@
"""
TagSpace Service - WFSのデータを EmbeddingGemma 2 の同じベクトル空間に置き、3Dに投影する
カード : ImagePrompt(ws_image_prompt)の画像+プロンプト。ベクトルは Gallery セマンティック索引の画像ベクトル
タグ : ImagePrompt/ワイルドカード/Tagger DB/Promptライブラリの文をカンマ等で分解した語。Ollamaでテキスト埋め込み
背景 : Gallery 索引から間引いた画像(位置関係を見るための点群)
画像とテキストのベクトルは同じ空間でも別の塊に分かれる(modality gap)ため、
画像群とテキスト群をそれぞれの平均で中心化してからPCAで3軸を求める。
タグのベクトルはタグ文字列をキーに tagspace_tags.npz へキャッシュする(740m/440mは同じベクトル)。
"""
import json
import logging
import re
import sqlite3
import threading
import time
from collections import Counter
from pathlib import Path
import numpy as np
import yaml
from . import semantic_ollama as ollama
from .semantic_service import LOCAL_MODEL, SemanticError
logger = logging.getLogger(__name__)
DEFAULT_MAX_TAGS = 2000
MAX_TAGS_LIMIT = 6000
ALL_TAGS_LIMIT = 20000 # 「全タグ」(max_tags=0)でも超えない上限(ワイルドカード込み・出現1回以上だと約5万種になるため)
MIN_COUNT_LIMIT = 10
DEFAULT_BG = 4000
BG_LIMIT = 20000
_EMBED_BATCH = 32
_RADIUS = 10.0 # 3D座標の広がり(98パーセンタイル半径)
_IMG_EXTS = {".png", ".jpg", ".jpeg", ".webp"}
_VAULT_THUMB_DIRS = {"thumbnails", "thumbnails_option2"}
SOURCES = ("image_prompt", "gallery", "tagger_auto", "tagger", "prompt_library", "wildcard")
TAGGER_SCOPES = ("background", "all") # Tagger補完の対象: 背景の点のみ / プロンプトの無い全画像
_TAGGER_MAX_SIDE = 1024 # Taggerに渡す前の長辺上限(PixAIの1008pxより少し大きく)
_TAGGER_SAVE_EVERY = 100
_PROMPT_MAX = 4000 # キャッシュするプロンプトの最大文字数
# Positive をたどるときに文字列として拾う入力名(CLIPTextEncode系・Qwen/Flux系のエンコーダー・文字列ノード)
_TEXT_INPUTS = {"text", "prompt", "positive", "text_g", "text_l", "clip_l", "t5xxl", "string", "value",
"user_prompt", "system_prompt_text"}
_SKIP_INPUTS = {"negative", "negative_prompt", "neg"}
_SPLIT = re.compile(r"[,\n|{}]+|\bBREAK\b")
_WEIGHT = re.compile(r":\s*-?\d+(?:\.\d+)?\s*$")
_DP_WEIGHT = re.compile(r"^\s*\d+(?:\.\d+)?\s*::") # Dynamic Prompts の "2::option"
_JSON_KEY = re.compile(r'"\s*:') # "key": の形
_MODEL_FILE = re.compile(r"\.(safetensors|ckpt|pt|pth|bin|gguf)\b", re.I)
_HAS_WORD = re.compile(r"[a-z぀-ヿ一-鿿]")
_STOP = {"break", "and", "or", "the", "a", "an"}
def normalize_tag(raw: str) -> str:
"""プロンプトの断片をタグとして正規化する。タグにならなければ空文字"""
s = _DP_WEIGHT.sub("", raw).strip()
if not s or "<" in s or "__" in s or s.lower().startswith(("embedding:", "rating:")):
return ""
# プロンプトに埋め込まれたJSON(MOSS-Image のレイアウト指定 bbox / 文字入れ text 等)の断片と、モデルのファイル名
if _JSON_KEY.search(s) or _MODEL_FILE.search(s):
return ""
s = s.replace('"', "") # 分割で片側だけ残った引用符(blue" / "pink)
s = s.replace("\\(", "\x00").replace("\\)", "\x01") # danbooruのエスケープ括弧は残す
for _ in range(3):
while len(s) > 1 and s[0] in "([" and s[-1] in ")]":
s = s[1:-1].strip()
s = _WEIGHT.sub("", s).strip(" \"'.;")
if s.count("(") != s.count(")") or s.count("[") != s.count("]"):
s = re.sub(r"[()\[\]]", "", s).strip() # 分割で片側だけ残った括弧
s = s.replace("\x00", "(").replace("\x01", ")").replace("_", " ")
s = re.sub(r"\s+", " ", s).lower()
if len(s) < 2 or len(s) > 40 or len(s.split()) > 5 or s in _STOP or not _HAS_WORD.search(s):
return ""
if s.startswith(("embedding:", "rating:")): # (embedding:xxx:1) のように括弧を外してから現れる形
return ""
return s
def split_tags(text: str) -> list[str]:
return [t for t in (normalize_tag(p) for p in _SPLIT.split(text or "")) if t]
# C実装があれば使う(4万行のワイルドカードYAMLで 1.9秒 → 0.2秒)。どちらも任意のPythonオブジェクトは作らない
_YAML_LOADER = getattr(yaml, "CSafeLoader", yaml.SafeLoader)
def _yaml_leaves(node):
"""YAMLを読んだ値から文字列の葉だけを取り出す(キーはカテゴリ名なので除く。
yes/no 等が真偽値・数値に変換された葉はタグにならないので除く)"""
if isinstance(node, dict):
for v in node.values():
yield from _yaml_leaves(v)
elif isinstance(node, list):
for v in node:
yield from _yaml_leaves(v)
elif isinstance(node, str):
yield node
def _wildcard_yaml_texts(text: str):
"""ワイルドカードYAMLの項目。`- >-` 等のブロックスカラー(複数行)やエスケープもYAMLとして解釈する。
YAMLとして読めないファイルは、従来どおり "- " で始まる行を1項目として読む"""
try:
yield from _yaml_leaves(yaml.load(text, Loader=_YAML_LOADER))
except yaml.YAMLError:
for ln in text.splitlines():
s = ln.strip()
if s.startswith("- "):
yield s[2:].strip().strip("\"'")
def _upstream_texts(graph: dict, node_id: str, seen: set) -> list[str]:
"""API形式グラフで node_id から上流へたどり、プロンプト用の文字列入力を集める(negative側はたどらない)"""
if node_id in seen or node_id not in graph:
return []
seen.add(node_id)
out = []
for key, val in ((graph[node_id] or {}).get("inputs") or {}).items():
lk = key.lower()
if lk in _SKIP_INPUTS:
continue
if isinstance(val, str):
if lk in _TEXT_INPUTS and val.strip():
out.append(val.strip())
elif isinstance(val, list) and len(val) == 2 and isinstance(val[0], (str, int)):
out += _upstream_texts(graph, str(val[0]), seen)
return out
def positive_prompt(graph: dict) -> str:
"""API形式グラフの Positive プロンプト。サンプラー/ガイダーの positive(無ければ BasicGuider等の conditioning)から上流をたどる"""
if not isinstance(graph, dict) or "nodes" in graph:
return ""
texts = []
for node in graph.values():
ins = (node or {}).get("inputs") if isinstance(node, dict) else None
if not isinstance(ins, dict):
continue
link = ins.get("positive")
if not isinstance(link, list) and "negative" not in ins:
link = ins.get("conditioning") if "guider" in str(node.get("class_type", "")).lower() else None
if isinstance(link, list) and link:
texts += _upstream_texts(graph, str(link[0]), set())
return ", ".join(dict.fromkeys(texts))[:_PROMPT_MAX]
class TagSpaceService:
def __init__(self, data_dir: Path, gallery_service, semantic_service, tagger_service=None):
self.data_dir = data_dir
self.gallery = gallery_service
self.semantic = semantic_service
self.tagger = tagger_service
self._tag_file = data_dir / "tagspace_tags.npz"
self._space_file = data_dir / "tagspace_space.json"
self._mat_file = data_dir / "tagspace_space.npz"
self._prompt_file = data_dir / "tagspace_prompts.json" # Gallery画像の Positive {path: [size, mtime, text]}
self._tagger_file = data_dir / "tagspace_tagger.json" # Tagger補完 {path: [size, mtime, model, tags]}
self._lock = threading.RLock()
self._tag_cache: dict[str, np.ndarray] | None = None # tag -> 768次元(正規化済み)
self._space: dict | None = None # 3D表示用データ(JSON)
self._mat: dict | None = None # 近傍/検索用 {ids, vecs, kinds, mean_img, mean_txt, axes, scale}
self._job = self._idle_job()
self._cancel = threading.Event()
@staticmethod
def _idle_job() -> dict:
return {"running": False, "phase": "", "done": 0, "total": 0, "note": "", "error": "", "error_code": "",
"finished": False, "cancelled": False}
# ── 状態 ───────────────────────────────────────────────
def status(self) -> dict:
space = self._load_space()
meta = (space or {}).get("meta") or {}
return {"job": dict(self._job), "built": bool(space), "meta": meta, "tagger_models": self.tagger_models(),
"index": self.semantic.index_info(), "ollama": ollama.status(),
"semantic_job": self.semantic.job_status()}
def space(self) -> dict:
space = self._load_space()
if not space:
raise SemanticError("tagspace_not_built")
return space
def _load_space(self) -> dict | None:
with self._lock:
if self._space is None and self._space_file.exists():
try:
self._space = json.loads(self._space_file.read_text(encoding="utf-8"))
except Exception as e:
logger.warning("TagSpace: failed to load space: %s", e)
return self._space
def _load_mat(self) -> dict:
with self._lock:
if self._mat is None:
if not self._mat_file.exists():
raise SemanticError("tagspace_not_built")
with np.load(self._mat_file, allow_pickle=False) as z:
self._mat = {k: z[k] for k in z.files}
m = self._mat
m["ids"] = [str(x) for x in m["ids"]]
m["pos"] = {i: n for n, i in enumerate(m["ids"])}
m["bg_ids"] = [str(x) for x in m["bg_ids"]] if "bg_ids" in m else []
m["bg_pos"] = {i: n for n, i in enumerate(m["bg_ids"])}
# 中心化して正規化したブロック(カード/タグ/背景画像)。近傍・検索のたびに作り直さない
n_img = int(m["n_img"])
m["blocks"] = {
"card": (m["ids"][:n_img], self._centered(m["vecs"][:n_img], m["mean_img"])),
"tag": (m["ids"][n_img:], self._centered(m["vecs"][n_img:], m["mean_txt"])),
"image": (m["bg_ids"], self._centered(m["bg_vecs"], m["mean_img"]) if "bg_vecs" in m
else np.zeros((0, m["vecs"].shape[1]), np.float32)),
}
return self._mat
# ── 材料の収集 ─────────────────────────────────────────
def _cards(self) -> tuple[list[dict], list]:
"""ImagePromptの画像のうちプロンプトを持つもの。戻り値: (カード, スキャン結果)"""
root = self.gallery.get_image_prompt_root()
if not root:
return [], []
base = Path(root).resolve()
entries = [e for e in self.gallery._scan_folder_recursive(base) if Path(e[1]).suffix.lower() in _IMG_EXTS]
cards, used = [], []
for name, ap, size, mtime in entries:
prompt = self.gallery._read_sidecar_prompt(Path(ap))
if not prompt:
continue
rel = Path(ap).resolve().relative_to(base).parts[:-1]
folders = [p for p in rel if p.lower() not in _VAULT_THUMB_DIRS]
# tags: 詳細パネルでタグを選んで空間検索するための、プロンプトを分解したタグ(Gallery点の tags と同じ正規化)
cards.append({"id": ap, "kind": "card", "label": name.split(".")[0], "prompt": prompt.strip(),
"tags": list(dict.fromkeys(split_tags(prompt))),
"category": "/".join(folders[-2:]) or "(root)", "group": folders[0] if folders else "(root)"})
used.append((name, ap, size, mtime))
return cards, used
def _wildcard_texts(self):
folder = self.data_dir / "wildcard"
if not folder.is_dir():
return
for p in sorted(folder.rglob("*")):
if p.suffix.lower() == ".txt":
lines = p.read_text(encoding="utf-8", errors="replace").splitlines()
yield from (ln for ln in lines if ln.strip() and not ln.lstrip().startswith("#"))
elif p.suffix.lower() in (".yaml", ".yml"):
yield from _wildcard_yaml_texts(p.read_text(encoding="utf-8", errors="replace"))
def _tagger_texts(self):
db = self.data_dir / "tagger.db"
if not db.exists():
return
try:
with sqlite3.connect(f"file:{db}?mode=ro", uri=True) as conn:
for (text,) in conn.execute("SELECT all_tags FROM images"):
if text:
yield text
except sqlite3.Error as e:
logger.warning("TagSpace: tagger.db read failed: %s", e)
def _library_texts(self):
f = self.data_dir / "prompts.json"
try:
items = json.loads(f.read_text(encoding="utf-8")) if f.exists() else []
except Exception:
items = []
for it in items if isinstance(items, list) else []:
if isinstance(it, dict) and it.get("text"):
yield str(it["text"])
def tagger_models(self) -> list[str]:
"""Tagger補完に使えるモデル(ONNX)"""
if self.tagger is None:
return []
try:
return [m["name"] for m in self.tagger.list_models() if m.get("type") == "onnx"]
except Exception:
return []
def _tagger_fill(self, targets: list[tuple[str, int, float]], model: str) -> dict[str, str]:
"""targets([(path, size, mtime)])を Tagger でタグ付けする。同じ画像・同じモデルならキャッシュを使う。
中止しても、それまでの結果はキャッシュに残す。戻り値: {path: "tag, tag, ..."}"""
from PIL import Image
try:
cache = json.loads(self._tagger_file.read_text(encoding="utf-8")) if self._tagger_file.exists() else {}
except Exception as e:
logger.warning("TagSpace: failed to load tagger cache: %s", e)
cache = {}
job = self._job
job.update(phase="tagger", done=0, total=len(targets), note="")
out: dict[str, str] = {}
dirty = 0
was_loaded = model in getattr(self.tagger, "_cache", {})
def save():
tmp = self._tagger_file.with_suffix(".tmp.json")
tmp.write_text(json.dumps(cache, ensure_ascii=False), encoding="utf-8")
tmp.replace(self._tagger_file)
try:
for n, (path, size, mtime) in enumerate(targets):
if self._cancel.is_set():
break
hit = cache.get(path)
if hit and hit[0] == size and abs(hit[1] - mtime) < 1e-3 and hit[2] == model:
text = hit[3]
else:
try:
with Image.open(path) as im:
im.seek(0)
im = im.convert("RGBA") if im.mode in ("RGBA", "LA", "P") else im.convert("RGB")
im.thumbnail((_TAGGER_MAX_SIDE, _TAGGER_MAX_SIDE), Image.LANCZOS)
text = ", ".join(self.tagger.tag_image(im, model))
except RuntimeError as e: # モデルを読み込めない: 続けても全件失敗する
raise SemanticError("tagspace_tagger_model", str(e))
except Exception as e:
logger.warning("TagSpace: tagger failed for %s: %s", path, e)
text = ""
cache[path] = [size, mtime, model, text]
dirty += 1
if not job["note"]:
job["note"] = self.tagger.model_provider(model)
if dirty >= _TAGGER_SAVE_EVERY:
save()
dirty = 0
if text:
out[path] = text
job["done"] = n + 1
finally:
if dirty:
save()
if not was_loaded: # 補完のために読み込んだモデルはメモリから外す(Taggerタブで使用中のものは残す)
getattr(self.tagger, "_cache", {}).pop(model, None)
return out
def _gallery_prompts(self, exclude_prefix: str) -> dict[str, str]:
"""索引済み Gallery 画像の Positive プロンプト。(size, mtime)が同じならキャッシュを使う"""
try:
cache = json.loads(self._prompt_file.read_text(encoding="utf-8")) if self._prompt_file.exists() else {}
except Exception as e:
logger.warning("TagSpace: failed to load prompt cache: %s", e)
cache = {}
entries = [e for e in self.semantic.indexed_entries(exclude_prefix)
if Path(e[0]).suffix.lower() in _IMG_EXTS]
job = self._job
job.update(phase="prompts", done=0, total=len(entries))
new_cache, out = {}, {}
for n, (path, size, mtime) in enumerate(entries):
if self._cancel.is_set():
break
if not Path(path).is_file():
continue # 索引作成後に削除された画像(キャッシュにも残さない)
hit = cache.get(path)
if hit and hit[0] == size and abs(hit[1] - mtime) < 1e-3:
text = hit[2]
else:
try:
text = positive_prompt(self.gallery._extract_embedded_workflow(path, prefer="prompt"))
except Exception:
text = ""
new_cache[path] = [size, mtime, text]
if text:
out[path] = text
if n % 200 == 0:
job["done"] = n
job["done"] = len(entries)
if not self._cancel.is_set(): # 中止時は途中までの結果で既存のキャッシュを上書きしない
tmp = self._prompt_file.with_suffix(".tmp.json")
tmp.write_text(json.dumps(new_cache, ensure_ascii=False), encoding="utf-8")
tmp.replace(self._prompt_file)
return out
def collect_tags(self, cards: list[dict], max_tags: int, gallery_texts=(), tagger_texts=(),
min_count: int = 1, wildcard: bool = True) -> tuple[list[dict], int]:
"""全ソースのタグを数えて上位 max_tags 件を返す(max_tags=0 は全件、ただし ALL_TAGS_LIMIT まで)。
ソースごとに出現数の多い順に並べ、ソースを順番に1件ずつ取る(数の多いGalleryだけで埋まらないように)。
出現数は「そのタグを含む文の数」で数え、全出典の合計が min_count 未満のタグは候補から外す。
wildcard=False ならワイルドカードは材料にしない(ワイルドカードにしか無い語がタグの種類の大半を占めるため)。
戻り値: (タグ, 候補数)"""
per_src: dict[str, Counter] = {s: Counter() for s in SOURCES}
feeds = {"image_prompt": (c["prompt"] for c in cards), "gallery": iter(gallery_texts),
"tagger_auto": iter(tagger_texts), "tagger": self._tagger_texts(), "prompt_library": self._library_texts(),
"wildcard": self._wildcard_texts() if wildcard else iter(())}
for src, texts in feeds.items():
for text in texts:
per_src[src].update(set(split_tags(text)))
total = Counter()
for c in per_src.values():
total.update(c)
ok = {t for t, n in total.items() if n >= min_count}
if not max_tags:
max_tags = ALL_TAGS_LIMIT
queues = {s: sorted((t for t in c if t in ok), key=lambda t, c=c: (-c[t], t)) for s, c in per_src.items()}
queues = {s: q for s, q in queues.items() if q}
picked: list[str] = []
seen: set = set()
pos = dict.fromkeys(queues, 0)
while len(picked) < max_tags and queues:
for src in list(queues):
q, i = queues[src], pos[src]
while i < len(q) and q[i] in seen:
i += 1
if i >= len(q):
del queues[src]
continue
pos[src] = i + 1
seen.add(q[i])
picked.append(q[i])
if len(picked) >= max_tags:
break
return [{"id": f"tag:{t}", "kind": "tag", "label": t,
"count": total[t],
"sources": [s for s in SOURCES if per_src[s][t]]} for t in picked], len(ok)
# ── タグベクトルのキャッシュ ───────────────────────────
def _tag_vectors(self) -> dict[str, np.ndarray]:
with self._lock:
if self._tag_cache is None:
self._tag_cache = {}
if self._tag_file.exists():
try:
with np.load(self._tag_file, allow_pickle=False) as z:
self._tag_cache = dict(zip((str(t) for t in z["tags"]), z["vecs"]))
except Exception as e:
logger.warning("TagSpace: failed to load tag cache: %s", e)
return self._tag_cache
def _save_tag_vectors(self) -> None:
with self._lock:
cache = self._tag_cache or {}
if not cache:
return
tags = list(cache)
tmp = self._tag_file.with_suffix(".tmp.npz")
np.savez(tmp, tags=np.array(tags), vecs=np.stack([cache[t] for t in tags]).astype(np.float32))
tmp.replace(self._tag_file)
# ── 構築ジョブ ─────────────────────────────────────────
def start_build(self, max_tags: int, bg: int, tagger_model: str = "", tagger_scope: str = "background",
min_count: int = 1, wildcard: bool = True) -> None:
"""max_tags=0 は全タグ(ALL_TAGS_LIMIT まで)"""
if tagger_model and tagger_model not in self.tagger_models():
raise SemanticError("tagspace_tagger_model", tagger_model)
if tagger_scope not in TAGGER_SCOPES:
tagger_scope = TAGGER_SCOPES[0]
with self._lock:
if self._job["running"]:
raise SemanticError("already_running")
info = self.semantic.index_info()
if info["count"] and info["model"] != LOCAL_MODEL:
raise SemanticError("tagspace_index_model", info["model"])
st = ollama.status()
if not st["reachable"]:
raise SemanticError("ollama_unreachable", f"{st['url']}: {st['error']}")
if not st["ready"]:
raise SemanticError("ollama_model_missing", st["tag"])
self._cancel.clear()
self._job = self._idle_job()
self._job.update(running=True, phase="cards")
max_tags = 0 if int(max_tags) == 0 else max(50, min(int(max_tags), MAX_TAGS_LIMIT))
args = (max_tags, max(0, min(int(bg), BG_LIMIT)), tagger_model, tagger_scope,
max(1, min(int(min_count), MIN_COUNT_LIMIT)), bool(wildcard))
threading.Thread(target=self._run_build, args=args, daemon=True).start()
def cancel(self) -> None:
self._cancel.set()
if self._job.get("phase") == "index":
self.semantic.cancel()
def _run_build(self, max_tags: int, bg: int, tagger_model: str = "", tagger_scope: str = "background",
min_count: int = 1, wildcard: bool = True) -> None:
job = self._job
try:
cards, entries = self._cards()
root = self.gallery.get_image_prompt_root() or ""
# 1. カード画像を Gallery 索引に追加(未索引/更新分のみ)
if entries and not self._cancel.is_set():
job.update(phase="index", done=0, total=0)
info = self.semantic.index_info()
dim = info["dim"] or ollama.DEFAULT_LOCAL_DIM
self.semantic.start_index(root, True, "missing", LOCAL_MODEL, dim)
while True:
sj = self.semantic.job_status()
job.update(done=sj["done"] + sj["failed"], total=sj["total"])
if not sj["running"]:
break
time.sleep(0.5)
if sj.get("error_code") in ("ollama_unreachable", "ollama_model_missing"):
raise SemanticError(sj["error_code"], sj["error"])
card_vecs = self.semantic.vectors_for(entries)
cards = [c for c in cards if c["id"] in card_vecs]
dim = self.semantic.index_info()["dim"] or ollama.DEFAULT_LOCAL_DIM
# 2. Gallery 画像の Positive プロンプト(タグの材料と、背景点のタグ)
prefix = Path(root).resolve().as_posix().rstrip("/") + "/" if root else ""
gallery_prompts = self._gallery_prompts(prefix)
if self._cancel.is_set():
return
# 3. 背景の Gallery 画像(Tagger補完の対象を決めるため、タグ集めより先に選ぶ)
bg_paths, bg_mat = self.semantic.sample_vectors(bg + bg // 4, exclude_prefix=prefix) if bg else ([], None)
if bg_paths: # 索引作成後に削除された画像を除く(多めに取って bg 件に詰める)
keep = [i for i, p in enumerate(bg_paths) if Path(p).is_file()][:bg]
bg_paths, bg_mat = [bg_paths[i] for i in keep], bg_mat[keep]
# 4. Tagger補完: プロンプト由来のタグが無い画像
tagger_tags: dict[str, str] = {}
if tagger_model:
stamps = {p: (sz, mt) for p, sz, mt in self.semantic.indexed_entries(prefix)}
pool = bg_paths if tagger_scope == "background" else [
p for p in stamps if Path(p).suffix.lower() in _IMG_EXTS and Path(p).is_file()]
targets = [(p, *stamps[p]) for p in pool
if p in stamps and Path(p).suffix.lower() in _IMG_EXTS
and not split_tags(gallery_prompts.get(p, ""))]
tagger_tags = self._tagger_fill(targets, tagger_model)
if self._cancel.is_set():
return
# 5. タグを集めて未キャッシュ分を埋め込む
job.update(phase="tags", done=0, total=0, note="")
tags, available = self.collect_tags(cards, max_tags, gallery_prompts.values(), tagger_tags.values(),
min_count, wildcard)
cache = self._tag_vectors()
todo = [t["label"] for t in tags if t["label"] not in cache]
job.update(total=len(todo))
for i in range(0, len(todo), _EMBED_BATCH):
if self._cancel.is_set():
break
batch = todo[i:i + _EMBED_BATCH]
try:
vecs = ollama.embed_texts(batch, ollama.DEFAULT_LOCAL_DIM)
except ollama.OllamaError as e:
raise SemanticError(e.code, str(e))
with self._lock:
cache.update(zip(batch, vecs))
job["done"] = min(len(todo), i + len(batch))
if (i // _EMBED_BATCH) % 20 == 19:
self._save_tag_vectors()
self._save_tag_vectors()
tags = [t for t in tags if t["label"] in cache]
if self._cancel.is_set():
return
# 6. 投影
job.update(phase="project", done=0, total=0)
self._project(cards, card_vecs, tags, cache, dim, bg_paths, bg_mat, gallery_prompts, tagger_tags,
tagger_model if tagger_tags else "",
{"max_tags": max_tags, "min_count": min_count, "wildcard": wildcard, "tags_available": available})
except SemanticError as e:
job["error_code"], job["error"] = e.code, str(e)
except Exception as e:
logger.exception("TagSpace: build failed")
job["error_code"], job["error"] = "tagspace_error", str(e)
finally:
ollama.release()
job["running"] = False
job["finished"] = True
job["cancelled"] = self._cancel.is_set() and not job["error_code"]
job["phase"] = ""
@staticmethod
def _unit(m: np.ndarray, dim: int) -> np.ndarray:
m = m[:, :dim].astype(np.float32)
n = np.linalg.norm(m, axis=1, keepdims=True)
return m / np.where(n > 0, n, 1)
def _project(self, cards, card_vecs, tags, cache, dim, bg_paths, bg_mat, gallery_prompts=None,
tagger_tags=None, tagger_model: str = "", tag_meta: dict | None = None) -> None:
img = self._unit(np.stack([card_vecs[c["id"]] for c in cards]), dim) if cards else np.zeros((0, dim), np.float32)
txt = self._unit(np.stack([cache[t["label"]] for t in tags]), dim) if tags else np.zeros((0, dim), np.float32)
if len(img) + len(txt) < 3:
raise SemanticError("tagspace_too_few")
bg_u = self._unit(bg_mat, dim) if bg_mat is not None and len(bg_mat) else np.zeros((0, dim), np.float32)
# modality gap 対策: 画像とテキスト(タグ)をそれぞれの平均で中心化する。
# 画像側はカードの平均を使う(数の多い背景画像の平均だとカードがタグの塊から離れて見えるため)
img_ref = img if len(img) else bg_u
mean_img = img_ref.mean(axis=0) if len(img_ref) else np.zeros(dim, np.float32)
mean_txt = txt.mean(axis=0) if len(txt) else np.zeros(dim, np.float32)
x = np.concatenate([img - mean_img, txt - mean_txt])
_, s, vt = np.linalg.svd(x, full_matrices=False)
axes = vt[:3].astype(np.float32)
var = (s ** 2) / max(float((s ** 2).sum()), 1e-12)
pts = x @ axes.T
r98 = float(np.percentile(np.linalg.norm(pts, axis=1), 98)) or 1.0
scale = _RADIUS / r98
def xyz(m):
return [[round(float(v), 3) for v in row] for row in (m @ axes.T * scale)]
n_img = len(img)
for c, p in zip(cards, xyz(img - mean_img)):
c["xyz"] = p
for t, p in zip(tags, xyz(txt - mean_txt)):
t["xyz"] = p
gp, tt = gallery_prompts or {}, tagger_tags or {}
def bg_item(path, pos):
"""背景点にはその画像のタグを持たせる(クリックでまとめて追加)。プロンプト由来が無ければTagger補完"""
tags_p = list(dict.fromkeys(split_tags(gp.get(path, ""))))
if tags_p:
return {"id": path, "xyz": pos, "tags": tags_p, "tag_src": "prompt"}
tags_t = list(dict.fromkeys(split_tags(tt.get(path, ""))))
return {"id": path, "xyz": pos, "tags": tags_t, "tag_src": "tagger" if tags_t else ""}
bg_items = [bg_item(p, q) for p, q in zip(bg_paths, xyz(bg_u - mean_img))] if len(bg_u) else []
meta = {"built_at": time.strftime("%Y-%m-%d %H:%M:%S"), "cards": len(cards), "tags": len(tags),
"background": len(bg_items), "gallery_prompts": len(gp), "tagger_images": len(tt),
"tagger_model": tagger_model, "dim": dim, "model": LOCAL_MODEL,
"explained": [round(float(v), 4) for v in var[:3]], **(tag_meta or {})}
space = {"meta": meta, "cards": cards, "tags": tags, "background": bg_items}
ids = [c["id"] for c in cards] + [t["id"] for t in tags]
tmp = self._mat_file.with_suffix(".tmp.npz")
np.savez(tmp, ids=np.array(ids), vecs=np.concatenate([img, txt]).astype(np.float32),
n_img=np.array(n_img), mean_img=mean_img.astype(np.float32), mean_txt=mean_txt.astype(np.float32),
axes=axes, scale=np.array(scale, dtype=np.float32),
bg_ids=np.array([b["id"] for b in bg_items]), bg_vecs=bg_u.astype(np.float32))
tmp.replace(self._mat_file)
tmp_json = self._space_file.with_suffix(".tmp.json")
tmp_json.write_text(json.dumps(space, ensure_ascii=False), encoding="utf-8")
tmp_json.replace(self._space_file)
with self._lock:
self._space, self._mat = space, None
# ── 近傍・検索 ─────────────────────────────────────────
@staticmethod
def _centered(vecs: np.ndarray, mean: np.ndarray) -> np.ndarray:
c = vecs - mean
return c / np.maximum(np.linalg.norm(c, axis=1, keepdims=True), 1e-6)
def _rank(self, m: dict, q: np.ndarray, k: int, exclude: str = "", kind: str = "") -> list[dict]:
"""カード・タグ・画像は別々の塊なので、それぞれの平均を引いた空間で比べる(=中心化コサイン)。
同じ種類どうしの方がスコアが高く出るため、種類ごとに順位付けして交互に並べる。
Gallery画像(背景点)を候補に入れるのは、Gallery画像を基準にしたときだけ。"""
qc = q - (m["mean_txt"] if kind == "tag" else m["mean_img"])
qn = qc / max(float(np.linalg.norm(qc)), 1e-6)
order = {"tag": ("tag", "card"), "card": ("card", "tag"), "image": ("image", "tag", "card")}[kind or "card"]
lists = []
for name in order:
ids, mat = m["blocks"][name]
if not len(ids):
lists.append([])
continue
scores = mat @ qn
top = np.argsort(-scores)[:k + 1]
lists.append([{"id": ids[i], "score": round(float(scores[i]), 4)} for i in top if ids[i] != exclude][:k])
out = []
for i in range(k):
out += [lst[i] for lst in lists if i < len(lst)]
if len(out) >= k:
break
return out[:k]
def neighbors(self, item_id: str, k: int) -> list[dict]:
m = self._load_mat()
i = m["pos"].get(item_id)
if i is not None:
kind = "card" if i < int(m["n_img"]) else "tag"
return self._rank(m, m["vecs"][i], k, exclude=item_id, kind=kind)
j = m["bg_pos"].get(item_id)
if j is not None:
return self._rank(m, m["bg_vecs"][j], k, exclude=item_id, kind="image")
raise SemanticError("tagspace_unknown_item", item_id)
def search(self, query: str, k: int) -> dict:
query = (query or "").strip()[:500]
if not query:
return {"probe": None, "matches": []}
m = self._load_mat()
dim = m["vecs"].shape[1]
try:
q = ollama.embed_text(query, ollama.DEFAULT_LOCAL_DIM)
except ollama.OllamaError as e:
raise SemanticError(e.code, str(e))
q = self._unit(q[None, :], dim)[0]
p = (q - m["mean_txt"]) @ m["axes"].T * float(m["scale"])
return {"probe": [round(float(v), 3) for v in p], "matches": self._rank(m, q, k, kind="tag")}
+2 -1
View File
@@ -99,7 +99,7 @@ class WorkflowStudio:
app.router.add_get("/wfm", serve_index_page)
# API routes
from .routes import workflow_routes, settings_routes, ollama_routes, unsloth_routes, eagle_routes, nodes_routes, prompts_routes, models_routes, gallery_routes, wildcard_routes, tagger_routes, gmic_routes, skill_routes, lab_routes, video_routes, vram_routes, partner_routes
from .routes import workflow_routes, settings_routes, ollama_routes, unsloth_routes, eagle_routes, nodes_routes, prompts_routes, models_routes, gallery_routes, wildcard_routes, tagger_routes, gmic_routes, skill_routes, lab_routes, video_routes, vram_routes, partner_routes, tagspace_routes
workflow_routes.setup_routes(app)
settings_routes.setup_routes(app)
@@ -118,5 +118,6 @@ class WorkflowStudio:
lab_routes.setup_routes(app)
video_routes.setup_routes(app)
vram_routes.setup_routes(app)
tagspace_routes.setup_routes(app)
logger.info("Workflow Studio: Routes registered successfully")
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-workflow-studio"
description = "A comprehensive workflow, asset management, and generation UI plugin for ComfyUI. Manage workflows, models, images, and prompts; batch generation and Image Feeder in the GenerateUI tab; library side panel with canvas drag & drop and AI tools."
version = "0.8.14"
version = "0.9.2"
license = { file = "LICENSE" }
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+67
View File
@@ -0,0 +1,67 @@
/* TagSpace タブ */
#wfm-tab-tagspace.active { overflow: hidden; }
.wfm-ts { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wfm-ts-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--wfm-border, #444); }
.wfm-ts-num { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--wfm-text-secondary, #aaa); }
.wfm-ts-num input { width: 72px; }
.wfm-ts-sep { width: 1px; height: 18px; background: var(--wfm-border, #444); }
.wfm-ts-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.wfm-ts-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; }
.wfm-ts-legend { display: inline-flex; gap: 10px; font-size: 11px; color: var(--wfm-text-secondary, #aaa); }
.wfm-ts-search { margin-left: auto; width: 240px; max-width: 100%; }
.wfm-ts-status { padding: 4px 12px; font-size: 12px; color: var(--wfm-text-secondary, #aaa); min-height: 22px; }
.wfm-ts-status-error { color: var(--wfm-danger, #ef4444); }
.wfm-ts-main { flex: 1; display: flex; min-height: 0; }
.wfm-ts-view { position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--wfm-bg, #111); }
.wfm-ts-view canvas { display: block; width: 100%; height: 100%; }
.wfm-ts-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wfm-ts-label { position: absolute; left: 0; top: 0; margin: -22px 0 0 6px; padding: 1px 6px; border-radius: 4px; font-size: 11px; white-space: nowrap; background: rgba(0, 0, 0, 0.6); color: #fff; }
.wfm-ts-label-chip { background: var(--wfm-primary, #6366f1); }
.wfm-ts-label-near { background: rgba(8, 145, 178, 0.85); }
.wfm-ts-label-hover { background: rgba(255, 255, 255, 0.92); color: #111; }
.wfm-ts-tooltip { position: absolute; z-index: 2; display: flex; gap: 8px; max-width: 360px; padding: 6px 8px; border-radius: 6px; font-size: 12px; pointer-events: none; background: var(--wfm-surface, #222); border: 1px solid var(--wfm-border, #444); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); }
.wfm-ts-tooltip img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; flex: none; }
.wfm-ts-tip-body { margin-top: 2px; color: var(--wfm-text-secondary, #aaa); }
.wfm-ts-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--wfm-text-secondary, #aaa); pointer-events: none; }
.wfm-ts-hint { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--wfm-text-secondary, #aaa); opacity: 0.8; pointer-events: none; }
.wfm-ts-side { width: 300px; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px; overflow: hidden; border-left: 1px solid var(--wfm-border, #444); }
/* プロンプト列(右端): チップは中身の高さ(最大40%)、出力欄が残りの高さいっぱいに伸びる */
.wfm-ts-side-prompt .wfm-ts-chips { flex: 0 1 auto; max-height: 40%; align-content: flex-start; }
.wfm-ts-side-prompt .wfm-ts-output { flex: 1; min-height: 120px; resize: none; }
.wfm-ts-panel { 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); min-height: 0; }
.wfm-ts-panel h4 { margin: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfm-ts-panel-grow { flex: 1; }
.wfm-ts-muted { color: var(--wfm-text-secondary, #aaa); font-size: 11px; }
.wfm-ts-detail { display: flex; flex-direction: column; gap: 4px; font-size: 12px; max-height: 260px; overflow: auto; }
.wfm-ts-detail-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding-bottom: 2px; background: var(--wfm-surface, #222); }
.wfm-ts-detail-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfm-ts-detail-head .wfm-btn { flex: none; }
.wfm-ts-detail-thumb { max-width: 100%; max-height: 140px; object-fit: contain; align-self: flex-start; border-radius: 4px; }
.wfm-ts-detail-text { white-space: pre-wrap; word-break: break-word; }
.wfm-ts-pick-list { display: flex; flex-wrap: wrap; gap: 3px; }
.wfm-ts-full summary { cursor: pointer; color: var(--wfm-text-secondary, #999); font-size: 11px; }
.wfm-ts-pick { padding: 1px 7px; border-radius: 10px; font-size: 11px; cursor: pointer; color: inherit; background: var(--wfm-bg-secondary, #333); border: 1px solid var(--wfm-border, #444); }
.wfm-ts-pick:hover { border-color: #f472b6; }
.wfm-ts-pick.on { background: #f472b6; border-color: #f472b6; color: #1a1a1a; }
/* タグが多くても検索ボタンが見えるよう、詳細パネルの下端に固定する */
.wfm-ts-pick-actions { position: sticky; bottom: 0; order: 10; display: flex; gap: 6px; padding-top: 4px; background: var(--wfm-surface, #222); }
.wfm-ts-path { word-break: break-all; }
.wfm-ts-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.wfm-ts-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.wfm-ts-row:hover { background: var(--wfm-surface-hover, rgba(255, 255, 255, 0.06)); }
.wfm-ts-row img { width: 28px; height: 28px; object-fit: cover; border-radius: 3px; flex: none; }
.wfm-ts-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 9px; }
.wfm-ts-row-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfm-ts-row-add { flex: none; width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--wfm-border, #444); background: transparent; color: var(--wfm-text, #ddd); cursor: pointer; }
.wfm-ts-row-add.on { background: var(--wfm-primary, #6366f1); color: #fff; border-color: transparent; }
.wfm-ts-row-add-none { flex: none; width: 22px; }
.wfm-ts-row img.wfm-ts-row-image { border-radius: 50%; }
.wfm-ts-chips { display: flex; flex-wrap: wrap; gap: 4px; max-height: 110px; overflow: auto; }
.wfm-ts-chip { display: inline-flex; align-items: center; gap: 2px; padding: 1px 2px 1px 7px; border-radius: 10px; font-size: 11px; background: var(--wfm-bg-secondary, #333); border: 1px solid var(--wfm-border, #444); }
.wfm-ts-chip-card { border-color: var(--wfm-primary, #6366f1); }
.wfm-ts-chip-image { border-color: #f472b6; }
.wfm-ts-chip button { border: none; background: transparent; color: inherit; cursor: pointer; padding: 0 4px; font-size: 12px; }
.wfm-ts-output { width: 100%; resize: vertical; font-size: 12px; box-sizing: border-box; }
.wfm-ts-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.wfm-ts-zoom { position: fixed; z-index: 1000; width: 360px; height: 360px; display: flex; align-items: center; justify-content: center; padding: 4px; box-sizing: border-box; pointer-events: none; border-radius: 8px; background: var(--wfm-surface, #222); border: 1px solid var(--wfm-border, #444); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55); }
.wfm-ts-zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
+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" };
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" };
document.querySelectorAll(".wfm-tab").forEach((tab) => {
const key = tabMap[tab.dataset.tab];
if (key) tab.textContent = t(key);
@@ -592,6 +592,7 @@ function applyI18nToHtml() {
"wfm-help-gallery-card-styleprompt-title": "helpGalleryCardStyleprompt",
"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-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",
@@ -845,6 +846,7 @@ import { initGalleryTab } from "./gallery-tab.js";
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 { imageEditTab } from "./image-edit-tab.js";
import { initVideoTab } from "./video-tab.js";
@@ -897,6 +899,7 @@ document.addEventListener("DOMContentLoaded", () => {
initGalleryTab();
initAiTab();
initTaggerTab();
initTagSpaceTab();
imageEditTab.init();
initVideoTab();
+79
View File
@@ -2146,6 +2146,85 @@ function openCompare(paths) {
overlay.querySelectorAll("video, audio").forEach(applyStoredVideoVolume);
}
// ── 他のタブから画像を表示する ────────────────────────────────
const _normPath = (p) => (p || "").replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
/**
* Output サブタブで path の画像を表示する(TagSpace の Gallery 点から呼ぶ)。
* 絞り込み(検索・お気に入り・タグ・グループ・類似表示)を解除し、フォルダツリーを
* 親から順に展開してフォルダを選び、一覧でその画像を選択して詳細を開く。
* 戻り値: 表示できたら true(出力フォルダ外・一覧に無いときは false)
*/
export async function revealInGallery(path) {
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
document.querySelector('.wfm-tab[data-tab="gallery"]')?.click(); // 初回はここで出力フォルダとツリーを読み込む
document.querySelector('.wfm-gallery-subtab-btn[data-gallery-subtab="output"]')?.click();
for (let i = 0; i < 100 && !state.folderTree; i++) await wait(100);
if (!state.folderTree) return false;
const target = _normPath(path);
const folder = target.slice(0, target.lastIndexOf("/"));
// ツリーの根から目的のフォルダまでのノードを集める
const chain = [];
let node = state.folderTree;
if (folder !== _normPath(node.abs_path) && !folder.startsWith(_normPath(node.abs_path) + "/")) return false;
while (node) {
chain.push(node);
if (_normPath(node.abs_path) === folder) break;
node = (node.children || []).find((c) => folder === _normPath(c.abs_path) || folder.startsWith(_normPath(c.abs_path) + "/"));
}
const leaf = chain[chain.length - 1];
if (_normPath(leaf.abs_path) !== folder) return false;
// 絞り込みの解除(「Clear filters」ボタンと同じ。再読み込みは下で1回だけ行う)
clearTimeout(_searchDebounceTimer);
state.search = "";
state.favoriteOnly = false;
state.tagFilter = "";
state.groupFilter = "";
const searchInput = document.getElementById("wfm-gallery-search");
if (searchInput) searchInput.value = "";
const tagSel = document.getElementById("wfm-gallery-tag-filter");
if (tagSel) tagSel.value = "";
const groupSel = document.getElementById("wfm-gallery-group-filter");
if (groupSel) groupSel.value = "";
document.getElementById("wfm-gallery-fav-btn")?.classList.remove("active");
exitSimilarMode();
// ツリーを親から順に展開(子ノードは展開時に描画される)
const itemOf = (abs) => [...document.querySelectorAll(".wfm-gallery-tree-item")].find((el) => _normPath(el.dataset.path) === _normPath(abs));
for (const n of chain.slice(0, -1)) {
const arrow = itemOf(n.abs_path)?.querySelector(".wfm-gallery-tree-arrow");
if (arrow && arrow.dataset.expanded !== "true" && arrow.style.visibility !== "hidden") arrow.click();
}
const item = itemOf(leaf.abs_path);
document.querySelectorAll(".wfm-gallery-tree-item.selected").forEach((el) => el.classList.remove("selected"));
item?.classList.add("selected");
item?.scrollIntoView({ block: "nearest" });
state.currentFolder = leaf.abs_path;
state.selectedImages.clear();
state.lastSelectionIndex = -1;
updateBulkBar();
await loadImages();
const idx = state.images.findIndex((img) => _normPath(img.path) === target);
if (idx === -1) return false;
// サムネイル表示は50件ずつ描くので、目的の画像まで描き足す
const grid = document.getElementById("wfm-gallery-grid");
if (state.viewMode === "thumb" && _renderedCount <= idx) {
while (_renderedCount <= idx) _appendNextPage(grid);
// 無限スクロールの目印を末尾へ戻す(全件描いたら外す)。_attachScrollSentinel と同じ扱い
if (_renderedCount >= state.images.length) _disconnectScrollObserver();
else { const s = document.getElementById("wfm-gallery-scroll-sentinel"); if (s) grid.appendChild(s); }
}
const el = [...grid.querySelectorAll("[data-path]")].find((e) => _normPath(e.dataset.path) === target);
if (!el) return false;
el.click(); // 通常のクリックと同じ選択・詳細表示
el.scrollIntoView({ block: "center" });
return true;
}
// ── outputパス取得 ────────────────────────────────────────────
async function detectOutputPath() {
+273
View File
@@ -750,6 +750,84 @@ const LANGUAGES = {
tabAi: "AI TOOL",
tabTagger: "Tagger",
tabTagSpace: "TagSpace",
tsBuild: "Build / Update",
tsCancel: "Stop",
tsMaxTags: "Tags:",
tsBackground: "Gallery points:",
tsAllTags: "All tags",
tsAllTagsHint: "Use every candidate tag instead of the Tags number (up to 20,000)",
tsMinCount: "Min uses:",
tsMinCountHint: "Leave out tags used in fewer prompts than this (all sources combined)",
tsWildcard: "Wildcards",
tsWildcardHint: "Use wildcard files as a tag source (words only found in wildcards are most of the distinct tags)",
tsTagsAvailable: (n) => ` (of ${n} candidates)`,
tsLayerCards: "Cards",
tsThumbs: "Thumbnails",
tsGlow: "Glow",
tsTwinkle: "Twinkle",
tsLayerTags: "Tags",
tsLayerGallery: "Gallery",
tsSearchPlaceholder: "Search the space (Enter)…",
tsLoading: "Loading the 3D view…",
tsHint: "Drag: rotate · Right-drag: pan · Wheel: zoom · Click: select · Double-click: add or remove",
tsNotBuilt: "The space is not built yet. Press \"Build / Update\".",
tsNeedOllama: "EmbeddingGemma 2 in Ollama is required (Gallery > Semantic settings > Model).",
tsBuilt: (c, g, b, at, ev) => `${c} cards · ${g} tags · ${b} Gallery points · built ${at} · PCA ${(ev * 100).toFixed(1)}%`,
tsPhase_cards: () => `Collecting ImagePrompt cards…`,
tsPhase_index: (d, n) => `Indexing card images in the Gallery semantic index… ${d} / ${n}`,
tsPhase_prompts: (d, n) => `Reading prompts from Gallery images… ${d} / ${n}`,
tsSrc_gallery: "Gallery prompts",
tsImageNoTags: "No prompt tags (no prompt found in this image)",
tsPhase_tags: (d, n) => `Embedding tags… ${d} / ${n}`,
tsPhase_project: () => `Projecting to 3D…`,
tsDetailTitle: "Selection",
tsDetailEmpty: "Hover or click an item in the space.",
tsNeighborsTitle: "Nearby",
tsNeighborsOf: (name) => `Near "${name}"`,
tsSearchTitle: (q) => `Search: ${q}`,
tsPickHint: "Click tags to choose them, then search the space with them",
tsPickSearch: (n) => `Search with selected (${n})`,
tsPickClear: "Deselect",
tsFullPrompt: "Full prompt",
tsAddPicked: (n) => `Add selected (${n})`,
tsOpenInGallery: "Open in Gallery",
tsRevealFailed: "Could not show this image in the Gallery (it is outside the Gallery output folder or no longer exists)",
tsChipPicked: (name, n) => `${name} (${n} tags)`,
tsListEmpty: "Select an item or search to list nearby cards and tags.",
tsBuilderTitle: "Prompt",
tsChipsEmpty: "Double-click cards or tags in the space, or use Add / + in the panels, to add them.",
tsSend: "Add to GenerateUI (Positive)",
tsCopy: "Copy",
tsClear: "Clear",
tsAdd: "Add",
tsRemove: "Remove",
tsSent: "Added to the Positive prompt in GenerateUI",
tsCopied: "Copied to the clipboard",
tsNoWorkflow: "Load a workflow in GenerateUI first",
tsSources: "Sources:",
tsKind_card: "Card",
tsKind_tag: "Tag",
tsKind_image: "Gallery image",
tsSrc_image_prompt: "ImagePrompt",
tsSrc_tagger: "Tagger DB",
tsSrc_prompt_library: "Prompt library",
tsSrc_wildcard: "Wildcards",
tsSourceFilterHint: "Show or hide tags by source (a tag stays visible while any of its sources is on)",
tsTagger: "Tagger fill:",
tsTaggerOff: "OFF",
tsTaggerHint: "Tag Gallery images that have no readable prompt with a Tagger model (results are cached; very slow without a GPU)",
tsScope_background: "Gallery points only",
tsScope_all: "All images without a prompt",
tsPhase_tagger: (d, n, note) => `Tagging images without a prompt… ${d} / ${n}${note ? ` (${note})` : ""}`,
tsSrc_tagger_auto: "Tagger fill",
tsTagsFromTagger: "(Tagger fill)",
ts_err_tagspace_tagger_model: (m) => `Tagger model could not be used: ${m}`,
ts_err_tagspace_not_built: () => `The space is not built yet. Press "Build / Update".`,
ts_err_tagspace_index_model: (m) => `The Gallery semantic index was made with ${m}. TagSpace needs EmbeddingGemma 2 — rebuild the index with it in Gallery > Semantic settings.`,
ts_err_tagspace_too_few: () => `Not enough cards or tags to build the space.`,
ts_err_tagspace_unknown_item: () => `That item is no longer in the space. Rebuild the space.`,
ts_err_tagspace_error: (m) => `TagSpace error: ${m}`,
tabImageEdit: "Image Edit",
// -- Tagger Tab --
@@ -1106,6 +1184,19 @@ const LANGUAGES = {
helpGallery26: "Four sub-tabs at the top of the Gallery tab: Output (this browser), ImagePrompt, Style_Catalog, and Metadata — the last one embeds the full Metadata Tab (see its own help page) so you can drop an image there to inspect its embedded model/prompt data without leaving Gallery",
// -- Tagger Tab --
helpTagSpaceTitle: "TagSpace Tab",
helpTagSpaceCardOverview: "Overview & Building the Space",
helpTagSpaceCardUse: "Choosing Tags & Making a Prompt",
helpTagSpace1: "TagSpace places WFS's own data in the EmbeddingGemma 2 vector space and shows it in 3D: Cards (ImagePrompt images with their prompt, shown as thumbnails), Tags (words split out of ImagePrompt prompts, the positive prompts embedded in Gallery images, wildcards, the Tagger DB and the Prompt library, colored by source) and Gallery points (a sample of indexed Gallery images as a faint background, each carrying the tags from its own prompt). Nearby items have similar meanings",
helpTagSpace2: "Requirements: Ollama running with EmbeddingGemma 2 (Gallery > Semantic settings > Model). If the Gallery semantic index was made with Gemini, rebuild it with EmbeddingGemma 2 first",
helpTagSpace10: "Search with a card's or Gallery image's tags: when a card or Gallery point is selected, its prompt tags are shown as buttons (a card's full prompt is under \"Full prompt\"; card tags appear after Build / Update). Click tags to choose them (click again to deselect) and press \"Search with selected\" to search the space with those tags joined in prompt order — the same as typing them into the search box. The choice is kept until another item is selected. While tags are selected, the Add button becomes \"Add selected (N)\" and adds only those tags (in prompt order) as one chip; with none selected it adds the whole item as before. For a Gallery point, \"Open in Gallery\" opens the Gallery tab with the image's folder selected and the image selected in the list (search and other filters are cleared)",
helpTagSpace9: "Choosing how many tags: \"All tags\" uses every candidate tag instead of the Tags number (up to 20,000). \"Min uses\" drops tags used in fewer prompts than this, counted over all sources — 2 removes one-off typos and fragments. \"Wildcards\" turns wildcard files on or off as a tag source: words found only in wildcards make up most of the distinct tags (about 37,000 of 47,600 in testing), so turning it off with All tags gives about 10,400 tags (about 6,800 with Min uses 2). The status line shows the number of candidates when only part of them is used. New tags are embedded once (the first build with many new tags takes a few extra minutes)",
helpTagSpace3: "Build / Update: collects the cards, adds card images that are not yet indexed to the Gallery semantic index, reads the positive prompt embedded in each indexed Gallery image (followed upstream from the sampler's positive input, never the negative; cached in tagspace_prompts.json so only new or changed images are read again), embeds new tags with Ollama (cached in tagspace_tags.npz) and projects everything to 3D with PCA. Tags: how many tags to keep — each source is ranked by how many prompts use a tag and the sources take turns, so the many Gallery prompts do not crowd out the other sources; Gallery points: how many Gallery images to show (0 = none). Prompts are split only at commas (and | { } BREAK), not at spaces; long sentences (over 5 words) are skipped. Images and text are centered separately before PCA so cards and their matching tags overlap. The first build took about 2.5 minutes for the cards plus about 3 minutes to read the prompts of 29,000 Gallery images; rebuilds with caches take seconds",
helpTagSpace4: "Navigation: drag to rotate, right-drag to pan, wheel to zoom. Hover shows the name, thumbnail and prompt/sources; the checkboxes show or hide Cards, Thumbnails, Tags and Gallery. The source checkboxes (ImagePrompt / Gallery prompts / Tagger DB / Prompt library / Wildcards) show or hide tags by where they came from — a tag stays visible while any of its sources is on and takes the color of its first visible source; hidden tags are also left out of the nearby and search lists. The choices are remembered",
helpTagSpace5: "Click a card or tag to select it and list nearby items (clicking only selects — it does not change the prompt). To add it to the Prompt panel, double-click it, press Add next to its name under Selection, or press + in the list (double-click / press again to remove) — cards and tags are ranked separately and listed alternately, so a card also shows its closest tags. Adding a Gallery point adds all tags from that image's prompt as one chip (images without readable tags cannot be added); clicking one lists similar Gallery images (round thumbnails) together with nearby tags and cards; selecting a card or tag, or searching, never lists Gallery images. Use + in the list to add, click a row to move to it. The search box (Enter, any language) places a white marker for the text and lists the nearest items",
helpTagSpace6: "Prompt panel: a card adds its whole prompt, a tag adds the tag, a Gallery image adds its prompt tags. The text joins them with duplicates removed (case and spacing ignored). \"Add to GenerateUI (Positive)\" appends it to the positive prompt of the workflow loaded in GenerateUI; Copy puts it on the clipboard",
helpTagSpace7: "Tagger fill: about a third of Gallery images have no readable positive prompt (imported or edited images, prompts made only of LoRA tags or long sentences). Choose a Tagger model (ONNX models from the Tagger tab) next to \"Tagger fill\" to tag those images on Build / Update: \"Gallery points only\" tags just the sampled Gallery points, \"All images without a prompt\" tags every indexed image that lacks prompt tags. Default thresholds are used (WD 0.35 / character 0.85, PixAI its recommended values) and rating labels are dropped. Results are cached in tagspace_tagger.json per image and model, so later builds only tag new images; stopping keeps what was done. The tags become the \"Tagger fill\" source (shown/hidden like the others) and the tags of those Gallery points, marked \"(Tagger fill)\". The status shows whether the model runs on CUDA or CPU — on the CPU it takes about 0.5 s per image, so check that onnxruntime-gpu is active (see Troubleshooting) before tagging all images",
helpTagSpace8: "Display: \"Glow\" draws points as glowing stars on a night-sky background (dense areas brighten; Gallery points are drawn dimmer so they don't wash out to white) — turn it off for the plain dots and the normal background. \"Twinkle\" (works with Glow) makes tags, cards and Gallery points slowly twinkle, each with its own rhythm; the selection and nearby highlights stay steady. Hover over the image under Selection or the thumbnails in the Nearby list to see an enlarged preview (clicking a list row changes the selection, so hovering lets you check images first). The Add / Remove button sits on the title row of Selection and stays visible while the text scrolls",
helpTaggerTitle: "Tagger Tab",
helpTagger1: "Automatic image tagging using WD Tagger (ONNX), PixAI Tagger v1.0 (ONNX), SwinV2, DeepDanbooru (.h5), and VLM (Ollama / LM Studio / Lemonade / Unsloth) — 3 sub-tabs: Single / Batch / DB",
helpTagger2: "Model placement: put each model in its own subfolder under ComfyUI/models/tagger/<model-name>/; the folder must contain a .onnx file + selected_tags.csv (or .h5 + label file for DeepDanbooru). PixAI Tagger v1.0: use the community ONNX conversion Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8 — one .onnx (model_fp16.onnx recommended on GPU) + selected_tags.csv + preprocess.json in the folder; it is detected automatically",
@@ -2468,6 +2559,84 @@ const LANGUAGES = {
tabAi: "AI TOOL",
tabTagger: "Tagger",
tabTagSpace: "TagSpace",
tsBuild: "作成 / 更新",
tsCancel: "中止",
tsMaxTags: "タグ数:",
tsBackground: "Gallery点数:",
tsAllTags: "全タグ",
tsAllTagsHint: "「タグ数」の代わりに候補のタグをすべて使う(上限2万件)",
tsMinCount: "最低出現回数:",
tsMinCountHint: "全出典を合わせて、この回数未満しか使われていないタグを除く",
tsWildcard: "ワイルドカード",
tsWildcardHint: "ワイルドカードをタグの材料に含める(ワイルドカードにしか無い語がタグの種類の大半を占めます)",
tsTagsAvailable: (n) => `(候補 ${n})`,
tsLayerCards: "カード",
tsThumbs: "サムネイル",
tsGlow: "発光",
tsTwinkle: "またたき",
tsLayerTags: "タグ",
tsLayerGallery: "Gallery",
tsSearchPlaceholder: "空間を検索(Enter)…",
tsLoading: "3D表示を読み込み中…",
tsHint: "ドラッグ: 回転 · 右ドラッグ: 移動 · ホイール: ズーム · クリック: 選択 · ダブルクリック: 追加・削除",
tsNotBuilt: "空間がまだ作成されていません。「作成 / 更新」を押してください。",
tsNeedOllama: "OllamaのEmbeddingGemma 2が必要です(Gallery > セマンティック設定 > モデル設定)。",
tsBuilt: (c, g, b, at, ev) => `カード ${c} · タグ ${g} · Gallery点 ${b} · 作成 ${at} · PCA寄与率 ${(ev * 100).toFixed(1)}%`,
tsPhase_cards: () => `ImagePromptカードを収集中…`,
tsPhase_index: (d, n) => `カード画像をGalleryのセマンティック索引に追加中… ${d} / ${n}`,
tsPhase_prompts: (d, n) => `Gallery画像のプロンプトを読み取り中… ${d} / ${n}`,
tsSrc_gallery: "Galleryのプロンプト",
tsImageNoTags: "プロンプト由来のタグなし(この画像からプロンプトを取り出せませんでした)",
tsPhase_tags: (d, n) => `タグを埋め込み中… ${d} / ${n}`,
tsPhase_project: () => `3Dに投影中…`,
tsDetailTitle: "選択中",
tsDetailEmpty: "空間の要素にカーソルを合わせるか、クリックしてください。",
tsNeighborsTitle: "近くの要素",
tsNeighborsOf: (name) => `「${name}」の近く`,
tsSearchTitle: (q) => `検索: ${q}`,
tsPickHint: "タグをクリックで選び、選んだタグで空間を検索できます",
tsPickSearch: (n) => `選択したタグで空間検索(${n})`,
tsPickClear: "選択解除",
tsFullPrompt: "プロンプト全文",
tsAddPicked: (n) => `選択したタグを追加(${n})`,
tsOpenInGallery: "Galleryで開く",
tsRevealFailed: "この画像をGalleryで表示できませんでした(GalleryのOutputフォルダの外にあるか、画像が見つかりません)",
tsChipPicked: (name, n) => `${name}(${n}タグ)`,
tsListEmpty: "要素を選ぶか検索すると、近いカードやタグを一覧表示します。",
tsBuilderTitle: "プロンプト",
tsChipsEmpty: "空間のカードやタグをダブルクリックするか、「追加」・一覧の+で追加できます。",
tsSend: "GenerateUIへ追記(Positive)",
tsCopy: "コピー",
tsClear: "クリア",
tsAdd: "追加",
tsRemove: "削除",
tsSent: "GenerateUIのPositiveプロンプトに追記しました",
tsCopied: "クリップボードにコピーしました",
tsNoWorkflow: "先にGenerateUIでワークフローを読み込んでください",
tsSources: "出典:",
tsKind_card: "カード",
tsKind_tag: "タグ",
tsKind_image: "Gallery画像",
tsSrc_image_prompt: "ImagePrompt",
tsSrc_tagger: "Tagger DB",
tsSrc_prompt_library: "Promptライブラリ",
tsSrc_wildcard: "ワイルドカード",
tsSourceFilterHint: "出典ごとにタグの表示を切り替えます(出典のどれか1つがONならそのタグは表示されます)",
tsTagger: "Tagger補完:",
tsTaggerOff: "OFF",
tsTaggerHint: "プロンプトを取り出せないGallery画像にTaggerモデルでタグを付けます(結果はキャッシュ。GPUが無いとかなり遅くなります)",
tsScope_background: "Gallery点のみ",
tsScope_all: "プロンプトの無い全画像",
tsPhase_tagger: (d, n, note) => `プロンプトの無い画像にタグ付け中… ${d} / ${n}${note ? `(${note})` : ""}`,
tsSrc_tagger_auto: "Tagger補完",
tsTagsFromTagger: "(Tagger補完)",
ts_err_tagspace_tagger_model: (m) => `Taggerモデルを使えません: ${m}`,
ts_err_tagspace_not_built: () => `空間がまだ作成されていません。「作成 / 更新」を押してください。`,
ts_err_tagspace_index_model: (m) => `Galleryのセマンティック索引は ${m} で作られています。TagSpaceにはEmbeddingGemma 2が必要です。Gallery > セマンティック設定で索引を作り直してください。`,
ts_err_tagspace_too_few: () => `カードやタグが少なすぎて空間を作れません。`,
ts_err_tagspace_unknown_item: () => `その要素は空間にありません。空間を作り直してください。`,
ts_err_tagspace_error: (m) => `TagSpaceエラー: ${m}`,
tabImageEdit: "Image Edit",
// -- Tagger Tab --
@@ -2824,6 +2993,19 @@ const LANGUAGES = {
helpGallery26: "Galleryタブ上部の4つのサブタブ:Output(このブラウザ)・ImagePrompt・Style_Catalog・Metadata — 最後のMetadataは独立したMetadataタブ(該当ヘルプページ参照)をそのまま内包しているため、Galleryを離れずに画像をドロップして埋め込みモデル/プロンプト情報を確認できます",
// -- Tagger Tab --
helpTagSpaceTitle: "TagSpaceタブ",
helpTagSpaceCardOverview: "概要・空間の作成",
helpTagSpaceCardUse: "タグを選んでプロンプトを作る",
helpTagSpace1: "TagSpaceは、WFS内のデータをEmbeddingGemma 2のベクトル空間に置いて3Dで表示します。カード(ImagePromptの画像とそのプロンプト。サムネイルで表示)、タグ(ImagePromptのプロンプト・Gallery画像に埋め込まれたPositiveプロンプト・ワイルドカード・Tagger DB・Promptライブラリの文を分解した語。出典ごとに色分け)、Gallery点(索引済みのGallery画像の一部を薄い背景として表示。それぞれ自分のプロンプト由来のタグを持つ)の3種類です。近くにあるものほど意味が近くなります",
helpTagSpace2: "必要なもの:OllamaとEmbeddingGemma 2(Gallery > セマンティック設定 > モデル設定)。Galleryのセマンティック索引をGeminiで作っている場合は、先にEmbeddingGemma 2で作り直してください",
helpTagSpace10: "カード・Gallery画像のタグで空間検索:カードやGallery点を選ぶと、プロンプトのタグがボタンで表示されます(カードのプロンプト全文は「プロンプト全文」で表示。カードのタグは「作成 / 更新」後に表示されます)。タグをクリックして選び(もう一度で解除)、「選択したタグで空間検索」を押すと、選んだタグをプロンプトの順につないだ文で空間を検索します(検索欄に入力した場合と同じ)。選択は別の要素を選ぶまで保持されます。タグを選んでいる間は「追加」ボタンが「選択したタグを追加(N)」に変わり、選んだタグだけを(プロンプトの順で)1つのチップとして追加します。選んでいなければ、これまでどおり全体を追加します。Gallery点では「Galleryで開く」で、ギャラリータブのその画像のフォルダを開き、一覧でその画像を選んだ状態にします(検索などの絞り込みは解除されます)",
helpTagSpace9: "タグの選び方:「全タグ」をオンにすると「タグ数」の代わりに候補のタグをすべて使います(上限2万件)。「最低出現回数」は、全出典を合わせてその回数未満しか使われていないタグを除きます(2にすると1回だけの表記ゆれや断片が消えます)。「ワイルドカード」はワイルドカードをタグの材料に含めるかどうかです。ワイルドカードにしか出てこない語がタグの種類の大半を占めるため(検証環境では4.76万種中約3.7万種)、オフにして全タグにすると約1.04万種(最低出現回数2なら約6,800種)になります。候補の一部だけを使ったときは、状態表示に候補数も出ます。新しいタグは一度だけ埋め込みます(新しいタグが多い初回の作成は数分長くかかります)",
helpTagSpace3: "「作成 / 更新」:カードを集め、まだ索引にないカード画像をGalleryのセマンティック索引に追加し、索引済みのGallery画像に埋め込まれたPositiveプロンプトを読み取り(サンプラーのpositive入力から上流をたどり、negative側はたどらない。tagspace_prompts.jsonにキャッシュし、2回目以降は新しい画像・変更された画像だけを読む)、新しいタグをOllamaで埋め込み(tagspace_tags.npzにキャッシュ)、PCAで3Dに投影します。「タグ数」は残すタグの数で、出典ごとに「そのタグを使った文の数」で順位を付け、出典を順番に取るので、数の多いGalleryのプロンプトだけで埋まることはありません。「Gallery点数」は表示するGallery画像の数(0で表示なし)。プロンプトはカンマ(と | { } BREAK)でだけ区切り、スペースでは区切りません。5語を超える文章は除きます。画像とテキストはそれぞれ中心をそろえてから投影し、カードと対応するタグが重なるようにしています。初回はカードの準備に約2.5分、Gallery画像2.9万枚のプロンプト読み取りに約3分かかりました。キャッシュがあれば数秒です",
helpTagSpace4: "操作:ドラッグで回転、右ドラッグで移動、ホイールでズーム。カーソルを合わせると名前・サムネイル・プロンプト/出典を表示します。チェックボックスでカード・サムネイル・タグ・Galleryの表示を切り替えます。出典のチェックボックス(ImagePrompt/Galleryのプロンプト/Tagger DB/Promptライブラリ/ワイルドカード)では、タグを出典ごとに表示・非表示にできます。出典のどれか1つがONならそのタグは表示され、色は表示中の出典のうち最初のものになります。非表示のタグは近くの要素・検索結果の一覧からも除かれます。選択は保存されます",
helpTagSpace5: "カードやタグをクリックすると選択され、近くの要素が一覧表示されます(クリックだけではプロンプトは変わりません)。プロンプト欄に追加するには、ダブルクリックするか、「選択中」の名前の横の「追加」、または一覧の+を押します(もう一度ダブルクリック・押すと削除)。カードとタグは別々に順位付けして交互に並べるので、カードを選ぶと近いタグも出ます。Gallery点を追加すると、その画像のタグをまとめて1つのチップになります(タグの無い画像は追加できません)。Gallery点をクリックすると、似ているGallery画像(丸いサムネイル)を近いタグ・カードと一緒に一覧表示します。カードやタグを選んだときと検索のときは、Gallery画像は一覧に入りません。一覧の+で追加、行のクリックでその位置へ移動します。検索欄(Enter・日本語可)では文章の位置に白い印を置き、近い要素を一覧にします",
helpTagSpace6: "プロンプト欄:カードはプロンプト全体、タグはタグそのもの、Gallery画像はそのプロンプト由来のタグを追加します。重複(大文字小文字・空白の違いは無視)を除いて連結します。「GenerateUIへ追記(Positive)」でGenerateUIに読み込んだワークフローのPositiveプロンプトに追記、「コピー」でクリップボードにコピーします",
helpTagSpace7: "Tagger補完:Gallery画像の約3分の1は、Positiveプロンプトを取り出せません(読み込んだ画像・編集した画像、LoRA指定や長い文章だけのプロンプトなど)。「Tagger補完」でTaggerモデル(TaggerタブのONNXモデル)を選ぶと、「作成 / 更新」のときにそれらの画像へタグを付けます。「Gallery点のみ」は表示するGallery点だけ、「プロンプトの無い全画像」は索引済みでプロンプト由来のタグが無いすべての画像が対象です。しきい値は既定値(WDは0.35/キャラクター0.85、PixAIは推奨値)で、評価(rating)ラベルは除きます。結果は画像とモデルごとにtagspace_tagger.jsonへキャッシュするので、2回目以降は新しい画像だけを処理します。中止してもそこまでの結果は残ります。付いたタグは出典「Tagger補完」として他の出典と同じように表示・非表示でき、該当するGallery点のタグにもなります(「(Tagger補完)」と表示)。進み具合の表示にモデルの実行先(CUDA/CPU)が出ます。CPUでは1枚あたり約0.5秒かかるので、全画像を対象にする前にonnxruntime-gpuが有効か確認してください(トラブルシューティング参照)",
helpTagSpace8: "表示:「発光」は点を夜空の背景に光る星のように描きます(密集した場所ほど明るくなります。数の多いGallery点は白く飛ばないよう控えめにしています)。オフにすると元の丸い点と通常の背景に戻ります。「またたき」(発光がオンのときに有効)は、タグ・カード・Gallery点を点ごとに違うリズムでゆっくり瞬かせます。選択中・近傍の強調表示は瞬きません。「選択中」の画像や「近く」の一覧のサムネイルにマウスを乗せると拡大表示されます(一覧の行をクリックすると選択が変わるので、乗せるだけで画像を確認できます)。追加/削除ボタンは「選択中」の名前の行にあり、本文をスクロールしても隠れません",
helpTaggerTitle: "Taggerタブ",
helpTagger1: "WD Tagger(ONNX)・PixAI Tagger v1.0(ONNX)・SwinV2・DeepDanbooru(.h5)・VLM(Ollama / LM Studio / Lemonade / Unsloth)による自動タグ付け — サブタブ: Single / Batch / DB",
helpTagger2: "モデル配置:ComfyUI/models/tagger/<モデル名>/ 以下に各モデルのフォルダを作成し、.onnx + selected_tags.csv(DeepDanbooruは .h5 + ラベルファイル)を格納。PixAI Tagger v1.0 はコミュニティ変換版 Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8 を使用し、フォルダに .onnx を1つ(GPUなら model_fp16.onnx 推奨)+ selected_tags.csv + preprocess.json を置くと自動判別",
@@ -4186,6 +4368,84 @@ const LANGUAGES = {
tabAi: "AI TOOL",
tabTagger: "Tagger",
tabTagSpace: "TagSpace",
tsBuild: "创建 / 更新",
tsCancel: "停止",
tsMaxTags: "标签数:",
tsBackground: "Gallery点数:",
tsAllTags: "全部标签",
tsAllTagsHint: "不使用“标签数”,而是使用所有候选标签(上限2万个)",
tsMinCount: "最少出现次数:",
tsMinCountHint: "排除所有来源合计中使用次数少于该值的标签",
tsWildcard: "通配符",
tsWildcardHint: "将通配符作为标签来源(只出现在通配符中的词占标签种类的大部分)",
tsTagsAvailable: (n) => `(候选 ${n})`,
tsLayerCards: "卡片",
tsThumbs: "缩略图",
tsGlow: "发光",
tsTwinkle: "闪烁",
tsLayerTags: "标签",
tsLayerGallery: "Gallery",
tsSearchPlaceholder: "在空间中搜索(Enter)…",
tsLoading: "正在加载3D视图…",
tsHint: "拖动:旋转 · 右键拖动:平移 · 滚轮:缩放 · 点击:选择 · 双击:添加或移除",
tsNotBuilt: "空间尚未创建。请按“创建 / 更新”。",
tsNeedOllama: "需要Ollama中的EmbeddingGemma 2(Gallery > 语义设置 > 模型设置)。",
tsBuilt: (c, g, b, at, ev) => `卡片 ${c} · 标签 ${g} · Gallery点 ${b} · 创建于 ${at} · PCA贡献率 ${(ev * 100).toFixed(1)}%`,
tsPhase_cards: () => `正在收集ImagePrompt卡片…`,
tsPhase_index: (d, n) => `正在将卡片图像加入Gallery语义索引… ${d} / ${n}`,
tsPhase_prompts: (d, n) => `正在读取Gallery图像的提示词… ${d} / ${n}`,
tsSrc_gallery: "Gallery提示词",
tsImageNoTags: "没有来自提示词的标签(未能从该图像取出提示词)",
tsPhase_tags: (d, n) => `正在嵌入标签… ${d} / ${n}`,
tsPhase_project: () => `正在投影到3D…`,
tsDetailTitle: "已选择",
tsDetailEmpty: "将鼠标悬停在空间中的元素上或点击它。",
tsNeighborsTitle: "附近的元素",
tsNeighborsOf: (name) => `“${name}”附近`,
tsSearchTitle: (q) => `搜索:${q}`,
tsPickHint: "点击标签进行选择,然后用所选标签搜索空间",
tsPickSearch: (n) => `用所选标签搜索空间(${n})`,
tsPickClear: "取消选择",
tsFullPrompt: "完整提示词",
tsAddPicked: (n) => `添加所选标签(${n})`,
tsOpenInGallery: "在Gallery中打开",
tsRevealFailed: "无法在Gallery中显示该图像(位于Gallery的Output文件夹之外,或图像不存在)",
tsChipPicked: (name, n) => `${name}(${n}个标签)`,
tsListEmpty: "选择元素或搜索后,会列出附近的卡片和标签。",
tsBuilderTitle: "提示词",
tsChipsEmpty: "双击空间中的卡片或标签,或使用“添加”·列表中的+即可添加。",
tsSend: "追加到GenerateUI(Positive)",
tsCopy: "复制",
tsClear: "清除",
tsAdd: "添加",
tsRemove: "移除",
tsSent: "已追加到GenerateUI的Positive提示词",
tsCopied: "已复制到剪贴板",
tsNoWorkflow: "请先在GenerateUI中加载工作流",
tsSources: "来源:",
tsKind_card: "卡片",
tsKind_tag: "标签",
tsKind_image: "Gallery图像",
tsSrc_image_prompt: "ImagePrompt",
tsSrc_tagger: "Tagger DB",
tsSrc_prompt_library: "Prompt库",
tsSrc_wildcard: "通配符",
tsSourceFilterHint: "按来源切换标签的显示(只要标签的任一来源为开启,就会显示)",
tsTagger: "Tagger补全:",
tsTaggerOff: "关闭",
tsTaggerHint: "用Tagger模型为无法取出提示词的Gallery图像打标签(结果会缓存;没有GPU时会非常慢)",
tsScope_background: "仅Gallery点",
tsScope_all: "所有无提示词的图像",
tsPhase_tagger: (d, n, note) => `正在为无提示词的图像打标签… ${d} / ${n}${note ? `(${note})` : ""}`,
tsSrc_tagger_auto: "Tagger补全",
tsTagsFromTagger: "(Tagger补全)",
ts_err_tagspace_tagger_model: (m) => `无法使用Tagger模型:${m}`,
ts_err_tagspace_not_built: () => `空间尚未创建。请按“创建 / 更新”。`,
ts_err_tagspace_index_model: (m) => `Gallery语义索引是用 ${m} 创建的。TagSpace需要EmbeddingGemma 2——请在Gallery > 语义设置中用它重建索引。`,
ts_err_tagspace_too_few: () => `卡片或标签太少,无法创建空间。`,
ts_err_tagspace_unknown_item: () => `该元素已不在空间中。请重新创建空间。`,
ts_err_tagspace_error: (m) => `TagSpace错误:${m}`,
tabImageEdit: "Image Edit",
// -- Tagger Tab --
@@ -4542,6 +4802,19 @@ const LANGUAGES = {
helpGallery26: "Gallery标签页顶部有四个子标签:Output(此浏览器)、ImagePrompt、Style_Catalog、Metadata — 最后一个直接内嵌完整的Metadata标签页(参见其专属帮助页),因此无需离开Gallery即可拖入图像查看其内嵌的模型/提示词数据",
// -- Tagger Tab --
helpTagSpaceTitle: "TagSpace标签页",
helpTagSpaceCardOverview: "概述与创建空间",
helpTagSpaceCardUse: "选择标签并生成提示词",
helpTagSpace1: "TagSpace将WFS内的数据放入EmbeddingGemma 2的向量空间并以3D显示:卡片(ImagePrompt的图像及其提示词,以缩略图显示)、标签(从ImagePrompt提示词、Gallery图像中嵌入的Positive提示词、通配符、Tagger DB和Prompt库的文本中拆分出的词,按来源着色)以及Gallery点(已索引的部分Gallery图像,作为淡色背景,各自带有来自其提示词的标签)。距离越近,含义越相近",
helpTagSpace2: "需要:运行中的Ollama与EmbeddingGemma 2(Gallery > 语义设置 > 模型设置)。如果Gallery语义索引是用Gemini创建的,请先用EmbeddingGemma 2重建",
helpTagSpace10: "用卡片或Gallery图像的标签搜索空间:选择卡片或Gallery点后,其提示词标签以按钮显示(卡片的完整提示词在“完整提示词”中显示;卡片标签在“创建 / 更新”后显示)。点击标签进行选择(再次点击取消),按“用所选标签搜索空间”即可将所选标签按提示词顺序连接后搜索空间(与在搜索框中输入相同)。在选择其他元素之前会保留所选内容。选择了标签时,“添加”按钮会变为“添加所选标签(N)”,只将所选标签(按提示词顺序)作为一个标签块添加;未选择时与以前一样添加整体。对于Gallery点,“在Gallery中打开”会打开Gallery标签页中该图像所在的文件夹,并在列表中选中该图像(搜索等筛选会被清除)",
helpTagSpace9: "标签的选择:勾选“全部标签”后不再使用“标签数”,而是使用所有候选标签(上限2万个)。“最少出现次数”会排除在所有来源合计中使用次数少于该值的标签(设为2可去除只出现一次的拼写差异和片段)。“通配符”决定是否将通配符作为标签来源。只出现在通配符中的词占了标签种类的大部分(测试环境中4.76万种中约3.7万种),关闭后使用全部标签约为1.04万种(最少出现次数为2时约6,800种)。只使用部分候选时,状态栏会显示候选数量。新标签只嵌入一次(新标签较多的首次创建会多花几分钟)",
helpTagSpace3: "“创建 / 更新”:收集卡片,将尚未索引的卡片图像加入Gallery语义索引,读取已索引Gallery图像中嵌入的Positive提示词(从采样器的positive输入向上追溯,不追溯negative;缓存于tagspace_prompts.json,之后只读取新增或更改的图像),用Ollama嵌入新标签(缓存于tagspace_tags.npz),再用PCA投影到3D。“标签数”为保留的标签数量:每个来源按“使用该标签的文本数”排序,各来源轮流选取,因此不会被数量众多的Gallery提示词占满;“Gallery点数”为显示的Gallery图像数量(0为不显示)。提示词只按逗号(以及 | { } BREAK)拆分,不按空格拆分,超过5个词的句子会被排除。图像与文本分别对齐中心后再投影,使卡片与对应标签重叠。首次创建时,卡片准备约2.5分钟,读取2.9万张Gallery图像的提示词约3分钟;有缓存时只需几秒",
helpTagSpace4: "操作:拖动旋转,右键拖动平移,滚轮缩放。悬停时显示名称、缩略图以及提示词/来源;复选框可切换卡片、缩略图、标签和Gallery的显示。来源复选框(ImagePrompt/Gallery提示词/Tagger DB/Prompt库/通配符)可按来源显示或隐藏标签:只要标签的任一来源为开启就会显示,颜色取显示中来源的第一个;隐藏的标签也会从附近元素和搜索结果列表中排除。所选内容会被保存",
helpTagSpace5: "点击卡片或标签会选中它并列出附近的元素(仅点击不会改变提示词)。要加入提示词栏,请双击,或按“选中”中名称旁的“添加”或列表中的+(再次双击或按下即移除)。卡片和标签分别排序后交替排列,因此选择卡片时也会显示相近的标签。添加Gallery点时,该图像的标签会合并为一个标签块(没有标签的图像无法添加);点击Gallery点会将相似的Gallery图像(圆形缩略图)与附近的标签、卡片一起列出;选择卡片或标签以及搜索时,列表中不会出现Gallery图像。列表中的+用于添加,点击行会移动到该位置。搜索框(Enter,支持中文)会在文本的位置放置白色标记并列出附近的元素",
helpTagSpace6: "提示词栏:卡片添加其完整提示词,标签添加标签本身,Gallery图像添加其提示词中的标签;去除重复(忽略大小写和空格差异)后连接。“追加到GenerateUI(Positive)”会追加到GenerateUI中已加载工作流的Positive提示词,“复制”会复制到剪贴板",
helpTagSpace7: "Tagger补全:约三分之一的Gallery图像无法取出Positive提示词(导入或编辑过的图像、只有LoRA指定或长句的提示词等)。在“Tagger补全”中选择Tagger模型(Tagger标签页中的ONNX模型)后,“创建 / 更新”时会为这些图像打标签。“仅Gallery点”只处理显示的Gallery点,“所有无提示词的图像”处理所有已索引且没有提示词标签的图像。使用默认阈值(WD为0.35/角色0.85,PixAI为推荐值),并排除评级(rating)标签。结果按图像和模型缓存于tagspace_tagger.json,之后只处理新图像;中止时已完成的结果会保留。得到的标签作为来源“Tagger补全”,可与其他来源一样显示或隐藏,也会成为对应Gallery点的标签(标注“(Tagger补全)”)。进度中会显示模型的运行位置(CUDA/CPU)。在CPU上每张约0.5秒,处理全部图像前请确认onnxruntime-gpu已生效(参见故障排除)",
helpTagSpace8: "显示:“发光”会在夜空背景上把点绘制成发光的星星(越密集越亮;数量多的Gallery点会调暗,避免过曝发白)。关闭后恢复原来的圆点和普通背景。“闪烁”(在发光开启时有效)让标签、卡片和Gallery点以各自不同的节奏缓慢闪烁;选中和附近的高亮不会闪烁。将鼠标悬停在“选中”中的图像或“附近”列表的缩略图上会显示放大预览(点击列表行会改变选中项,因此只需悬停即可查看图像)。添加/移除按钮位于“选中”的名称行,滚动正文时也不会被隐藏",
helpTaggerTitle: "Tagger标签",
helpTagger1: "使用WD Tagger(ONNX)、PixAI Tagger v1.0(ONNX)、SwinV2、DeepDanbooru(.h5)和VLM(Ollama / LM Studio / Lemonade / Unsloth)进行自动图像标注 — 子标签:Single / Batch / DB",
helpTagger2: "模型放置:在ComfyUI/models/tagger/<模型名>/ 下为每个模型创建单独子文件夹,必须包含 .onnx + selected_tags.csv(DeepDanbooru为 .h5 + 标签文件)。PixAI Tagger v1.0 使用社区ONNX转换版 Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8:文件夹内放一个 .onnx(GPU推荐 model_fp16.onnx)+ selected_tags.csv + preprocess.json,将自动识别",
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
The MIT License
Copyright © 2010-2026 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+3
View File
@@ -0,0 +1,3 @@
three.js r187 (0.187.0) - MIT License (see LICENSE)
Bundled subset for the TagSpace tab: core classes + OrbitControls.
Built with: esbuild --bundle --format=esm --minify
File diff suppressed because one or more lines are too long
+33
View File
@@ -11,6 +11,7 @@
<link rel="stylesheet" href="/wfm_static/css/image-edit-tab.css">
<link rel="stylesheet" href="/wfm_static/css/lab-tab.css">
<link rel="stylesheet" href="/wfm_static/css/video-tab.css">
<link rel="stylesheet" href="/wfm_static/css/tagspace-tab.css">
</head>
<body>
<!-- Header -->
@@ -28,6 +29,7 @@
<button class="wfm-tab" data-tab="image-edit">Image Edit</button>
<button class="wfm-tab" data-tab="video">Video</button>
<button class="wfm-tab" data-tab="tagger">Tagger</button>
<button class="wfm-tab" data-tab="tagspace">TagSpace</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>
@@ -1354,6 +1356,7 @@
<button class="wfm-help-nav-item" data-help-page="sidepanel">Library (Side Panel)</button>
<button class="wfm-help-nav-item" data-help-page="aitool">AI TOOL Tab</button>
<button class="wfm-help-nav-item" data-help-page="tagger">Tagger Tab</button>
<button class="wfm-help-nav-item" data-help-page="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="shortcuts">Keyboard Shortcuts</button>
@@ -2000,6 +2003,33 @@
</div>
</div>
<div class="wfm-help-page" id="wfm-help-page-tagspace">
<div class="wfm-help-article-header">
<h2 id="wfm-help-tagspace-title">TagSpace Tab</h2>
<button type="button" class="wfm-btn wfm-btn-sm wfm-help-jump-btn" data-jump-tab="tagspace">Open tab &rarr;</button>
</div>
<div class="wfm-help-card">
<h3 id="wfm-help-tagspace-card-overview-title">Overview &amp; Building the Space</h3>
<ul>
<li id="wfm-help-tagspace-1">TagSpace places WFS's own data in the EmbeddingGemma 2 vector space and shows it in 3D: Cards (ImagePrompt images with their prompt, shown as thumbnails), Tags (words split out of ImagePrompt prompts, the positive prompts embedded in Gallery images, wildcards, the Tagger DB and the Prompt library, colored by source) and Gallery points (a sample of indexed Gallery images as a faint background, each carrying the tags from its own prompt). Nearby items have similar meanings</li>
<li id="wfm-help-tagspace-2">Requirements: Ollama running with EmbeddingGemma 2 (Gallery &gt; Semantic settings &gt; Model). If the Gallery semantic index was made with Gemini, rebuild it with EmbeddingGemma 2 first</li>
<li id="wfm-help-tagspace-3">Build / Update: collects the cards, adds card images that are not yet indexed to the Gallery semantic index, reads the positive prompt embedded in each indexed Gallery image (followed upstream from the sampler's positive input, never the negative; cached in tagspace_prompts.json so only new or changed images are read again), embeds new tags with Ollama (cached in tagspace_tags.npz) and projects everything to 3D with PCA. Tags: how many tags to keep — each source is ranked by how many prompts use a tag and the sources take turns, so the many Gallery prompts do not crowd out the other sources; Gallery points: how many Gallery images to show (0 = none). Prompts are split only at commas (and | { } BREAK), not at spaces; long sentences (over 5 words) are skipped. Images and text are centered separately before PCA so cards and their matching tags overlap. The first build took about 2.5 minutes for the cards plus about 3 minutes to read the prompts of 29,000 Gallery images; rebuilds with caches take seconds</li>
<li id="wfm-help-tagspace-9">Choosing how many tags: &quot;All tags&quot; uses every candidate tag instead of the Tags number (up to 20,000). &quot;Min uses&quot; drops tags used in fewer prompts than this, counted over all sources — 2 removes one-off typos and fragments. &quot;Wildcards&quot; turns wildcard files on or off as a tag source: words found only in wildcards make up most of the distinct tags (about 37,000 of 47,600 in testing), so turning it off with All tags gives about 10,400 tags (about 6,800 with Min uses 2). The status line shows the number of candidates when only part of them is used. New tags are embedded once (the first build with many new tags takes a few extra minutes)</li>
</ul>
</div>
<div class="wfm-help-card">
<h3 id="wfm-help-tagspace-card-use-title">Choosing Tags &amp; Making a Prompt</h3>
<ul>
<li id="wfm-help-tagspace-4">Navigation: drag to rotate, right-drag to pan, wheel to zoom. Hover shows the name, thumbnail and prompt/sources; the checkboxes show or hide Cards, Thumbnails, Tags and Gallery. The source checkboxes (ImagePrompt / Gallery prompts / Tagger DB / Prompt library / Wildcards) show or hide tags by where they came from — a tag stays visible while any of its sources is on and takes the color of its first visible source; hidden tags are also left out of the nearby and search lists. The choices are remembered</li>
<li id="wfm-help-tagspace-5">Click a card or tag to select it and list nearby items (clicking only selects — it does not change the prompt). To add it to the Prompt panel, double-click it, press Add next to its name under Selection, or press + in the list (double-click / press again to remove) — cards and tags are ranked separately and listed alternately, so a card also shows its closest tags. Adding a Gallery point adds all tags from that image's prompt as one chip (images without readable tags cannot be added); clicking one lists similar Gallery images (round thumbnails) together with nearby tags and cards; selecting a card or tag, or searching, never lists Gallery images. Use + in the list to add, click a row to move to it. The search box (Enter, any language) places a white marker for the text and lists the nearest items</li>
<li id="wfm-help-tagspace-10">Search with a card's or Gallery image's tags: when a card or Gallery point is selected, its prompt tags are shown as buttons (a card's full prompt is under &quot;Full prompt&quot;; card tags appear after Build / Update). Click tags to choose them (click again to deselect) and press &quot;Search with selected&quot; to search the space with those tags joined in prompt order — the same as typing them into the search box. The choice is kept until another item is selected. While tags are selected, the Add button becomes &quot;Add selected (N)&quot; and adds only those tags (in prompt order) as one chip; with none selected it adds the whole item as before. For a Gallery point, &quot;Open in Gallery&quot; opens the Gallery tab with the image's folder selected and the image selected in the list (search and other filters are cleared)</li>
<li id="wfm-help-tagspace-6">Prompt panel: a card adds its whole prompt, a tag adds the tag, a Gallery image adds its prompt tags. The text joins them with duplicates removed (case and spacing ignored). "Add to GenerateUI (Positive)" appends it to the positive prompt of the workflow loaded in GenerateUI; Copy puts it on the clipboard</li>
<li id="wfm-help-tagspace-7">Tagger fill: about a third of Gallery images have no readable positive prompt (imported or edited images, prompts made only of LoRA tags or long sentences). Choose a Tagger model (ONNX models from the Tagger tab) next to "Tagger fill" to tag those images on Build / Update: "Gallery points only" tags just the sampled Gallery points, "All images without a prompt" tags every indexed image that lacks prompt tags. Default thresholds are used (WD 0.35 / character 0.85, PixAI its recommended values) and rating labels are dropped. Results are cached in tagspace_tagger.json per image and model, so later builds only tag new images; stopping keeps what was done. The tags become the "Tagger fill" source (shown/hidden like the others) and the tags of those Gallery points, marked "(Tagger fill)". The status shows whether the model runs on CUDA or CPU — on the CPU it takes about 0.5 s per image, so check that onnxruntime-gpu is active (see Troubleshooting) before tagging all images</li>
<li id="wfm-help-tagspace-8">Display: "Glow" draws points as glowing stars on a night-sky background (dense areas brighten; Gallery points are drawn dimmer so they don't wash out to white) — turn it off for the plain dots and the normal background. "Twinkle" (works with Glow) makes tags, cards and Gallery points slowly twinkle, each with its own rhythm; the selection and nearby highlights stay steady. Hover over the image under Selection or the thumbnails in the Nearby list to see an enlarged preview (clicking a list row changes the selection, so hovering lets you check images first). The Add / Remove button sits on the title row of Selection and stays visible while the text scrolls</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>
@@ -3395,6 +3425,9 @@
</div>
</section>
<!-- TagSpace Tab (内容は tagspace-tab.js が生成) -->
<section id="wfm-tab-tagspace" class="wfm-tab-content"></section>
<!-- AI Tab -->
<section id="wfm-tab-ai" class="wfm-tab-content">
<!-- Translation pane -->