Compare commits

...
43 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 8fc1a9c68c release: v0.8.14 — Fibo 2.0 / FastH3 OmniRef / Pika-H3-Flex support
- GenerateUI / Metadata / side panel I tab: TextEncodeFibo2 and
  MiniMaxH3ReferenceToVideo prompt detection
- Video Plan tab: FastH3-family Reference to Video (Reference Image /
  Reference Image 2, unset references disconnected)
- Gallery semantic search on Ollama (EmbeddingGemma 2) instead of ONNX
- DEVLOG updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:56:12 +09:00
ketle-manandClaude Opus 5.5 805a4fa30f feat(video): disconnect unset reference images on Reference-to-Video plans
FastH3 / Pika-H3-Flex: a Reference Image / Reference Image 2 field left as
None/Clear now unlinks that ref_images input (and drops the template's
LoadImage once nothing else uses it) instead of silently generating with the
template's wired image. Other video families keep their existing behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:39:08 +09:00
ketle-manandClaude Opus 5.5 d6752c018c feat(video): Reference Image 2 for FastH3 / Pika-H3-Flex Plan blocks
Reuse the Plan block's Last Image field as Reference Image 2
(ref_images.ref_image_1) on Reference-to-Video templates: existing LoadImage
is overwritten or one is injected. Labels (Plan + Asset buttons/toasts)
switch to Reference Image / Reference Image 2. For chain_previous, Reference
Image 2 is never taken as the previous block's last frame — the generated
last frame is extracted instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:36:24 +09:00
ketle-manandClaude Opus 5.5 0039dd4f5b feat(video): support FastH3 OmniRef (MiniMax H3 Reference to Video) in Plan tab
FastH3 is a flat graph (no subgraph), so each field is written to the node
its input is wired from: prompt -> PrimitiveStringMultiline, duration ->
PrimitiveFloat (or length frames on the node itself, snapped to 17k+5),
resolution -> ResolutionSelector, First Image -> ref_images.ref_image_0
(labelled "Reference Image"; Last Image unavailable). widgetIndex falls back
to a default widget order for nodes saved without widget input entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:17:19 +09:00
ketle-manandClaude Opus 5.5 f5ea682440 feat(generateui): support Fibo 2.0 Edit and FastH3 OmniRef prompt detection
- TextEncodeFibo2: fixed positive/negative roles (prompt via PreviewAny ->
  PE switch chain), negative_prompt prompt node, width/height/batch_size
- MiniMaxH3ReferenceToVideo: treated as a video all-in-one node
  (VIDEO_ALL_IN_ONE_RE); a linked prompt source is seeded as positive
- Metadata / side panel I tab: resolve linked video prompts, split Fibo2
  positive/negative

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:17:19 +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
ketle-manandClaude Opus 5.5 65ccc60f00 docs: record live verification of Ollama-based semantic search in DEVLOG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:25:20 +09:00
ketle-manandClaude Opus 5.5 ea66f2565d feat: run Gallery semantic search's EmbeddingGemma 2 in Ollama instead of ONNX
- new semantic_ollama.py replaces semantic_local.py (ONNX runtime removed)
- images sent as input=[{"image": b64}] (the "images" field is silently ignored),
  4 per request, per-image fallback on batch failure, retries on dropped connections
- model size selectable: 740m / 440m (identical vectors, no rebuild); :latest used as 740m
- npz model name unchanged, existing indexes keep working (cos ~0.97 vs ONNX vectors)
- Ollama URL checked by url_guard; settings saved via /wfm/gallery/semantic/options
- model is unloaded from VRAM after indexing (keep_alive 0)
- settings UI: device/threads/image precision replaced by Ollama URL + model size
- help (helpGallery33/35/36, helpTrouble10/11 en/ja/zh), README, requirements, DEVLOG updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:16:49 +09:00
ketle-manandClaude Sonnet 5.5 f43ad515bf fix: persist image sent to Mask Editor One node (v0.8.13)
- wfmOpenMaskEditorForNode calls node._persistBgDataUrl so properties.bg_image
  stays in sync (Mask Editor One v0.1.12+); prevents an older image being
  restored on reload and overwriting the server-side cache
- layer_data carries the sent image width/height for preview restore
- help (helpImageEditMask14 en/ja/zh), README, DEVLOG updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-27 18:47:53 +09:00
ketle-manandClaude Sonnet 5.5 21fe458753 feat: multi-image I2I bridge for Comic Creator + Input tab Prompt/Image merge, collapsible Raw JSON (v0.8.12)
- window._wfmReceiveMultiImageI2IRunRequest: image i -> i-th LoadImage node, optional width/height/steps/cfg/denoise/sampler/scheduler/seed
- GenerateUI Input tab: Prompt | Image side by side (3:2), Image wraps under Prompt when narrow
- Raw JSON column collapsible (Input tab only, remembered)
- help (helpGen4 en/ja/zh), README, DEVLOG updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 18:34:25 +09:00
ketle-manandClaude Sonnet 5.5 f3a103aa67 feat: split Gallery Send CC into Layout / Image buttons (v0.8.11)
- Send CC Layout: existing behavior (panel/overlay, MP4 to Video tool)
- Send CC Image: new, calls Comic Creator's window.sendImageToImageTab
- help (helpGallery37 en/ja/zh), README, DEVLOG, manual ch.8/11 updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 11:43:11 +09:00
ketle-manandClaude Sonnet 5.5 6f24e61c5e feat: support PixAI Tagger v1.0 (ONNX) in the Tagger tab (v0.8.10)
- Detect PixAI-format model folders (preprocess.json + selected_tags.csv with a category column) and run them through a dedicated 1008px preprocessing path (black padding, RGB, mean/std 0.5, probabilities out)
- Tags come from general/style/copyright/character; the Threshold / Char Thr. sliders offset the recommended per-category thresholds
- Selecting a PixAI model switches the sliders to 0.17 / 0.27 (Single and Batch); switching back restores 0.35 / 0.85 unless edited
- Help text (helpTagger1/2/4) updated in en/ja/zh

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-23 09:57:24 +09:00
ketle-manandClaude Sonnet 5.5 fbaac2adf2 docs: update manual to v0.8.9
Revise the Japanese and English beginner manuals (text-only edition) from v0.8.3 to v0.8.9: partner API (Nano Banana) setup, new supported workflows, Video asset registration and audio conversion, faster GenerateUI check, filename-match model fallback, and troubleshooting entries.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-22 17:22:13 +09:00
ketle-manandClaude Sonnet 5.5 092b83b35d feat: add Register as Asset, Edit audio conversion, and Video Source layout fix (v0.8.9)
- Video Source: "Register as Asset" copies the loaded video into output/video and tags it into Video Assets
- Video Edit: "Convert audio..." next to the crop buttons, sharing Gallery's convert dialog
- Video Source panel widened so the file name and three buttons fit on one line each
- Help text (helpVideo5/11) updated in en/ja/zh

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

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

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

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 14:46:32 +09:00
ketle-manandClaude Sonnet 5.5 3fa7147f9c release: v0.8.4 - ComfyUI v0.40 native Load LoRA nodes (Model / Text Encoder), help update
- docs: help (helpGen20/21/29, helpSidepanel15 in en/ja/zh + index.html), README, DEVLOG
- bump version to 0.8.4

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 13:14:42 +09:00
ketle-manandClaude Sonnet 5.5 5078dd7660 feat: support ComfyUI v0.40 native LoRA stack nodes (LoadLoraModel / LoadLoraTextEncoder)
The new nodes take a DynamicGroup of rows, sent in API format as flat keys
"loras.<row>.lora_name|strength|enabled". Previously they were not detected, and
the generic lora_name writers would have produced invalid keys.

- detect them in analyzeWorkflow (is_lora_stack)
- add comfyEditor.applyLoraStack: writes every stack node together (Model node gets
  the model strength, Text Encoder node the clip strength)
- wire it into GenerateUI Single/Stack apply, bypass toggle, Lab, Models "Apply" and
  the LoRA batch
- extract the LoRAs in Metadata tab / I tab (API format)

UI-format workflows are not covered: frontend 1.55.17 has no DynamicGroup widget,
so such nodes carry no widgets_values yet.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 12:45:12 +09:00
80 changed files with 10076 additions and 835 deletions
+8
View File
@@ -19,3 +19,11 @@ UNSLOTH_API_KEY=
# Get a key at https://aistudio.google.com (free tier available).
# Same steps as above: copy to ".env", paste the key, restart ComfyUI.
GEMINI_API_KEY=
# ComfyUI-Workflow-Studio - Partner API nodes in GenerateUI (Nano Banana, Kling, Seedream, ...)
# A Comfy API key issued at https://platform.comfy.org (separate from the Gemini key above;
# usage is billed as Comfy credits). With it set, GenerateUI queues prompts through the plugin
# server, which adds the key to the request only when the workflow contains a partner API node.
# Same steps as above: copy to ".env", paste the key, restart ComfyUI.
COMFY_API_KEY=
+14
View File
@@ -2,6 +2,20 @@
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折りたたみ
- **v0.8.11(2026-10-26)** — Gallery: Send CC をレイアウト/Imageタブの2ボタンに分割
- **v0.8.10(2026-10-23)** — Tagger: PixAI Tagger v1.0 対応
- **v0.8.9(2026-10-20)** — Video: アセット登録ボタン / Editの音声変換 / ソースパネルのレイアウト
- **v0.8.8(2026-10-19)** — MOSS-Image 対応(GenerateUI / Gallery / Metadata / Iタブ)
- **v0.8.7(2026-10-16)** — Qwen Image 2.1 Turbo(ComfyUI公式テンプレート T2I / I2I)対応
- **v0.8.6(2026-10-14)** — GenerateUI: パートナーAPIノード(Nano Banana 等)の実行に対応
- **v0.8.5(2026-10-14)** — Metadata / I タブ: Gemini 系ノード(Nano Banana)の画像を読めるように
- **v0.8.4(2026-10-14)** — ComfyUI v0.40.0 対応: ネイティブ LoRA スタックノード(`LoadLoraModel` / `LoadLoraTextEncoder`)
- **v0.8.3(2026-10-13)** — GenerateUI: シードモード「Workflow」を追加(改善候補メモ 2-A)
- **v0.8.2(2026-10-12)** — Gallery: セマンティック検索(Gemini Embedding 2 / EmbeddingGemma 2)
- **v0.8.1(2026-10-11)** — バグ修正
+342
View File
@@ -2,6 +2,348 @@
---
## 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タブ)
- **GenerateUI解析**(`comfyui-workflow.js`): `TextEncodeFibo2` を `TextEncodeQwenImage21` と同じ固定ロール扱いに(prompt は PreviewAny → プロンプト強化スイッチ経由でリンクされるので配線元へ positive を伝播、negative_prompt は VGL JSON のままプロンプト欄に出す、width/height/batch_size を設定タブへ。0 は自動サイズ)。動画オールインワンノードの判定を `VIDEO_ALL_IN_ONE_RE`(`ImageToVideo|TextToVideo|ReferenceToVideo`)に集約し、`MiniMaxH3ReferenceToVideo` の prompt が別ノード(PrimitiveStringMultiline)から配線されていれば配線元を positive にする。
- **Metadata / サイドパネルIタブ**: 動画ノードの prompt がリンクなら配線元テキストを解決。Fibo2 は MageFlow/Boogu と同じく1ノードで positive/negative を分けて取り出す。
- **Videoタブ(Plan)**: 既存の MiniMax H3 / LTX-2.5 / Wan2.2 はサブグラフの公開入力1ノードに書く方式だが、FastH3 系はサブグラフ無しのフラット構成。新ファミリー `fasth3` として、各入力の**配線元ノード**を書き込み先にした(prompt → PrimitiveStringMultiline、duration → PrimitiveFloat(length が未配線なら自ノードの length へ 24fps・17k+5 グリッドのフレーム数で書く)、解像度 → ResolutionSelector)。First Image / Last Image 欄を **Reference Image / Reference Image 2**(`ref_images.ref_image_0` / `ref_image_1`)として流用し、Asset タブのボタン表記・トーストも切り替える。
- **未指定の参照画像は接続を外す**: FastH3 系のみ、None / Clear の参照画像はテンプレートの LoadImage が繋がっていても切断し、使われなくなった LoadImage はノードごと除く(外さないと UI 上は未指定なのにテンプレートの画像で生成される)。他ファミリーは従来通り。
- **chain_previous**: Reference Image 2 は「前ブロックの最終フレーム」として扱わず、常に生成された最終フレームを抽出して次ブロックの1枚目の参照画像にする。
- **罠**: FastH3 テンプレートの PrimitiveString/Float・ResolutionSelector・LoadImage は `inputs[]` に widget 定義を持たない形式で保存されており、`widgetIndex` が -1 を返して何も書けなかった。ノード型ごとの既定の並び順にフォールバックするようにした。
- **ノード側の仕様**: `MiniMaxH3ReferenceToVideo` は `ref_images.values()` を順に使うだけなので、1枚目が欠けて2枚目だけでも動く(その画像が `<Picture 1>` になる)。
- **検証**: Node 上で実コード+ ComfyUI_5(8189)の object_info を使い、3種のワークフローの変換・解析・抽出と、参照画像の差し替え/注入/切断を確認(既存 minimax / ltx25 テンプレートは結果不変)。Playwright で Video タブを実操作(ラベル・既定値・Clear・+Block・ドロップ・Asset 表記)。Pika-H3-Flex を Plan から実生成(2ブロック×2秒・0.2MP → 352×608・56フレーム・音声付き、約160秒)し、chain_previous でブロック1の最終フレームがブロック2の参照画像になって自然に繋がることを確認。
- **未対応**: 参照画像の3枚目以降・参照動画・参照音声はワークフロー側の設定のまま。Pika は ManualSigmas のため GenerateUI の Steps は効かない(linked 表示)。
### Gallery セマンティック検索: EmbeddingGemma 2 を ONNX から Ollama へ移行
- **背景**: latenttag-3d(Ollama の `embeddinggemma-2` でタグを埋め込む)と Gallery 索引を共通の空間で使いたい。ONNX 版(`semantic_local.py`、q4)は onnxruntime-gpu の入れ替え問題も抱えていた。
- **互換性の実測**: 同じ入力で ONNX 版と Ollama 版(Q8_0)を比較。テキスト cos 0.985〜0.993、画像(12枚)平均 0.967(最小 0.923)。既存索引に Ollama の検索文を当てた上位10件の一致は 8〜9/10。→ npz の `model` 名は `embeddinggemma-2` のまま、既存索引(2.9万枚)をそのまま使う。
- **740m / 440m**: 740m=テキスト+画像+音声、440m=テキスト+画像。画像・テキストとも cos 1.0(同じベクトル)なので、切り替えても再作成不要。`:latest` は 740m と同じ(parent_model 740m-q8_0)で、740m 未取得時の代わりに使う。270m / 570m は画像非対応のため選択肢に入れない。
- **Ollama の画像埋め込みの罠**: `/api/embed` に `images` フィールドを付けても**エラーにならず無視され、テキストだけの埋め込みが返る**。正しくは `input: [{"image": "<base64>"}]`。`[{"images": ...}]` は 400、壊れた画像は 500 "Failed to load image or audio file"、未取得モデルは 404。`input: []` + `keep_alive: 0` でアンロードできる。
- **実装**: `semantic_ollama.py` を新設し `semantic_local.py` を削除。画像は4枚ずつ送信(1枚ずつより約1.8倍速い)し、バッチが失敗したら1枚ずつ送り直して原因の画像だけを失敗扱いにする。Ollama 内部の接続切断(400 "forcibly closed" 等)と 5xx は最大5回再試行。接続不可・モデル未取得はジョブ開始前に検出し、作成中に起きたら中止。作成後は VRAM から外す。URL は `url_guard` で検査。設定は `semantic_settings.json`(`url` / `tag`)、保存用に `/wfm/gallery/semantic/options` を追加。
- **UI**: モデル設定タブのデバイス/CPUスレッド/画像精度を廃止し、Ollama URL・モデルサイズ(未取得表示つき)に置き換え。ヘルプ(helpGallery33/35/36・helpTrouble10/11 英/日/中)、README、requirements.txt を更新。マニュアル(v0.8.9版)は未更新。
- **実機確認**(ComfyUI_5 / 8189、再起動 13:17 > 反映 13:13 をプロセス起動時刻で確認): 既存索引 29,356件をそのまま読み込み。テキスト検索 0.9秒、類似画像 約0.6秒(4件)。URL ガードで `169.254.169.254` を拒否。モデル設定の 740m⇔440m 切替が保存され状態欄に反映。`ponyxl/scenes/city`(未索引9枚)を「新規・変更のみ」で作成→約1.7秒・失敗0(4+4+1枚のバッチ)、作成後 `/api/ps` が空(アンロード済み)、追加した `alley.jpeg` の類似上位は同フォルダの画像(0.88〜0.93)。コンソールエラーなし。
- 確認中に Python の urllib から `/similar` が1回120秒タイムアウト、`/folders` が1回 WinError 10054 になった。いずれも再試行や curl では毎回0.6秒前後で正常で、変更していない `/folders` でも起きたため今回の変更とは別の現象と判断(このPCで以前から出ている接続切断と同種の可能性)。
- **残作業**: 旧 ONNX モデル(`user/default/Workflow-Studio/models/embeddinggemma-2`、302MB)は削除可能。`onnxruntime` は Tagger で使うため依存に残す。
---
## v0.8.13(2026-10-27)
### Edit in Mask Editor One: 送信画像をノードへ永続化(Mask Editor One v0.1.12 対応)
- **背景**: Mask Editor One v0.1.12(PR #4)が、背景画像を `input/mask_editor/` へアップロードして `node.properties.bg_image` に保存し、ワークフロー切り替え/リロード時の `onConfigure` で復元するようになった。一方 `window.wfmOpenMaskEditorForNode`(`web/comfyui/node_sets_menu.js`)は `node._bgDataUrl` / `node._bgImg` を直接差し替えるだけで `properties` を更新しないため、そのままだとリロード時に**以前の画像が復元され、`/mask_editor/store_image` のサーバーキャッシュを上書きする**(WFSが送った画像が消える)。
- **修正**: 画像送信後に `node._persistBgDataUrl(imageDataUrl, "wfs_image.png")` を呼んで `properties.bg_image` を同期(Mask Editor One 側が公開する関数。旧バージョンでは `typeof` チェックで無視)。
- **layer_data**: 既存マスクを引き継ぐ際の `layer_data` に、送信画像の `width` / `height` を付与。ノードのマスクプレビュー復元はこのサイズでレイヤーを作る(無い場合は復元済みの背景画像サイズ、それも無ければスキップ)。付与順は「`_bgImg` ロード後」に変更。
- **How to apply**: 外部から `MaskEditorOne` ノードの画像を差し替えるコードは、`node._bgDataUrl` を書き換えたら必ず `node._persistBgDataUrl()` で参照も同期すること。`applyImageAndMaskToMaskEditorOneNode`(API形式ワークフローへ書き込む経路)はグラフ上のノードを触らないので影響なし。
- **検証**: ComfyUI_5(8189)で、画像A保存→WFS相当でB送信→シリアライズ/復元で、背景がB(300×600)・マスクプレビューも300×600になること、`width/height` なしの `layer_data` でも背景サイズで復元されることを確認。
- ヘルプ(`helpImageEditMask14` 英/日/中)とREADMEを更新。マニュアル(v0.8.9版)は未更新。
---
## v0.8.12(2026-10-27)
### Comic Creator向け複数画像I2Iブリッジ + GenerateUI Inputタブ: Prompt/Image統合・Raw JSON折りたたみ
- **背景**: Comic Creator v1.65.0 の Nanobanana+ タブ(ローカルモード)が、Flux.3 Image Klein / Qwen Image 2.1 等の Image Edit 系ワークフローを複数の参照画像つきで実行したい、という要望。既存の `_wfmReceiveI2IRunRequest` は画像1枚(slot 0固定)だった。
- **複数画像ブリッジ**: `gallery-tab.js` に `window._wfmReceiveMultiImageI2IRunRequest(imageBlobs, params, workflowData, workflowFilename)` を追加(ワークフロー読込→`image-edit-tab.js` の `runI2IExternalMulti` へ委譲)。`InpaintI2IActions.js` の `_runI2IWithImages` が `imageBlobs[i]` を i 番目のLoadImageへ `applyImageToSlot(file, i, ...)` で割り当て(ノード数超過分は無視)。戻り値は `{ ok, url, slotCount, usedImages }`。
- **生成パラメータ**: width/height/steps/cfg/denoise/sampler_name/scheduler は既存の `comfyEditor.setGenerationParams` を再利用(指定時のみ書き込み。未指定=ワークフローの値のまま)。シードは `generate(workflow, { seedValue })` で固定。
- **How to apply(限界)**: `setGenerationParams` はKSampler系・解析済みlatentノードにしか書けない。出力サイズを入力画像から決める構成(例: Flux.3 Image Klein の `ReferenceMultiLatent`)では `EmptyFlux2LatentImage` が解析対象外になり、width/height は反映されない(Steps/CFG/シード/プロンプトは反映)。
- **Inputタブ(GenerateUI)**: Prompt / Image の内部タブを廃止し、同一画面に左右(Prompt:Image = 3:2)で並べた。親カラム(`.wfm-gen-params-col--input`)をCSSコンテナにして、幅が720px以下になるとImageがPromptの下へ折り返す(`@container`)。JSのタブ切替ハンドラは削除(`gallery-tab.js` の `[data-input-tab="image"]` クリックは `?.` のため無害)。
- **Raw JSONの折りたたみ(Inputのみ)**: 右カラムの上端に »/« ボタン。折りたたむと幅30pxの縦書き「Raw JSON」の帯だけが右端に残り、Prompt/Imageが広がる。状態は `localStorage`(`wfm_gen_rawjson_collapsed`)。Model/Settings の Raw JSON は従来どおり。
- 落とし穴: `.wfm-gen-rawjson-col`(幅540px)より前に書いた `--collapsed { width:30px }` は詳細度が同じで負ける。`.wfm-gen-rawjson-col.wfm-gen-rawjson-col--collapsed` と2クラスで指定する。
- **検証**: Comic Creator内のiframe(ComfyUI_5、8189)で、横並び(757px : 514px)・折りたたみ(540→30px)・狭幅での折り返しと、Comic Creator経由の実生成(Qwen2.1 1枚/2枚入力、Flux.3 Klein)を確認。
- ヘルプ(helpGen4 英/日/中・`index.html`)とREADMEを更新。マニュアル(v0.8.9版)は未更新。
---
## v0.8.11(2026-10-26)
### Gallery: Send CC をレイアウト/Imageタブの2ボタンに分割
- **背景**: これまで「Send CC」はレイアウトタブ(選択コマ/オーバーレイ)専用で、Imageタブへ送れるのはComic Creatorの「I2Iへ送る」を押した直後(`window.parent._ccI2ITargetMode === 'image'`)の戻り経路だけだった。送り先を自分で選べるようにしたい、という要望。
- **UI**(`templates/index.html`): `wfm-gallery-send-cc-btn` を「Send CC Layout」に改名し、隣に `wfm-gallery-send-cc-image-btn`「Send CC Image」を追加。どちらもComic Creator内にiframe埋め込みされたときだけ表示(従来どおり)。
- **Send CC Layout**(`gallery-tab.js`): 従来の経路(画像は `insertImageFromUrl`、MP4は `insertVideoFromUrl`)のまま。`_ccI2ITargetMode` による分岐は撤去(Imageタブへは新ボタンで送る)。
- **Send CC Image**: Comic Creator側の新設ブリッジ `window.parent.sendImageToImageTab(url, name)` を呼ぶ。ブリッジは Imageタブへ `switchTab` してから `_ccImageTab.loadFromUrl` で読み込む(作業中のレイヤーがあれば新規レイヤー、無ければ新規キャンバス)。動画はImageタブ未対応のため従来どおりトーストで弾く。ブリッジが無い(古いComic Creator)/失敗時は「Comic Creator内から開いてください」のトースト。
- **連携の前提**: Comic Creator側の `window.sendImageToImageTab`(`14-integrations.js`、feature/ocr-text-insert ブランチ)が必要。
- **検証**: Comic Creator内のGalleryで両ボタンの表示と、画像選択→Send CC Image→Imageタブへの読み込み(トースト表示)を実機(ComfyUI_5)で確認。Send CC Layoutの実クリックは未検証(処理は従来のまま)。
- ヘルプ(helpGallery37、日英中)、README、マニュアル第8章・第11章(日英)を更新。
- 教訓: ComfyUI_5への同期は変更したファイルだけでなく、事前に実行側とHEADが同一であることを `diff --strip-trailing-cr` で確認してからコピーする。
---
## v0.8.10(2026-10-23)
### Tagger: PixAI Tagger v1.0 対応
- **対象**: コミュニティ変換の `Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8`(FP32/FP16/INT8、sigmoid込みの確率出力、`selected_tags.csv`にcategory列)。モデルフォルダに`preprocess.json`と`selected_tags.csv`があり、行数が出力数(30,877)と一致すればPixAI形式とみなす(`TaggerService._load_pixai_categories`)。`list_models`は該当モデルに`pixai: true`を付ける。
- **前処理**(`_predict_pixai`): 透過は白合成 → 長辺1008にBICUBICで縮小 → 黒で1008角にセンタリング → RGBのまま`(x/255-0.5)/0.5` → NCHW。WD系(白パディング/BGR/0-255)とは別経路。
- **タグ抽出**: general(0)/style(1)/copyright(3)/character(4)のみ採用(meta/ratingは除外)、確率の高い順。推奨しきい値は general 0.17 / style 0.15 / copyright 0.24 / character 0.27。UIのThreshold(general,style)とChar Thr.(copyright,character)は推奨値を基準にした相対指定(スライダー=0.17/0.27で推奨値そのもの)。
- **UI**(`tagger-tab.js`): PixAIモデル選択でスライダーが0.17/0.27へ、WD系へ戻すと0.35/0.85へ切替(Single/Batch両方)。手動で変えた値は上書きしない。
- **性能**: CUDA(onnxruntime-gpu)で約0.4秒/枚(FP16・1008px)、CPUでは約21秒/枚。
- 教訓: `onnxruntime`と`onnxruntime-gpu`が同じvenvに共存すると、後から入ったCPU版が同じ`onnxruntime/`フォルダを上書きしてCUDAが無言で無効になる(`get_available_providers()`にCUDAが出ない)。insightface/rtmlib/qwen-tts/onnxruntime-genaiが`onnxruntime`を要求するため再発しやすい。直し方は両方uninstallして`onnxruntime-gpu`のみ入れ直し。
- ヘルプ(helpTagger1/2/4、日英中)を更新。
---
## v0.8.9(2026-10-20)
### Video: アセット登録ボタン / Editの音声変換 / ソースパネルのレイアウト
- **アセット登録**: 動画ソースパネルに「アセット登録」ボタンを追加(`video-tab.js`)。ローカルファイルは`comfyUI.uploadImage`でinputへ上げ、バックエンド`POST /api/wfm/video/asset/register`(`VideoService.register_asset`)でoutput/videoへコピーしてから`__Video Assets__`グループへ追加する。Galleryはoutputフォルダしか一覧しないためコピーが必要。すでにoutput配下のソース(Asset選択・生成結果)はコピーせずタグ付けのみ。同名はアンダースコア+連番で回避。登録後はAssetタブを更新。
- **Editの音声変換**: クロップ行のボタンをクロップ関連(編集/キャンセル/リセット)左寄せ→`|`区切り→「音声変換...」の並びに変更。Galleryの変換モーダルを`openAudioConvertDialog()`として共通化・export(`convertOne`コールバック方式。`allowDelete`/`allowCopyMeta`で項目の出し分け)。Gallery側の挙動は不変。Editのクリップはinputフォルダにあるため`POST /api/wfm/video/edit/convert-audio`(`VideoService.convert_audio_to_output`、PyAVを`asyncio.to_thread`で実行)がoutput/videoへ保存する。音声付き動画クリップのみ対象、読み込み中のクリップはトーストで案内。
- **ソースパネルのレイアウト**: パネル幅を220→320pxに拡大(左右プレビューはflex:1で自動的に縮む)、ファイル名を専用の1行(省略表示)にし、ボタン3つを折り返さず横一列に。
- ヘルプ(helpVideo5/helpVideo11、日英中)を更新。
- 教訓: i18n.jsの英語文字列内に`"`を入れると全体が構文エラーになる(`node --check`は.mjsコピーで確認)。
## v0.8.8(2026-10-19)
### MOSS-Image 対応(GenerateUI / Gallery / Metadata / Iタブ)
ユーザー提供の5本(公式テンプレートのBase/SFT × T2I/バウンディングボックス4本と、公式ではない自作のmanga 8step LoRA構成1本)で、`convertUiToApi`→`analyzeWorkflow`を実測して直した。
- **サブグラフの外側ウィジェット値のズレ**: 新フロントエンドは外側ノードに`widgets_values_named`(名前キーの値)も保存し、`inputs[]`にはseed/steps/cfg/sampler/schedulerが載らない一方`widgets_values`は全ポートを持つ。従来の「`inputs[]`内の位置」参照だとunet_nameに25、vae_nameに`er_sde`が入っていた。`_flattenSubgraphs()`で`widgets_values_named`を優先(無い場合は従来どおり)。Iタブ用の複製(`node_sets_menu.js`の`_wfmFlattenSubgraphs`)にも同じ修正。
- **`CreateBoundingBoxes`の変換**: `bboxes`の型`BOUNDING_BOX,ARRAY,STRING`が共用体の途中にSTRINGを含むため入力欄と誤判定され、本来の入力欄`editor_state`/`last_incoming`(型`BOUNDING_BOXES`)が読まれていなかった。共用体型は先頭セグメントだけで判定し、`BOUNDING_BOXES`を入力欄型に追加。配列値はAPIでリンク扱いされるため`{"__value__": [...]}`で送る(バックエンドが展開)。Flux.3 Klein 4種にも同ノードがあり、変換前は検証エラーになる出力だったものが直った。
- **プロンプト検出**: `MOSSImageLayoutPrompt`の`prompt`をpositiveとして検出(`textKey: prompt`)。リンクされた`PrimitiveStringMultiline`/`PrimitiveString`はロールを上流へ伝播し、リンクのままの値は編集対象にしない(従来は配列がtextに入っていた)。
- **Gallery Promptタブ**: APIの`prompt`チャンクが無くサブグラフ入りのUI形式のみの画像は、変換してから抽出(Metadataタブと同じ扱い)。通常の生成画像は従来どおりAPI形式を使う。
- 実機(8189)で公式bboxes版と自作manga版の生成成功を確認。ワークフロー357件で変換結果を新旧比較し、差分はFlux.3 Klein 4件のCreateBoundingBoxesのみ。
### 変換チェック(GenerateUI Check)の初回待ち時間を短縮
初回に`/object_info`全件(この環境で約26MB・約43秒、毎回)を取得していたのが原因。ワークフロー詳細を開いた時点で全件の先読みも走らせており、サーバーを長時間塞いでいた。
- `_loadObjectInfoFor(types)`: 使用ノード型(サブグラフ内も含む)だけを`/object_info/<型>`で取得(1型約20ms、16並列、型ごとにキャッシュ)。転送失敗時や、既知の型が1つも無いときは全件にフォールバック。全件キャッシュがあればそれを優先。`invalidateObjectInfoCache()`は型別キャッシュも消す。
- 変換(`_convertUiToApiImpl`)と互換性チェックで使用。GenerateUIの初回変換も速くなる。先読みは削除。
- MOSSで初回変換 約43秒→約250ms、2回目以降は約2ms。362ワークフローで全件版との変換結果が完全一致。
## v0.8.7(2026-10-16)
### Qwen Image 2.1 Turbo(ComfyUI公式テンプレート T2I / I2I)対応
テンプレート(`SamplerCustomAdvanced`+`ManualSigmas`+`CFGGuider`、プロンプトエンハンサー=`TextGenerate`+`ComfySwitchNode`構成)をGenerateUIで使えるようにした。
- **Positiveプロンプトが空になる問題**: プロンプトが`PreviewAny → ComfySwitchNode(on_false=文字列リテラル)`経由で`TextEncodeQwenImage21.prompt`に入るため検出できなかった。`comfyui-workflow.js`のPass 1で`TextEncodeQwenImage21`のリンクされた`prompt`/`negative_prompt`へロールを伝播し、Pass 2で文字列リテラルを持つ`ComfySwitchNode`を`textKey: "on_false"`のプロンプトノードとして登録。
- **サブグラフ展開のファンアウト**: `_flattenSubgraphs()`は外部リンクをポートの最初の接続先にしか張らなかったため、`images.image_1`がTextEncodeとプロンプトエンハンサー用`BatchImagesNode`の2か所へ分岐するI2Iで、後者が画像未接続になっていた。2番目以降の接続先にも同じ外部リンクを複製するよう修正。
- 実機(8189)でT2I/I2Iとも生成成功を確認。
- プロンプトエンハンサー対応: `TextGenerate.prompt`とスイッチ`on_false`が展開後に別々のリテラルになる問題を、`_unifyPromptEnhancerText()`で共有の`PrimitiveStringMultiline`(`<switchId>:wfs_prompt`)へ集約して解消。GenerateUIの入力欄の編集がエンハンサー入力にも反映される。I2Iでエンハンサーをオンにして実機確認(入力プロンプトと参照画像の両方がエンハンサーに届く)。
### Flux.3 Image Klein(ComfyUI公式テンプレート 4種)対応
Klein(cfg 3.5/25step)とKlein SD(蒸留、cfg 1/16step)それぞれのT2I(プロンプトエンハンサー付きサブグラフ)とImage Edit(`ReferenceMultiLatent`)。`CLIPLoader`のtype=`flux3`は既存の変換でそのまま通る。
- **`ReferenceMultiLatent`のロール伝播**: positive/negative入力が別々の出力に出るノードなので、`InstructPixToPixConditioning`と同様にロールを各入力へ個別に伝播。従来はEdit版のPositive/Negativeが両方とも"Positive Prompt"というタイトルだったため、Negative側もpositiveと誤判定されていた。
- **未使用の空Latent**: `ReferenceMultiLatent`は参照画像サイズの`empty_latent`を自前で出力するため、テンプレートに残っている未接続の`EmptyFlux2LatentImage`はSettingsのLatent Imageに出さない(`ReferenceMultiLatent`を含むワークフローに限定)。
- T2I側はQwen Image 2.1 Turboと同様、エンハンサーの`TextGenerate.prompt`が入力用`PrimitiveStringMultiline`に直結しているため、そのまま編集が両方に反映される。SD版T2I(SD_4)はテンプレート既定でエンハンサーがオン。
- **COMBO値の誤置換**: テンプレートは`unet_name`をフォルダ接頭辞なし(`flux3_image_klein_int8_convrot.safetensors`)で保存しているが、実機の選択肢は`diffusion_models\flux3_...`。従来の「選択肢に無い値はchoices[0]へ無警告で差し替え」により、無関係なモデルに差し替わって実行されていた。選択肢に無い場合はまずファイル名(区切り文字`\`/`/`の後ろ)が一致する選択肢が1つだけあればそれを採用してから、従来のフォールバックに回すよう変更(`_convertUiToApiImpl`のCOMBO検証)。
- 実機で4種とも生成成功(エンハンサーはオフ)。Edit版は参照画像の編集が効くことを画像で確認。
## v0.8.6(2026-10-14)
### GenerateUI: パートナーAPIノード(Nano Banana 等)の実行に対応
v0.8.5 で見送った課題。パートナーAPIノードは `/prompt` の `extra_data` に Comfy の認証情報(`auth_token_comfy_org` = ブラウザのログイン、または `api_key_comfy_org` = Comfy APIキー)が必要。ComfyUI 本体の画面は自動で付けるが、WFS の `queuePrompt`(`fetch('/prompt')` 直叩き)は付けないため、GenerateUI からは `Unauthorized: Please login first to use this node.` で失敗していた。
- **`py/routes/partner_routes.py`(新規)**: `GET /api/wfm/partner/status`(キー設定の有無のみ)、`POST /api/wfm/partner/prompt`(`/prompt` の中継)。`.env` の `COMFY_API_KEY`(prestartup_script.py が python-dotenv で読み込み)が設定されているとき、プロンプトに API ノード(`/object_info` の `api_node: true`、クラスごとにキャッシュ)が含まれる場合だけ `extra_data.api_key_comfy_org` を付与して自 ComfyUI の `/prompt` へ中継し、応答はそのまま返す。クライアントが既に認証情報を付けている場合は上書きしない。キーはブラウザへ出さない。`.env.example` に追記。
- **`comfyui-client.js`**: `queuePrompt` は、キー設定あり(`isPartnerKeyConfigured()`、60秒キャッシュ)かつ接続先が同一オリジンのときだけ中継を使う(別サーバーへキーを送らない)。`execution_error` が `Unauthorized` / `login first` のときは、設定方法を案内する文言(`partnerAuthHint`、3言語)を付ける。
- **`comfyui-workflow.js`**: `Gemini(Image|NanoBanana)*` ノードの `prompt` 入力を `prompt_nodes`(positive、`textKey: "prompt"`)に追加し、GenerateUI の Prompt タブで編集できるようにした。参考画像は従来どおり Image タブの `LoadImage` 経由。
- ヘルプ(`helpGen32`、`index.html` / `i18n.js` 3言語 / `app.js` の `helpIdMap`)、README、サンプルワークフロー `workflows/ws_nano_banana_2_1_t2i.json` を追加。
### UI形式→API形式の変換: DynamicCombo ノードの `widgets_values` ずれを修正
Nano Banana 2.1 の UI 形式ワークフローを変換すると値がずれていた(`seed` が `"IMAGE"`、システムプロンプトが `response_modalities` に入る等)。原因は2つで、どちらも修正した。
1. `_getDynamicComboSubNames` が、選択肢の子入力のうちソケット(`images` = Autogrow、`files` = `GEMINI_INPUT_FILES`)まで `widgets_values` の1枠として数えていた。ウィジェット型の子入力だけを数えるようにした(`_resolveWidgetType` を再利用)。
2. `seed` 等の `control_after_generate` 付きウィジェットの直後に入るフロントエンド専用の `"randomize"` 等の1枠を、次のウィジェットが数値型のときしか読み飛ばせなかった(Nano Banana 2.1 は `seed` の次が COMBO の `response_modalities`)。object_info の `control_after_generate` フラグで判定する `_hasControlAfterGenerate` を追加。
- 検証: ComfyUI 本体のフロントエンドで作ったワークフローの `graphToPrompt()` 出力と、変換結果が完全に一致。実機の保存済み UI 形式ワークフロー301件を修正前後で比較し、300件は変換結果が同一、変化は今回の Nano Banana サンプルのみ。
### Gallery: `cc_nanobanana` フォルダの画像でもメタデータがあれば Prompt タブを表示
Comic Creator v1.55.0 で、半自動マンガがネイティブノード経由で生成した画像が `cc_nanobanana` に保存され、PNG に `prompt` / `workflow` が埋め込まれるようになるため。`gallery-tab.js`: 埋め込みワークフローがある画像は `isNanobananaFolderImage` による Prompt タブの非表示を解除する(埋め込みの無い Gemini API 直叩きの画像だけ従来どおり非表示)。
**実機確認(ComfyUI_5 / ポート8189、v0.40.0)**
- `.env` に `COMFY_API_KEY` を設定し、GenerateUI でサンプル(Nano Banana 2.1)を読み込み、Prompt タブで編集して Apply → Generate を実クリック: リクエストは `/api/wfm/partner/prompt` 経由、16.4秒で成功、編集どおりの絵(青いティーポット)が `output/nano_banana_00001_.png` に出力された。
- キー未設定時の案内文(`partnerAuthHint`)が表示用文言として解決されること、ヘルプ(`helpGen32`)が表示されることを確認。
### 今後の作業候補(2026-10-14 時点・未着手。v0.8.4〜v0.8.6 の続き)
**ネイティブ LoRA スタックノード(`LoadLoraModel` / `LoadLoraTextEncoder`、v0.8.4)**
- **UI形式への対応**: ComfyUI フロントエンド 1.55.17 は DynamicGroup を実装していない(行を追加できず `widgets_values` も空)。フロントエンドが対応したら、実物の UI 形式 JSON で `widgets_values` の並びを確認し、`analyzeWorkflow` / Metadata / I タブの UI 形式分岐を追加する。
- **画面操作の確認**: GenerateUI の Stack タブ(Stack グループを複数行として書き込む処理)は、関数の直接呼び出しでのみ確認済み。Models タブで Stack グループを登録した状態での画面確認が未実施。
**Gemini / Nano Banana 系ノード(v0.8.5 / v0.8.6)**
- **Metadata / I タブの表示拡充**: プロンプトは Positive / Negative に分けず全文を1件で表示している(送信全文に `NEGATIVE_PROMPT:` が含まれる)。`NEGATIVE_PROMPT:` で分割して Positive / Negative に振り分ける、`aspect_ratio` / `resolution` / `thinking_level` を設定欄に出す、UI 形式の `widgets_values`(並びは `[prompt, model, aspect_ratio, resolution, thinking_level, seed, control_after_generate, response_modalities, system_prompt, temperature, top_p]`)に対応する、が候補。
- **他のパートナーAPIノードの Prompt タブ対応**: 現状は `Gemini(Image|NanoBanana)*` のみを `prompt_nodes` に登録している。`/object_info` の `api_node: true` かつ `prompt` 入力を持つノード(Seedream / Kling 等)へ一般化できないか検討する。
- **費用ガード**: Batch / Lab / カタログ作成などの繰り返し実行でパートナーAPIノードを使うと、回数ぶんのクレジットが連続して消費される。`/object_info` の `price_badge` から概算を出して、実行前に表示・確認する案。
- **Settings タブに `COMFY_API_KEY` の設定状態を表示**: 現状は `.env` 編集のみ。`GET /api/wfm/partner/status`(設定の有無のみ返す)を使って、設定済み/未設定と設定手順を Settings タブに出す。キー自体は表示・入力させない方針を維持する。
- **サンプルの追加**: 参考画像付き(I2I、`LoadImage` → `model.images.image_1`)の Nano Banana ワークフロー、複数参考画像のもの。Nano Banana Pro(`GeminiImage2Node`)は Comic Creator 側のネイティブ対応と合わせて。
**運用・開発環境**
- **同期スクリプトの整備**: 開発リポジトリから実機の `custom_nodes` への反映は、今回も手作業(追跡ファイルの `cmp` 比較 + `cp`、`workflows/` / `data/` / `.env` は除外)だった。CLAUDE.md の「同期スクリプトでパッケージ全体をデプロイ」に沿って、`tools/` に同期スクリプト(除外リスト付き、ハッシュ比較・`__pycache__` 削除まで)を用意する。部分同期が残ると古い版が混在する(今回、実機は v0.8.2 開発途中の版のまま止まっていた)。
- **comfy-cli / comfy-mcp の既定ワークスペース**が ComfyUI_6(プラグイン 0.3.78)で、実際に使っている ComfyUI_5(8189)と一致しない。`server_info` の `running` / `freshness` は ComfyUI_6 の情報になるため、MCP で実機を扱うときは注意するか、既定ワークスペースを揃える。
- **英語・中国語UIでの表示確認**: 今回追加したヘルプ(`helpGen32` ほか)と `partnerAuthHint` は日本語UIでのみ画面確認した。
## v0.8.5(2026-10-14)
### Metadata / I タブ: Gemini 系ノード(Nano Banana)の画像を読めるように
Comic Creator v1.54.0 で、Nano Banana を ComfyUI ネイティブノード(`GeminiNanoBanana2V2`)経由で生成できるようにした(併用)。この経路の画像は SaveImage により `prompt` / `workflow` が PNG に埋め込まれるため、Workflow Studio 側で通常の ComfyUI 画像として読めるようにした。
- `metadata-tab.js` / `web/comfyui/node_sets_menu.js`: 自ノードの `prompt` 入力を持つ `Gemini(Image|NanoBanana)*` ノードを、動画ノード(`*ImageToVideo` / `*TextToVideo`)と同じ扱いでプロンプト候補(`texts`)へ追加。`NEGATIVE_PROMPT:` を含む送信全文がそのまま1件として出る(Positive / Negative の分割はしない)。
- `extractDiffusionModels`(API形式): Gemini 系ノードの `model` 入力(例: `Gemini Nano Banana 2.1`)をモデル名として表示。
- `extractSamplerSettings`: Gemini 系ノードの `seed` を補助ノードとして拾い、設定欄に表示。
- 対象は API 形式のみ(DynamicCombo のため UI 形式の `widgets_values` の並びは未確認)。`GenerateUI` のプロンプト編集・実行は対象外。
- `cc_nanobanana` フォルダ用の特別扱い(`history.jsonl` 参照・Promptタブ非表示)は、従来の Gemini API 直叩きの画像のため変更なし。ネイティブ経路の出力先は別フォルダ(`cc_nanobanana_native`)なので、この特別扱いに該当せず、埋め込みメタデータが使われる。
**実機確認(ComfyUI_5 / ポート8189、v0.40.0)**
- Comic Creator のネイティブ経路で実際に生成した画像(`cc_nanobanana_native/NB_00001_.png`、848×1264)を `extractAllMetadata` に通し、モデル名(`Gemini Nano Banana 2.1`)・シード・プロンプト(`NEGATIVE_PROMPT:` 付き全文)が取れることを確認。Gallery の一覧・画像メタ取得でも通常の画像として扱われる(`nanobanana` エントリは null)。
**ネイティブ API ノードの認証について(今回の調査で判明)**
- API ノードは `/prompt` の `extra_data` に `auth_token_comfy_org`(ブラウザのログイン)または `api_key_comfy_org`(Comfy APIキー)が必要。ComfyUI 本体の画面は自動で付けるが、Workflow Studio の `queuePrompt`(`fetch('/prompt')` 直叩き)は付けないため、GenerateUI からパートナーAPIノードを実行すると認証エラーになる。今回は対応せず(Comic Creator はサーバー側で `COMFY_API_KEY` を渡す方式で対応)。必要になれば Workflow Studio 側にも同様のサーバー側プロキシが必要。
## v0.8.4(2026-10-14)
### ComfyUI v0.40.0 対応: ネイティブ LoRA スタックノード(`LoadLoraModel` / `LoadLoraTextEncoder`)
ComfyUI v0.40.0 の変更点を確認し、影響のあった LoRA 検出・編集を対応させた(コミット 5078dd7)。
**背景・調査結果**
- 新ノードは `comfy_extras/nodes_lora_stack.py`。1ノードに DynamicGroup `loras`(1〜20行)を持ち、API形式では `loras.<行>.lora_name|strength|enabled` のドット結合キーで渡す。Model用とText Encoder用で別ノード。
- Workflow Studio の LoRA 検出は固定リスト(`LoraLoader` / `LoraLoaderModelOnly` / Power Lora / LoraManager / ImageMetadataLoRALoader)だったため新ノードは未検出。また既存の編集コードが `inputs.lora_name` を書き込むため、そのまま使うと DynamicGroup の検証エラーになる状態だった。
- **ComfyUI フロントエンド 1.55.17 には DynamicGroup の実装が無い**(型名ラベルのみ)。GUI のグラフエディタではこのノードに行を追加できず、UI形式の `widgets_values` も空になる。そのため対応は **API形式のみ**。UI形式の対応はフロントエンドの対応後に実物のJSONで再検証が必要。
**実装**
- `comfyui-workflow.js`: `analyzeWorkflow` が2ノードを `is_lora_stack` として `lora_nodes` に追加(1ノード1エントリ、代表は有効な最初の行。無効行は飛ばし、行番号順に解釈)。
- `comfyui-editor.js`: 共通の書き込み処理 `applyLoraStack`(`comfyEditor` から公開)を追加。ワークフロー内の全スタックノードを同期して書き込む(Modelノード=Str M、Text Encoderノード=Str C)。Single / Stack Apply(Stackは全モデルを行として書く、最大20行)、バイパスボタン(全行のstrengthを0、解除で行ごと復元)、LoRAペインの現在値表示に対応。
- `lab-tab.js` / `models-tab.js` / `generate-tab.js`: Lab、Models タブの Apply、LoRA バッチも同じ処理経由に。Models Apply は既存の強度を保持する。
- `metadata-tab.js` / `web/comfyui/node_sets_menu.js`: Metadata タブ・サイドパネル I タブの LoRA 抽出(API形式)に対応。Model/Text Encoder 両ノードの同名LoRAは1件にまとめ、両方の強度を表示する。
- ヘルプ(helpGen20 / helpGen21 / helpGen29 / helpSidepanel15、en/ja/zh)と index.html を更新。README に項目を追加。
**実機確認(ComfyUI_5 / ポート8189、v0.40.0)**
- テスト用 API 形式ワークフロー(Checkpoint → Load LoRA 2ノード×2行 → SDXL)を `/prompt` へ投入: HTTP 200・`node_errors` 空・1枚生成成功(18秒)。
- 生成時ログの `lora key not loaded: ...`(約5千行)は、Model/Text Encoder で別ノードに分かれる設計上、各ノードが対象外キーを報告する無害なノイズ(従来 `LoraLoader` 単独では0件、件数も2LoRA×キー数と一致)。
- GenerateUI 画面で、ID:2/ID:3 の選択、バイパスボタンの往復(0→元の値)、Single Apply(RAW JSON・LORA SYNTAX・トリガーワード更新)を実クリックで確認。
- 書き込み処理は実ファイルから切り出して Node で単体試験(強度維持・行入替・両ノード同期・バイパス復元・ワークフロー引数指定)。
**影響なしと確認した項目**
- WebSocket のメタデータ付与: メタデータは `workflow_metadata` の送信または機能フラグ `supports_preview_metadata` の宣言時のみ付く。本プラグインのクライアントはどちらも行わず、メッセージも既知フィールドだけを `try/catch` 付きで読むため影響なし。
- 3D 出力・カメラ系ノード: 結果取得は `images` と `saved_svg` のみを見るため無視されるだけ。
- Comic Creator(v1.53.2): LoRA / WebSocket / `/prompt` を使わず、`/upload/image` の応答形式も互換。`/ccc` と `/wfm` の iframe 連携も正常。
**その他(運用上の発見)**
- ランタイム(ComfyUI_5 の `custom_nodes`)が v0.8.2 開発途中の版のまま古いファイルが残っていた(部分同期)。リポジトリの追跡ファイルを同期し直した(`workflows/`・`data/`・`.env` は上書きしない)。
- comfy-cli の既定ワークスペースは ComfyUI_6(プラグイン 0.3.78)。comfy-mcp の `server_info` の running / freshness は 8189 の ComfyUI_5 とは別物。
## v0.8.3(2026-10-13)
### GenerateUI: シードモード「Workflow」を追加(改善候補メモ 2-A)
+13 -9
View File
@@ -27,7 +27,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- Built-in AI tools (translation and more)
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.8.3-green)
![Version](https://img.shields.io/badge/version-0.8.11-green)
## Features (tab -> feature names)
@@ -38,7 +38,7 @@ Thumbnail / Table views, Thumbnail side panel, Badge filtering, Search, Side pan
One-click capture, Auto-save as thumbnail, Embedded workflow metadata, Auto-import
### GenerateUI Tab (v0.3.5)
6-tab layout, Save button, Input tab, Model tab, Settings tab, Always-visible Raw JSON, Bypass/Mute node handling, One-click generation, Seed control, Style selector, Create Catalog / Catalog buttons, Batch type selector, Batch tab, UI-to-API conversion, Video workflow support, Eagle integration, Qwen Image 2.1 support, Ming Image support
6-tab layout, Save button, Input tab, Multi-image I2I for Comic Creator, Model tab, Settings tab, Always-visible Raw JSON, Bypass/Mute node handling, One-click generation, Seed control, Style selector, Create Catalog / Catalog buttons, Batch type selector, Batch tab, UI-to-API conversion, Video workflow support, Eagle integration, Qwen Image 2.1 support, Ming Image support
### Feeder subtab (v0.3.5 / v0.3.42)
ImageFeeder node control, Image library, Selection management, Presets, Continuous Run loop, Index sync, Seed, WFS_GalleryFeeder node, Node & group selector, Image grid, After Gen modes, Run / Stop controls
@@ -53,7 +53,7 @@ Setting / Results / Plan JSON sub-panels, Per-column keyframes, Model column —
2-column layout, Collapsible sections, Theme selection, Theme customization, Workflows directory, Gallery output directory, Eagle connection, CivitAI Host, CivitAI API Key, Default workflow, Default Checkpoint, VRAM Management (Ollama), Video Playback Volume, Data Management, Text Size, RAW JSON Colors, GenerateUI Model Tab Highlight, Wildcard Integration, G'MIC-Qt Integration, Language
### Gallery Tab (v0.3.44)
Output / ImagePrompt / Style_Catalog / Metadata sub-tabs, Image browser, Folder tree root label, Thumbnail / Table views, Folder management, File operations, Download, MP4 video support, MP4 embedded metadata, WebM support, Embedded metadata reading fixes, Audio support, File conversion, Move To folder filter, Semantic Search, Audio waveform colors, Info tab: dimensions & duration, Multi-select, Image Compare, Prompt search, Server-side filtering, Group management, Thumbnail F button, Favorites, Detail panel, Prompt tab, Nanobanana tab, Workflow viewer, GenUI button, Image Edit button, Send GenUI Image button, Send to LI node button, Send to LV node button, Send CC button, Search clear (✕), Clear all filters (✕ Clear), Workflow auto-save, Output folder configurable, SVG file support, PSD file support, Performance
Output / ImagePrompt / Style_Catalog / Metadata sub-tabs, Image browser, Folder tree root label, Thumbnail / Table views, Folder management, File operations, Download, MP4 video support, MP4 embedded metadata, WebM support, Embedded metadata reading fixes, Audio support, File conversion, Move To folder filter, Semantic Search, Audio waveform colors, Info tab: dimensions & duration, Multi-select, Image Compare, Prompt search, Server-side filtering, Group management, Thumbnail F button, Favorites, Detail panel, Prompt tab, Nanobanana tab, Gemini / Nano Banana nodes, MOSS-Image in GenerateUI, Faster GenerateUI Check / conversion, Partner API nodes in GenerateUI, Workflow viewer, GenUI button, Image Edit button, Send GenUI Image button, Send to LI node button, Send to LV node button, Send CC Layout / Send CC Image buttons, Search clear (✕), Clear all filters (✕ Clear), Workflow auto-save, Output folder configurable, SVG file support, PSD file support, Performance
### ImagePrompt Gallery subtab (v0.3.94, renamed from Style/Prompt in v0.3.95)
Visual prompt library, 3-column layout, Prompt builder (right pane), Plain-text prompt storage, ponyxlWildcardsVault format support, Seed data importer
@@ -73,11 +73,14 @@ 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
### Video Tab (v0.5.0 – v0.7.4)
Dedicated video generation UI, independent of GenerateUI, Plan subtab, Base settings row, Edit subtab, Edit: Multi-track, Edit: Audio / BGM, Edit: Text overlays, Edit: Crop, Edit: Undo / Redo, Edit project persistence, Asset subtab, Project subtab, Two center previews, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, Frame tab, GIF tab, Playback volume
Dedicated video generation UI, independent of GenerateUI, Plan subtab, Base settings row, Edit subtab, Edit: Multi-track, Edit: Audio / BGM, Edit: Text overlays, Edit: Crop, Edit: Convert audio, Edit: Undo / Redo, Edit project persistence, Asset subtab, Project subtab, Two center previews, Register as Asset, First Frame / Last Frame are both optional, Semantic node lookup, not hardcoded IDs, Field highlight color, Load in Video, Frame tab, GIF tab, Playback volume
### AI TOOL Tab (v0.3.14)
4-pane layout, Translation pane, Chat pane, Chat pane — image generation via Tool Calling, Chat pane — generate_image extra parameters, TOOLS pane (VLM), TOOLS pane — shared Chat attachment, TOOLS pane (Wildcards), Chat pane — image-to-image (I2I), Chat pane — SVG generation, no ComfyUI workflow involved, Chat pane — Skills, Settings pane, Unsloth backend, Decision API client, Settings pane — Chat Image Generation, Settings pane — Chat I2I Generation, Settings pane — Generation, Model unload, Settings shared, Backend support, URL security, Lemonade's other endpoints (not integrated)
@@ -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.3, 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.3_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.8.3.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`
---
@@ -170,7 +173,7 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
- **[LM Studio](https://lmstudio.ai/)** — alternative backend for translation and VLM (OpenAI-compatible API)
- **[Lemonade Server](https://lemonade-server.ai/)** — alternative backend for translation, chat, and VLM (OpenAI-compatible API)
- **[Unsloth](https://unsloth.ai/)** — alternative backend for translation, chat, and VLM (OpenAI-compatible API); needs an API key set via `UNSLOTH_API_KEY` in a `.env` file, or Unsloth's Keyless API access → "Chat and inference" turned on — `pip install -r requirements.txt` for `python-dotenv`
- **Gemini API key / EmbeddingGemma 2** (v0.8.2) — only for the Gallery's Semantic Search: either set `GEMINI_API_KEY` in the plugin's `.env` (key from [Google AI Studio](https://aistudio.google.com); free tier available, paid beyond it), or use the local **EmbeddingGemma 2** (no key; `onnxruntime`, `tokenizers` and `huggingface_hub` — normally already present with ComfyUI; the model downloads on first use). `onnxruntime-gpu` makes the local model ≈45× faster on NVIDIA GPUs
- **Gemini API key / EmbeddingGemma 2** (v0.8.2) — only for the Gallery's Semantic Search: either set `GEMINI_API_KEY` in the plugin's `.env` (key from [Google AI Studio](https://aistudio.google.com); free tier available, paid beyond it), or use the local **EmbeddingGemma 2** in [Ollama](https://ollama.com) (no key; `ollama pull embeddinggemma-2:740m` or `embeddinggemma-2:440m`)
- **[Eagle](https://eagle.cool/)** — for auto-saving generated images with metadata
- **[comfyui-mask-editor-one](https://github.com/ketle-man/comfyui-mask-editor-one) (v0.1.9+)** — enables BiRefNet background removal, SAM3 text-prompt segmentation, and ABR stamp-brush library in the Image Edit Mask tool; `birefnet.safetensors` must be placed in `ComfyUI/models/background_removal/` for BiRefNet
- **[psd-tools](https://pypi.org/project/psd-tools/)** (v0.6.0) — enables all PSD (Photoshop) features: Gallery bulk "Create PSD" export, Gallery browsing/thumbnails for `.psd` files, and Image Edit's Save PSD / Open PSD buttons; `pip install -r requirements.txt` (ships prebuilt wheels, no C compiler required); without it, PSD-related actions show an error toast with the install command instead of failing silently
@@ -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
+45 -16
View File
@@ -23,7 +23,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- Built-in AI tools (translation and more)
![Workflow Studio](https://img.shields.io/badge/ComfyUI-Custom_Node-blue)
![Version](https://img.shields.io/badge/version-0.8.3-green)
![Version](https://img.shields.io/badge/version-0.8.11-green)
## Screenshots
@@ -55,6 +55,10 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
| :--------------------------------: | :------------------------------------------: |
| ![Lab Tab](docs/15_labtab.png) | ![Lab Index Image](docs/16_lab_index.png) |
| Gallery Tab - Semantic Search ("sunset city street") |
| :-----------------------------------------------------------------: |
| ![Gallery Semantic Search](docs/20_gallery_semantic_search.png) |
---
## Features
@@ -95,7 +99,8 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **6-tab layout** — Input / Model / Settings / Feeder / Batch / **Lab** tabs; Input, Model, and Settings each include a Raw JSON column on the right for instant preview and direct editing
- **Save button** — located at the right end of the subtab row; opens a filename dialog (default: current workflow name) and saves the current workflow as a `.json` file to the Workflow tab via the import API; hidden while the Batch or Lab subtab is active (v0.4.6), since those work on workflow copies / their own Plan files rather than the currently loaded workflow
- **Default-workflow snapshot fix** (v0.4.8) — overwriting the loaded workflow under a filename that's currently set as the auto-load **Default workflow** (Settings tab, see below) now also refreshes that cached snapshot; previously only the file on disk was updated, so the old (pre-edit) version — including any checkpoint no longer installed — kept reappearing after every page reload until the default was re-set by hand
- **Input tab** — Prompt and Image inner tabs (drag-and-drop upload); Prompt tab shows Positive Prompt and Negative Prompt textareas, plus an **Embeddings selector** at the bottom (Filter + Select + Weight input + Paste button); Paste inserts `(embedding:Name:weight)` at the cursor position of the last focused textarea (defaults to Positive when neither is focused); Raw JSON (540px) in the right column
- **Input tab** — Prompt (left) and Image (right, about 3:2) side by side on one screen (drag-and-drop upload; Image wraps under Prompt when the area is narrow, about 720px or less); Prompt area shows Positive Prompt and Negative Prompt textareas, plus an **Embeddings selector** at the bottom (Filter + Select + Weight input + Paste button); Paste inserts `(embedding:Name:weight)` at the cursor position of the last focused textarea (defaults to Positive when neither is focused); Raw JSON (540px) in the right column, collapsible to a slim strip with the » button (Input tab only; remembered)
- **Multi-image I2I for Comic Creator** (v0.8.12) — new iframe bridge `window._wfmReceiveMultiImageI2IRunRequest(imageBlobs, params, workflowData?, workflowFilename?)` used by Comic Creator's Nanobanana+ tab (Local mode): image *i* goes to the workflow's *i*-th LoadImage node (extra images are ignored), and optional width / height / steps / cfg / denoise / sampler / scheduler / seed are written through `setGenerationParams`; returns `{ ok, url, slotCount, usedImages }`
- **Revert button** (v0.3.70) — a ↺ button next to each Apply button reverts the textarea to the node's currently applied value (the reverse of Apply)
- **Emphasis weight editing** (v0.3.70) — select text (or just place the cursor on a word/parenthesis block) and press Ctrl+↑/↓ to adjust `(text:weight)` by ±0.05, A1111/native-ComfyUI style; parentheses are removed automatically when the weight returns to 1.0
- **Mask slot for inpainting** (v0.3.71) — LoadImage slots whose MASK output feeds an inpaint node (e.g. `VAEEncodeForInpaint`) show an additional Mask drop zone; when a mask is set, image + mask are composited into a single RGBA upload (mask baked into the alpha channel) matching ComfyUI's native alpha→MASK extraction — no extra nodes required
@@ -103,6 +108,7 @@ A comprehensive workflow, asset management, and generation UI plugin for [ComfyU
- **Model tab** — Checkpoint, VAE, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), and Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — single clip: type + device; dual clip: two clip selectors + type + device) are always shown; **ControlNet** and **Hypernetwork** (with Strength field) are collapsed by default (v0.3.98) since they're used less often — click their header to expand; **LoRA** (Single/Stack tabs) has its own column; all selectors have a filter; Raw JSON on the right
- **Highlight color** (v0.3.98) — the label of each model type above, plus the LoRA column header, turns a distinct color (default bright green, customizable in the Settings tab) when the loaded workflow actually contains that type of node; stays visible even while ControlNet/Hypernetwork are collapsed, so relevance is visible without expanding
- **LoRA Stack Group toggle** (v0.3.92) — for `Lora Loader (LoraManager)` nodes, a **Use Stack Group** checkbox next to the Single/Stack tabs switches what the Stack tab shows and edits: OFF (the default whenever a workflow is loaded) displays and edits the LoRAs actually configured in the workflow's own Lora Manager node — correctly showing every LoRA it holds, not just the first one; ON switches to the LoRA group registered in the Models tab instead; toggling either direction clears the node's LoRA list first, then loads it from the newly selected source, and switching back to OFF restores exactly the list that was present when the workflow was loaded
- **Native Load LoRA nodes** (v0.8.4) — ComfyUI v0.40's `Load LoRA (Model)` / `Load LoRA (Text Encoder)` pair (each node holds up to 20 rows of LoRA / strength / enabled) is detected and edited like the other LoRA nodes: Single / Stack Apply, the Models tab "Apply", the LoRA batch, Lab and the Bypass button write both nodes together (the Model node takes Str M, the Text Encoder node takes Str C); Stack Apply writes the whole Stack group as rows, and the Metadata tab / side-panel I tab list their LoRAs. API-format workflows only for now — ComfyUI frontend 1.55.17 cannot add rows to these nodes in its own graph editor, so UI-format workflows carry no `widgets_values` for them yet
- **LoRA Bypass button** (v0.4.4) — a ⛔ toggle next to the Refresh Stack group button in the LoRA column header; forces the target LoRA node's strength to 0 (`strength_model`/`strength_clip` for a standard LoraLoader, or every entry's `strength`/`clipStrength` for a Lora Manager node — its LoRA list stays intact, not replaced) without touching the actual ComfyUI node's mode; click again to restore the exact values that were there before toggling; targets whichever node Single/Stack Apply default to (the workflow's Lora Manager node if it has one, else the first LoRA node); clicking a Single or Stack Apply button clears the bypass state so it can't silently reassert itself later
- **Settings tab** — KSampler and Latent Image side by side at 50% width each; Raw JSON on the right
- **Always-visible Raw JSON** — edit the API-format JSON directly from any tab with syntax highlighting; Apply button reloads the workflow; built-in **search bar** (always shown) finds all matches as you type with count display (`3/12`); navigate with ↑/↓ buttons or Enter / Shift+Enter; Escape or ✕ clears; current match highlighted in orange, other matches in yellow
@@ -271,9 +277,9 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **File conversion** (v0.8.0) — a **Convert...** button in the Gallery bulk bar (shown when the selection contains audio or video) converts audio files to FLAC / MP3 / Opus / M4A / WAV, or extracts the audio track of videos, using PyAV (no system ffmpeg needed); bitrate, sample rate (44.1 / 48 kHz) and channels (mono / stereo) are selectable, output goes next to the source as a new file (`name.ext`, or `name_converted.ext` if taken). ComfyUI `prompt` / `workflow` tags (and title / artist / album tags) are carried over to formats that can hold them — WAV cannot, so they are skipped there; favorite / tags / memo / groups can be carried over, and the original can optionally be deleted after a successful conversion (with a confirmation). `.ogg` is readable but not offered as an output (the bundled PyAV has no Vorbis encoder)
- **Move To folder filter** (v0.8.0) — the Move To dialog (detail panel and bulk bar) has a filter box that narrows the folder list by name or path (space = AND), Enter moves to the first match; the move toast now reads "Moved N file(s)" since audio/video files are moved too
- **Semantic Search** (v0.8.2) — find images by meaning instead of keywords. The **S** button next to the search box turns it on: the search box then takes a free-text description (e.g. "sunset city street"), Enter searches, and results are ordered by similarity with a score badge on each thumbnail. Turning **S** on also shows a second toolbar row (left-aligned): **Similar** (lists images similar to the selected one; selecting another image keeps the list, **↻** re-runs it for the newly selected image, pressing Similar again returns to the normal list), the **⚙** settings button, and the result count. Searches cover the selected folder and its subfolders; sort and tag/group filters do not apply to semantic results
- **Index window (⚙)** — three tabs. **Index**: target folder (optionally with subfolders), "new/changed only" or "rebuild all", progress bar, stop, delete all. **Model**: choose with radio buttons between **Gemini Embedding 2** (API; set `GEMINI_API_KEY` in the plugin's `.env` and restart ComfyUI — the free tier exists but content sent on it may be used by Google to improve its products, beyond it the API is paid) and **EmbeddingGemma 2** (runs locally, free, no key; the ~300 MB q4 ONNX model is downloaded on first use), plus vector size (Gemini 768 / 1536 / 3072, EmbeddingGemma 2 128 / 256 / 512 / 768), and for the local model the device (auto / CPU / GPU CUDA), CPU thread count (default: half the cores) and image precision (high / standard ≈2.5× faster / light ≈5× faster). **Search**: minimum score for similar-image results (e.g. `0.6` shows only images scoring 0.6 or higher), minimum score for text search, and maximum results — stored per model because score levels differ between models
- **Index window (⚙)** — three tabs. **Index**: target folder (optionally with subfolders), "new/changed only" or "rebuild all", progress bar, stop, delete all. **Model**: choose with radio buttons between **Gemini Embedding 2** (API; set `GEMINI_API_KEY` in the plugin's `.env` and restart ComfyUI — the free tier exists but content sent on it may be used by Google to improve its products, beyond it the API is paid) and **EmbeddingGemma 2** (runs locally in Ollama, free, no key), plus vector size (Gemini 768 / 1536 / 3072, EmbeddingGemma 2 128 / 256 / 512 / 768), and for EmbeddingGemma 2 the Ollama URL and the model size (740m or 440m). **Search**: minimum score for similar-image results (e.g. `0.6` shows only images scoring 0.6 or higher), minimum score for text search, and maximum results — stored per model because score levels differ between models
- **Index state in the folder tree** — a green dot next to a folder's image count means every image directly in that folder is indexed; the index is one shared store, so folders can be indexed one at a time. Images, plus videos / PSD via their thumbnails (audio is skipped), are embedded; changing the model, vector size or image precision requires "Rebuild all"
- **Local GPU** — EmbeddingGemma 2 is a port of Transformers.js' pipeline onto `onnxruntime` (no `transformers` support needed). On an RTX 4070 it indexes ≈0.13 s per image with CUDA versus ≈6 s on the CPU (≈45× faster, identical vectors); to use the GPU, install `onnxruntime-gpu` in place of `onnxruntime` (`pip uninstall onnxruntime onnxruntime-gpu` then `pip install onnxruntime-gpu`). DirectML is not supported (its vision model fails). The model is released from memory when indexing finishes
- **EmbeddingGemma 2 in Ollama** — download the model with `ollama pull embeddinggemma-2:740m` (text + image + audio) or `ollama pull embeddinggemma-2:440m` (text + image, smaller). Both return identical vectors, so you can switch sizes without rebuilding (`:latest` is the same as 740m and is used when 740m is missing; 270m / 570m cannot embed images). Images are sent 4 per request (≈0.1–0.2 s per image on an NVIDIA GPU) and retried automatically when Ollama drops a connection. The model is unloaded from VRAM when indexing finishes. Indexes built with the earlier built-in ONNX runtime keep working (cos ≈0.97 with the Ollama vectors); use "rebuild all" to regenerate them exactly. Other Ollama hosts must be listed in `WFS_ALLOWED_BACKEND_HOSTS`
- **Audio waveform colors** (v0.8.0) — waveform thumbnails are colored per format (MP3 blue, WAV green, FLAC amber, OGG/Opus purple, M4A rose)
- **Info tab: dimensions & duration** (v0.5.1) — the detail panel's Info tab now also shows image dimensions (width×height) or video duration, in addition to filename, size, date, tags, and memo
- **Multi-select** — Ctrl+click to select multiple images; Bulk Bar appears for batch operations: select group → "Add to Group" / "Remove from Group"; Favorite All / Unfavorite All; Compare (2–4 images); Move To...; **Export** (downloads all selected images as a ZIP file); **Create PSD** (v0.6.0, combines the selected images into one layered PSD file, positioned top-left on a canvas sized to the largest image); **Edit as Layers** (v0.6.0, opens all selected images in the Image Edit tab at once, each as its own layer); Delete File
@@ -286,13 +292,17 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Detail panel** — view filename, path, tags, groups, and metadata in a slide-out panel; four or five tabs — **Info** / **JSON** / **Groups** / **Prompt** / **Nanobanana** (only for `cc_nanobanana`-folder images, see below)
- **Prompt tab** (v0.4.7) — selected by default (the most frequently checked piece of info shouldn't need an extra click); lists every positive/negative prompt candidate found in the embedded workflow with POS/NEG badges, reusing the exact same list→click→full-text UI as the Metadata tab; extracts from the API-format embedding when available rather than the UI-format one, since a workflow with independent top-level and subgraph sampling chains (e.g. Krea-2) can otherwise have some of its prompts missed; hidden entirely for images in the `cc_nanobanana` folder (see Nanobanana tab below), since they carry no embedded ComfyUI workflow to extract a prompt from
- **Nanobanana tab** (v0.7.14) — shown only for images in a `cc_nanobanana` folder (written by ComfyUI Comic Creator's Nanobanana tab) that have a matching entry in that folder's `history.jsonl` generation log; shows engine, model, image size, seed, timestamp, and the prompt/negative prompt actually used — the same info is also surfaced in the Metadata tab (see below) when opened from here via the **Metadata** button
- **Gemini / Nano Banana nodes** (v0.8.5) — images generated by ComfyUI's native Nano Banana nodes (`GeminiNanoBanana2V2` etc., e.g. via ComfyUI Comic Creator's "ComfyUI native node" engine) are readable like any other ComfyUI image: the Metadata tab and the side-panel I tab show the prompt (in the prompt list, including the appended `NEGATIVE_PROMPT:` text), the model name (under Diffusion Model, e.g. `Gemini Nano Banana 2.1`) and the seed; these images need no history file and are not special-cased like the `cc_nanobanana` folder (API-format workflows only)
- **MOSS-Image in GenerateUI** (v0.8.8) — the official MOSS-Image templates (Base / SFT, T2I and the bounding-box layout versions) load and run from GenerateUI; a custom (non-official) manga workflow using MOSS-Image Base with the 8-step distillation LoRA was also tested and works. The `MOSSImageLayoutPrompt` text is edited as the positive prompt, `CreateBoundingBoxes` converts correctly (the boxes themselves are still drawn on ComfyUI's canvas), and the Gallery Prompt tab, Metadata tab and side-panel I tab read the prompt, models and sampler settings of MOSS images. Newer frontends save subgraph widget values by name (`widgets_values_named`); these are now read correctly, so model names and sampler values no longer shift
- **Faster GenerateUI Check / conversion** (v0.8.8) — the first conversion or check used to download the full `/object_info` (tens of MB, 40+ s on installs with many custom nodes); it now fetches only the node types the workflow uses (about 0.25 s) and caches them per type
- **Partner API nodes in GenerateUI** (v0.8.6) — workflows containing ComfyUI's partner API nodes (Nano Banana / Gemini image nodes, etc.) can be run from GenerateUI. These nodes need Comfy credentials in the `/prompt` request's `extra_data`, which ComfyUI's own screen adds automatically but a separate page cannot: add `COMFY_API_KEY=...` (a Comfy API key issued at platform.comfy.org) to the plugin's `.env` and restart ComfyUI. With it set, GenerateUI queues prompts through the plugin server (`/api/wfm/partner/prompt`), which adds the key only when the workflow contains an API node (`api_node` in `/object_info`) and only for this ComfyUI instance; the key never reaches the browser, and usage is billed as Comfy credits. Without a key, an authentication error now shows how to set it up. A Gemini image node's prompt shows in the Prompt tab (reference images go through `LoadImage` in the Image tab); sample: `ws_nano_banana_2_1_t2i`. Also fixed: UI-format → API-format conversion misaligned `widgets_values` for nodes whose DynamicCombo option has socket sub-inputs (Nano Banana 2.1's `images` / `files`) or a widget right after a `control_after_generate` seed; Gallery now shows the Prompt tab for `cc_nanobanana`-folder images that carry embedded metadata (images made through Comic Creator's ComfyUI native node engine)
- **Workflow viewer** — Metadata tab displays workflow JSON from PNG embedded data (`prompt` / `workflow` keys) or from workflow saved by the Generate UI tab; **Copy & Send Canvas** button copies the JSON to the clipboard and sends the workflow directly to the ComfyUI canvas (UI and API formats both supported)
- **GenUI button** (renamed from "Load GenUI" in v0.5.0 for readability) — loads the embedded ComfyUI workflow from the selected image directly into the GenerateUI tab; shows a warning toast if no workflow is embedded or the format is unsupported; Metadata button is styled green, GenUI button uses the primary accent color
- **Image Edit button** — toolbar button; sends the selected image directly to the Image Edit tab as the base layer; PSD files (v0.6.0) are fully decomposed into their original layers instead of being flattened into one image
- **Send GenUI Image button** — toolbar button (next to Image Edit); uploads the selected image to ComfyUI and sets it as the input for the first LoadImage node in the GenerateUI tab; automatically switches to GenerateUI → Input → Image; requires a workflow with at least one LoadImage node to be loaded
- **Send to LI node button** (v0.5.2) — toolbar button (next to Send GenUI Image); uploads the selected image and writes its filename into the `image` widget of the node currently selected on the ComfyUI canvas (falling back to the first LoadImage-type node found) — same destination and cross-window bridge as the Image Edit tab's **Send to LI node** button (renamed from "Send to Workflow" in this same release), so both entry points now share one consistent name; requires Workflow Studio to have been opened from ComfyUI's top menu button
- **Send to LV node button** (v0.7.14) — toolbar button (next to Send to LI node), the video equivalent: uploads the selected video and writes its filename into the `file` widget of the node currently selected on the ComfyUI canvas, restricted to ComfyUI's native **Load Video** node (`LoadVideo`) since `file` as a widget name isn't unique enough to search for generically the way `image` is; only enabled when the selected item is a video (mp4/webm); same cross-window bridge and launch requirement as Send to LI node
- **Send CC button** (v0.3.69) — toolbar button, shown only when this Gallery tab is embedded as an iframe inside ComfyUI Comic Creator (a separate custom node); sends the selected image directly into Comic Creator's currently selected panel/overlay; when the selected file is an MP4 video (v0.6.3), it is routed to Comic Creator's Layout-tab Video tool instead — inserted as a new video object in the selected panel (playable, capturable to a still frame) rather than as a flattened image; sending a video while the Image tab is the intended destination is not yet supported and shows an info toast instead
- **Send CC Layout / Send CC Image buttons** (v0.3.69, split in v0.8.11) — toolbar buttons, shown only when this Gallery tab is embedded as an iframe inside ComfyUI Comic Creator (a separate custom node). **Send CC Layout** sends the selected image directly into Comic Creator's Layout tab (the currently selected panel/overlay); when the selected file is an MP4 video (v0.6.3), it is routed to the Layout-tab Video tool instead — inserted as a new video object in the selected panel (playable, capturable to a still frame) rather than as a flattened image. **Send CC Image** (v0.8.11) switches Comic Creator to its Image tab and loads the selected image there — as a new layer if a document is already open, otherwise as a new canvas; videos are not supported there and show an info toast. Requires a Comic Creator version that provides `window.sendImageToImageTab` (the one released together with v0.8.11).
- **Search clear (✕)** — inline ✕ button appears inside the search box whenever text is entered; click to clear immediately
- **Clear all filters (✕ Clear)** — toolbar button next to the view-mode (Thumbnail/Table) switch (v0.5.2, moved from the toolbar's rightmost position so it sits with the other display-affecting controls); resets search text, tag filter, group filter, and favorites filter in one click (sort order is preserved)
- **Workflow auto-save** — images generated from the Generate UI tab have their workflow automatically saved to gallery metadata
@@ -336,13 +346,13 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **MP4 embedded metadata** (v0.5.1) — reads the `workflow`/`prompt` container tags ComfyUI's `SaveVideo` writes into the mp4's `moov/udta/meta` box (parsed client-side, no server round-trip); also recognizes all-in-one video-generation nodes that carry their prompt directly on a `prompt` input instead of a separate `CLIPTextEncode`-style node (e.g. `MiniMaxH3ImageToVideo`); WebM isn't supported here (this parser only understands MP4's ISO-BMFF container) — the Gallery tab's own video metadata reading (PyAV-based, see Gallery Tab above) covers WebM instead
- **Settings section** (v0.7.14) — image size (width×height) and, when the embedded workflow has a KSampler-type node, its Seed / Steps / CFG / Sampler / Scheduler / Denoise values, read from the API-format embedding's named inputs (UI-format workflows are converted through the same UI→API path GenerateUI uses first)
- **Nanobanana section** (v0.7.14) — shown only for images from ComfyUI Comic Creator's Nanobanana tab (a `cc_nanobanana`-folder image opened via the Gallery tab's **Metadata** button, with a matching entry in that folder's `history.jsonl` log); shows engine, model, image size, seed, timestamp, and the prompt/negative prompt actually used — since these images carry no embedded ComfyUI workflow, this section's data replaces what would otherwise be a "no metadata found" error, with the rest of the layout (Checkpoint/LoRA/Prompt/Settings) simply staying empty
- **Model extraction** — automatically extracts Checkpoint, VAE, Diffusion Model, and Text Encoder names from the workflow; supports both standard and subgraph-based workflows (Flux.2 Dev/Klein, Qwen-Image-Edit/2511/Layered, Z-Image Base/Turbo, Ernie Image, WAN2.2, Mage-Flow, LongCat, Boogu, HiDream E1, FireRed, Krea-2 Turbo); node types covered: UNETLoader, UnetLoaderGGUF, UNETLoaderGGUF (e.g. HiDream GGUF), CLIPLoader, DualCLIPLoader, TripleCLIPLoader, QuadrupleCLIPLoader (e.g. HiDream 4-CLIP)
- **Model extraction** — automatically extracts Checkpoint, VAE, Diffusion Model, and Text Encoder names from the workflow; supports both standard and subgraph-based workflows (Flux.2 Dev/Klein, Qwen-Image-Edit/2511/Layered, Z-Image Base/Turbo, Ernie Image, WAN2.2, Mage-Flow, LongCat, Boogu, HiDream E1, FireRed, Krea-2 Turbo, MOSS-Image); node types covered: UNETLoader, UnetLoaderGGUF, UNETLoaderGGUF (e.g. HiDream GGUF), CLIPLoader, DualCLIPLoader, TripleCLIPLoader, QuadrupleCLIPLoader (e.g. HiDream 4-CLIP)
- **LoRA extraction** — lists all LoRA models with `strength_model / strength_clip` values
- **Prompt extraction** — lists prompts with POS / NEG badges when positive/negative can be determined; when distinction is not possible (e.g. `SamplerCustomAdvanced`, intermediate nodes, cross-level connections), prompts are shown without a badge as plain **Text**; click any entry to view the full text below
- **CLIP Text Encode edit+ support** (v0.3.92) — `CLIPTextEncodeEditPlus` nodes are resolved using the same RAW / EDIT / front / back combination rule as the node itself, correctly merging the linked `text1` (e.g. a Lora Manager's trigger words) with the editable `text_edit` field instead of showing only one side
- **Custom multi-output text node fix** (v0.7.14) — nodes whose text output comes from a differently-named widget (e.g. ComfyUI-LiveChatStream's `response`/`positive`/`negative` outputs, backed by `response_text`/`prompt_text`/`negative_text` widgets) previously resolved to nothing when the API-format embedding was used, since the generic key lookup didn't recognize those widget names — LiveChatStream is now resolved by name explicitly; confirmed working with response text up to 40,000 characters
- **Prompt actions** — Copy to clipboard, **GenUI:P/N** (set GenerateUI positive/negative prompt), **Prompt:P/N** (set Prompt tab preset positive/negative)
- **Format support** — ComfyUI PNG/WebP/MP4/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Ernie Image / WAN2.2 / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Krea-2 Turbo subgraph workflows), SD WebUI, SD Forge, Fooocus
- **Format support** — ComfyUI PNG/WebP/MP4/JSON (standard + Flux.2 / Qwen-Image / Z-Image / Ernie Image / WAN2.2 / Mage-Flow / LongCat / Boogu / HiDream E1 / FireRed / Krea-2 Turbo / MOSS-Image subgraph workflows), SD WebUI, SD Forge, Fooocus
- **Format note** — supported formats and covered model types are always shown in the left column
</details>
@@ -394,7 +404,7 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
<summary><h3>Tagger Tab (v0.3.38)</h3></summary>
- **3 sub-tabs** — Single / Batch / DB for single-image tagging, folder batch processing, and tag database management
- **Model support** — WD Tagger (ONNX, NCHW/NHWC auto-detect), SwinV2 (ONNX), DeepDanbooru (.h5, requires TensorFlow); place each model in its own subfolder under `ComfyUI/models/tagger/<model-name>/` containing the `.onnx` + `selected_tags.csv` (or `.h5` + label file)
- **Model support** — WD Tagger (ONNX, NCHW/NHWC auto-detect), SwinV2 (ONNX), DeepDanbooru (.h5, requires TensorFlow); place each model in its own subfolder under `ComfyUI/models/tagger/<model-name>/` containing the `.onnx` + `selected_tags.csv` (or `.h5` + label file). **PixAI Tagger v1.0** (v0.8.10) is supported via the community ONNX conversion [Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8](https://huggingface.co/Mexes/pixai-tagger-v1.0-onnx-fp32-fp16-int8): put one of `model.onnx` / `model_fp16.onnx` / `model_int8.onnx` (only one `.onnx` per folder) together with `selected_tags.csv` and `preprocess.json` in a subfolder. It is detected by `preprocess.json` and uses its own preprocessing (1008px, black padding, RGB, mean/std 0.5; the model already outputs probabilities); tags come from the general / style / copyright / character categories (meta and rating are left out). Selecting it switches the sliders to its recommended defaults (Threshold 0.17 / Char Thr. 0.27); the sliders then offset the recommended per-category values (Threshold moves general and style, Char Thr. moves character and copyright). FP16 needs a GPU to be fast: with both `onnxruntime` and `onnxruntime-gpu` installed the CPU package overwrites the GPU one and CUDA is silently unavailable, so keep only `onnxruntime-gpu`
- **Threshold sliders** — General threshold (default 0.35) and Character threshold for `character:` prefix tags (default 0.85); sliders update the display value in real time
- **VLM tagging** (v0.3.38, multi-backend: v0.5.4) — optional vision model alongside WD Tagger, running on Ollama, LM Studio, Lemonade, or Unsloth through the same unified backend used by the Prompt tab; results from both models are merged into one comma-separated tag string
- **⚙ Settings modal** (v0.5.4) — a Settings button (Single and Batch tabs) opens the same modal component as the Prompt tab's AI Assistant (Backend / Connection / Model / Generation / Unload), but saved under its own `localStorage` key so Tagger's VLM backend/model choice is independent of the Prompt tab's; **Thinking mode** and **Max tokens** apply to VLM requests too, and the **Unload** button frees the selected model (Ollama/LM Studio/Lemonade; Unsloth unsupported) — replaces the old Tagger-only direct Ollama URL/model fields
@@ -406,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>
@@ -420,7 +446,7 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Text** — click to place; configure font, size, bold/italic, align, and color; placed as an exact-size text layer sized to the measured bounding box; double-click to re-edit
- **Shape** — drag to draw geometric shapes (Rect / Ellipse / Line / FreeLine); options: shape type, Rounded toggle (Rect/Ellipse), Fill color, Stroke color + width, Opacity; each committed shape becomes an independent draw layer; Stroke None hidden for Line/FreeLine (stroke always active)
- **Fill** (v0.6.2) — bucket fill; click a contiguous same-color region on the active layer to flood-fill it (scanline-based, ported from the Comic Creator plugin's Image tab); **Properties pane**: Mode (Solid / Gradient) — Solid: Color picker; Gradient: Shape (Linear / Radial), a draggable color-stop Ramp (click a stop to select it, drag to reposition, +/- to add/remove stops, color swatch to edit the selected stop's color), and a Direction dial (drag to set angle/radius); both Tolerance (0–255, color-match threshold) and Opacity apply to either mode; Ramp and Direction dial are pointer-event based with pointer capture, so pen tablets work the same as mouse
- **Mask** — 7 sub-tools for painting masks onto a dedicated mask layer; click **Mask** on the second row of the Layers header (renamed from "M" and moved to its own row in v0.6.0) to add a mask layer (Mask tool activates automatically); clicking a mask layer in the list also switches to the Mask tool; **Tool Options bar**: sub-tool buttons (Paint / Color / Alpha / Text / Vector / Shape / SAM3), Invert checkbox, Overlay color picker (default red), Blur slider (0–50 px); the overlay is only shown for the currently active mask layer, other mask layers stay hidden until selected (v0.3.70); SAM3 requires Mask Editor One (disabled when not installed); Color / Alpha / Text / Vector / Shape work without Mask Editor One; **Properties pane — Paint**: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); brush size responds to pen pressure on a tablet (v0.6.2, same as the Draw tool); **MASK EDITOR ONE section** (Paint sub-tool, visible when installed): Select opens the ABR stamp-brush library; ✕ clears back to Circle; when an image brush is active, Hardness is disabled and Spacing (5–100%), Angle (0–359°), Sz Jitter (0–100%), Rot. Jitter (on/off) appear; **Edit in Mask Editor One →** (v0.4.0) — sends the current canvas composite (plus the active mask layer's content, if one is selected) to a MaskEditorOne node on the ComfyUI canvas — the currently selected node if it is one, otherwise the first MaskEditorOne node found in the graph (same selection logic as **Send to LI node**) — and opens its full interactive editor (paint, SAM3, BiRefNet, shapes, etc.) in the ComfyUI browser tab; clicking Apply there imports the result back here as a new mask layer; requires Workflow Studio to have been launched from ComfyUI's top-menu button and at least one MaskEditorOne node to exist on the ComfyUI canvas; **Properties pane — Color**: click canvas to flood-select pixels by color similarity; Mode (Add / Subtract), Tolerance (0–255), Feather % (0–100); **Properties pane — Alpha**: extract the active layer's transparency as a mask; Threshold, Invert checkbox, Extract Alpha button; **Properties pane — Text**: click canvas to open a stamp overlay — enter text, set Font / Size / Bold / Italic / Align / Mode (Add / Erase), Stamp or Ctrl+Enter to apply; multi-line supported; **Properties pane — Vector**: click to add Catmull-Rom spline points; Enter (or click first point) closes and fills the polygon; Backspace removes the last point; Esc resets; Mode (Add / Erase); **Properties pane — Shape**: drag to draw Rect or Ellipse; hold Shift for square/circle; blue dashed outline preview while dragging; Mode (Add / Erase); **Properties pane — SAM3**: enter a text prompt, set Max candidates (3/6/9/12), click Segment; select candidate thumbnails (multi-select), Apply Selected (N) applies with current Mode; **Mask layer A/S operation**: A/S toggle — Add (green) composites normally, Subtract (red) cuts the mask from below; **✂ clipping mask button** clips the layer below to the painted area; brush cursor shown as size-accurate circle; strokes can start from outside the canvas margin and continue past the edge
- **Mask** — 7 sub-tools for painting masks onto a dedicated mask layer; click **Mask** on the second row of the Layers header (renamed from "M" and moved to its own row in v0.6.0) to add a mask layer (Mask tool activates automatically); clicking a mask layer in the list also switches to the Mask tool; **Tool Options bar**: sub-tool buttons (Paint / Color / Alpha / Text / Vector / Shape / SAM3), Invert checkbox, Overlay color picker (default red), Blur slider (0–50 px); the overlay is only shown for the currently active mask layer, other mask layers stay hidden until selected (v0.3.70); SAM3 requires Mask Editor One (disabled when not installed); Color / Alpha / Text / Vector / Shape work without Mask Editor One; **Properties pane — Paint**: Mode (Add / Erase), Size (1–200 px), Hardness (0–100%); brush size responds to pen pressure on a tablet (v0.6.2, same as the Draw tool); **MASK EDITOR ONE section** (Paint sub-tool, visible when installed): Select opens the ABR stamp-brush library; ✕ clears back to Circle; when an image brush is active, Hardness is disabled and Spacing (5–100%), Angle (0–359°), Sz Jitter (0–100%), Rot. Jitter (on/off) appear; **Edit in Mask Editor One →** (v0.4.0) — sends the current canvas composite (plus the active mask layer's content, if one is selected) to a MaskEditorOne node on the ComfyUI canvas — the currently selected node if it is one, otherwise the first MaskEditorOne node found in the graph (same selection logic as **Send to LI node**) — and opens its full interactive editor (paint, SAM3, BiRefNet, shapes, etc.) in the ComfyUI browser tab; clicking Apply there imports the result back here as a new mask layer; requires Workflow Studio to have been launched from ComfyUI's top-menu button and at least one MaskEditorOne node to exist on the ComfyUI canvas; **Properties pane — Color**: click canvas to flood-select pixels by color similarity; Mode (Add / Subtract), Tolerance (0–255), Feather % (0–100); **Properties pane — Alpha**: extract the active layer's transparency as a mask; Threshold, Invert checkbox, Extract Alpha button; **Properties pane — Text**: click canvas to open a stamp overlay — enter text, set Font / Size / Bold / Italic / Align / Mode (Add / Erase), Stamp or Ctrl+Enter to apply; multi-line supported; **Properties pane — Vector**: click to add Catmull-Rom spline points; Enter (or click first point) closes and fills the polygon; Backspace removes the last point; Esc resets; Mode (Add / Erase); **Properties pane — Shape**: drag to draw Rect or Ellipse; hold Shift for square/circle; blue dashed outline preview while dragging; Mode (Add / Erase); **Properties pane — SAM3**: enter a text prompt, set Max candidates (3/6/9/12), click Segment; select candidate thumbnails (multi-select), Apply Selected (N) applies with current Mode; **Mask layer A/S operation**: A/S toggle — Add (green) composites normally, Subtract (red) cuts the mask from below; **✂ clipping mask button** clips the layer below to the painted area; brush cursor shown as size-accurate circle; strokes can start from outside the canvas margin and continue past the edge Since v0.8.13 the sent image is also saved to the node's `node.properties.bg_image` (via `node._persistBgDataUrl`, Mask Editor One v0.1.12 or later; ignored on older versions) and the mask layer data carries the image `width`/`height`, so the image and the mask preview survive a ComfyUI page reload or workflow tab switch instead of an older image being restored.
- **Blur** — **Whole Blur**: Gaussian blur to the entire active layer with intensity slider (1–50 px); **Whole Mosaic**: pixelation mosaic with block-size slider (5–100 px); **Rect Blur / Rect Mosaic**: enable the toggle then drag a rectangle on the canvas to apply blur or mosaic to that region only (blue preview for blur, orange for mosaic); Rect Blur and Rect Mosaic are mutually exclusive; all operations support Undo
- **BG Remove** — remove the background from the active layer; **Lightweight (@imgly)**: runs entirely in the browser via CDN (no server required; ~40 MB model downloaded on first use); **BiRefNet**: high-quality removal via Mask Editor One's Python backend (requires Mask Editor One installed and `birefnet.safetensors` in `ComfyUI/models/background_removal/`); **New Layer** option (default on) adds the result as a new layer above the original; when off, replaces the active layer in-place
- **Filter (G'MIC)** — apply G'MIC-Qt filter effects to the active image layer; click **Edit with G'MIC** to launch G'MIC-Qt GUI; select a filter and click OK — a "G'MIC-Qt filter output" window appears; close it to save the result back as the active layer; requires G'MIC-Qt Standalone installed and path configured in Settings → G'MIC-Qt Executable Path
@@ -438,7 +464,7 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
<details>
<summary><h3>Video Tab (v0.5.0 – v0.7.4)</h3></summary>
- **Dedicated video generation UI, independent of GenerateUI** — a purpose-built tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), and Wan2.2 (Text to Video) workflows (LTX-2.5/Wan2.2: v0.5.4); does not share state with the GenerateUI tab, and model selection (UNet/CLIP/VAE/Audio VAE) is fixed to the loaded workflow's own defaults rather than editable here
- **Dedicated video generation UI, independent of GenerateUI** — a purpose-built tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First & Last Frame to Video), Wan2.2 (Text to Video), and FastH3 OmniRef (MiniMax H3 Reference to Video) workflows (LTX-2.5/Wan2.2: v0.5.4); does not share state with the GenerateUI tab, and model selection (UNet/CLIP/VAE/Audio VAE) is fixed to the loaded workflow's own defaults rather than editable here
- **Plan subtab** (center panel, batch redesign in v0.5.5) — a **plan** is a sequence of timeline blocks, each a fully self-contained generation job with its own Prompt, Duration, and First/Last Image; split the timeline with **+ Split** / **+ Block** / **Delete**, then **Run** to generate every block in order (Pause/Cancel work mid-run) — a plan with a single block behaves exactly like the old one-shot form. First Image can be None, an explicit image, or "use previous block's last frame" (chaining — an explicit Last Image on the previous block always wins over extracting one from its generated output). Save / Save As / Clear a plan (`ws_videoplan_*.json`, with a PNG contact-sheet thumbnail that embeds the full plan data so dropping the image back on works too)
- **Base settings row** (topbar, v0.5.7) — Aspect Ratio / Megapixels / Multiple / Duration (seconds) / Noise Seed on one row — Duration always reflects the currently selected block (each block keeps its own value), the rest are plan-wide — plus a second row of model-specific fields: Width / Height (become directly editable for workflows with no Resolution Selector node, e.g. Wan2.2 and LTX-2.5's First & Last Frame to Video), Turbo Mode / Strength / Steps (MiniMax H3's turbo LoRA — Turbo Mode doubles as Wan2.2's own turbo toggle, sharing one field), and Prompt Enhance (LTX-2.5 only). Every field in both rows is enabled only when the loaded workflow actually has it — see Field highlight color below (one exception: Wan2.2's Text-to-Video variant doesn't expose Noise Seed at all, so it alone leaves that field disabled)
- **Edit subtab** (v0.7.0) — a lightweight clip timeline for trimming and concatenating video/image clips outside of generation: add clips via the Video Source panel's **Add to Edit** button or the Asset subtab's **Send to Edit** button, drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, Clear to empty the timeline. The trim panel for a selected video clip shows a Clipchamp-style scrubber — a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges (image clips get a simple hold-duration field instead); the playhead's own time badge sits a row above the in/out handle badges (v0.7.2) so it stays legible even when the playhead lands right on a trim point, and the scrubber has extra headroom/height and spacing from the clip name above it (v0.7.2). **▶ Preview** plays every ready clip back-to-back (trimmed to its in/out points) in the result preview, and **Export** builds and runs the actual ComfyUI graph (trim → crop → concatenate if more than one clip → save), tagging the result into Video Temp automatically. Multi-clip exports keep each clip's own audio (v0.7.4 — previously they were always silent). **Clear** empties the clips and also resets the Audio section to its defaults (v0.7.4)
@@ -446,15 +472,17 @@ An experimental batch generator: runs the workflow currently loaded in GenerateU
- **Edit: Audio / BGM** (v0.7.4) — the export panel's **Audio** section sets the soundtrack: **Keep original audio** (with its own volume in dB) keeps every clip's audio aligned to its segment even across multiple clips (image clips contribute silence), and one **BGM** file is laid over the whole video with its own volume and start offset (a longer BGM is cut to the video length). Pick the BGM with **BGM...**, by dropping an audio/video file onto the Audio section, or with **Set as BGM** on a video in the Asset subtab (that video's audio track is used; videos without audio are rejected). Built entirely inside the export graph with ComfyUI core audio nodes (EmptyAudio / AudioMerge / AudioConcat / LoadAudio / TrimAudioDuration / AudioAdjustVolume) passed to ConcatenateVideo's `complete_audio` — no extra dependencies. ▶ Preview plays the BGM alongside the clips
- **Edit: Text overlays** (v0.7.4) — each clip can carry any number of text overlays (**+ Add text** under the trim panel): text, start/end seconds within the clip, size as % of frame height, color, 9-position anchor, outline, and an optional background box. They follow the clip when it's reordered, are previewed live over the Source/Result panes, and are burned in on Export as a final pass (PyAV decode → Pillow → H.264 encode, frame by frame so memory stays flat; the soundtrack is remuxed untouched). Japanese/CJK text renders with a system CJK font (Meiryo / Yu Gothic / Noto Sans JP on Windows)
- **Edit: Crop** (v0.7.4) — **Edit crop** puts a draggable/corner-resizable rectangle over the Source preview (optionally locked to 16:9 / 9:16 / 1:1 / 4:3 / 3:4); **Done** keeps it, **Cancel** restores the crop from before editing, and switching to another subtab/tab ends editing like Done. Export applies it with ComfyUI core `VideoCrop`; the output size is the first video clip's cropped size, and other clips of a different size are center-fit to it. Text overlay previews are drawn relative to the cropped frame
- **Edit: Convert audio** (v0.8.9) — a **Convert audio...** button sits next to the crop buttons (separated by `|`); it converts the selected video clip's audio track to FLAC / MP3 / Opus / M4A / WAV with the same dialog as Gallery's **Convert...** (bitrate, sample rate, channels), and saves the result into the output/video folder so it shows up in Gallery. Delete-original and carry-over-gallery-meta options are not offered here. Server route: `POST /api/wfm/video/edit/convert-audio`
- **Edit: Undo / Redo** (v0.7.4) — **↶ / ↷** in the timeline toolbar (or Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z outside text fields) step through edits to clips, trims, crops, text and audio settings; a deleted clip comes back without re-uploading. History resets when a project is loaded
- **Edit project persistence** (v0.7.2) — **Save** / **Save As** / **Load** buttons in the Edit subtab's export panel persist the timeline itself (clip order, trim points, and which uploaded server-side file each clip refers to — plus crops, text overlays and audio/BGM settings since v0.7.4) as a `ws_videoeditproj_*.json` project file; Load re-fetches and re-probes each clip from its saved server reference, so the original files need to still exist
- **Asset subtab** (center panel, next to Plan/Edit — moved here from the sidebar in v0.7.0) — browses generated videos/images through three groups: **Video Assets** (a manually-curated keeper group you organize yourself, on your own schedule), **Video Temp** (every plan run's output lands here automatically regardless of whether the plan itself was saved — a **Clear Video Temp** button in the Gallery tab's detail panel empties it in one click), and **All Video Assets** (the union of both); a filename search box, a video/image type filter dropdown (All Types / Video Only / Image Only, v0.7.2), and a thumbnail-grid/table (▦/☰) view toggle sit above the list (v0.7.0). Selecting an item shows it in the center preview and lets you tag/memo it, **Send to Edit** (queues it as a clip in the Edit subtab), **Set as BGM** for videos (v0.7.4 — uses its audio track as the Edit BGM), jump straight to the full Gallery tab, or — for images only — **Set as First Image** / **Set as Last Image** (v0.7.0, uploads it straight into the currently-selected Plan block and switches to the Plan subtab)
- **Project subtab** (sidebar) — lists saved plan files while the center Plan subtab is active, or saved Edit projects while the center Edit subtab is active (v0.7.2 — thumbnail/block-or-clip-count/last-updated) — click one to load it into the matching editor, or delete it with the × button; the panel collapses back down when its own tab is clicked again, and switching Plan↔Edit while it's open refreshes the list in place
- **Two center previews** (v0.5.5) — the left preview shows either the video currently selected in the Asset subtab or whatever's dropped/picked in the **Video Source** panel to its left (**Clear** resets it to empty); the right preview always shows the most recently generated clip; both preview frames are a fixed height (v0.7.0) so switching sources never shifts the Plan/Edit/Asset panel below them. The Frame/GIF tools act on whichever preview was touched most recently
- **Register as Asset** (v0.8.9) — a **Register as Asset** button in the Video Source panel (next to **Add to Edit** and **Clear**) puts the loaded video into the **Video Assets** group so it appears in the Asset subtab: local files are uploaded and copied into output/video (Gallery only lists the output folder), sources already in output are just tagged. The Video Source panel was also widened so the file name stays on one line and the three buttons fit in a row. Server route: `POST /api/wfm/video/asset/register`
- **First Frame / Last Frame are both optional** — leaving First Image empty runs the workflow text-only (the node is simply left unconnected — a "bypass"); workflows that don't even include a LoadImage node for First Frame are supported out of the box (Wan2.2's Text-to-Video graph has neither slot at all), and a LoadImage node is only injected into the graph on the fly if an image is actually supplied
- **Semantic node lookup, not hardcoded IDs** (generalized in v0.5.4) — detects which of the three families is loaded from its subgraph's internal node types (or, for Wan2.2, the subgraph's own name — it has no distinctive internal node type), then locates its Resolution Selector and LoadImage node(s) by the subgraph's *public input label* (`prompt`, `duration`, `width`, `first_frame`, `last_frame`) rather than a fixed slot index — so it keeps working even though the three families expose those inputs under different internal names; a workflow no longer needs to match any bundled reference file's exact node IDs, and no fallback test workflow is auto-loaded on tab open
- **Field highlight color** — Prompt / Duration / First Image / Last Image / Aspect Ratio / Megapixels / Multiple / Noise Seed / Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance labels turn the same highlight color as the GenerateUI Model tab (shared setting, customizable in the Settings tab — see below) when the loaded workflow actually exposes that field; e.g. a Wan2.2 workflow (no Resolution Selector node) leaves Aspect Ratio / Megapixels / Multiple unhighlighted while Width / Height light up instead
- **Load in Video** (Workflow tab) — load any workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, or a Wan2.2 Text-to-Video node straight into this tab from the Workflow tab's side-panel toolbar (next to Load in GenerateUI) — starts a fresh single-block plan seeded from the workflow's own current values; unsupported workflows show an error toast instead of loading
- **Load in Video** (Workflow tab) — load any workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, a Wan2.2 Text-to-Video node, or a FastH3 OmniRef (MiniMax H3 Reference-to-Video) node — for FastH3 / Pika-H3-Flex the First Image and Last Image fields become Reference Image (ref_image_0) and Reference Image 2 (ref_image_1); leaving either one empty (None / Clear) disconnects that reference input even if the workflow had an image wired to it; Reference Image 2 is never used as the previous block's last frame for "Use previous block's last frame" (the actually generated last frame is used instead) straight into this tab from the Workflow tab's side-panel toolbar (next to Load in GenerateUI) — starts a fresh single-block plan seeded from the workflow's own current values; unsupported workflows show an error toast instead of loading
- **Frame tab** (right panel) — captures the active preview's current playback position as a still frame: play/seek to the position you want, click **Capture Frame** (client-side canvas, no server round-trip), then **Save to Output** to write it as a PNG into ComfyUI's own Output folder (auto-numbered, same pattern as other generated images); an optional **Add to Video Assets group** checkbox (v0.7.0) also tags the saved frame into Gallery's Video Assets group
- **GIF tab** (right panel) — converts the active preview to an animated GIF; set Start/End (seconds), FPS, and an optional Max Width, then **Convert to GIF** — the server decodes the video (PyAV) and encodes an animated GIF (Pillow), both dependencies ComfyUI itself already requires, so no ffmpeg binary or extra install is needed; the result is saved into ComfyUI's Output folder and previewed inline
- **Playback volume** — the preview player's volume is saved to the Settings tab and shared across every video player in the plugin (Video tab, Gallery tab), so it no longer resets to maximum each time a different video is opened
@@ -567,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.3, 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.3_en.zip`
- 日本語: [`docs/manual/`](docs/manual/) — ZIP: `Workflow_Studio_Manual_v0.8.3.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`
---
@@ -612,7 +640,7 @@ Click the **camera icon** (next to the W button) in ComfyUI's top bar to capture
- **[LM Studio](https://lmstudio.ai/)** — alternative backend for translation and VLM (OpenAI-compatible API)
- **[Lemonade Server](https://lemonade-server.ai/)** — alternative backend for translation, chat, and VLM (OpenAI-compatible API)
- **[Unsloth](https://unsloth.ai/)** — alternative backend for translation, chat, and VLM (OpenAI-compatible API); needs an API key set via `UNSLOTH_API_KEY` in a `.env` file, or Unsloth's Keyless API access → "Chat and inference" turned on — `pip install -r requirements.txt` for `python-dotenv`
- **Gemini API key / EmbeddingGemma 2** (v0.8.2) — only for the Gallery's Semantic Search: either set `GEMINI_API_KEY` in the plugin's `.env` (key from [Google AI Studio](https://aistudio.google.com); free tier available, paid beyond it), or use the local **EmbeddingGemma 2** (no key; `onnxruntime`, `tokenizers` and `huggingface_hub` — normally already present with ComfyUI; the model downloads on first use). `onnxruntime-gpu` makes the local model ≈45× faster on NVIDIA GPUs
- **Gemini API key / EmbeddingGemma 2** (v0.8.2) — only for the Gallery's Semantic Search: either set `GEMINI_API_KEY` in the plugin's `.env` (key from [Google AI Studio](https://aistudio.google.com); free tier available, paid beyond it), or use the local **EmbeddingGemma 2** in [Ollama](https://ollama.com) (no key; `ollama pull embeddinggemma-2:740m` or `embeddinggemma-2:440m`)
- **[Eagle](https://eagle.cool/)** — for auto-saving generated images with metadata
- **[comfyui-mask-editor-one](https://github.com/ketle-man/comfyui-mask-editor-one) (v0.1.9+)** — enables BiRefNet background removal, SAM3 text-prompt segmentation, and ABR stamp-brush library in the Image Edit Mask tool; `birefnet.safetensors` must be placed in `ComfyUI/models/background_removal/` for BiRefNet
- **[psd-tools](https://pypi.org/project/psd-tools/)** (v0.6.0) — enables all PSD (Photoshop) features: Gallery bulk "Create PSD" export, Gallery browsing/thumbnails for `.psd` files, and Image Edit's Save PSD / Open PSD buttons; `pip install -r requirements.txt` (ships prebuilt wheels, no C compiler required); without it, PSD-related actions show an error toast with the install command instead of failing silently
@@ -652,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
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

+3 -5
View File
@@ -2,12 +2,12 @@
ノードが苦手でも大丈夫 ― 画像生成をもっと手軽に、もっと整理して
- 対象バージョン:Workflow Studio v0.8.3
- 対象バージョン:Workflow Studio v0.9.1
- 著者:ketle-man
- © 2026 ketle-man
このマニュアルは、Kindle版をもとにした **画像なしのテキスト版** です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.8.3.md` です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.9.1.md` です。
画面の例は省略しているため、実際の画面はWorkflow Studioのヘルプタブとあわせてご覧ください。
## 目次
@@ -29,6 +29,4 @@
- [13_付録](chapters/13_付録.md)
- [14_おわりに](chapters/14_おわりに.md)
全章まとめ:[Workflow_Studio_Manual_v0.8.3.md](Workflow_Studio_Manual_v0.8.3.md)
English edition: [en/README.md](en/README.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.3
- 対象バージョン:Workflow Studio v0.9.1
- 著者:ketle-man
- © 2026 ketle-man
このマニュアルは、Kindle版をもとにした **画像なしのテキスト版** です。
章ごとのファイルは `chapters/` フォルダ、全章をまとめたファイルは `Workflow_Studio_Manual_v0.8.3.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.3
- **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/設定/ヘルプ
他のタブでの作業を助けたり、全体の設定をしたりするタブです。
> **ポイント**
@@ -1000,8 +1003,8 @@ Workflow Studioで探して、ComfyUIで細かく編集する、という使い
> △ や × でも生成自体はできることが多いので、「生成UIだけで完結しにくい」という目安として見てください。
> **ポイント**
> ワークフロータブを開いて最初のチェックは、ComfyUIからノードの情報を取得するため、10秒ほどかかることがあります。
> 2回目以降はすぐに結果が出ます。
> チェックは、そのワークフローで使っているノードの情報だけをComfyUIから取得して行います(v0.8.8〜)。
> 以前は最初の1回に数十秒かかることがありましたが、今は一瞬で結果が出ます。
---
@@ -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)
@@ -1146,6 +1152,9 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
> - 読み込んだときに「このワークフローのCheckpoint「…」が見つからず、無警告で別のモデルに差し替えられました」と表示される
> (この場合、手元のモデルの一覧の先頭のものに自動で差し替わっています)
>
> なお v0.8.7〜は、フォルダ名が違うだけで同じファイル名のモデルが手元に1つだけあれば、先頭のものではなく、そのモデルに自動で差し替わります。
> (公式テンプレートはフォルダ名なしでモデル名を保存していることが多く、以前は無関係なモデルに差し替わることがありました)
>
> どちらの場合も、一覧から使いたいモデルを選び直して、Apply を押してください。
> 毎回選び直すのが面倒なときは、設定タブの **デフォルトCheckpoint**(第11章)が便利です。
@@ -1160,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** の欄に、描いてほしい内容を英語で入力します。
```
@@ -1456,11 +1467,65 @@ Labでは、「何回目の生成から、どの設定に切り替えるか」
- **Plan Save** - 設定(プラン)を保存できます。保存すると、結果をまとめた一覧画像も作られ、
その画像をドロップすれば同じプランを読み込み直せます。
---
## 5-8 パートナーAPI(Nano Banana)を使う
ComfyUIには、Googleの画像生成モデル **Nano Banana**(Gemini画像ノード)のように、
クラウドのサービスに生成を任せる **パートナーAPIノード** があります。
v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実行できます。
> **注意**
> パートナーAPIノードは、自分のパソコンのGPUではなくクラウドで動き、**Comfyクレジット(有料)を消費** します。
> BatchやLabなどで繰り返し実行すると、回数ぶんのクレジットが続けて消費されます。
### 準備:Comfy APIキーを設定する
1. platform.comfy.org でComfy APIキーを発行します。
2. プラグインのフォルダにある `.env` に、`COMFY_API_KEY=発行したキー` という行を追加します。
(`.env` がなければ `.env.example` をコピーして作ります)
3. ComfyUIを再起動します。`.env` は起動時にしか読み込まれません。
キーはサーバー側でだけ使われ、ブラウザには送られません。
キーを設定していない状態で実行すると、「パートナーAPIノードの認証に失敗しました」という案内が出ます。
### 使い方
1. ワークフロータブで、Nano Bananaのサンプル(`ws_nano_banana_2_1_t2i`)を生成UIに読み込みます。
2. **Input** サブタブの左側(Prompt)でプロンプトを編集し、**Apply** を押します。
3. 参考画像を使うときは、**Input** サブタブの右側(Image)の画像カードで指定します。
4. **Generate** を押します。
> **ポイント**
> ComfyUI本体の画面でログインして実行する方法もあります。その場合は `.env` の設定は要りません。
---
## 5-9 対応ワークフローが増えました(v0.8.4〜)
生成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表示に対応 |
> **注意**
> ネイティブLoRAスタックのノードは、保存形式が **API形式のワークフローのみ** 対応です。
> ComfyUI本体の画面がこのノードの行追加にまだ対応していないためで、UI形式のワークフローは対象外です。
> **ポイント**
> 画像のメタデータを見るMetadataタブとサイドパネルの **I** タブでも、Nano Bananaで作った画像を読めます(v0.8.5〜)。
> プロンプトは、Positive/Negativeに分けずに全文が1件で表示されます。
> **この章(後半)のまとめ**
> - Batchサブタブで、モデル・プロンプト・サンプラーなどを1種類ずつ変えながらまとめて生成できる
> - Batch Queueの列のチェックで種類を選び、Generateで開始。終わったらチェックを外す
> - Feederは、たくさんの画像を1枚ずつワークフローに送り込む機能。専用ノードが必要
> - Labは、複数の設定を別々のタイミングで切り替えられる上級者向けの機能
> - パートナーAPIノード(Nano Bananaなど)は、`.env` の `COMFY_API_KEY` を設定すれば実行できる。クレジットが消費される
---
@@ -2045,8 +2110,9 @@ ComfyUIで生成した画像には、生成に使ったワークフローやプ
### 方法2:ComfyUIのノード画面で再現する(コピー&キャンバスへ送る)
1. ギャラリーで、再現したい画像をクリックします。
2. 詳細パネルの **メタデータ** タブを開きます。
3. **コピー&キャンバスへ送る**(Copy & Send Canvas)を押します。
2. 詳細パネルの **JSON** タブを開きます。
3. **Copy & Send Canvas**(コピー&キャンバスへ送る)を押します。
(このボタンは英語表示のままです。ワークフローが埋め込まれた画像でだけ押せます)
ComfyUIのノード画面に、その画像を作ったワークフローが読み込まれます。
ノード画面で細かく手を加えたいときは、こちらを使います。
@@ -2063,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(画像から画像を作る)ワークフローで、生成した画像をさらに描き直していくときに便利です。
@@ -2148,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の製品改善に使われる場合があります。
@@ -2160,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以前に作ったインデックスも、そのまま使えます。
- **検索設定** タブで、類似画像・文章検索それぞれの「最小スコア」と最大表示件数を決められます。
スコアの水準はモデルによって違うため、モデルごとに保存されます。
@@ -2646,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` を使います。
@@ -2661,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)と組み合わせて、両方の結果をまとめたタグを作ることもできます。
@@ -2711,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)。
@@ -2723,6 +2799,32 @@ Image Editのいちばん便利な使い方が、**インペイント** です
そのほか、動画の好きな場面を静止画として保存する **Frame** や、動画をGIFアニメに変換する **GIF** の機能もあります。
### アセット登録と音声変換(v0.8.9〜)
- **アセット登録** - 左側の動画ソースパネルのボタンです。パソコン内の動画を、outputフォルダ(`output/video`)へコピーして「Video Assets」グループに登録します。
登録すると、Assetサブタブの一覧に出て、Editなどで使えるようになります。
すでにoutputフォルダにある動画(Assetで選んだものや生成結果)は、コピーせずにグループへの登録だけを行います。同じ名前があるときは、名前の後ろに連番が付きます。
- **音声変換...** - Editサブタブの、クロップのボタンの横にあるボタンです。選んだ動画クリップの音声だけを、FLAC・MP3・Opus・M4A・WAVに変換して `output/video` に保存します。
ギャラリーの変換と同じ画面です。音声が入っている動画クリップだけが対象です。
- 音声変換のボタンを押すと、次の画面が開きます。**出力形式**(FLACなど)、**サンプルレート**、**チャンネル** を選び、**変換** を押します。
「埋め込みのprompt/workflowタグを引き継ぐ」にチェックを入れると、タグを持つ形式(FLACなど)で、元の動画の情報を引き継げます。
- 動画ソースパネルは少し広くなり、ファイル名が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メモリと時間を使います。
> 使うモデルの必要スペックを確認してから試しましょう。
@@ -2790,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の中だけで行えます。
@@ -2816,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は画像からタグを自動生成する。モデルと追加パッケージの準備が必要
@@ -2823,6 +2994,7 @@ Workflow Studioとは別にインストールするソフトですが、両方
> - Videoタブで、対応する動画生成モデルを使った動画作りと簡単な編集ができる
> - 設定タブの「デフォルトCheckpoint」と「データ管理(バックアップ)」は特に便利
> - 同じ作者の Comic Creator と組み合わせると、生成した画像でマンガを作れる
> - TagSpaceでは、手持ちのタグ・プロンプト・生成画像を意味の近さで3Dに並べ、眺めながらタグを選んでプロンプトを作れる
---
@@ -2910,6 +3082,7 @@ Batchサブタブを開き、Batch Queueの列のチェックをすべてオフ
### 思っていたのと違うモデルで生成される
ワークフローに保存されているモデルが手元にないと、別のモデルに自動で差し替えられることがあります。
その場合は「Checkpoint「…」が見つからず、無警告で別のモデルに差し替えられました」と表示されます。
(v0.8.7〜は、フォルダ名だけが違う同名のモデルが1つだけ手元にあれば、それに自動で差し替わります)
生成UIの **Model** サブタブで、使いたいモデルを選び直して **Apply** を押してください。
いつも同じモデルを使いたい場合は、設定タブの **デフォルトCheckpoint** を使うと便利です(第11章 11-5)。
@@ -2970,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を再起動してください。
@@ -2977,9 +3155,22 @@ 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)。
`.env` は起動時にしか読み込まれません。
### ギャラリーに画像が出てこない
- ギャラリーの **Refresh** を押します。
@@ -3069,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.3
- **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/設定/ヘルプ
他のタブでの作業を助けたり、全体の設定をしたりするタブです。
> **ポイント**
@@ -257,8 +257,8 @@ Workflow Studioで探して、ComfyUIで細かく編集する、という使い
> △ や × でも生成自体はできることが多いので、「生成UIだけで完結しにくい」という目安として見てください。
> **ポイント**
> ワークフロータブを開いて最初のチェックは、ComfyUIからノードの情報を取得するため、10秒ほどかかることがあります。
> 2回目以降はすぐに結果が出ます。
> チェックは、そのワークフローで使っているノードの情報だけをComfyUIから取得して行います(v0.8.8〜)。
> 以前は最初の1回に数十秒かかることがありましたが、今は一瞬で結果が出ます。
---
@@ -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)
@@ -95,6 +98,9 @@ Input・Model・Settingsの右側には、ワークフローの中身がJSON形
> - 読み込んだときに「このワークフローのCheckpoint「…」が見つからず、無警告で別のモデルに差し替えられました」と表示される
> (この場合、手元のモデルの一覧の先頭のものに自動で差し替わっています)
>
> なお v0.8.7〜は、フォルダ名が違うだけで同じファイル名のモデルが手元に1つだけあれば、先頭のものではなく、そのモデルに自動で差し替わります。
> (公式テンプレートはフォルダ名なしでモデル名を保存していることが多く、以前は無関係なモデルに差し替わることがありました)
>
> どちらの場合も、一覧から使いたいモデルを選び直して、Apply を押してください。
> 毎回選び直すのが面倒なときは、設定タブの **デフォルトCheckpoint**(第11章)が便利です。
@@ -109,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** の欄に、描いてほしい内容を英語で入力します。
```
@@ -173,8 +173,62 @@ Labでは、「何回目の生成から、どの設定に切り替えるか」
- **Plan Save** - 設定(プラン)を保存できます。保存すると、結果をまとめた一覧画像も作られ、
その画像をドロップすれば同じプランを読み込み直せます。
---
## 5-8 パートナーAPI(Nano Banana)を使う
ComfyUIには、Googleの画像生成モデル **Nano Banana**(Gemini画像ノード)のように、
クラウドのサービスに生成を任せる **パートナーAPIノード** があります。
v0.8.6〜は、こうしたノードを含むワークフローも生成UIで実行できます。
> **注意**
> パートナーAPIノードは、自分のパソコンのGPUではなくクラウドで動き、**Comfyクレジット(有料)を消費** します。
> BatchやLabなどで繰り返し実行すると、回数ぶんのクレジットが続けて消費されます。
### 準備:Comfy APIキーを設定する
1. platform.comfy.org でComfy APIキーを発行します。
2. プラグインのフォルダにある `.env` に、`COMFY_API_KEY=発行したキー` という行を追加します。
(`.env` がなければ `.env.example` をコピーして作ります)
3. ComfyUIを再起動します。`.env` は起動時にしか読み込まれません。
キーはサーバー側でだけ使われ、ブラウザには送られません。
キーを設定していない状態で実行すると、「パートナーAPIノードの認証に失敗しました」という案内が出ます。
### 使い方
1. ワークフロータブで、Nano Bananaのサンプル(`ws_nano_banana_2_1_t2i`)を生成UIに読み込みます。
2. **Input** サブタブの左側(Prompt)でプロンプトを編集し、**Apply** を押します。
3. 参考画像を使うときは、**Input** サブタブの右側(Image)の画像カードで指定します。
4. **Generate** を押します。
> **ポイント**
> ComfyUI本体の画面でログインして実行する方法もあります。その場合は `.env` の設定は要りません。
---
## 5-9 対応ワークフローが増えました(v0.8.4〜)
生成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表示に対応 |
> **注意**
> ネイティブLoRAスタックのノードは、保存形式が **API形式のワークフローのみ** 対応です。
> ComfyUI本体の画面がこのノードの行追加にまだ対応していないためで、UI形式のワークフローは対象外です。
> **ポイント**
> 画像のメタデータを見るMetadataタブとサイドパネルの **I** タブでも、Nano Bananaで作った画像を読めます(v0.8.5〜)。
> プロンプトは、Positive/Negativeに分けずに全文が1件で表示されます。
> **この章(後半)のまとめ**
> - Batchサブタブで、モデル・プロンプト・サンプラーなどを1種類ずつ変えながらまとめて生成できる
> - Batch Queueの列のチェックで種類を選び、Generateで開始。終わったらチェックを外す
> - Feederは、たくさんの画像を1枚ずつワークフローに送り込む機能。専用ノードが必要
> - Labは、複数の設定を別々のタイミングで切り替えられる上級者向けの機能
> - パートナーAPIノード(Nano Bananaなど)は、`.env` の `COMFY_API_KEY` を設定すれば実行できる。クレジットが消費される
@@ -135,8 +135,9 @@ ComfyUIで生成した画像には、生成に使ったワークフローやプ
### 方法2:ComfyUIのノード画面で再現する(コピー&キャンバスへ送る)
1. ギャラリーで、再現したい画像をクリックします。
2. 詳細パネルの **メタデータ** タブを開きます。
3. **コピー&キャンバスへ送る**(Copy & Send Canvas)を押します。
2. 詳細パネルの **JSON** タブを開きます。
3. **Copy & Send Canvas**(コピー&キャンバスへ送る)を押します。
(このボタンは英語表示のままです。ワークフローが埋め込まれた画像でだけ押せます)
ComfyUIのノード画面に、その画像を作ったワークフローが読み込まれます。
ノード画面で細かく手を加えたいときは、こちらを使います。
@@ -153,7 +154,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(画像から画像を作る)ワークフローで、生成した画像をさらに描き直していくときに便利です。
@@ -238,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の製品改善に使われる場合があります。
@@ -250,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)。
@@ -131,6 +139,32 @@ Image Editのいちばん便利な使い方が、**インペイント** です
そのほか、動画の好きな場面を静止画として保存する **Frame** や、動画をGIFアニメに変換する **GIF** の機能もあります。
### アセット登録と音声変換(v0.8.9〜)
- **アセット登録** - 左側の動画ソースパネルのボタンです。パソコン内の動画を、outputフォルダ(`output/video`)へコピーして「Video Assets」グループに登録します。
登録すると、Assetサブタブの一覧に出て、Editなどで使えるようになります。
すでにoutputフォルダにある動画(Assetで選んだものや生成結果)は、コピーせずにグループへの登録だけを行います。同じ名前があるときは、名前の後ろに連番が付きます。
- **音声変換...** - Editサブタブの、クロップのボタンの横にあるボタンです。選んだ動画クリップの音声だけを、FLAC・MP3・Opus・M4A・WAVに変換して `output/video` に保存します。
ギャラリーの変換と同じ画面です。音声が入っている動画クリップだけが対象です。
- 音声変換のボタンを押すと、次の画面が開きます。**出力形式**(FLACなど)、**サンプルレート**、**チャンネル** を選び、**変換** を押します。
「埋め込みのprompt/workflowタグを引き継ぐ」にチェックを入れると、タグを持つ形式(FLACなど)で、元の動画の情報を引き継げます。
- 動画ソースパネルは少し広くなり、ファイル名が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メモリと時間を使います。
> 使うモデルの必要スペックを確認してから試しましょう。
@@ -198,11 +232,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の中だけで行えます。
@@ -224,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は画像からタグを自動生成する。モデルと追加パッケージの準備が必要
@@ -231,3 +334,4 @@ Workflow Studioとは別にインストールするソフトですが、両方
> - Videoタブで、対応する動画生成モデルを使った動画作りと簡単な編集ができる
> - 設定タブの「デフォルトCheckpoint」と「データ管理(バックアップ)」は特に便利
> - 同じ作者の Comic Creator と組み合わせると、生成した画像でマンガを作れる
> - TagSpaceでは、手持ちのタグ・プロンプト・生成画像を意味の近さで3Dに並べ、眺めながらタグを選んでプロンプトを作れる
@@ -82,6 +82,7 @@ Batchサブタブを開き、Batch Queueの列のチェックをすべてオフ
### 思っていたのと違うモデルで生成される
ワークフローに保存されているモデルが手元にないと、別のモデルに自動で差し替えられることがあります。
その場合は「Checkpoint「…」が見つからず、無警告で別のモデルに差し替えられました」と表示されます。
(v0.8.7〜は、フォルダ名だけが違う同名のモデルが1つだけ手元にあれば、それに自動で差し替わります)
生成UIの **Model** サブタブで、使いたいモデルを選び直して **Apply** を押してください。
いつも同じモデルを使いたい場合は、設定タブの **デフォルトCheckpoint** を使うと便利です(第11章 11-5)。
@@ -142,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を再起動してください。
@@ -149,9 +155,22 @@ 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)。
`.env` は起動時にしか読み込まれません。
### ギャラリーに画像が出てこない
- ギャラリーの **Refresh** を押します。
+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.3
- 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.3_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.3_en.md](Workflow_Studio_Manual_v0.8.3_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.3
- 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.3_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.3
- **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**
@@ -997,7 +1000,8 @@ Hovering the mouse over a badge shows the reason for the judgment.
> Even with a warning or cross, generation itself is often possible, so treat it as a rough indication of "hard to finish using GenerateUI alone".
> **Tip**
> The first check after opening the Workflow tab can take about 10 seconds, because it fetches node information from ComfyUI.
> The check fetches from ComfyUI only the information of the nodes that workflow uses (v0.8.8 and later).
> It used to take tens of seconds the first time, but now the result appears almost instantly.
> From the second time on, results appear immediately.
---
@@ -1120,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
@@ -1127,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)
@@ -1143,6 +1150,9 @@ Now, to generate. At minimum, you check and set these three things.
> - When loading, a message says the workflow's Checkpoint "..." was not found and was replaced with another model without warning
> (in this case it has been replaced automatically with the first model in the list you have)
>
> From v0.8.7, if you have exactly one model with the same file name that differs only in its folder, it is replaced with that model instead of the first one.
> (Official templates often save model names without a folder, and the old behavior could swap in an unrelated model.)
>
> In either case, choose the model you want to use from the list and press Apply.
> If choosing again each time is a nuisance, the **Default Checkpoint** in the Settings tab (Chapter 11) is handy.
@@ -1157,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.
```
@@ -1453,11 +1465,62 @@ Results are listed in the **Results** panel.
- **Plan Save** - lets you save the settings (the plan). When saved, an overview image summarizing the results is also made,
and dropping that image lets you load the same plan again.
---
## 5-8 Using partner APIs (Nano Banana)
ComfyUI has **partner API nodes**, such as Google's **Nano Banana** image model (the Gemini image nodes), that hand the generation over to a cloud service.
From v0.8.6, GenerateUI can also run workflows that contain these nodes.
> **Caution**
> Partner API nodes run in the cloud, not on your PC's GPU, and **consume Comfy credits (paid)**.
> If you run them repeatedly with Batch, Lab and so on, credits are consumed once per run.
### Preparation: set your Comfy API key
1. Issue a Comfy API key at platform.comfy.org.
2. Add the line `COMFY_API_KEY=your key` to the `.env` file in the plugin folder.
(If there is no `.env`, copy `.env.example` to make one.)
3. Restart ComfyUI. `.env` is read only at startup.
The key is used only on the server side and is never sent to the browser.
If you run without a key, a message says that partner API authentication failed and how to set it up.
### 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 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**
> You can also run it from ComfyUI's own screen while logged in. In that case you do not need the `.env` setting.
---
## 5-9 More workflows are supported (v0.8.4 and later)
The workflows you can use in GenerateUI have increased as follows. They are used the same way as other workflows.
- **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**
> The native LoRA stack nodes are supported **only in API-format workflows**.
> ComfyUI's own screen cannot yet add rows to this node, so UI-format workflows are not covered.
> **Tip**
> The Metadata tab and the side panel's **I** tab can also read images made with Nano Banana (v0.8.5 and later).
> The prompt appears as one whole entry, not split into Positive/Negative.
> **Summary of this chapter (second half)**
> - With the Batch subtab, you can generate in bulk while changing the model, prompt, sampler and so on, one kind at a time
> - Choose the kind with the Batch Queue column checkbox and start with Generate. Turn the check off when done
> - Feeder is a feature that feeds many images one at a time into a workflow. A dedicated node is required
> - Lab is an advanced feature that can switch several settings at separate timings
> - Partner API nodes (Nano Banana and others) run once `COMFY_API_KEY` is set in `.env`. They consume credits
---
@@ -2056,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.
@@ -2141,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.
@@ -2153,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.
@@ -2639,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.
@@ -2654,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.
@@ -2704,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).
@@ -2716,6 +2789,30 @@ You load a matching workflow with **Load in Video** in the Workflow tab and use
There are also the **Frame** feature, which saves a favorite scene of a video as a still image, and **GIF**, which converts a video to an animated GIF.
### Register as Asset and audio conversion (v0.8.9 and later)
- **Register as Asset** - a button in the Video Source panel on the left. It copies a video from your PC into the output folder (`output/video`) and registers it in the "Video Assets" group.
Once registered, it appears in the Asset subtab list and can be used in Edit and elsewhere.
Videos already in the output folder (ones chosen in Asset or generation results) are only tagged into the group, not copied. If the name already exists, a number is added after it.
- **Convert audio...** - a button next to the crop buttons in the Edit subtab. It converts only the audio of the selected video clip to FLAC, MP3, Opus, M4A or WAV and saves it into `output/video`.
It is the same dialog as Gallery's Convert. Only video clips that contain audio are covered.
- Pressing the audio-conversion button opens the dialog below. Choose the **output format** (such as FLAC), the **sample rate** and the **channels**, then press **Convert**.
If you check the option to carry over the embedded prompt/workflow tags, the original video's information is kept in formats that can hold tags (such as FLAC).
- 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.
@@ -2783,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.
@@ -2809,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
@@ -2816,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
---
@@ -2903,6 +3066,7 @@ Open the Batch subtab and turn off all the Batch Queue column checkboxes.
### It generates with a different model than you expected
If the model saved in the workflow is not on your computer, it may be replaced automatically with another model.
In that case a message says the Checkpoint "..." was not found and was replaced with another model without warning.
(From v0.8.7, if you have exactly one model with the same name that differs only in its folder, it is replaced with that one.)
In the **Model** subtab of GenerateUI, choose the model you want to use again and press **Apply**.
If you always want to use the same model, the **Default Checkpoint** in the Settings tab is handy (Chapter 11, section 11-5).
@@ -2963,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.
@@ -2970,9 +3139,22 @@ 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).
`.env` is read only at startup.
### Images do not appear in the Gallery
- Press **Refresh** in the Gallery.
@@ -3054,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.3
- **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**
@@ -257,7 +257,8 @@ Hovering the mouse over a badge shows the reason for the judgment.
> Even with a warning or cross, generation itself is often possible, so treat it as a rough indication of "hard to finish using GenerateUI alone".
> **Tip**
> The first check after opening the Workflow tab can take about 10 seconds, because it fetches node information from ComfyUI.
> The check fetches from ComfyUI only the information of the nodes that workflow uses (v0.8.8 and later).
> It used to take tens of seconds the first time, but now the result appears almost instantly.
> From the second time on, results appear immediately.
---
@@ -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)
@@ -95,6 +98,9 @@ Now, to generate. At minimum, you check and set these three things.
> - When loading, a message says the workflow's Checkpoint "..." was not found and was replaced with another model without warning
> (in this case it has been replaced automatically with the first model in the list you have)
>
> From v0.8.7, if you have exactly one model with the same file name that differs only in its folder, it is replaced with that model instead of the first one.
> (Official templates often save model names without a folder, and the old behavior could swap in an unrelated model.)
>
> In either case, choose the model you want to use from the list and press Apply.
> If choosing again each time is a nuisance, the **Default Checkpoint** in the Settings tab (Chapter 11) is handy.
@@ -109,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.
```
@@ -173,8 +173,59 @@ Results are listed in the **Results** panel.
- **Plan Save** - lets you save the settings (the plan). When saved, an overview image summarizing the results is also made,
and dropping that image lets you load the same plan again.
---
## 5-8 Using partner APIs (Nano Banana)
ComfyUI has **partner API nodes**, such as Google's **Nano Banana** image model (the Gemini image nodes), that hand the generation over to a cloud service.
From v0.8.6, GenerateUI can also run workflows that contain these nodes.
> **Caution**
> Partner API nodes run in the cloud, not on your PC's GPU, and **consume Comfy credits (paid)**.
> If you run them repeatedly with Batch, Lab and so on, credits are consumed once per run.
### Preparation: set your Comfy API key
1. Issue a Comfy API key at platform.comfy.org.
2. Add the line `COMFY_API_KEY=your key` to the `.env` file in the plugin folder.
(If there is no `.env`, copy `.env.example` to make one.)
3. Restart ComfyUI. `.env` is read only at startup.
The key is used only on the server side and is never sent to the browser.
If you run without a key, a message says that partner API authentication failed and how to set it up.
### 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 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**
> You can also run it from ComfyUI's own screen while logged in. In that case you do not need the `.env` setting.
---
## 5-9 More workflows are supported (v0.8.4 and later)
The workflows you can use in GenerateUI have increased as follows. They are used the same way as other workflows.
- **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**
> The native LoRA stack nodes are supported **only in API-format workflows**.
> ComfyUI's own screen cannot yet add rows to this node, so UI-format workflows are not covered.
> **Tip**
> The Metadata tab and the side panel's **I** tab can also read images made with Nano Banana (v0.8.5 and later).
> The prompt appears as one whole entry, not split into Positive/Negative.
> **Summary of this chapter (second half)**
> - With the Batch subtab, you can generate in bulk while changing the model, prompt, sampler and so on, one kind at a time
> - Choose the kind with the Batch Queue column checkbox and start with Generate. Turn the check off when done
> - Feeder is a feature that feeds many images one at a time into a workflow. A dedicated node is required
> - Lab is an advanced feature that can switch several settings at separate timings
> - Partner API nodes (Nano Banana and others) run once `COMFY_API_KEY` is set in `.env`. They consume credits
@@ -153,7 +153,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.
@@ -238,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.
@@ -250,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).
@@ -131,6 +139,30 @@ You load a matching workflow with **Load in Video** in the Workflow tab and use
There are also the **Frame** feature, which saves a favorite scene of a video as a still image, and **GIF**, which converts a video to an animated GIF.
### Register as Asset and audio conversion (v0.8.9 and later)
- **Register as Asset** - a button in the Video Source panel on the left. It copies a video from your PC into the output folder (`output/video`) and registers it in the "Video Assets" group.
Once registered, it appears in the Asset subtab list and can be used in Edit and elsewhere.
Videos already in the output folder (ones chosen in Asset or generation results) are only tagged into the group, not copied. If the name already exists, a number is added after it.
- **Convert audio...** - a button next to the crop buttons in the Edit subtab. It converts only the audio of the selected video clip to FLAC, MP3, Opus, M4A or WAV and saves it into `output/video`.
It is the same dialog as Gallery's Convert. Only video clips that contain audio are covered.
- Pressing the audio-conversion button opens the dialog below. Choose the **output format** (such as FLAC), the **sample rate** and the **channels**, then press **Convert**.
If you check the option to carry over the embedded prompt/workflow tags, the original video's information is kept in formats that can hold tags (such as FLAC).
- 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.
@@ -198,11 +230,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.
@@ -224,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
@@ -231,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
@@ -82,6 +82,7 @@ Open the Batch subtab and turn off all the Batch Queue column checkboxes.
### It generates with a different model than you expected
If the model saved in the workflow is not on your computer, it may be replaced automatically with another model.
In that case a message says the Checkpoint "..." was not found and was replaced with another model without warning.
(From v0.8.7, if you have exactly one model with the same name that differs only in its folder, it is replaced with that one.)
In the **Model** subtab of GenerateUI, choose the model you want to use again and press **Apply**.
If you always want to use the same model, the **Default Checkpoint** in the Settings tab is handy (Chapter 11, section 11-5).
@@ -142,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.
@@ -149,9 +155,22 @@ 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).
`.env` is read only at startup.
### Images do not appear in the Gallery
- Press **Refresh** in the Gallery.
+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()
+18 -5
View File
@@ -73,6 +73,7 @@ def setup_routes(app: web.Application):
app.router.add_post("/wfm/gallery/semantic/similar", semantic_similar)
app.router.add_post("/wfm/gallery/semantic/clear", semantic_clear)
app.router.add_post("/wfm/gallery/semantic/test", semantic_test)
app.router.add_post("/wfm/gallery/semantic/options", semantic_options)
app.router.add_get("/wfm/gallery/images", list_images)
app.router.add_get("/wfm/gallery/image/meta", get_image_meta)
app.router.add_get("/wfm/gallery/image/workflow", get_image_workflow)
@@ -112,7 +113,7 @@ def setup_routes(app: web.Application):
# ──────────────────────────────────────────────────────────────
# セマンティック検索 (Gemini Embedding 2)
# セマンティック検索 (Gemini Embedding 2 / Ollama EmbeddingGemma 2)
# ──────────────────────────────────────────────────────────────
def _semantic_error(e: SemanticError) -> web.Response:
@@ -164,9 +165,9 @@ async def semantic_folders(request: web.Request) -> web.Response:
def _apply_local_options(body: dict) -> None:
"""リクエストに実行デバイス/スレッド数が含まれていれば反映・保存する"""
if "device" in body:
_semantic.set_local_options(str(body.get("device", "auto")), _num(body, "threads", 0, 0, 256))
"""リクエストに Ollama の接続先/モデルサイズが含まれていれば反映・保存する"""
if "ollama_url" in body:
_semantic.set_local_options(str(body.get("ollama_url", "")), str(body.get("ollama_tag", "")))
async def semantic_index(request: web.Request) -> web.Response:
@@ -180,7 +181,6 @@ async def semantic_index(request: web.Request) -> web.Response:
"all" if body.get("mode") == "all" else "missing",
str(body.get("model", SEMANTIC_DEFAULT_MODEL)),
_num(body, "dim", DEFAULT_DIM, 0, 100000),
_num(body, "soft", 280, 0, 100000),
)
return web.json_response({"ok": True})
except SemanticError as e:
@@ -848,3 +848,16 @@ async def get_psd_layers(request: web.Request) -> web.Response:
except Exception as e:
logger.error("Error reading PSD layers: %s", e)
return web.json_response({"error": str(e)}, status=500)
async def semantic_options(request: web.Request) -> web.Response:
"""Ollama の接続先/モデルサイズを保存して、新しい状態を返す"""
body = await _json_body(request)
try:
await asyncio.to_thread(_apply_local_options, body)
return web.json_response(await asyncio.to_thread(_semantic.status))
except SemanticError as e:
return _semantic_error(e)
except Exception as e:
logger.error("semantic_options error: %s", e)
return web.json_response({"error": str(e)}, status=500)
+107
View File
@@ -0,0 +1,107 @@
"""Partner (API) node execution support for GenerateUI.
ComfyUI's partner API nodes (Nano Banana / Gemini, Kling, Seedream, ...) authenticate through the
``extra_data`` of the ``/prompt`` request: ``auth_token_comfy_org`` (the browser's Comfy login) or
``api_key_comfy_org`` (a Comfy API key issued at platform.comfy.org). ComfyUI's own web UI adds
the login token automatically, but Workflow Studio is a separate page that POSTs to ``/prompt`` itself,
so such a prompt fails with "Unauthorized: Please login first to use this node."
When COMFY_API_KEY is set (loaded from the plugin's .env by prestartup_script.py), the frontend
queues prompts through this proxy instead. The proxy adds the key to ``extra_data`` — only when the
prompt actually contains an API node (``api_node: true`` in /object_info) — and relays the request
to the local ComfyUI. The key never reaches the browser. Usage is billed as Comfy credits.
"""
import json
import logging
import os
from urllib.parse import quote
import aiohttp
from aiohttp import web
logger = logging.getLogger(__name__)
_api_node_cache: dict = {} # class_type -> bool (api_node flag); the node set only changes on restart
def _get_comfy_key():
"""Return the Comfy API key from the environment (.env), or None."""
return os.environ.get("COMFY_API_KEY", "").strip() or None
def _local_base_url() -> str:
"""Base URL of this ComfyUI instance (from its --listen / --port launch arguments)."""
try:
from comfy.cli_args import args as _a
port = getattr(_a, "port", None) or 8188
host = str(getattr(_a, "listen", "") or "127.0.0.1").split(",")[0].strip()
if host in ("", "0.0.0.0", "::"):
host = "127.0.0.1"
elif ":" in host:
host = f"[{host}]"
except Exception:
host, port = "127.0.0.1", 8188
return f"http://{host}:{port}"
async def _is_api_node(sess: aiohttp.ClientSession, base: str, class_type: str) -> bool:
if class_type in _api_node_cache:
return _api_node_cache[class_type]
for attempt in range(2): # /object_info occasionally drops the connection; one retry is enough
try:
async with sess.get(f"{base}/object_info/{quote(class_type, safe='')}") as r:
if r.status == 200:
info = await r.json(content_type=None)
flag = bool((info.get(class_type) or {}).get("api_node"))
_api_node_cache[class_type] = flag
return flag
break
except Exception:
if attempt == 1:
logger.warning("object_info lookup failed for %s", class_type)
return False
def setup_routes(app: web.Application):
app.router.add_get("/api/wfm/partner/status", handle_status)
app.router.add_post("/api/wfm/partner/prompt", handle_prompt)
async def handle_status(request: web.Request) -> web.Response:
"""GET /api/wfm/partner/status - whether a Comfy API key is configured (the key itself is never returned)."""
return web.json_response({"configured": _get_comfy_key() is not None})
async def handle_prompt(request: web.Request) -> web.Response:
"""POST /api/wfm/partner/prompt - Relay a /prompt request to this ComfyUI, adding the Comfy API key
to ``extra_data`` when the prompt contains an API node. The response is passed through unchanged."""
try:
body = await request.json()
except Exception:
return web.json_response({"error": {"message": "invalid JSON body"}}, status=400)
prompt = body.get("prompt")
if not isinstance(prompt, dict):
return web.json_response({"error": {"message": "prompt is required"}}, status=400)
base = _local_base_url()
key = _get_comfy_key()
try:
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=120, connect=10)) as sess:
if key:
extra = body.get("extra_data")
extra = extra if isinstance(extra, dict) else {}
already = extra.get("auth_token_comfy_org") or extra.get("api_key_comfy_org")
if not already:
classes = {n.get("class_type") for n in prompt.values() if isinstance(n, dict) and n.get("class_type")}
for cls in classes:
if await _is_api_node(sess, base, cls):
extra["api_key_comfy_org"] = key
break
body["extra_data"] = extra
async with sess.post(f"{base}/prompt", json=body) as r:
data = await r.read()
return web.Response(status=r.status, body=data, content_type="application/json")
except Exception as e:
logger.error("partner prompt relay failed: %s", e)
return web.json_response({"error": {"message": f"relay failed: {e}"}}, status=502)
+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)
+41
View File
@@ -21,6 +21,8 @@ _edit_project_service = VideoEditProjectService(VIDEO_EDIT_PROJECT_DIR)
def setup_routes(app: web.Application):
app.router.add_post("/api/wfm/video/frame/save-to-output", handle_save_frame)
app.router.add_post("/api/wfm/video/to-gif", handle_to_gif)
app.router.add_post("/api/wfm/video/asset/register", handle_register_asset)
app.router.add_post("/api/wfm/video/edit/convert-audio", handle_convert_audio)
app.router.add_get("/api/wfm/video/edit/probe", handle_probe_video)
app.router.add_post("/api/wfm/video/edit/overlay-text", handle_overlay_text)
@@ -49,6 +51,45 @@ async def handle_save_frame(request: web.Request) -> web.Response:
return web.json_response({"error": str(e)}, status=500)
async def handle_register_asset(request: web.Request) -> web.Response:
try:
body = await request.json()
filename = body.get("filename", "")
if not filename:
return web.json_response({"error": "filename required"}, status=400)
result = await asyncio.to_thread(
_service.register_asset, filename, body.get("subfolder", ""), body.get("type", "input")
)
return web.json_response({"status": "ok", **result})
except FileNotFoundError as e:
return web.json_response({"error": str(e)}, status=404)
except ValueError as e:
return web.json_response({"error": str(e)}, status=400)
except Exception as e:
logger.error("Error registering video asset: %s", e)
return web.json_response({"error": str(e)}, status=500)
async def handle_convert_audio(request: web.Request) -> web.Response:
try:
body = await request.json()
filename = body.get("filename", "")
if not filename:
return web.json_response({"error": "filename required"}, status=400)
# PyAVの変換はCPU負荷が高いのでスレッドで実行する(イベントループを止めない)
result = await asyncio.to_thread(
_service.convert_audio_to_output, filename, body.get("subfolder", ""), body.get("type", "input"), body
)
return web.json_response({"ok": True, **result})
except FileNotFoundError as e:
return web.json_response({"ok": False, "error": str(e)}, status=404)
except ValueError as e:
return web.json_response({"ok": False, "error": str(e)}, status=400)
except Exception as e:
logger.error("Error converting clip audio: %s", e)
return web.json_response({"ok": False, "error": str(e)}, status=500)
async def handle_to_gif(request: web.Request) -> web.Response:
try:
body = await request.json()
-239
View File
@@ -1,239 +0,0 @@
"""
EmbeddingGemma 2 ローカル実行 (onnx-community/embeddinggemma-2-ONNX)
onnxruntime + tokenizers + huggingface_hub だけで動かす(transformers の対応を待たない)。
前処理は Transformers.js の Gemma4ImageProcessor / EmbeddingGemma2Processor の移植:
画像 -> アスペクト比維持でリサイズ(48px倍数, 最大2520パッチ) -> 16pxパッチ化 -> vision_encoder
-> image_features を text model の <|image|> トークン位置に差し込み -> sentence_embedding(768)
モデルは初回のみ固定リポジトリからダウンロードする(約300MB, q4)。
"""
import logging
import math
import os
import threading
from pathlib import Path
import numpy as np
logger = logging.getLogger(__name__)
REPO_ID = "onnx-community/embeddinggemma-2-ONNX"
LOCAL_MODEL = "embeddinggemma-2"
LOCAL_DIMS = (128, 256, 512, 768) # MRL対応次元
DEFAULT_LOCAL_DIM = 768
# 量子化精度 -> ファイル名サフィックス
DTYPES = {"q4": "_q4", "q8": "_quantized", "fp16": "_fp16", "fp32": ""}
DEFAULT_DTYPE = "q4"
_PATCH = 16
_POOL = 3
SOFT_TOKENS = (70, 140, 280) # 画像1枚あたりのソフトトークン数(多いほど高精度・低速)
DEFAULT_SOFT = 280
_MAX_TOKENS = 1024 # テキスト入力のトークン数上限(画像用プロンプトは約290トークン)
_MAX_IMAGE_SIDE = 2048 # 画像の長辺上限(超える場合は縮小してから処理)
_IMAGE_TOKEN = "<|image|>"
_BOI = "<|image>"
_EOI = "<image|>"
DEVICES = ("auto", "cpu", "cuda", "dml")
_PROVIDER_BY_DEVICE = {"cuda": "CUDAExecutionProvider", "dml": "DmlExecutionProvider"}
_lock = threading.Lock()
_runtime = None # ((dtype, device, threads), _Runtime)
_opts = {"device": "auto", "threads": 0} # 実行デバイス/CPUスレッド数(configureで更新)
def configure(device: str = "auto", threads: int = 0) -> None:
"""ローカル推論の実行設定。次回のensure_runtimeから反映(device/threads変更時はセッション再作成)。"""
_opts["device"] = device if device in DEVICES else "auto"
_opts["threads"] = max(0, min(int(threads), (os.cpu_count() or 1) * 2))
def current_config() -> dict:
return dict(_opts)
def release() -> None:
"""セッションを破棄してVRAM/RAMを解放する(インデックス作成後など)。次回利用時に再ロードされる。"""
global _runtime
with _lock:
_runtime = None
def active_provider() -> str:
"""直近にロードしたセッションの実行プロバイダ(未ロードなら空)"""
rt = _runtime[1] if _runtime else None
return rt.providers[0].replace("ExecutionProvider", "") if rt else ""
def available_devices() -> dict:
"""onnxruntime が使える実行デバイス。GPU用ビルド(onnxruntime-gpu / -directml)が無ければcpuのみ。"""
try:
import onnxruntime as ort
prov = ort.get_available_providers()
version = ort.__version__
except Exception:
return {"cpu": True, "cuda": False, "dml": False, "ort_version": ""}
return {"cpu": True, "cuda": "CUDAExecutionProvider" in prov, "dml": "DmlExecutionProvider" in prov,
"ort_version": version, "cpu_count": os.cpu_count() or 1}
def default_threads() -> int:
"""既定のCPUスレッド数: 画像生成と同居しても邪魔になりにくいよう、コアの半分(最低1)"""
return max(1, (os.cpu_count() or 2) // 2)
def _target_size(h: int, w: int, max_patches: int) -> tuple[int, int]:
"""Gemma4ImageProcessor の get_aspect_ratio_preserving_size"""
factor = math.sqrt(max_patches * _PATCH ** 2 / (h * w))
side = _POOL * _PATCH
th = int(math.floor(factor * h / side)) * side
tw = int(math.floor(factor * w / side)) * side
max_side = (max_patches // _POOL ** 2) * side
if th == 0 and tw == 0:
raise ValueError("image too small")
if th == 0:
th, tw = side, min((w // h) * side, max_side)
elif tw == 0:
tw, th = side, min((h // w) * side, max_side)
return th, tw
class _Runtime:
def __init__(self, model_dir: Path, dtype: str, device: str = "auto", threads: int = 0):
import onnxruntime as ort
from tokenizers import Tokenizer
sfx = DTYPES[dtype]
so = ort.SessionOptions()
so.log_severity_level = 3 # CUDA使用時のMemcpy警告などを抑止
if threads > 0:
so.intra_op_num_threads = threads
so.inter_op_num_threads = 1
avail = ort.get_available_providers()
if device in _PROVIDER_BY_DEVICE:
providers = [_PROVIDER_BY_DEVICE[device]] if _PROVIDER_BY_DEVICE[device] in avail else []
elif device == "cpu":
providers = []
else: # auto: 使えるGPUを優先
providers = [p for p in ("CUDAExecutionProvider", "DmlExecutionProvider") if p in avail]
if "DmlExecutionProvider" in providers:
# DirectMLは並列実行/メモリパターン最適化に非対応
so.enable_mem_pattern = False
so.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL
providers.append("CPUExecutionProvider")
self.providers = providers
def make(name):
path = str(model_dir / "onnx" / f"{name}{sfx}.onnx")
try:
return ort.InferenceSession(path, so, providers=providers)
except Exception as e:
if providers == ["CPUExecutionProvider"]:
raise
logger.warning("EmbeddingGemma2: %s failed on %s (%s); falling back to CPU", name, providers[0], e)
self.providers = ["CPUExecutionProvider"]
return ort.InferenceSession(path, so, providers=["CPUExecutionProvider"])
self.text = make("model")
self.vision = make("vision_encoder")
self.tok = Tokenizer.from_file(str(model_dir / "tokenizer.json"))
self.tok.no_truncation()
self.tok.no_padding()
def _run_text(self, text: str, image_features: np.ndarray | None) -> np.ndarray:
ids = np.asarray([self.tok.encode(text).ids[:_MAX_TOKENS]], dtype=np.int64)
feeds = {
"input_ids": ids,
"attention_mask": np.ones_like(ids),
"image_features": image_features if image_features is not None else np.zeros((0, 512), np.float32),
"video_features": np.zeros((0, 512), np.float32),
"audio_features": np.zeros((0, 512), np.float32),
}
return self.text.run(["sentence_embedding"], feeds)[0][0]
def embed_text(self, text: str, prefix: str) -> np.ndarray:
return self._run_text(f"{prefix}{text.strip()}", None)
def embed_image(self, image, soft_tokens: int = DEFAULT_SOFT) -> np.ndarray:
from PIL import Image
im = image.convert("RGB")
if im.width < 1 or im.height < 1:
raise ValueError("empty image")
if max(im.size) > _MAX_IMAGE_SIDE: # 巨大画像でメモリを使い切らないよう先に縮小
im.thumbnail((_MAX_IMAGE_SIDE, _MAX_IMAGE_SIDE), Image.LANCZOS)
max_patches = soft_tokens * _POOL ** 2
th, tw = _target_size(im.height, im.width, max_patches)
if (th, tw) != (im.height, im.width):
im = im.resize((tw, th), Image.BICUBIC)
arr = np.asarray(im, dtype=np.float32) * (1.0 / 255.0) # H,W,3
ph, pw = th // _PATCH, tw // _PATCH
n = ph * pw
# (pH, dy, pW, dx, C) -> (pH, pW, dy, dx, C) -> (n, 768)
patches = arr.reshape(ph, _PATCH, pw, _PATCH, 3).transpose(0, 2, 1, 3, 4).reshape(n, _PATCH * _PATCH * 3)
# パディング無し(n個ちょうど)で渡す: 計算量が減り、パディングは出力に影響しない
pixel = patches[None].astype(np.float32)
pos = np.zeros((1, n, 2), dtype=np.int64)
rows, cols = np.divmod(np.arange(n), pw)
pos[0, :, 0], pos[0, :, 1] = cols, rows
feats = self.vision.run(["image_features"], {"pixel_values": pixel, "pixel_position_ids": pos})[0]
text = f"{_BOI}{_IMAGE_TOKEN * (n // _POOL ** 2)}{_EOI}"
return self._run_text(text, feats.astype(np.float32))
def model_dir(data_dir: Path) -> Path:
return data_dir / "models" / LOCAL_MODEL
def is_downloaded(data_dir: Path, dtype: str = DEFAULT_DTYPE) -> bool:
d, sfx = model_dir(data_dir), DTYPES.get(dtype, "_q4")
need = [d / "tokenizer.json"] + [d / "onnx" / f"{n}{sfx}.onnx{e}" for n in ("model", "vision_encoder") for e in ("", "_data")]
return all(p.exists() for p in need)
def ensure_runtime(data_dir: Path, dtype: str = DEFAULT_DTYPE, progress=None,
device: str | None = None, threads: int | None = None) -> _Runtime:
"""モデルをダウンロード(未取得時)してセッションを返す。dtype/device/threads変更時は作り直す。"""
global _runtime
if dtype not in DTYPES:
dtype = DEFAULT_DTYPE
device = _opts["device"] if device is None else device
threads = _opts["threads"] if threads is None else threads
if device not in DEVICES:
device = "auto"
key = (dtype, device, int(threads))
with _lock:
if _runtime and _runtime[0] == key:
return _runtime[1]
d, sfx = model_dir(data_dir), DTYPES[dtype]
if not is_downloaded(data_dir, dtype):
if progress:
progress("downloading")
from huggingface_hub import hf_hub_download
files = ["tokenizer.json"] + [f"onnx/{n}{sfx}.onnx{e}" for n in ("model", "vision_encoder") for e in ("", "_data")]
for f in files:
hf_hub_download(REPO_ID, f, local_dir=str(d))
if progress:
progress("loading")
_runtime = (key, _Runtime(d, dtype, device, int(threads)))
return _runtime[1]
def _finish(vec: np.ndarray, dim: int) -> np.ndarray:
v = np.asarray(vec, dtype=np.float32)
if dim < v.shape[0]:
v = v[:dim]
n = float(np.linalg.norm(v))
return v / n if n > 0 else v
def embed_text(data_dir: Path, text: str, dim: int, dtype: str = DEFAULT_DTYPE) -> np.ndarray:
rt = ensure_runtime(data_dir, dtype)
return _finish(rt.embed_text(text[:8000], "task: search result | query: "), dim)
def embed_image(data_dir: Path, image, dim: int, soft: int = DEFAULT_SOFT, dtype: str = DEFAULT_DTYPE) -> np.ndarray:
rt = ensure_runtime(data_dir, dtype)
return _finish(rt.embed_image(image, soft if soft in SOFT_TOKENS else DEFAULT_SOFT), dim)
+211
View File
@@ -0,0 +1,211 @@
"""
EmbeddingGemma 2 を Ollama で実行する (Gallery セマンティック検索のローカルバックエンド)
画像は /api/embed に input=[{"image": <base64>}] で渡す(images フィールドは無視されテキスト扱いになる)。
740m(テキスト+画像+音声) と 440m(テキスト+画像) は同じ重みで同じベクトルを返すため、
インデックスにはタグを区別せず LOCAL_MODEL として記録する。270m/570m は画像非対応なので選択肢に入れない。
接続先は url_guard で検査する(既定はループバックのみ)。
"""
import base64
import io
import json
import logging
import threading
import time
import urllib.error
import urllib.request
import numpy as np
from . import url_guard
logger = logging.getLogger(__name__)
LOCAL_MODEL = "embeddinggemma-2" # インデックス(npz)に記録するモデル名
LOCAL_DIMS = (128, 256, 512, 768) # MRL対応次元
DEFAULT_LOCAL_DIM = 768
TAGS = ("embeddinggemma-2:740m", "embeddinggemma-2:440m")
DEFAULT_TAG = TAGS[0]
# :latest は 740m と同じモデル(parent_model 740m-q8_0)。740m が無ければ代わりに使う
_ALIASES = {"embeddinggemma-2:740m": ("embeddinggemma-2:latest", "embeddinggemma-2")}
DEFAULT_URL = "http://localhost:11434"
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}
_tags_cache = {"at": 0.0, "url": "", "names": None, "error": ""}
_lock = threading.Lock()
class OllamaError(Exception):
"""code: ollama_unreachable / ollama_model_missing / local_error"""
def __init__(self, code: str, message: str = ""):
super().__init__(message or code)
self.code = code
def configure(url: str = DEFAULT_URL, tag: str = DEFAULT_TAG) -> None:
"""接続先とモデルサイズを設定する。許可されないURLは ValueError(url_guard.HINT)。"""
url = url_guard.require_backend_url((url or "").strip() or DEFAULT_URL)
with _lock:
_opts["url"] = url
_opts["tag"] = tag if tag in TAGS else DEFAULT_TAG
_tags_cache["at"] = 0.0
def current_config() -> dict:
return dict(_opts)
def _post(path: str, body: dict, timeout: float = _TIMEOUT) -> dict:
base = url_guard.require_backend_url(_opts["url"])
req = urllib.request.Request(base + path, data=json.dumps(body).encode("utf-8"), method="POST",
headers={"Content-Type": "application/json"})
with url_guard.urlopen(req, timeout) as res:
return json.loads(res.read().decode("utf-8"))
def _http_message(e: urllib.error.HTTPError) -> str:
try:
return json.loads(e.read().decode("utf-8")).get("error", "") or str(e.reason)
except Exception:
return str(e.reason)
def _transient(code: int, msg: str) -> bool:
low = msg.lower()
if "failed to load image" in low:
return False # 壊れた画像。再試行しても直らない
if code >= 500:
return True
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]:
"""(インストール済みモデル名, エラー)。接続できなければ (None, エラー文)。"""
now = time.time()
with _lock:
c = dict(_tags_cache)
url = _opts["url"]
if not force and c["url"] == url and now - c["at"] < _TAGS_TTL:
return c["names"], c["error"]
names, err = None, ""
try:
base = url_guard.require_backend_url(url)
with url_guard.urlopen(urllib.request.Request(base + "/api/tags"), 3) as res:
data = json.loads(res.read().decode("utf-8"))
names = [m.get("name") or m.get("model") or "" for m in data.get("models", [])]
except Exception as e:
err = str(getattr(e, "reason", e))
with _lock:
_tags_cache.update(at=now, url=url, names=names, error=err)
return names, err
def _resolve(names: list[str], tag: str) -> str:
"""実際に呼ぶモデル名。未インストールなら空文字"""
for cand in (tag,) + _ALIASES.get(tag, ()):
if cand in names:
return cand
return ""
def status() -> dict:
names, err = installed_tags()
tag = _opts["tag"]
out = {"url": _opts["url"], "tag": tag, "tags": list(TAGS), "reachable": names is not None, "error": err,
"installed": {t: bool(names and _resolve(names, t)) for t in TAGS}}
out["ready"] = bool(out["reachable"] and out["installed"][tag])
return out
def _model_name() -> str:
names, err = installed_tags()
if names is None:
raise OllamaError("ollama_unreachable", f"{_opts['url']}: {err}")
name = _resolve(names, _opts["tag"])
if not name:
raise OllamaError("ollama_model_missing", _opts["tag"])
return name
def _embed(inputs: list) -> list[np.ndarray]:
model = _model_name()
last = ""
for attempt in range(_RETRIES + 1):
try:
data = _post("/api/embed", {"model": model, "input": inputs})
embs = data.get("embeddings") or []
if len(embs) != len(inputs):
raise OllamaError("local_error", f"expected {len(inputs)} embeddings, got {len(embs)}")
return [np.asarray(e, dtype=np.float32) for e in embs]
except urllib.error.HTTPError as e:
msg = _http_message(e)
last = f"HTTP {e.code}: {msg}"
if e.code == 404:
with _lock:
_tags_cache["at"] = 0.0 # 削除された可能性があるので次回は問い合わせ直す
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:
raise OllamaError("ollama_unreachable", f"{_opts['url']}: {last}")
time.sleep(min(4.0, 0.5 * (2 ** attempt)))
raise OllamaError("local_error", last)
def _finish(vec: np.ndarray, dim: int) -> np.ndarray:
v = vec[:dim] if dim < vec.shape[0] else vec
n = float(np.linalg.norm(v))
return v / n if n > 0 else v
def _image_b64(image) -> str:
buf = io.BytesIO()
image.convert("RGB").save(buf, "JPEG", quality=88)
return base64.b64encode(buf.getvalue()).decode("ascii")
def embed_text(text: str, dim: int) -> np.ndarray:
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]:
"""PIL画像(RGB)のリストをまとめて埋め込む。1枚でも読めないとリクエスト全体が失敗する。"""
return [_finish(v, dim) for v in _embed([{"image": _image_b64(im)} for im in images])]
def release() -> None:
"""モデルをVRAMから外す(インデックス作成後)。次回利用時にOllamaが再ロードする。"""
try:
names, _ = installed_tags()
name = _resolve(names or [], _opts["tag"])
if name:
_post("/api/embed", {"model": name, "input": [], "keep_alive": 0}, timeout=30)
except Exception as e:
logger.debug("semantic_ollama: release failed: %s", e)
+137 -74
View File
@@ -1,7 +1,7 @@
"""
Semantic Service - Gallery用セマンティック検索(Gemini Embedding 2)
Semantic Service - Gallery用セマンティック検索(Gemini Embedding 2 / Ollama の EmbeddingGemma 2)
画像(動画・PSDはサムネイル)をGemini Embedding APIでベクトル化してローカルに保存し、
画像(動画・PSDはサムネイル)をGemini Embedding API または Ollama でベクトル化してローカルに保存し、
テキストクエリ/類似画像でコサイン類似度検索する。インデックス構築後の検索は
(テキストクエリの埋め込み1回を除き)ローカル処理でAPI費用はかからない。
@@ -21,13 +21,13 @@ from pathlib import Path
import numpy as np
from . import semantic_local as local
from . import semantic_ollama as local
logger = logging.getLogger(__name__)
API_BASE = "https://generativelanguage.googleapis.com/v1beta"
MODEL = "gemini-embedding-2" # Gemini API (クラウド)
LOCAL_MODEL = local.LOCAL_MODEL # EmbeddingGemma 2 (ローカルONNX)
LOCAL_MODEL = local.LOCAL_MODEL # EmbeddingGemma 2 (Ollama)
DEFAULT_DIM = 1536
VALID_DIMS = (768, 1536, 3072)
# バックエンド(モデル名) -> 選択可能な出力次元
@@ -126,7 +126,6 @@ class SemanticService:
self._stamp: dict[str, tuple[int, float]] = {} # path -> (size, mtime)
self._dim = 0 # インデックスの次元(0=空)
self._model = MODEL # インデックスを作ったモデル
self._soft = local.DEFAULT_SOFT # ローカルモデルの画像ソフトトークン数(インデックスと一致させる)
self._settings_file = data_dir / "semantic_settings.json"
self._load_settings()
self._mat_cache = None # (paths, matrix)
@@ -137,21 +136,22 @@ class SemanticService:
self._cancel = threading.Event()
self._thread: threading.Thread | None = None
# ── ローカル推論の実行設定(デバイス/スレッド数) ─────────────
# ── Ollama の接続先/モデルサイズ ────────────────────────
def _load_settings(self) -> None:
try:
if self._settings_file.exists():
d = json.loads(self._settings_file.read_text(encoding="utf-8"))
local.configure(str(d.get("device", "auto")), int(d.get("threads", 0)))
return
local.configure(str(d.get("url", local.DEFAULT_URL)), str(d.get("tag", local.DEFAULT_TAG)))
except Exception as e:
logger.warning("SemanticService: failed to load settings: %s", e)
local.configure("auto", local.default_threads())
def set_local_options(self, device: str, threads: int) -> None:
"""実行デバイス/CPUスレッド数を反映して保存する(検索時のクエリ埋め込みにも使われる)"""
local.configure(device, threads)
def set_local_options(self, url: str, tag: str) -> None:
"""Ollama の接続先/モデルサイズを反映して保存する(検索時のクエリ埋め込みにも使われる)"""
try:
local.configure(url, tag)
except ValueError as e:
raise SemanticError("bad_url", str(e))
try:
self._settings_file.write_text(json.dumps(local.current_config()), encoding="utf-8")
except Exception as e:
@@ -177,7 +177,6 @@ class SemanticService:
if model not in DIMS_BY_MODEL:
return
self._model = model
self._soft = int(z["soft"]) if "soft" in z.files else local.DEFAULT_SOFT
paths = [str(p) for p in z["paths"]]
sizes, mtimes, vecs = z["sizes"], z["mtimes"], z["vecs"]
self._dim = int(z["dim"])
@@ -201,7 +200,7 @@ class SemanticService:
tmp = self._file.with_suffix(".tmp.npz")
np.savez(
tmp,
model=np.array(self._model), dim=np.array(self._dim), soft=np.array(self._soft),
model=np.array(self._model), dim=np.array(self._dim),
paths=np.array(paths),
sizes=np.array([self._stamp[p][0] for p in paths], dtype=np.int64),
mtimes=np.array([self._stamp[p][1] for p in paths], dtype=np.float64),
@@ -228,24 +227,18 @@ class SemanticService:
def status(self, folder: str = "", recursive: bool = True) -> dict:
self._ensure_loaded()
ollama = local.status()
out = {
"has_key": bool(get_api_key()),
"model": MODEL,
"backends": {
MODEL: {"dims": list(VALID_DIMS), "default_dim": DEFAULT_DIM, "ready": bool(get_api_key())},
LOCAL_MODEL: {"dims": list(local.LOCAL_DIMS), "default_dim": local.DEFAULT_LOCAL_DIM,
"ready": True, "downloaded": local.is_downloaded(self.data_dir)},
"ready": ollama["ready"]},
},
"index_model": self._model,
"index_dim": self._dim,
"index_soft": self._soft,
"local": {
"devices": local.available_devices(),
"options": local.current_config(),
"default_threads": local.default_threads(),
"soft_tokens": list(local.SOFT_TOKENS),
"default_soft": local.DEFAULT_SOFT,
},
"ollama": ollama,
"indexed_total": len(self._vecs),
"job": dict(self._job),
}
@@ -279,8 +272,7 @@ class SemanticService:
# ── インデックス作成ジョブ ────────────────────────────
def start_index(self, folder: str, recursive: bool, mode: str, model: str, dim: int,
soft: int = local.DEFAULT_SOFT) -> None:
def start_index(self, folder: str, recursive: bool, mode: str, model: str, dim: int) -> None:
self._ensure_loaded()
if model not in DIMS_BY_MODEL:
raise SemanticError("bad_model", model)
@@ -288,15 +280,19 @@ class SemanticService:
raise SemanticError("no_api_key")
if dim not in DIMS_BY_MODEL[model]:
raise SemanticError("bad_dim", str(dim))
if model != LOCAL_MODEL or soft not in local.SOFT_TOKENS:
soft = local.DEFAULT_SOFT # ソフトトークン数はローカルモデルのみの設定
if model == LOCAL_MODEL:
st = local.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"])
with self._lock:
if self._job["running"]:
raise SemanticError("already_running")
entries = self._scope_entries(folder, recursive)
mismatch = bool(self._vecs) and (self._dim != dim or self._model != model or self._soft != soft)
mismatch = bool(self._vecs) and (self._dim != dim or self._model != model)
if mismatch and mode != "all":
raise SemanticError("dim_mismatch", f"{self._model}/{self._dim}/{self._soft}")
raise SemanticError("dim_mismatch", f"{self._model}/{self._dim}")
if mode == "all":
# 範囲内の既存ベクトルを破棄して作り直す(モデル/次元違いなら全消去)
if mismatch:
@@ -309,14 +305,13 @@ class SemanticService:
self._mat_cache = None
self._dim = dim
self._model = model
self._soft = soft
todo = [e for e in entries if not self._is_fresh(e[1], e[2], e[3])]
# スコープ内で消えたファイルの残骸を掃除(スコープ配下のキーのみ)
self._prune_missing(folder, recursive, {e[1] for e in entries})
self._cancel.clear()
self._job = self._idle_job()
self._job.update(running=True, total=len(todo))
self._thread = threading.Thread(target=self._run_index, args=(todo, model, dim, soft), daemon=True)
self._thread = threading.Thread(target=self._run_index, args=(todo, model, dim), daemon=True)
self._thread.start()
def _prune_missing(self, folder: str, recursive: bool, existing: set[str]) -> None:
@@ -335,52 +330,78 @@ class SemanticService:
def cancel(self) -> None:
self._cancel.set()
def _run_index(self, todo: list, model: str, dim: int, soft: int = local.DEFAULT_SOFT) -> None:
def work(entry):
if self._cancel.is_set():
return
name, ap, size, mtime = entry
self._job["current"] = name
try:
vec = self._embed_image(model, dim, Path(ap), soft)
self._put(ap, vec, size, mtime)
self._job["done"] += 1
except SemanticError as e:
if e.code in ("no_api_key", "api_key_invalid"):
self._job["error_code"], self._job["error"] = e.code, str(e)
self._cancel.set()
else:
self._job["failed"] += 1
if not self._job["error"]:
self._job["error_code"], self._job["error"] = e.code, str(e)
except Exception as e:
logger.warning("SemanticService: embed failed for %s: %s", ap, e)
def _run_index(self, todo: list, model: str, dim: int) -> None:
def fail(e: SemanticError) -> None:
if e.code in ("no_api_key", "api_key_invalid", "ollama_unreachable", "ollama_model_missing"):
# 続けても全件失敗するので中止する
self._job["error_code"], self._job["error"] = e.code, str(e)
self._cancel.set()
else:
self._job["failed"] += 1
if not self._job["error"]:
self._job["error_code"], self._job["error"] = e.code, str(e)
def checkpoint() -> None:
if self._dirty >= _CHECKPOINT_EVERY:
try:
self._save()
except Exception as e:
logger.warning("SemanticService: checkpoint failed: %s", e)
def work(entry):
if self._cancel.is_set():
return
name, ap, size, mtime = entry
self._job["current"] = name
try:
vec = self._embed_image(model, dim, Path(ap))
self._put(ap, vec, size, mtime)
self._job["done"] += 1
except SemanticError as e:
fail(e)
except Exception as e:
logger.warning("SemanticService: embed failed for %s: %s", ap, e)
self._job["failed"] += 1
checkpoint()
def work_batch(batch):
"""Ollama: まとめて送る。失敗したら1枚ずつ送り直して原因の画像だけを失敗扱いにする"""
if self._cancel.is_set():
return
self._job["current"] = batch[0][0]
vecs = None
try:
ims = [self._load_local_image(Path(e[1])) for e in batch]
vecs = local.embed_images(ims, dim)
except local.OllamaError as e:
if e.code != "local_error":
fail(SemanticError(e.code, str(e)))
return
except Exception:
pass
if vecs is None:
for entry in batch:
work(entry)
return
for (name, ap, size, mtime), vec in zip(batch, vecs):
self._put(ap, vec, size, mtime)
self._job["done"] += 1
checkpoint()
try:
if model == LOCAL_MODEL:
# 初回はモデルのダウンロード/ロードを先に行う(失敗したらジョブ全体を中止)
try:
local.ensure_runtime(self.data_dir, progress=lambda ph: self._job.update(current=f"({ph} model...)"))
except Exception as e:
logger.warning("SemanticService: local model load failed: %s", e)
self._job["error_code"], self._job["error"] = "local_error", str(e)
self._cancel.set()
workers = 1 if model == LOCAL_MODEL else _WORKERS # ローカルはORT側がマルチスレッド
with ThreadPoolExecutor(max_workers=workers) as ex:
list(ex.map(work, todo))
for i in range(0, len(todo), local.BATCH):
work_batch(todo[i:i + local.BATCH])
else:
with ThreadPoolExecutor(max_workers=_WORKERS) as ex:
list(ex.map(work, todo))
finally:
try:
self._save()
except Exception as e:
logger.warning("SemanticService: save failed: %s", e)
if model == LOCAL_MODEL:
local.release() # 画像生成とVRAM/RAMを奪い合わないよう、作成後はモデルを解放(検索時に再ロード)
local.release() # 画像生成とVRAMを奪い合わないよう、作成後はモデルを外す(検索時にOllamaが再ロード)
self._job["running"] = False
self._job["finished"] = True
self._job["cancelled"] = self._cancel.is_set() and not self._job["error_code"]
@@ -401,18 +422,24 @@ class SemanticService:
im.thumbnail((IMAGE_MAX_SIZE, IMAGE_MAX_SIZE), Image.LANCZOS)
return im
def _embed_image(self, model: str, dim: int, path: Path, soft: int | None = None) -> np.ndarray:
def _load_local_image(self, path: Path):
"""Ollama用のRGB画像(透過部は白背景に合成)"""
from PIL import Image
im = self._load_pil(path)
if im.mode == "RGBA":
bg = Image.new("RGB", im.size, (255, 255, 255))
bg.paste(im, mask=im.getchannel("A"))
return bg
return im
def _embed_image(self, model: str, dim: int, path: Path) -> np.ndarray:
if model == LOCAL_MODEL:
if im.mode == "RGBA": # 透過部は白背景に合成
bg = Image.new("RGB", im.size, (255, 255, 255))
bg.paste(im, mask=im.getchannel("A"))
im = bg
im = self._load_local_image(path)
try:
return local.embed_image(self.data_dir, im, dim, self._soft if soft is None else soft)
except Exception as e:
raise SemanticError("local_error", str(e))
return local.embed_images([im], dim)[0]
except local.OllamaError as e:
raise SemanticError(e.code, str(e))
im = self._load_pil(path)
buf = io.BytesIO()
if im.mode == "RGBA":
im.save(buf, "PNG")
@@ -423,11 +450,47 @@ class SemanticService:
def _embed_text(self, model: str, dim: int, text: str) -> np.ndarray:
if model == LOCAL_MODEL:
try:
return local.embed_text(self.data_dir, text, dim)
except Exception as e:
raise SemanticError("local_error", str(e))
return local.embed_text(text, dim)
except local.OllamaError as e:
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):
@@ -510,4 +573,4 @@ class SemanticService:
if dim not in DIMS_BY_MODEL[model]:
dim = DEFAULT_DIM_BY_MODEL[model]
n = int(self._embed_text(model, dim, "test").shape[0])
return {"dimensions": n, "provider": local.active_provider() if model == LOCAL_MODEL else "API"}
return {"dimensions": n, "provider": f"Ollama {local.current_config()['tag']}" if model == LOCAL_MODEL else "API"}
+88 -1
View File
@@ -72,7 +72,10 @@ class TaggerService:
continue
exts = {f.suffix.lower() for f in item.iterdir() if f.is_file()}
if ".onnx" in exts:
models.append({"name": item.name, "type": "onnx"})
entry = {"name": item.name, "type": "onnx"}
if (item / "preprocess.json").exists() and (item / "selected_tags.csv").exists():
entry["pixai"] = True
models.append(entry)
elif ".h5" in exts:
models.append({"name": item.name, "type": "deepdanbooru"})
return models
@@ -128,6 +131,9 @@ class TaggerService:
"input_shape": session.get_inputs()[0].shape,
"type": "onnx",
}
categories = self._load_pixai_categories(model_dir, len(labels))
if categories:
data["pixai_categories"] = categories
self._cache[name] = data
logger.info("ONNX loaded: %s (%d labels)", name, len(labels))
return data
@@ -173,6 +179,20 @@ class TaggerService:
logger.warning("Label load failed %s: %s", p, e)
return []
@staticmethod
def _load_pixai_categories(model_dir: Path, n_labels: int) -> Optional[list]:
"""PixAI Tagger形式(preprocess.json + selected_tags.csvのcategory列)ならカテゴリ番号の配列を返す。"""
if not (model_dir / "preprocess.json").exists():
return None
csv_path = model_dir / "selected_tags.csv"
try:
with open(csv_path, "r", encoding="utf-8-sig", newline="") as f:
rows = list(csv.DictReader(f))
cats = [int(r["category"]) for r in rows]
except Exception:
return None
return cats if cats and len(cats) == n_labels else None
# ── 推論(WD Tagger / DeepDanbooru) ────────────────────
def predict(self, image_b64: str, model_name: str, threshold: float = 0.35, char_threshold: float = 0.85) -> dict:
@@ -190,7 +210,74 @@ 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に追従する。
_PIXAI_THRESHOLDS = {0: 0.17, 1: 0.15, 3: 0.24, 4: 0.27}
_PIXAI_BASE = {"general": 0.17, "character": 0.27}
_PIXAI_SIZE = 1008
def _predict_pixai(self, img: Image.Image, data: dict, thr: float, char_thr: float) -> list:
"""PixAI Tagger v1.0: 白背景合成 → 黒パディングで1008角 → RGB, (x/255-0.5)/0.5, NCHW。出力はsigmoid済み確率。"""
size = self._PIXAI_SIZE
img = ImageOps.exif_transpose(img)
if img.mode != "RGBA":
img = img.convert("RGBA")
canvas = Image.new("RGBA", img.size, (255, 255, 255, 255))
canvas.alpha_composite(img)
img = canvas.convert("RGB")
scale = size / max(img.size)
w, h = max(1, round(img.width * scale)), max(1, round(img.height * scale))
img = img.resize((w, h), Image.Resampling.BICUBIC)
padded = Image.new("RGB", (size, size), (0, 0, 0))
padded.paste(img, ((size - w) // 2, (size - h) // 2))
arr = (np.asarray(padded, dtype=np.float32) / 255.0 - 0.5) / 0.5
arr = np.ascontiguousarray(arr.transpose(2, 0, 1)[None])
preds = data["session"].run(None, {data["input_name"]: arr})[0][0]
d_gen = thr - self._PIXAI_BASE["general"]
d_chr = char_thr - self._PIXAI_BASE["character"]
limits = {
c: max(0.0, min(1.0, base + (d_gen if c in (0, 1) else d_chr)))
for c, base in self._PIXAI_THRESHOLDS.items()
}
labels, cats = data["labels"], data["pixai_categories"]
picked = [
(float(score), labels[i])
for i, score in enumerate(preds)
if i < len(labels) and float(score) >= limits.get(cats[i], 2.0)
]
picked.sort(key=lambda t: t[0], reverse=True)
return [name for _, name in picked]
def _predict_onnx(self, img: Image.Image, data: dict, thr: float, char_thr: float) -> list:
if data.get("pixai_categories"):
return self._predict_pixai(img, data, thr, char_thr)
shape = data["input_shape"]
fmt = "NHWC"
size = 224
+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")}
+62
View File
@@ -237,6 +237,68 @@ class VideoService:
save_path.write_bytes(image_bytes)
return {"filename": save_name, "subfolder": subfolder}
@staticmethod
def _unique_output_path(stem: str, ext: str) -> tuple[Path, str]:
"""output/video/ 配下で未使用のパスを決める。戻り値は (絶対パス, subfolder)。"""
import folder_paths # type: ignore
subfolder = "video"
out_dir = Path(folder_paths.get_output_directory()) / subfolder
out_dir.mkdir(parents=True, exist_ok=True)
dst = out_dir / f"{stem}{ext}"
counter = 1
while dst.exists():
dst = out_dir / f"{stem}_{counter}{ext}"
counter += 1
return dst, subfolder
def register_asset(self, filename: str, subfolder: str, type_: str) -> dict:
"""Video Sourceの動画をGalleryに載せるため、outputフォルダ配下の実体にする。
既にoutput配下ならそのまま、input/tempならoutput/videoへコピーする。"""
import shutil
src = self._resolve_media_path(filename, subfolder, type_)
if type_ == "output":
return {"filename": src.name, "subfolder": subfolder or "", "path": str(src).replace("\\", "/")}
dst, out_sub = self._unique_output_path(src.stem, src.suffix)
shutil.copy2(src, dst)
return {"filename": dst.name, "subfolder": out_sub, "path": str(dst).replace("\\", "/")}
def convert_audio_to_output(self, filename: str, subfolder: str, type_: str, opts: dict) -> dict:
"""動画/音声クリップの音声を指定形式へ変換し、output/videoへ保存する。"""
from .convert_service import OUTPUT_FORMATS, convert_audio, supports_tags
fmt = str(opts.get("format", ""))
if fmt not in OUTPUT_FORMATS:
raise ValueError(f"Unsupported format: {fmt}")
def _int(key: str) -> int:
try:
return max(0, int(opts.get(key) or 0))
except (TypeError, ValueError):
return 0
src = self._resolve_media_path(filename, subfolder, type_)
inherit = bool(opts.get("inherit_metadata", True))
dst, out_sub = self._unique_output_path(src.stem, OUTPUT_FORMATS[fmt]["ext"])
try:
convert_audio(
src, dst, fmt,
bitrate_kbps=_int("bitrate"),
sample_rate=_int("sample_rate"),
channels=str(opts.get("channels", "keep")),
inherit_metadata=inherit,
)
except Exception:
dst.unlink(missing_ok=True)
raise
return {
"filename": dst.name,
"subfolder": out_sub,
"path": str(dst).replace("\\", "/"),
"tags_skipped": inherit and not supports_tags(fmt),
}
def probe_video(self, filename: str, subfolder: str, type_: str) -> dict:
"""Reads duration/dimensions/fps/audio presence via PyAV only (no ffmpeg
subprocess) — used by the Video Edit tab right after a clip is added, so
+3 -1
View File
@@ -99,12 +99,13 @@ class WorkflowStudio:
app.router.add_get("/wfm", serve_index_page)
# API routes
from .routes import workflow_routes, settings_routes, ollama_routes, unsloth_routes, eagle_routes, nodes_routes, prompts_routes, models_routes, gallery_routes, wildcard_routes, tagger_routes, gmic_routes, skill_routes, lab_routes, video_routes, vram_routes
from .routes import workflow_routes, settings_routes, ollama_routes, unsloth_routes, eagle_routes, nodes_routes, prompts_routes, models_routes, gallery_routes, wildcard_routes, tagger_routes, gmic_routes, skill_routes, lab_routes, video_routes, vram_routes, partner_routes, tagspace_routes
workflow_routes.setup_routes(app)
settings_routes.setup_routes(app)
ollama_routes.setup_routes(app)
unsloth_routes.setup_routes(app)
partner_routes.setup_routes(app)
eagle_routes.setup_routes(app)
nodes_routes.setup_routes(app)
prompts_routes.setup_routes(app)
@@ -117,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.3"
version = "0.9.2"
license = { file = "LICENSE" }
requires-python = ">= 3.10"
dependencies = ["jinja2"]
+3 -9
View File
@@ -34,12 +34,6 @@ psd-tools>=1.10
# (Gallery itself keeps working). Not pinned here on purpose — see torch note above.
# av>=17.0.0
# -- Gallery Semantic Search: local EmbeddingGemma 2 (optional) --
# Uses onnxruntime (above) + tokenizers + huggingface_hub (both normally pre-installed with ComfyUI's
# transformers). The model (~300 MB, q4) is downloaded to the data folder on first use.
# GPU (NVIDIA/CUDA): replace onnxruntime with onnxruntime-gpu
# pip uninstall onnxruntime onnxruntime-gpu
# pip install onnxruntime-gpu
# Local EmbeddingGemma 2 then indexes ~45x faster than on the CPU. DirectML is not supported.
# tokenizers
# huggingface_hub
# -- Gallery Semantic Search: EmbeddingGemma 2 (optional) --
# Runs in Ollama (no extra Python packages). Install Ollama and download the model:
# ollama pull embeddinggemma-2:740m (or embeddinggemma-2:440m - same vectors, no audio encoder)
+1
View File
@@ -1151,6 +1151,7 @@
.wfm-sem-pane { display: flex; flex-direction: column; gap: 10px; min-height: 230px; }
.wfm-sem-footer { justify-content: flex-end; border-top: 1px solid var(--wfm-border, #444); padding-top: 10px; }
.wfm-sem-num { width: 80px; }
.wfm-sem-url { width: 240px; max-width: 100%; }
.wfm-sem-danger { margin-left: auto; color: #ef4444; }
.wfm-sem-row .wfm-select { width: auto; min-width: 90px; }
+97
View File
@@ -984,6 +984,103 @@ body {
min-height: 0;
}
/* Input tab: Prompt (3) | Image (2) side by side. Wraps Image under Prompt when the column is narrow. */
.wfm-gen-params-col--input {
container-type: inline-size;
container-name: wfm-input;
min-width: 0;
}
.wfm-input-split {
display: flex;
flex: 1;
min-height: 0;
}
.wfm-input-inner-panel--prompt {
flex: 3 1 0;
min-width: 0;
border-right: 1px solid var(--wfm-border);
}
.wfm-input-inner-panel--image {
flex: 2 1 0;
min-width: 0;
}
.wfm-input-panel-title {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--wfm-text-secondary);
margin-bottom: 6px;
}
@container wfm-input (max-width: 720px) {
.wfm-input-split {
flex-direction: column;
overflow-y: auto;
}
.wfm-input-inner-panel--prompt,
.wfm-input-inner-panel--image {
flex: none;
overflow-y: visible;
border-right: none;
}
.wfm-input-inner-panel--prompt {
border-bottom: 1px solid var(--wfm-border);
}
}
/* Input tab Raw JSON: collapsible to a slim strip at the right edge */
.wfm-rawjson-collapse-btn {
display: flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
padding: 3px 10px;
background: var(--wfm-bg-secondary);
border: none;
border-bottom: 1px solid var(--wfm-border);
color: var(--wfm-text-secondary);
font-size: 11px;
cursor: pointer;
text-align: left;
}
.wfm-rawjson-collapse-btn:hover {
color: var(--wfm-text);
}
.wfm-rawjson-collapse-label {
display: none;
}
.wfm-gen-rawjson-col.wfm-gen-rawjson-col--collapsed {
width: 30px;
}
.wfm-gen-rawjson-col--collapsed .wfm-rawjson-collapse-btn {
flex: 1;
flex-direction: column;
justify-content: flex-start;
padding: 8px 0;
border-bottom: none;
border-left: 1px solid var(--wfm-border);
background: var(--wfm-bg-secondary);
}
.wfm-gen-rawjson-col--collapsed .wfm-rawjson-collapse-label {
display: block;
writing-mode: vertical-rl;
letter-spacing: 1px;
}
.wfm-gen-rawjson-col--collapsed #wfm-gen-rawjson-widget {
display: none !important;
}
/* Right sub-column: Raw JSON */
.wfm-gen-rawjson-col {
width: 540px;
+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; }
+39 -1
View File
@@ -821,6 +821,21 @@
border-top: 1px solid var(--wfm-border);
}
/* クロップ関連ボタンを左寄せにし、|区切りの右に音声変換を置く */
.wfm-video-edit-crop-head {
justify-content: flex-start;
}
.wfm-video-edit-crop-head > span:first-child {
margin-right: 4px;
}
.wfm-video-edit-head-sep {
color: var(--wfm-text-secondary);
font-weight: 400;
user-select: none;
}
.wfm-video-edit-crop-row {
display: flex;
align-items: end;
@@ -992,12 +1007,35 @@
}
.wfm-video-source-panel {
width: 220px;
width: 320px;
flex: none;
display: flex;
flex-direction: column;
}
/* ファイル名は1行(はみ出しは省略)、操作ボタン3つは折り返さず横一列 */
.wfm-video-source-status-line {
margin-top: 6px;
min-height: 1.4em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.wfm-video-source-actions {
display: flex;
gap: 6px;
margin-top: 6px;
}
.wfm-video-source-actions .wfm-btn {
flex: 1 1 auto;
min-width: 0;
padding-left: 6px;
padding-right: 6px;
white-space: nowrap;
}
.wfm-video-pane-header {
font-weight: 600;
margin-bottom: 4px;
+6 -2
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);
@@ -492,6 +492,7 @@ function applyI18nToHtml() {
"wfm-help-gen-29": "helpGen29",
"wfm-help-gen-30": "helpGen30",
"wfm-help-gen-31": "helpGen31",
"wfm-help-gen-32": "helpGen32",
"wfm-help-feeder-title": "helpFeederTitle",
"wfm-help-feeder-desc": "helpFeederDesc",
"wfm-help-feeder-imgloop-title": "helpFeederImgloopTitle",
@@ -587,10 +588,11 @@ function applyI18nToHtml() {
"wfm-help-gallery-26": "helpGallery26",
"wfm-help-gallery-28": "helpGallery28", "wfm-help-gallery-29": "helpGallery29",
"wfm-help-gallery-30": "helpGallery30", "wfm-help-gallery-31": "helpGallery31",
"wfm-help-gallery-32": "helpGallery32", "wfm-help-gallery-33": "helpGallery33", "wfm-help-gallery-34": "helpGallery34", "wfm-help-gallery-35": "helpGallery35", "wfm-help-gallery-36": "helpGallery36",
"wfm-help-gallery-32": "helpGallery32", "wfm-help-gallery-33": "helpGallery33", "wfm-help-gallery-34": "helpGallery34", "wfm-help-gallery-35": "helpGallery35", "wfm-help-gallery-36": "helpGallery36", "wfm-help-gallery-37": "helpGallery37",
"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",
@@ -844,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";
@@ -896,6 +899,7 @@ document.addEventListener("DOMContentLoaded", () => {
initGalleryTab();
initAiTab();
initTaggerTab();
initTagSpaceTab();
imageEditTab.init();
initVideoTab();
+24 -2
View File
@@ -4,6 +4,7 @@
*/
import { prepareVramForGeneration } from "./vram-prepare.js";
import { t } from "./i18n.js";
function _uuid() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -194,6 +195,21 @@ export const comfyUI = {
return this._fetchModelList(["KSampler"], "scheduler");
},
// パートナー(API)ノード(Nano Banana等)は /prompt の extra_data にComfyの認証情報が必要。ComfyUI画面は
// ログイン情報を自動で付けるが、本アプリの直接fetchは付けないため、サーバー側の COMFY_API_KEY(.env) が
// 設定されていれば WFSサーバー経由で投入してキーを付与する(キーはブラウザへ出さない)。
async isPartnerKeyConfigured() {
const now = Date.now();
if (this._partnerKey && now - this._partnerKey.at < 60000) return this._partnerKey.value;
let value = false;
try {
const res = await fetch("/api/wfm/partner/status");
if (res.ok) value = !!(await res.json()).configured;
} catch { /* 無視 */ }
this._partnerKey = { value, at: now };
return value;
},
// Generation
async queuePrompt(workflow, extraData = null) {
// Settings tab "VRAM Management": unload Ollama models to free VRAM (no-op when off, never throws)
@@ -203,7 +219,10 @@ export const comfyUI = {
client_id: this.clientId,
};
if (extraData) body.extra_data = extraData;
const res = await fetch(`${this.baseUrl}/prompt`, {
// 接続先が同一オリジン(このComfyUI)のときだけ中継を使う(別サーバーへキーを送らない)
const sameOrigin = !this.baseUrl || this.baseUrl === location.origin;
const viaProxy = sameOrigin && await this.isPartnerKeyConfigured();
const res = await fetch(viaProxy ? "/api/wfm/partner/prompt" : `${this.baseUrl}/prompt`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
@@ -251,7 +270,10 @@ export const comfyUI = {
}
}
if (msg.type === "execution_error" && msg.data?.prompt_id === promptId) {
finish(false, new Error(msg.data.exception_message || "Execution error"));
let message = msg.data.exception_message || "Execution error";
// パートナー(API)ノードの認証エラーには、設定方法を案内する
if (/Unauthorized|login first/i.test(message)) message = `${message.trim()} ${t("partnerAuthHint")}`;
finish(false, new Error(message));
}
if (msg.type === "execution_interrupted" && msg.data?.prompt_id === promptId) {
finish(false, new Error("Execution interrupted"));
+82 -3
View File
@@ -198,7 +198,59 @@ function _buildLoraManagerSyntax(stackModels) {
.join(" ");
}
// ── Native LoRA stack nodes (LoadLoraModel / LoadLoraTextEncoder) ─────────
// DynamicGroup rows are flat API keys "loras.<row>.lora_name|strength|enabled" (max 20,
// min 1). The Model node takes the model strength and the Text Encoder node the clip
// strength; every stack node in the workflow is written together so a single Apply /
// Bypass keeps the pair consistent.
const _LORA_STACK_STRENGTH = { LoadLoraModel: "strModel", LoadLoraTextEncoder: "strClip" };
function _isLoraStackNode(wfNode) {
return !!wfNode && Object.hasOwn(_LORA_STACK_STRENGTH, wfNode.class_type);
}
function _readLoraStackRows(inputs) {
const rows = new Map();
for (const [k, v] of Object.entries(inputs || {})) {
const m = /^loras\.(\d+)\.(lora_name|strength|enabled)$/.exec(k);
if (!m) continue;
if (!rows.has(+m[1])) rows.set(+m[1], {});
rows.get(+m[1])[m[2]] = v;
}
return [...rows.entries()].sort((a, b) => a[0] - b[0]).map(([, r]) => r);
}
function _writeLoraStackRows(wfNode, rows) {
for (const k of Object.keys(wfNode.inputs)) if (k.startsWith("loras.")) delete wfNode.inputs[k];
rows.slice(0, 20).forEach((r, i) => {
wfNode.inputs[`loras.${i}.lora_name`] = r.lora_name;
wfNode.inputs[`loras.${i}.strength`] = r.strength;
wfNode.inputs[`loras.${i}.enabled`] = r.enabled;
});
}
// items: [{ name, strModel?, strClip?, enabled? }] — omitted strengths keep the node's
// first existing row (default 1). Writes every stack node in `wf`.
function _applyLoraStack(items, wf = comfyUI.currentWorkflow) {
if (!items.length) return;
for (const wfNode of Object.values(wf || {})) {
if (!_isLoraStackNode(wfNode)) continue;
const key = _LORA_STACK_STRENGTH[wfNode.class_type];
const prev = _readLoraStackRows(wfNode.inputs)[0]?.strength;
wfNode.inputs ??= {};
_writeLoraStackRows(wfNode, items.slice(0, 20).map((it) => ({
lora_name: it.name,
strength: it[key] ?? (typeof prev === "number" ? prev : 1),
enabled: it.enabled !== false,
})));
}
}
function _applyLoraToNode(nodeId, loraPath, strModel, strClip, isLoraManager) {
if (_isLoraStackNode(comfyUI.currentWorkflow[nodeId])) {
_applyLoraStack([{ name: comfyEditor.resolveLoraName(loraPath), strModel, strClip }]);
return;
}
if (isLoraManager) {
const stem = _loraBasename(loraPath);
comfyUI.currentWorkflow[nodeId].inputs.loras = {
@@ -463,6 +515,10 @@ export const comfyEditor = {
return found || name;
},
// Native LoRA stack nodes (LoadLoraModel / LoadLoraTextEncoder) — see _applyLoraStack.
isLoraStackNode: _isLoraStackNode,
applyLoraStack: _applyLoraStack,
renderAll(analysis, workflow, opts = {}) {
this.renderPromptTab(analysis, "wfm-gen-prompt-fields");
this.renderImageTab(analysis, "wfm-gen-image-fields");
@@ -776,7 +832,11 @@ export const comfyEditor = {
// Restore whatever was set before bypassing
const snap = _loraBypassSnapshot[nodeId];
if (snap) {
if (isLoraManager) {
if (snap.stackRows) {
for (const [id, rows] of Object.entries(snap.stackRows)) {
if (comfyUI.currentWorkflow?.[id]) _writeLoraStackRows(comfyUI.currentWorkflow[id], JSON.parse(JSON.stringify(rows)));
}
} else if (isLoraManager) {
wfNode.inputs.loras = { __value__: JSON.parse(JSON.stringify(snap.loras || [])) };
wfNode.inputs.text = snap.text ?? "";
} else {
@@ -791,7 +851,16 @@ export const comfyEditor = {
// Snapshot current values, then zero the strength (LoraManager: every
// entry in its loras list, keeping the list itself intact so un-bypassing
// restores the exact same Stack — not just a single-LoRA fallback).
if (isLoraManager) {
if (_isLoraStackNode(wfNode)) {
// Native stack nodes: snapshot every stack node's rows, then zero each strength
const stackRows = {};
for (const [id, n] of Object.entries(comfyUI.currentWorkflow)) {
if (!_isLoraStackNode(n)) continue;
stackRows[id] = _readLoraStackRows(n.inputs);
_writeLoraStackRows(n, stackRows[id].map((r) => ({ ...r, strength: 0 })));
}
_loraBypassSnapshot[nodeId] = { stackRows };
} else if (isLoraManager) {
const loras = Array.isArray(wfNode.inputs.loras?.__value__) ? wfNode.inputs.loras.__value__ : [];
_loraBypassSnapshot[nodeId] = { loras: JSON.parse(JSON.stringify(loras)), text: wfNode.inputs.text ?? "" };
wfNode.inputs.loras = { __value__: loras.map((l) => ({ ...l, strength: 0, clipStrength: 0 })) };
@@ -862,7 +931,9 @@ export const comfyEditor = {
const _firstLoraNode = loraNodes[0];
if (_firstLoraNode && comfyUI.currentWorkflow?.[_firstLoraNode.id]) {
const _wfNode = comfyUI.currentWorkflow[_firstLoraNode.id];
if (!_firstLoraNode.is_lora_manager) {
if (_firstLoraNode.is_lora_stack) {
currentVal = _readLoraStackRows(_wfNode.inputs)[0]?.lora_name || currentVal;
} else if (!_firstLoraNode.is_lora_manager) {
currentVal = _wfNode.inputs?.lora_name || currentVal;
} else {
// LoraManager: loras.__value__[0].nameからフルパスを復元
@@ -1294,6 +1365,14 @@ export const comfyEditor = {
});
comfyUI.currentWorkflow[nodeId].inputs.loras = { __value__: loraValue };
comfyUI.currentWorkflow[nodeId].inputs.text = _buildLoraManagerSyntax(stackModels);
} else if (node?.is_lora_stack) {
// Native stack nodes take the whole Stack group as rows (max 20)
_applyLoraStack(stackModels.map((m) => ({
name: comfyEditor.resolveLoraName(m),
strModel: _stackStrengths[m]?.m ?? 1.0,
strClip: _stackStrengths[m]?.c ?? 1.0,
enabled: _stackActive[m] !== false,
})));
} else {
const first = stackModels[0];
if (first) {
+267 -25
View File
@@ -2,6 +2,11 @@
* ComfyUI Workflow - Format detection, conversion, and analysis
*/
// Video all-in-one nodes (MiniMaxH3ImageToVideo, MiniMaxH3ReferenceToVideo, ...): hold their own
// "prompt" and build the conditioning + latent themselves. Matched by class-name pattern so other
// models sharing this shape work without a code change.
const VIDEO_ALL_IN_ONE_RE = /ImageToVideo|TextToVideo|ReferenceToVideo/;
// Cache for /object_info (loaded once, shared)
let _objectInfoCache = null;
@@ -74,12 +79,51 @@ async function _loadObjectInfo() {
return _objectInfoCache || {};
}
// Per-node-type object_info (GET /object_info/<type>, ~20 ms each). The full /object_info is
// tens of MB and can take 10-40 s on installs with many custom nodes, so conversions and the
// compatibility check only fetch the types the workflow actually uses. type -> info, or null when
// ComfyUI doesn't know the type. Only successful responses are cached.
const _objectInfoByType = new Map();
async function _loadObjectInfoFor(types) {
if (_objectInfoCache) return _objectInfoCache;
const wanted = [...new Set(types)].filter((ty) => typeof ty === "string" && ty && !_objectInfoByType.has(ty));
let failed = false;
for (let i = 0; i < wanted.length; i += 16) {
await Promise.all(wanted.slice(i, i + 16).map(async (ty) => {
try {
const res = await fetch(`/object_info/${encodeURIComponent(ty)}`);
if (!res.ok) { if (res.status === 404) _objectInfoByType.set(ty, null); else failed = true; return; }
const data = await res.json();
_objectInfoByType.set(ty, data?.[ty] || null);
} catch { failed = true; }
}));
}
// Any transport failure: fall back to the full snapshot rather than report types as unknown
if (failed) return _loadObjectInfo();
const out = {};
for (const ty of types) { const info = _objectInfoByType.get(ty); if (info) out[ty] = info; }
return out;
}
// Node types a UI-format workflow uses, including nodes inside subgraph definitions
function _collectNodeTypes(workflow) {
const sgIds = new Set((workflow?.definitions?.subgraphs || []).map((sg) => sg.id));
const types = new Set();
const add = (nodes) => { for (const n of nodes || []) if (n?.type && !sgIds.has(n.type)) types.add(n.type); };
add(workflow?.nodes);
for (const sg of workflow?.definitions?.subgraphs || []) add(sg.nodes);
return [...types];
}
/**
* Get ordered widget (non-link) input names for a node class from object_info.
* These correspond to widgets_values in UI-format nodes.
*/
// Scalar widget types object_info can declare for a required/optional input.
const _WIDGET_TYPE_SET = new Set(["INT", "FLOAT", "STRING", "BOOLEAN", "COMBO", "COMFY_DYNAMICCOMBO_V3"]);
// BOUNDING_BOXES: CreateBoundingBoxes' canvas widgets (editor_state / last_incoming) — array-valued
// frontend widgets that occupy a widgets_values slot; sent to the API as {"__value__": [...]}.
const _WIDGET_TYPE_SET = new Set(["INT", "FLOAT", "STRING", "BOOLEAN", "COMBO", "COMFY_DYNAMICCOMBO_V3", "BOUNDING_BOXES"]);
/**
* Resolve a possibly-compound object_info type spec (e.g. LTXVEmptyLatentAudio's frame_rate:
@@ -100,11 +144,10 @@ function _resolveWidgetType(type, spec) {
if (typeof type !== "string") return null;
const explicit = spec?.[1]?.widgetType;
if (typeof explicit === "string" && _WIDGET_TYPE_SET.has(explicit.toUpperCase())) return explicit.toUpperCase();
for (const part of type.split(",")) {
const upper = part.trim().toUpperCase();
if (_WIDGET_TYPE_SET.has(upper)) return upper;
}
return null;
// Only the first (default) segment decides: a union that merely *accepts* a scalar as one of its
// link types (CreateBoundingBoxes.bboxes: "BOUNDING_BOX,ARRAY,STRING") is still a link-only socket.
const first = type.split(",")[0].trim().toUpperCase();
return _WIDGET_TYPE_SET.has(first) ? first : null;
}
function _getWidgetInputNames(objectInfo, classType) {
@@ -172,6 +215,11 @@ function _getWidgetInputTypes(objectInfo, classType) {
* presence_penalty under optional — all 7 still occupy a widgets_values slot). Dropping the
* optional ones here under-counts how many slots the combo actually consumed, misaligning
* every widget declared after it in the node's schema.
*
* Only sub-fields that are actually widgets count: a sub-field can also be a link socket (e.g. the
* Nano Banana 2.1 node's "images" Autogrow group and its "files" GEMINI_INPUT_FILES input), which the
* frontend does NOT serialize into widgets_values — counting those would shift every value after
* them (seed read as "IMAGE", the system prompt landing in response_modalities, ...).
*/
function _getDynamicComboSubNames(objectInfo, classType, widgetName, selectedKey) {
const info = objectInfo[classType];
@@ -179,9 +227,13 @@ function _getDynamicComboSubNames(objectInfo, classType, widgetName, selectedKey
const options = spec?.[1]?.options;
if (!Array.isArray(options)) return [];
const opt = options.find((o) => o.key === selectedKey) || options[0];
const isWidget = ([, sub]) => {
if (Array.isArray(sub) && sub[1]?.forceInput) return false;
return !!_resolveWidgetType(Array.isArray(sub) ? sub[0] : sub, sub);
};
return [
...Object.keys(opt?.inputs?.required || {}),
...Object.keys(opt?.inputs?.optional || {}),
...Object.entries(opt?.inputs?.required || {}).filter(isWidget).map(([k]) => k),
...Object.entries(opt?.inputs?.optional || {}).filter(isWidget).map(([k]) => k),
];
}
@@ -192,6 +244,14 @@ function _getDynamicComboSubNames(objectInfo, classType, widgetName, selectedKey
*/
const _CONTROL_AFTER_GENERATE = new Set(["fixed", "increment", "decrement", "randomize"]);
// True when the widget's object_info spec declares control_after_generate (seed-style INT widgets):
// the frontend then serializes one extra "randomize"/"fixed"/... slot right after the widget's value.
function _hasControlAfterGenerate(objectInfo, classType, widgetName) {
const info = objectInfo[classType]?.input;
const spec = info?.required?.[widgetName] || info?.optional?.[widgetName];
return !!(Array.isArray(spec) && spec[1]?.control_after_generate);
}
function _isExtraWidgetValue(val, expectedType) {
if (expectedType === "INT" || expectedType === "FLOAT") {
// If we expect a number but got a string like "fixed", it's a control widget
@@ -441,6 +501,9 @@ function _flattenSubgraphs(workflow, objectInfo) {
// from ports that truly carry a link end-to-end (e.g. width/height wired to a
// ResolutionSelector node).
const redirectedTargets = new Set();
// Extra links for the 2nd+ fan-out targets of a port that has a real outer link
// (collected here and appended after the loop so wf.links isn't mutated mid-iteration).
const fanOutLinks = [];
for (const link of wf.links) {
if (link[3] === node.id) {
const dstSlot = link[4];
@@ -458,6 +521,13 @@ function _flattenSubgraphs(workflow, objectInfo) {
link[3] = target.targetNodeId;
link[4] = target.targetSlot;
redirectedTargets.add(`${target.targetNodeId}:${target.targetSlot}`);
// Same real outer link feeding further internal targets (e.g. Qwen Image 2.1
// Edit: images.image_1 -> TextEncodeQwenImage21 AND the prompt-enhancer's
// BatchImagesNode) — duplicate it for each remaining target.
for (const extra of (inputPortTargets[portIdx] || []).slice(1)) {
fanOutLinks.push([0, link[1], link[2], extra.targetNodeId, extra.targetSlot, link[5]]);
redirectedTargets.add(`${extra.targetNodeId}:${extra.targetSlot}`);
}
}
}
if (link[1] === node.id) {
@@ -470,6 +540,11 @@ function _flattenSubgraphs(workflow, objectInfo) {
}
}
for (const l of fanOutLinks) {
l[0] = ++maxLinkId;
wf.links.push(l);
}
// === Add internal nodes (remapped IDs) ===
const remappedByOrigId = {};
for (const iNode of sgDef.nodes) {
@@ -519,9 +594,19 @@ function _flattenSubgraphs(workflow, objectInfo) {
const port = sgDef.inputs[portIdx];
const outerInp = outerWidgetInputs.find((inp) => inp.name === port.name);
const outerWidgetIdx = outerInp ? outerWidgetInputs.indexOf(outerInp) : -1;
const hasOuterOverride = !!outerInp && outerInp.link == null && outerWidgetIdx !== -1
&& outerWidgetIdx < (node.widgets_values || []).length;
const outerValue = hasOuterOverride ? node.widgets_values[outerWidgetIdx] : undefined;
// Newer frontends also save a name-keyed copy of the outer widget values
// (widgets_values_named) and may omit widget ports (seed/steps/cfg/...) from the outer
// node's inputs[] while widgets_values still holds every port, so the index-among-inputs
// lookup drifts (e.g. MOSS-Image: unet_name read the steps value). Prefer the named copy.
const named = node.widgets_values_named;
const hasNamed = !!named && typeof named === "object"
&& Object.prototype.hasOwnProperty.call(named, port.name);
const hasOuterOverride = hasNamed
? !(outerInp && outerInp.link != null)
: (!!outerInp && outerInp.link == null && outerWidgetIdx !== -1
&& outerWidgetIdx < (node.widgets_values || []).length);
const outerValue = !hasOuterOverride ? undefined
: (hasNamed ? named[port.name] : node.widgets_values[outerWidgetIdx]);
// Value to apply to non-widget (wildcard) fan-out targets: the outer override if
// present, otherwise whatever a sibling widget-type target ends up holding (its own
@@ -629,6 +714,11 @@ export const comfyWorkflow = {
return _loadObjectInfo();
},
// object_info limited to the given node types (fast; see _loadObjectInfoFor)
async getObjectInfoForTypes(types) {
return _loadObjectInfoFor(types);
},
getLastBypassedNodes() {
return _lastBypassedNodes;
},
@@ -647,6 +737,7 @@ export const comfyWorkflow = {
// at the top) would replace it with an unrelated pre-existing file instead.
invalidateObjectInfoCache() {
_objectInfoCache = null;
_objectInfoByType.clear();
},
// opts.readOnly: 表示用の読み取り変換。COMBO値の差し替えを行わず、Workflowタブの互換性
@@ -668,7 +759,7 @@ export const comfyWorkflow = {
_lastMutedNodes = [];
if (!workflow.nodes || !workflow.links) return {};
const objectInfo = await _loadObjectInfo();
const objectInfo = await _loadObjectInfoFor(_collectNodeTypes(workflow));
// Flatten subgraphs before conversion (needs objectInfo to correctly map outer
// subgraph-node widget values onto internal nodes' widgets_values indices)
@@ -764,6 +855,16 @@ export const comfyWorkflow = {
if (wIdx >= widgets.length) break;
const name = widgetNames[nIdx];
const expectedType = widgetTypes[nIdx];
// A control_after_generate widget (seed etc.) is followed by a frontend-only
// "randomize"/"fixed"/... slot even when the next widget is not numeric (e.g.
// Nano Banana 2.1: seed -> response_modalities); the type heuristic below only
// catches it when the next widget happens to be INT/FLOAT.
if (nIdx > 0 && !linkedInputNames.has(widgetNames[nIdx - 1])
&& _hasControlAfterGenerate(objectInfo, node.type, widgetNames[nIdx - 1])
&& _CONTROL_AFTER_GENERATE.has(widgets[wIdx])) {
wIdx++;
if (wIdx >= widgets.length) break;
}
// Skip if this input is already linked
if (linkedInputNames.has(name)) {
if (!linkedSlotNames.has(name)) {
@@ -819,6 +920,14 @@ export const comfyWorkflow = {
const spec = allInputDefs[name];
if (spec) {
const choices = Array.isArray(spec[0]) ? spec[0] : null;
// Template saved the bare file name while this install lists it under a
// sub-folder (or the reverse, or with the other path separator): prefer the
// choice whose file name matches over an unrelated choices[0].
if (choices && choices.length > 0 && typeof val === "string" && !choices.includes(val)) {
const base = (x) => String(x).split(/[\\/]/).pop();
const sameFile = choices.filter((c) => typeof c === "string" && base(c) === base(val));
if (sameFile.length === 1) val = sameFile[0];
}
if (!opts.readOnly && choices && choices.length > 0 && !choices.includes(val)) {
if (name === "ckpt_name") {
_lastCheckpointSubstitutions.push({
@@ -840,6 +949,9 @@ export const comfyWorkflow = {
}
}
}
// List values are reserved for node links in the API format; the backend unwraps
// {"__value__": [...]} for array-valued widgets.
if (expectedType === "BOUNDING_BOXES" && Array.isArray(val)) val = { __value__: val };
inputs[name] = val;
}
} else {
@@ -879,6 +991,7 @@ export const comfyWorkflow = {
_meta: { title: node.title || node.type },
};
}
_unifyPromptEnhancerText(api);
return api;
},
@@ -1033,6 +1146,12 @@ export const comfyWorkflow = {
if (Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
// Video all-in-one nodes whose "prompt" is wired from a separate text node (FastH3
// OmniRef's MiniMaxH3ReferenceToVideo <- PrimitiveStringMultiline) — always positive
// (no negative counterpart), so seed the role on the source directly.
if (VIDEO_ALL_IN_ONE_RE.test(ct) && Array.isArray(inputs.prompt)) {
samplerPositiveRef[inputs.prompt[0]] = true;
}
}
// === Pass 1b: Expand refs through CONDITIONING graph (BFS, 5 iterations) ===
@@ -1109,6 +1228,13 @@ export const comfyWorkflow = {
if (isPos && Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (isNeg && Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
// ReferenceMultiLatent (Flux.3 Klein edit) — encodes reference images into the
// conditioning and outputs positive/negative/empty_latent: separate positive/negative
// inputs feeding separate outputs, so each role routes only to its own input.
if (ct === "ReferenceMultiLatent") {
if (isPos && Array.isArray(inputs.positive)) samplerPositiveRef[inputs.positive[0]] = true;
if (isNeg && Array.isArray(inputs.negative)) samplerNegativeRef[inputs.negative[0]] = true;
}
// LTXVConditioning (LTX-2.5) — same shape as InstructPixToPixConditioning:
// separate positive/negative inputs feeding separate outputs consumed by
// LTXVDualCFGGuider, so each role must route only to its own input.
@@ -1141,6 +1267,15 @@ export const comfyWorkflow = {
if (isNeg) samplerNegativeRef[tv[0]] = true;
}
}
// TextEncodeQwenImage21 — fixed roles (the node feeds both guider inputs): a linked
// "prompt" (prompt-enhancer switch chain, Qwen Image 2.1 Turbo) is the positive text,
// a linked "negative_prompt" the negative.
// TextEncodeFibo2 (Fibo 2.0 Edit) has the same shape, its prompt arriving via a
// PreviewAny -> prompt-enhancer switch chain.
if (ct === "TextEncodeQwenImage21" || ct === "TextEncodeFibo2") {
if (Array.isArray(inputs.prompt)) samplerPositiveRef[inputs.prompt[0]] = true;
if (Array.isArray(inputs.negative_prompt)) samplerNegativeRef[inputs.negative_prompt[0]] = true;
}
// PreviewAny — generic value tap/relay used mid-chain in prompt-enhancement wiring
// (e.g. Krea-2's "Refine Prompt?" switch output tap); pass role through its
// "source" input unchanged.
@@ -1151,6 +1286,15 @@ export const comfyWorkflow = {
if (isNeg) samplerNegativeRef[sv[0]] = true;
}
}
// PrimitiveStringMultiline/PrimitiveString whose value is linked (MOSS-Image's
// layout-prompt workflows feed it from a PreviewAny relay) — pass the role upstream.
if (ct === "PrimitiveStringMultiline" || ct === "PrimitiveString") {
const tv = inputs.value;
if (Array.isArray(tv)) {
if (isPos) samplerPositiveRef[tv[0]] = true;
if (isNeg) samplerNegativeRef[tv[0]] = true;
}
}
// StringConcatenate — appends e.g. a LoRA trigger word onto the prompt text
// (Krea-2); propagate role through both operands so the upstream literal is found.
if (ct === "StringConcatenate") {
@@ -1165,6 +1309,19 @@ export const comfyWorkflow = {
}
}
// ReferenceMultiLatent outputs its own empty latent sized from the reference image, so a
// template's leftover EmptyFlux2LatentImage that nothing consumes does nothing — don't offer
// its width/height in Settings.
const hasRefMultiLatent = Object.values(workflow).some((n) => n?.class_type === "ReferenceMultiLatent");
const referencedIds = new Set();
if (hasRefMultiLatent) {
for (const n of Object.values(workflow)) {
for (const v of Object.values(n?.inputs || {})) {
if (Array.isArray(v) && v.length === 2) referencedIds.add(String(v[0]));
}
}
}
// === Pass 2: Main analysis ===
for (const [id, node] of Object.entries(workflow)) {
if (!node?.class_type) continue;
@@ -1360,7 +1517,9 @@ export const comfyWorkflow = {
// with no images connected the node behaves as pure T2I). The reference images
// themselves need no special handling here — they arrive as ordinary LoadImage
// nodes already picked up generically by the load_image_nodes pass below.
if (ct === "TextEncodeQwenImage21") {
// TextEncodeFibo2 (Fibo 2.0) — same prompt/negative_prompt/images.image_N shape; its
// negative_prompt is a structured VGL JSON caption (edited as plain text here).
if (ct === "TextEncodeQwenImage21" || ct === "TextEncodeFibo2") {
if (typeof inputs.prompt === "string") {
result.prompt_nodes.push({
id, type: ct, title: `${title} [positive]`, role: "positive",
@@ -1435,8 +1594,30 @@ export const comfyWorkflow = {
}
}
// ComfySwitchNode holding the raw prompt as an inline literal (on_false) — the
// prompt-enhancer toggle of Qwen Image 2.1 Turbo, where the subgraph's prompt widget
// lands directly on the switch instead of a PrimitiveStringMultiline.
if (ct === "ComfySwitchNode" && typeof inputs.on_false === "string" && (isPos || isNeg)) {
result.prompt_nodes.push({
id, type: ct, title, role: getRole(),
text: inputs.on_false, textKey: "on_false",
});
}
// PrimitiveStringMultiline / PrimitiveString — when feeding a prompt node
if ((ct === "PrimitiveStringMultiline" || ct === "PrimitiveString") && (isPos || isNeg)) {
// MOSSImageLayoutPrompt (MOSS-Image bounding-box layout) — builds the final prompt from its own
// "prompt" widget (whole-image description) plus the CreateBoundingBoxes elements.
if (ct === "MOSSImageLayoutPrompt" && typeof inputs.prompt === "string" && (isPos || isNeg)) {
result.prompt_nodes.push({
id, type: ct, title, role: getRole(),
text: inputs.prompt, textKey: "prompt",
});
}
// PrimitiveStringMultiline / PrimitiveString — when feeding a prompt node (a linked
// value has no literal to edit; its role is propagated upstream in Pass 1b instead)
if ((ct === "PrimitiveStringMultiline" || ct === "PrimitiveString") && (isPos || isNeg)
&& !Array.isArray(inputs.value)) {
result.prompt_nodes.push({
id, type: ct, title, role: getRole(),
text: inputs.value || "",
@@ -1446,11 +1627,21 @@ export const comfyWorkflow = {
// Video all-in-one nodes (e.g. MiniMaxH3ImageToVideo) — hold their own "prompt"
// widget directly instead of going through a separate CLIPTextEncode, and have
// no negative counterpart. Matched generically by class name (ImageToVideo /
// TextToVideo) rather than a fixed list so future models sharing this pattern
// no negative counterpart. Matched generically by class name (VIDEO_ALL_IN_ONE_RE)
// rather than a fixed list so future models sharing this pattern
// (WAN, HunyuanVideo, etc.) work without a code change — same detection metadata-tab.js
// and node_sets_menu.js already use for prompt extraction (see extractPromptsAPI).
if ((ct.includes("ImageToVideo") || ct.includes("TextToVideo")) && typeof inputs.prompt === "string") {
if (VIDEO_ALL_IN_ONE_RE.test(ct) && typeof inputs.prompt === "string") {
result.prompt_nodes.push({
id, type: ct, title, role: "positive",
text: inputs.prompt, textKey: "prompt",
});
}
// Gemini image nodes (Nano Banana etc., partner API nodes) — like the video all-in-one nodes above
// they hold their own "prompt" widget (no negative counterpart; the node's reference images
// arrive through LoadImage nodes, which GenerateUI's Image tab already handles generically).
if (/^Gemini(Image|NanoBanana)/.test(ct) && typeof inputs.prompt === "string") {
result.prompt_nodes.push({
id, type: ct, title, role: "positive",
text: inputs.prompt, textKey: "prompt",
@@ -1466,12 +1657,14 @@ export const comfyWorkflow = {
// has the same width/height/batch_size shape plus a "layers" count, left as-is.
if (ct === "EmptyLatentImage" || ct === "EmptySD3LatentImage" || ct === "EmptyFlux2LatentImage"
|| ct === "EmptyQwenImageLayeredLatentImage") {
result.latent_nodes.push({
id, type: ct, title,
width: typeof inputs.width === "number" ? inputs.width : undefined,
height: typeof inputs.height === "number" ? inputs.height : undefined,
batch_size: inputs.batch_size,
});
if (!hasRefMultiLatent || referencedIds.has(String(id))) {
result.latent_nodes.push({
id, type: ct, title,
width: typeof inputs.width === "number" ? inputs.width : undefined,
height: typeof inputs.height === "number" ? inputs.height : undefined,
batch_size: inputs.batch_size,
});
}
}
// Video latent nodes (Wan2.2's EmptyHunyuanLatentVideo, LTX-2.5's
@@ -1508,7 +1701,8 @@ export const comfyWorkflow = {
// width/height are commonly wired to a ResolutionSelector-style helper node
// (array link ref) rather than a direct number — leave those as undefined so
// the settings-tab UI falls back to its default instead of rendering a link ref.
if (ct === "TextEncodeMageFlowEdit") {
// TextEncodeFibo2 likewise (0 = Fibo 2.0's trained size for the first image's aspect).
if (ct === "TextEncodeMageFlowEdit" || ct === "TextEncodeFibo2") {
result.latent_nodes.push({
id, type: ct, title,
width: typeof inputs.width === "number" ? inputs.width : undefined,
@@ -1541,6 +1735,29 @@ export const comfyWorkflow = {
}
}
// Native Load LoRA (Model / Text Encoder) — DynamicGroup rows arrive as flat keys
// "loras.<row>.lora_name|strength|enabled". One entry per node (first enabled row
// is the representative); editing goes through comfyEditor.applyLoraStack.
if (ct === "LoadLoraModel" || ct === "LoadLoraTextEncoder") {
const isModel = ct === "LoadLoraModel";
const rows = new Map();
for (const [k, v] of Object.entries(inputs)) {
const m = /^loras\.(\d+)\.(lora_name|strength|enabled)$/.exec(k);
if (!m) continue;
if (!rows.has(+m[1])) rows.set(+m[1], {});
rows.get(+m[1])[m[2]] = v;
}
const first = [...rows.entries()].sort((a, b) => a[0] - b[0]).map(([, r]) => r)
.find((r) => r.enabled !== false && typeof r.lora_name === "string");
const s = typeof first?.strength === "number" ? first.strength : 1;
result.lora_nodes.push({
id, type: ct, title, is_lora_stack: true,
lora_name: first?.lora_name,
strength_model: isModel ? s : 1,
strength_clip: isModel ? 1 : s,
});
}
// Lora Loader (LoraManager) — loras stored in inputs.loras.__value__
if (ct === "Lora Loader (LoraManager)") {
result.lora_nodes.push({ id, type: ct, title, is_lora_manager: true });
@@ -1663,7 +1880,7 @@ export const comfyWorkflow = {
// generation timeout (video generation runs far longer than a still image) — see
// generate-tab.js _coreGenerate and lab-tab.js _runLabBatch.
isVideoWorkflow(analysis) {
if ((analysis?.prompt_nodes || []).some((n) => /ImageToVideo|TextToVideo/.test(n.type))) return true;
if ((analysis?.prompt_nodes || []).some((n) => VIDEO_ALL_IN_ONE_RE.test(n.type))) return true;
// LTX-2.5/Wan2.2: no all-in-one *ToVideo node — detected instead via their
// EmptyHunyuanLatentVideo/EmptyLTXVLatentVideo latent node (see analyzeWorkflow)
// or a SaveVideo/CreateVideo node anywhere in the flattened graph.
@@ -1698,6 +1915,30 @@ export const comfyWorkflow = {
};
/** Check if a node is display-only (no connected inputs or outputs) */
/**
* Prompt-enhancer toggle (Qwen Image 2.1 Turbo): the template's subgraph "prompt" port fans out to
* both a ComfySwitchNode.on_false (raw text) and TextGenerate.prompt (text fed to the enhancer,
* wired to on_true). After flattening these are two independent literals, so editing one in the UI
* would leave the other stale. Route both through one shared PrimitiveStringMultiline instead.
*/
function _unifyPromptEnhancerText(api) {
for (const [swId, sw] of Object.entries(api)) {
if (sw.class_type !== "ComfySwitchNode" || typeof sw.inputs?.on_false !== "string") continue;
const tgRef = sw.inputs.on_true;
if (!Array.isArray(tgRef)) continue;
const tg = api[String(tgRef[0])];
if (tg?.class_type !== "TextGenerate" || tg.inputs.prompt !== sw.inputs.on_false) continue;
const primId = `${swId}:wfs_prompt`;
api[primId] = {
class_type: "PrimitiveStringMultiline",
inputs: { value: sw.inputs.on_false },
_meta: { title: "Prompt" },
};
sw.inputs.on_false = [primId, 0];
tg.inputs.prompt = [primId, 0];
}
}
function _isDisplayOnlyNode(node) {
const hasConnectedOutput = node.outputs?.some(o => o.links && o.links.length > 0);
const hasConnectedInput = node.inputs?.some(i => i.link != null);
@@ -1734,6 +1975,7 @@ function _getWidgetMapping(nodeType) {
ImpactWildcardEncode: ["wildcard_text"],
WFS_PromptText: ["positive", "negative"],
TextEncodeQwenImage21: ["prompt", "negative_prompt", "resolution"],
TextEncodeFibo2: ["prompt", "negative_prompt", "width", "height", "batch_size"],
TextEncodeMingImageEdit: ["prompt"],
EmptyQwenImageLayeredLatentImage: ["width", "height", "layers", "batch_size"],
};
+50 -59
View File
@@ -1,5 +1,5 @@
/**
* Gallery Tab - セマンティック検索 (Gemini Embedding 2)
* Gallery Tab - セマンティック検索 (Gemini Embedding 2 / Ollama の EmbeddingGemma 2)
* - 検索ボックスのSemantic Searchトグル(ONでEnter実行の意味検索)
* - 詳細パネルの「類似画像」トグル/更新ボタン
* - インデックス作成モーダル(Semantic⚙)
@@ -19,18 +19,20 @@ const API = {
clear: "/wfm/gallery/semantic/clear",
folders: (root) => `/wfm/gallery/semantic/folders?root=${encodeURIComponent(root)}`,
test: "/wfm/gallery/semantic/test",
options: "/wfm/gallery/semantic/options",
};
const LS_ON = "wfm_gallery_semantic_on";
const LS_DIM = "wfm_gallery_semantic_dim";
const LS_MODEL = "wfm_gallery_semantic_model";
const LS_SOFT = "wfm_gallery_semantic_soft";
const GEMINI = "gemini-embedding-2";
const LOCAL = "embeddinggemma-2";
const LS_SUB = "wfm_gallery_semantic_recursive";
const LS_TAB = "wfm_gallery_semantic_tab";
const LS_TH = "wfm_gallery_semantic_th";
const LIMITS = [50, 100, 200, 500, 1000];
// Ollama のモデルサイズ(どちらも同じベクトルを返すので、切り替えても再作成は不要)
const OLLAMA_TAGS = [["embeddinggemma-2:740m", "semOllamaTag740"], ["embeddinggemma-2:440m", "semOllamaTag440"]];
const sem = {
on: false, // Semantic Searchトグル
@@ -65,7 +67,8 @@ async function postJson(url, body) {
/** APIエラーコードをi18nメッセージにする */
export function semanticErrorMessage(e) {
const known = ["no_api_key", "api_key_invalid", "index_empty", "dim_mismatch", "already_running",
"folder_not_allowed", "unsupported_type", "network_error", "api_error", "local_error"];
"folder_not_allowed", "unsupported_type", "network_error", "api_error", "local_error",
"ollama_unreachable", "ollama_model_missing", "bad_url"];
if (e?.code && known.includes(e.code)) {
return t(`sem_err_${e.code}`, e.message);
}
@@ -244,23 +247,14 @@ function modalHtml() {
<select id="wfm-sem-dim" class="wfm-select"></select>
<span class="wfm-sem-hint">${escapeHtml(t("semDimHint"))}</span></div>
<div id="wfm-sem-local-opts" class="wfm-sem-local-opts" style="display:none;">
<div class="wfm-sem-row"><b>${escapeHtml(t("semDevice"))}</b>
<select id="wfm-sem-device" class="wfm-select">
<option value="auto">${escapeHtml(t("semDeviceAuto"))}</option>
<option value="cpu">CPU</option>
<option value="cuda">GPU (CUDA)</option>
<div class="wfm-sem-row"><b>${escapeHtml(t("semOllamaUrl"))}</b>
<input type="text" id="wfm-sem-ollama-url" class="wfm-input wfm-sem-url" spellcheck="false" placeholder="http://localhost:11434"></div>
<div class="wfm-sem-row"><b>${escapeHtml(t("semOllamaTag"))}</b>
<select id="wfm-sem-ollama-tag" class="wfm-select">
${OLLAMA_TAGS.map(([tag, key]) => `<option value="${tag}">${escapeHtml(t(key))}</option>`).join("")}
</select>
<span id="wfm-sem-device-info" class="wfm-sem-hint"></span></div>
<div class="wfm-sem-row" id="wfm-sem-threads-row"><b>${escapeHtml(t("semThreads"))}</b>
<select id="wfm-sem-threads" class="wfm-select"></select>
<span class="wfm-sem-hint">${escapeHtml(t("semThreadsHint"))}</span></div>
<div class="wfm-sem-row"><b>${escapeHtml(t("semSoft"))}</b>
<select id="wfm-sem-soft" class="wfm-select">
<option value="280">${escapeHtml(t("semSoftHigh"))}</option>
<option value="140">${escapeHtml(t("semSoftStd"))}</option>
<option value="70">${escapeHtml(t("semSoftLight"))}</option>
</select>
<span class="wfm-sem-hint">${escapeHtml(t("semSoftHint"))}</span></div>
<span id="wfm-sem-ollama-info" class="wfm-sem-hint"></span></div>
<p class="wfm-sem-hint">${escapeHtml(t("semOllamaTagHint"))}</p>
</div>
<div class="wfm-sem-actions">
<button class="wfm-btn" id="wfm-sem-test">${escapeHtml(t("semTest"))}</button>
@@ -302,19 +296,12 @@ function selectedModel() {
return document.querySelector('input[name="wfm-sem-model"]:checked')?.value || GEMINI;
}
/** ローカルモデルの実行設定(デバイス/スレッド/画像精度)の初期値をサーバー保存値から設定する */
/** Ollama の接続先/モデルサイズの初期値をサーバー保存値から設定する */
function initLocalOpts(st) {
const lo = st.local || {};
const devSel = document.getElementById("wfm-sem-device");
devSel.value = (lo.options && lo.options.device) || "auto";
const cores = lo.devices?.cpu_count || 4;
const cur = (lo.options && lo.options.threads) || lo.default_threads || Math.max(1, Math.floor(cores / 2));
const set = new Set([1, 2, 4, 6, 8, 12, 16, 24, 32].filter(n => n <= cores).concat([cores, cur, lo.default_threads || 1]));
document.getElementById("wfm-sem-threads").innerHTML = [...set].sort((a, b) => a - b)
.map(n => `<option value="${n}">${n}${n === cores ? ` (${t("semThreadsAll")})` : ""}</option>`).join("");
document.getElementById("wfm-sem-threads").value = String(cur);
const soft = st.indexed_total && st.index_model === LOCAL ? st.index_soft : parseInt(lsGet(LS_SOFT, String(lo.default_soft || 280)), 10);
document.getElementById("wfm-sem-soft").value = String([70, 140, 280].includes(soft) ? soft : 280);
const ol = st.ollama || {};
document.getElementById("wfm-sem-ollama-url").value = ol.url || "";
const sel = document.getElementById("wfm-sem-ollama-tag");
if (ol.tag) sel.value = ol.tag;
}
/** 検索タブ: しきい値の入力欄にインデックスのモデル用の保存値を入れる(入力中の値は上書きしない) */
@@ -359,20 +346,15 @@ function closeSemanticModal() {
}
}
/** 検出した実行デバイスの表示(GPU版onnxruntimeが無いときの案内を含む) */
function updateDeviceInfo(lo) {
const dev = lo?.devices;
if (!dev) return;
const info = document.getElementById("wfm-sem-device-info");
const cudaOpt = document.querySelector('#wfm-sem-device option[value="cuda"]');
if (cudaOpt) cudaOpt.disabled = !dev.cuda;
if (!dev.cuda && document.getElementById("wfm-sem-device").value === "cuda") {
document.getElementById("wfm-sem-device").value = "auto";
}
if (info) info.textContent = dev.cuda ? t("semDeviceCudaOk", dev.ort_version) : t("semDeviceNoGpu", dev.ort_version);
const dv = document.getElementById("wfm-sem-device").value;
const useCpu = dv === "cpu" || (dv === "auto" && !dev.cuda);
document.getElementById("wfm-sem-threads-row").style.display = useCpu ? "" : "none";
/** モデルサイズの選択肢に取得済みかどうかを表示する */
function updateOllamaInfo(ol) {
if (!ol) return;
document.querySelectorAll("#wfm-sem-ollama-tag option").forEach(opt => {
const key = OLLAMA_TAGS.find(([tag]) => tag === opt.value)?.[1];
if (key) opt.textContent = t(key) + (ol.installed?.[opt.value] ? "" : ` ${t("semOllamaNotPulled")}`);
});
const info = document.getElementById("wfm-sem-ollama-info");
if (info) info.textContent = ol.reachable && !ol.ready ? t("semOllamaPullHint", ol.tag) : "";
}
/** 選択中モデルの次元選択肢を作り直す(preferredが選択肢にあればそれを選ぶ) */
@@ -414,11 +396,12 @@ async function refreshModal() {
fillThresholds(st);
const model = selectedModel();
document.getElementById("wfm-sem-local-opts").style.display = model === LOCAL ? "" : "none";
updateDeviceInfo(st.local);
const ready = model === LOCAL ? true : !!st.has_key;
const keyLine = model === LOCAL
? (_backends[LOCAL]?.downloaded ? t("semLocalReady") : t("semLocalNeedDownload"))
: (st.has_key ? t("semKeyOk") : t("semKeyMissing"));
updateOllamaInfo(st.ollama);
const ol = st.ollama || {};
const ready = model === LOCAL ? !!ol.ready : !!st.has_key;
const keyLine = model !== LOCAL ? (st.has_key ? t("semKeyOk") : t("semKeyMissing"))
: !ol.reachable ? t("semOllamaUnreachable", ol.url)
: ol.ready ? t("semOllamaReady", ol.tag) : t("semOllamaMissing", ol.tag);
const idxLine = t("semIndexInfo", st.indexed_total, st.index_dim || "-");
const scopeLine = st.scope_total != null ? t("semScopeInfo", st.scope_indexed, st.scope_total) : "";
document.getElementById("wfm-sem-status").innerHTML =
@@ -437,7 +420,7 @@ async function refreshModal() {
let text = t("semProgress", job.done || 0, total, job.failed || 0);
if (job.running && job.current) text += ` ${job.current}`;
if (!job.running) {
if (["no_api_key", "api_key_invalid", "local_error"].includes(job.error_code)) text += ` ${t(`sem_err_${job.error_code}`, job.error)}`;
if (["no_api_key", "api_key_invalid", "local_error", "ollama_unreachable", "ollama_model_missing"].includes(job.error_code)) text += ` ${t(`sem_err_${job.error_code}`, job.error)}`;
else text += ` ${job.cancelled ? t("semCancelled") : t("semFinished")}`;
if (job.failed && job.error) text += ` (${job.error})`;
}
@@ -477,13 +460,22 @@ function openSemanticModal() {
}
openModal(t("semModalTitle"), modalHtml());
const dimOf = () => parseInt(document.getElementById("wfm-sem-dim").value, 10) || 0;
// ローカルモデル選択時のみ実行設定を送る(サーバー側で保存され、検索時のクエリ埋め込みにも使われる)
const localOpts = () => selectedModel() === LOCAL ? {
device: document.getElementById("wfm-sem-device").value,
threads: parseInt(document.getElementById("wfm-sem-threads").value, 10) || 0,
soft: parseInt(document.getElementById("wfm-sem-soft").value, 10) || 280,
} : {};
document.getElementById("wfm-sem-device").addEventListener("change", () => refreshModal());
// ローカルモデル選択時のみ Ollama の設定を送る(サーバー側で保存され、検索時のクエリ埋め込みにも使われる)
const ollamaOpts = () => ({
ollama_url: document.getElementById("wfm-sem-ollama-url").value.trim(),
ollama_tag: document.getElementById("wfm-sem-ollama-tag").value,
});
const localOpts = () => selectedModel() === LOCAL ? ollamaOpts() : {};
const saveOllamaOpts = async () => {
try {
await postJson(API.options, ollamaOpts());
} catch (e) {
showToast(semanticErrorMessage(e), "error");
}
refreshModal();
};
document.getElementById("wfm-sem-ollama-url").addEventListener("change", saveOllamaOpts);
document.getElementById("wfm-sem-ollama-tag").addEventListener("change", saveOllamaOpts);
document.querySelectorAll('input[name="wfm-sem-model"]').forEach(r => r.addEventListener("change", () => {
fillDims(selectedModel(), 0);
refreshModal();
@@ -507,7 +499,6 @@ function openSemanticModal() {
if (mode === "all" && !confirm(t("semConfirmAll"))) return;
lsSet(LS_DIM, String(dimOf()));
lsSet(LS_MODEL, selectedModel());
lsSet(LS_SOFT, document.getElementById("wfm-sem-soft").value);
try {
await postJson(API.index, {
folder: ctx.getFolder(),
+218 -101
View File
@@ -176,6 +176,26 @@ window._wfmReceiveI2IRunRequest = async (imageBlob, params, workflowData, workfl
}
};
// 複数画像版のI2I実行(Comic Creater の Nanobanana+ タブ「Local」用)。
// iframe.contentWindow._wfmReceiveMultiImageI2IRunRequest(imageBlobs, params, workflowData?, workflowFilename?)
// imageBlobs[i] がワークフロー内 i 番目の LoadImage ノードへ割り当てられる。結果: { ok, url, slotCount, usedImages }
window._wfmReceiveMultiImageI2IRunRequest = async (imageBlobs, params, workflowData, workflowFilename) => {
try {
if (workflowData) {
if (!comfyUI.connected) {
await comfyUI.checkConnection();
}
if (comfyUI.connected && (!comfyEditor.models.checkpoints || comfyEditor.models.checkpoints.length === 0)) {
await comfyEditor.loadModelLists();
}
await loadWorkflowIntoEditor(workflowData, workflowFilename || "workflow.json");
}
return await window._wfmImageEditTab.runI2IExternalMulti(imageBlobs, params);
} catch (e) {
return { ok: false, message: e.message };
}
};
// ComfyUI Comic Creater からiframe越しにコマの設定(シーン・要素・セリフ等)を受け取り、
// AIタブの設定タブと同じLLM接続設定(Ollama/LM Studio)で画像生成プロンプトの下書きを
// 生成して返す(半自動マンガ作成の「L」ボタン連携用)。
@@ -1082,6 +1102,9 @@ async function loadImageDetail(img) {
apiFetch(API.imageWorkflow(img.path)),
]);
state.embeddedWorkflow = wfRes.has_workflow ? wfRes.workflow : null;
// cc_nanobananaフォルダでも、ComfyUIネイティブノード経由(半自動マンガ・Auto等)の画像にはワークフロー/
// プロンプトが埋め込まれているため、Promptタブを表示する(埋め込みの無いGemini API直叩きの画像だけ非表示のまま)
if (state.embeddedWorkflow && isNanobananaFolderImage(img)) updatePromptTabVisibility(false);
renderWorkflowJson(state.embeddedWorkflow);
_updateCopyCanvasBtn();
renderImagePromptSection(metaRes.image_prompt);
@@ -1090,7 +1113,16 @@ async function loadImageDetail(img) {
// Promptタブは prompt_workflow (API形式優先) を使う。トップレベルとサブグラフに
// 独立した複数系統を持つワークフローでは workflow (UI形式) からの抽出だと
// トップレベル系統しか拾えないことがあるため(Metadataタブと同じ優先順位に揃える)。
renderPromptTab(wfRes.prompt_workflow ?? state.embeddedWorkflow, metaRes.embedded);
let promptWf = wfRes.prompt_workflow ?? state.embeddedWorkflow;
// サブグラフを持つUI形式(API形式のpromptチャンクが無い画像)は、外側ノードの実際の値を
// 反映するため変換してから抽出する(Metadataタブと同じ扱い)。失敗時は元の形式のまま。
if (Array.isArray(promptWf?.nodes) && promptWf.definitions?.subgraphs?.length > 0) {
try {
const converted = await comfyWorkflow.convertUiToApi(promptWf, { readOnly: true });
if (converted && Object.keys(converted).length > 0) promptWf = converted;
} catch { /* keep UI format */ }
}
renderPromptTab(promptWf, metaRes.embedded);
} catch (e) {
renderWorkflowJson(null);
_updateCopyCanvasBtn();
@@ -1852,13 +1884,38 @@ function openConvertModal(paths) {
showToast(t("convertNoTarget"), "info");
return;
}
const hasVideo = targets.some(isVideoFile);
openAudioConvertDialog({
count: targets.length,
hasVideo: targets.some(isVideoFile),
convertOne: async (opts, i) => {
const res = await fetch(API.convert, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: targets[i].path, ...opts }),
});
const data = await res.json();
if (!data.ok) throw new Error(data.error || `HTTP ${res.status}`);
if (data.deleted) state.selectedImages.delete(targets[i].path);
return data;
},
onDone: async () => {
await loadImages();
updateBulkBar();
},
});
}
/**
* 音声変換ダイアログ(Gallery・Video Edit共通)。
* convertOne(opts, i): i件目を変換し、失敗時はthrowする。結果は {tags_skipped?} を含むオブジェクト。
* allowDelete / allowCopyMeta=false の場合は該当チェックを出さず、optsにもfalseで渡す。
*/
export function openAudioConvertDialog({ count, hasVideo, convertOne, onDone, allowDelete = true, allowCopyMeta = true }) {
const overlay = document.createElement("div");
overlay.className = "wfm-gallery-lightbox";
overlay.innerHTML = `
<div class="wfm-gallery-move-modal wfm-gallery-convert-modal">
<div class="wfm-gallery-move-modal-title">${escapeHtml(t("convertTitle", targets.length))}</div>
<div class="wfm-gallery-move-modal-title">${escapeHtml(t("convertTitle", count))}</div>
${hasVideo ? `<div class="wfm-gallery-convert-note">${escapeHtml(t("convertVideoNote"))}</div>` : ""}
<label class="wfm-gallery-convert-row">${escapeHtml(t("convertFormat"))}
<select id="wfm-convert-format" class="wfm-select">
@@ -1883,8 +1940,8 @@ function openConvertModal(paths) {
</select>
</label>
<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-inherit" checked> ${escapeHtml(t("convertInherit"))}</label>
<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-copymeta" checked> ${escapeHtml(t("convertCopyMeta"))}</label>
<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-delete"> ${escapeHtml(t("convertDeleteOriginal"))}</label>
${allowCopyMeta ? `<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-copymeta" checked> ${escapeHtml(t("convertCopyMeta"))}</label>` : ""}
${allowDelete ? `<label class="wfm-gallery-convert-check"><input type="checkbox" id="wfm-convert-delete"> ${escapeHtml(t("convertDeleteOriginal"))}</label>` : ""}
<div class="wfm-gallery-convert-status" id="wfm-convert-status"></div>
<div class="wfm-gallery-move-modal-footer">
<button id="wfm-convert-run" class="wfm-btn wfm-btn-primary">${escapeHtml(t("convertRun"))}</button>
@@ -1913,8 +1970,8 @@ function openConvertModal(paths) {
q("#wfm-convert-cancel").addEventListener("click", () => { if (!running) overlay.remove(); });
overlay.addEventListener("click", (e) => { if (e.target === overlay && !running) overlay.remove(); });
q("#wfm-convert-run").addEventListener("click", async () => {
const deleteOriginal = q("#wfm-convert-delete").checked;
if (deleteOriginal && !window.confirm(t("convertConfirmDelete", targets.length))) return;
const deleteOriginal = !!q("#wfm-convert-delete")?.checked;
if (deleteOriginal && !window.confirm(t("convertConfirmDelete", count))) return;
running = true;
q("#wfm-convert-run").disabled = true;
q("#wfm-convert-cancel").disabled = true;
@@ -1924,33 +1981,25 @@ function openConvertModal(paths) {
sample_rate: Number(q("#wfm-convert-rate").value),
channels: q("#wfm-convert-channels").value,
inherit_metadata: q("#wfm-convert-inherit").checked,
copy_gallery_meta: q("#wfm-convert-copymeta").checked,
copy_gallery_meta: !!q("#wfm-convert-copymeta")?.checked,
delete_original: deleteOriginal,
};
let ok = 0, fail = 0, tagsSkipped = false;
for (let i = 0; i < targets.length; i++) {
q("#wfm-convert-status").textContent = t("convertProgress", i + 1, targets.length);
for (let i = 0; i < count; i++) {
q("#wfm-convert-status").textContent = t("convertProgress", i + 1, count);
try {
const res = await fetch(API.convert, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: targets[i].path, ...opts }),
});
const data = await res.json();
if (!data.ok) throw new Error(data.error || `HTTP ${res.status}`);
const data = await convertOne(opts, i);
ok++;
if (data.tags_skipped) tagsSkipped = true;
if (data.deleted) state.selectedImages.delete(targets[i].path);
if (data?.tags_skipped) tagsSkipped = true;
} catch (e) {
fail++;
console.warn("[Gallery] convert failed:", targets[i].filename, e);
console.warn("[Gallery] convert failed:", i, e);
}
}
overlay.remove();
showToast(t("convertDone", ok, fail), fail ? "error" : "success");
if (tagsSkipped && opts.inherit_metadata) showToast(t("convertTagsSkipped"), "info");
await loadImages();
updateBulkBar();
await onDone?.({ ok, fail });
});
document.body.appendChild(overlay);
@@ -2097,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() {
@@ -2294,93 +2422,82 @@ function bindEvents() {
}
});
// 選択画像を ComfyUI Comic Creator の選択コマ/オーバーレイへ送信
// (ComfyUI Comic CreaterからこのGalleryタブがiframe埋め込みされている場合のみ表示・動作する)
// 選択画像を ComfyUI Comic Creator へ送信(ComfyUI Comic CreaterからこのGalleryタブがiframe埋め込みされている場合のみ表示・動作する)
// Send CC Layout: レイアウトタブの選択コマ/オーバーレイへ(動画はComic Creatorの動画ツールへ)
// Send CC Image : Imageタブへ(作業中のレイヤーがあれば新規レイヤー、無ければ新規キャンバス)。動画は未対応
const sendCcBtn = document.getElementById("wfm-gallery-send-cc-btn");
if (sendCcBtn) {
let embedded = false;
const sendCcImageBtn = document.getElementById("wfm-gallery-send-cc-image-btn");
let ccEmbedded = false;
try {
ccEmbedded = !!(window.parent && window.parent !== window);
} catch (e) {
ccEmbedded = false;
}
if (ccEmbedded) {
if (sendCcBtn) sendCcBtn.style.display = "";
if (sendCcImageBtn) sendCcImageBtn.style.display = "";
}
// window.parent のメンバーを安全に取り出す(クロスオリジン等で参照できなければnull)
const getCcParentFn = (name) => {
try {
embedded = !!(window.parent && window.parent !== window);
} catch (e) {
embedded = false;
if (window.parent && window.parent !== window && typeof window.parent[name] === "function") return window.parent[name];
} catch (e) { /* ignore */ }
return null;
};
sendCcBtn?.addEventListener("click", () => {
if (!state.selectedImage) {
showToast(t("gallerySelectImageFirst"), "info");
return;
}
if (embedded) sendCcBtn.style.display = "";
const url = API.serveImage(state.selectedImage.path);
sendCcBtn.addEventListener("click", () => {
if (!state.selectedImage) {
showToast(t("gallerySelectImageFirst"), "info");
return;
}
const url = API.serveImage(state.selectedImage.path);
const isVideo = isVideoFile(state.selectedImage);
// I2I送信元がImageタブだった場合はそちらへ画像を読み込ませる(_ccI2ITargetModeはComic Creater側が
// 「I2Iへ送る」ボタン押下時にセットするフラグ。undefined/'layout'なら従来通りコマ/オーバーレイへ挿入)
let targetMode = null;
try {
targetMode = window.parent?._ccI2ITargetMode || null;
} catch (e) {
targetMode = null;
}
if (targetMode === "image") {
// Imageタブは動画未対応(Comic Creator側の動画ツールはレイアウトタブのみ対応)
if (isVideo) {
showToast(t("galleryVideoNotSupportedInImageTab"), "info");
return;
}
let imageTab = null;
try {
if (window.parent && window.parent !== window && typeof window.parent._ccImageTab?.loadFromUrl === "function") {
imageTab = window.parent._ccImageTab;
}
} catch (e) {
imageTab = null;
}
if (!imageTab) {
showToast(t("galleryCCNotAvailable"), "info");
return;
}
imageTab.loadFromUrl(url, (state.selectedImage.filename || "cc-image").replace(/\.[^.]+$/, ""));
showToast(t("gallerySentCC"), "success");
return;
}
// レイアウトタブのコマ/オーバーレイへ(デフォルト経路)。動画(.mp4)はComic Creator側の
// 動画ツール専用の受け口(insertVideoFromUrl)へ、それ以外は従来通り画像として送る
if (isVideo) {
let insertVideoFn = null;
try {
if (window.parent && window.parent !== window && typeof window.parent.insertVideoFromUrl === "function") {
insertVideoFn = window.parent.insertVideoFromUrl;
}
} catch (e) {
insertVideoFn = null;
}
if (!insertVideoFn) {
showToast(t("galleryCCNotAvailable"), "info");
return;
}
insertVideoFn(url, state.selectedImage.filename || "video.mp4");
showToast(t("gallerySentCC"), "success");
return;
}
let insertFn = null;
try {
if (window.parent && window.parent !== window && typeof window.parent.insertImageFromUrl === "function") {
insertFn = window.parent.insertImageFromUrl;
}
} catch (e) {
insertFn = null;
}
if (!insertFn) {
// 動画(.mp4)はComic Creator側の動画ツール専用の受け口(insertVideoFromUrl)へ、それ以外は画像として送る
if (isVideoFile(state.selectedImage)) {
const insertVideoFn = getCcParentFn("insertVideoFromUrl");
if (!insertVideoFn) {
showToast(t("galleryCCNotAvailable"), "info");
return;
}
insertFn(url);
insertVideoFn(url, state.selectedImage.filename || "video.mp4");
showToast(t("gallerySentCC"), "success");
});
}
return;
}
const insertFn = getCcParentFn("insertImageFromUrl");
if (!insertFn) {
showToast(t("galleryCCNotAvailable"), "info");
return;
}
insertFn(url);
showToast(t("gallerySentCC"), "success");
});
sendCcImageBtn?.addEventListener("click", async () => {
if (!state.selectedImage) {
showToast(t("gallerySelectImageFirst"), "info");
return;
}
// Imageタブは動画未対応
if (isVideoFile(state.selectedImage)) {
showToast(t("galleryVideoNotSupportedInImageTab"), "info");
return;
}
const sendFn = getCcParentFn("sendImageToImageTab");
if (!sendFn) {
showToast(t("galleryCCNotAvailable"), "info");
return;
}
const url = API.serveImage(state.selectedImage.path);
try {
const ok = await sendFn(url, (state.selectedImage.filename || "cc-image").replace(/\.[^.]+$/, ""));
showToast(t(ok === false ? "galleryCCNotAvailable" : "gallerySentCC"), ok === false ? "info" : "success");
} catch (e) {
console.error("[gallery] Send CC Image failed", e);
showToast(t("galleryCCNotAvailable"), "info");
}
});
// 検索(連続キー入力のたびにリクエストを飛ばすと、50枚程度のフォルダでも
// ファイルI/Oの重いサーバー処理が積み重なって読み込みが遅延するためdebounceする)
+21 -9
View File
@@ -1889,6 +1889,9 @@ async function _runBatchGenerate() {
__value__: [{ name: stem, strength: 1.0, active: true, expanded: false, clipStrength: 1.0, locked: false }],
};
comfyUI.currentWorkflow[node.id].inputs.text = `<lora:${stem}:1:1>`;
} else if (node.is_lora_stack) {
const actualName = loraNameMap?.get(loraName.replace(/\\/g, "/")) || loraName;
comfyEditor.applyLoraStack([{ name: actualName }]);
} else {
const actualName = loraNameMap?.get(loraName.replace(/\\/g, "/")) || loraName;
comfyUI.currentWorkflow[node.id].inputs.lora_name = actualName;
@@ -2214,16 +2217,25 @@ export async function initGenerateTab() {
comfyEditor.renderLoraPane(comfyUI.currentAnalysis, "wfm-gen-lora-fields");
});
// Input inner tab (Prompt / Image)
document.querySelectorAll(".wfm-input-inner-tab").forEach((btn) => {
btn.addEventListener("click", () => {
const target = btn.dataset.inputTab;
document.querySelectorAll(".wfm-input-inner-tab").forEach((b) => b.classList.remove("active"));
btn.classList.add("active");
document.querySelectorAll(".wfm-input-inner-panel").forEach((p) => p.style.display = "none");
document.getElementById(`wfm-input-panel-${target}`)?.style.setProperty("display", "");
// Input tab: Raw JSON column collapse / expand (state remembered in localStorage)
{
const col = document.getElementById("wfm-gen-rawjson-col-input");
const btn = document.getElementById("wfm-gen-rawjson-collapse-btn");
const KEY = "wfm_gen_rawjson_collapsed";
const apply = (collapsed) => {
col?.classList.toggle("wfm-gen-rawjson-col--collapsed", collapsed);
const icon = btn?.querySelector(".wfm-rawjson-collapse-icon");
if (icon) icon.textContent = collapsed ? "«" : "»";
};
let stored = false;
try { stored = localStorage.getItem(KEY) === "1"; } catch { /* ignore */ }
apply(stored);
btn?.addEventListener("click", () => {
const next = !col.classList.contains("wfm-gen-rawjson-col--collapsed");
apply(next);
try { localStorage.setItem(KEY, next ? "1" : "0"); } catch { /* ignore */ }
});
});
}
// Initial placement: move to first active tab (input)
moveRawJsonToTab("input");
+420 -111
View File
File diff suppressed because one or more lines are too long
+4
View File
@@ -1345,6 +1345,10 @@ class ImageEditTab {
}
// Comic Creator等、同一オリジンiframe越しの外部呼び出し専用エントリポイント(I2I版)。
async runI2IExternalMulti(imageBlobs, opts) {
return this._inpaint.runI2IExternalMulti(imageBlobs, opts);
}
async runI2IExternal(imageBlob, opts) {
return this._inpaint.runI2IExternal(imageBlob, opts);
}
+50
View File
@@ -287,6 +287,56 @@ export class InpaintI2IActions {
return resultImg?.src || null;
}
// 複数画像版: imageBlobs[i] をワークフロー内の i 番目の LoadImage ノードへ割り当てて実行する
// (Comic Creator の Nanobanana+ タブ「Local」用。LoadImage 数を超える分は無視する)。
// denoise は指定されたときだけ反映する(Image Edit系ワークフローはdenoiseを持たないことが多い)。
// width/height/steps/cfg/seed は指定時のみ反映(未指定=ワークフロー既定のまま)。
// seed が 0以上なら固定シード、未指定/負ならGenerateUIのシード設定に従う。
async _runI2IWithImages(imageBlobs, { positive, negative, denoise, width, height, steps, cfg, sampler_name, scheduler, seed, overrideOpts = {}, onStatus } = {}) {
const setStatus = onStatus || (() => {});
const analysisForLookup = overrideOpts.analysis || comfyUI.currentAnalysis;
if (!analysisForLookup) throw new Error("No workflow loaded in GenerateUI");
const slotCount = analysisForLookup.load_image_nodes?.length || 0;
if (imageBlobs.length > 0 && slotCount === 0) {
throw new Error("No LoadImage node found in the workflow");
}
setStatus("Uploading...");
const used = Math.min(imageBlobs.length, slotCount);
for (let i = 0; i < used; i++) {
const file = new File([imageBlobs[i]], `i2i_${Math.random().toString(36).slice(2, 10)}.png`, { type: "image/png" });
await comfyEditor.applyImageToSlot(file, i, overrideOpts);
}
comfyEditor.setPromptText("positive", positive, overrideOpts);
if (negative) comfyEditor.setPromptText("negative", negative, overrideOpts);
if (width != null || height != null || steps != null || cfg != null || denoise != null || sampler_name || scheduler) {
comfyEditor.setGenerationParams({ width, height, steps, cfg, denoise, sampler_name, scheduler, ...overrideOpts });
}
if (!window._wfmGenerateTab?.generate) throw new Error("GenerateUI is not ready yet");
setStatus("Generating...");
const genOptions = (seed != null && seed >= 0) ? { seedValue: seed } : {};
await window._wfmGenerateTab.generate(overrideOpts.workflow || undefined, genOptions);
const resultImg = document.getElementById("wfm-gen-result-img");
return { url: resultImg?.src || null, slotCount, usedImages: used };
}
async runI2IExternalMulti(imageBlobs, { positive = "", negative = "", denoise = null, width, height, steps, cfg, sampler_name, scheduler, seed } = {}) {
if (this.i2iExternalRunning) throw new Error("I2I is already running");
this.i2iExternalRunning = true;
try {
const r = await this._runI2IWithImages(imageBlobs || [], { positive, negative, denoise, width, height, steps, cfg, sampler_name, scheduler, seed });
if (!r.url) throw new Error("No result image produced");
return { ok: true, url: r.url, slotCount: r.slotCount, usedImages: r.usedImages };
} finally {
this.i2iExternalRunning = false;
}
}
// Comic Creator等、同一オリジンiframe越しの外部呼び出し専用エントリポイント(I2I版)。
// runExternal と対になる、マスク不要のシンプルなI2I実行。
async runI2IExternal(imageBlob, { positive = "", negative = "", denoise = 1.0 } = {}) {
+3 -1
View File
@@ -1353,7 +1353,9 @@ function _applyLabLoraToWorkflow(wf, analysis, lora) {
const bypass = !!lora.nodeBypass;
const strModel = bypass ? 0 : (lora.strengthModel ?? 1.0);
const strClip = bypass ? 0 : (lora.strengthClip ?? 1.0);
if (isLoraManager) {
if (comfyEditor.isLoraStackNode(wf[nodeId])) {
comfyEditor.applyLoraStack([{ name: comfyEditor.resolveLoraName(lora.name), strModel, strClip, enabled: !bypass }], wf);
} else if (isLoraManager) {
const stem = lora.name.replace(/\\/g, "/").split("/").pop().replace(/\.[^.]+$/, "");
wf[nodeId].inputs.loras = {
__value__: [{ name: stem, strength: strModel, active: !bypass, expanded: false, clipStrength: strClip, locked: false }],
+37 -7
View File
@@ -201,7 +201,12 @@ function extractDiffusionModels(wf) {
if (!wf || typeof wf !== "object") return [];
const UNET_TYPES = new Set(["UNETLoader", "UnetLoaderGGUF", "UNETLoaderGGUF"]);
if (Array.isArray(wf.nodes)) return collectUnique(collectAllNodes(wf).filter(n => UNET_TYPES.has(n.type)).map(n => n.widgets_values?.[0]));
return collectUnique(Object.values(wf).filter(n => UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name));
// Gemini系の画像生成ノード(Nano Banana等、API形式)は"model"入力がモデル名(例: "Gemini Nano Banana 2.1")
const isGeminiImage = (ct) => /^Gemini(Image|NanoBanana)/.test(ct ?? "");
return collectUnique([
...Object.values(wf).filter(n => UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name),
...Object.values(wf).filter(n => isGeminiImage(n?.class_type)).map(n => typeof n.inputs?.model === "string" ? n.inputs.model : undefined),
]);
}
function extractTextEncoders(wf) {
if (!wf || typeof wf !== "object") return [];
@@ -227,7 +232,7 @@ function extractTextEncoders(wf) {
}
function extractLoRAs(wf) {
if (!wf || typeof wf !== "object") return [];
const results = [], seen = new Set();
const results = [], seen = new Set(), stackNames = new Set();
function add(name, sm, sc) {
if (!name || typeof name !== "string" || name === "None" || seen.has(name)) return;
seen.add(name);
@@ -250,6 +255,19 @@ function extractLoRAs(wf) {
if (ct === "LoraLoader") add(n.inputs?.lora_name, n.inputs?.strength_model, n.inputs?.strength_clip);
else if (ct === "LoraLoaderModelOnly") add(n.inputs?.lora_name, n.inputs?.strength, 1.0);
else if (ct === "ImageMetadataLoRALoader") { for (let i = 1; i <= 3; i++) add(n.inputs?.[`lora_${i}`], n.inputs?.[`strength_model_${i}`], n.inputs?.[`strength_clip_${i}`]); }
else if (ct === "LoadLoraModel" || ct === "LoadLoraTextEncoder") {
// Native stack node: DynamicGroup rows are flat API keys "loras.<row>.<field>".
// Model node carries the model strength, Text Encoder node the clip strength.
const isModel = ct === "LoadLoraModel";
for (const [k, name] of Object.entries(n.inputs || {})) {
const m = /^loras\.(\d+)\.lora_name$/.exec(k);
if (!m || typeof name !== "string" || n.inputs[`loras.${m[1]}.enabled`] === false) continue;
const s = n.inputs[`loras.${m[1]}.strength`];
const hit = stackNames.has(name) && results.find((r) => r.name === name);
if (hit) hit[isModel ? "strength_model" : "strength_clip"] = parseFloat(s) || 1.0;
else { add(name, isModel ? s : 1.0, isModel ? 1.0 : s); stackNames.add(name); }
}
}
else if (ct === "Lora Loader (LoraManager)") {
const lorasData = n.inputs?.loras;
const list = lorasData?.__value__ ?? (Array.isArray(lorasData) ? lorasData : null);
@@ -287,6 +305,11 @@ function extractSamplerSettings(apiWf) {
// 補助ノードから不足分を補う。
const AUX = {
RandomNoise: ["noise_seed"],
// Gemini系の画像生成ノード(Nano Banana等)はseedのみ(GeminiへはseedではなくComfyUIのキャッシュキーとして働く)
GeminiImageNode: ["seed"],
GeminiImage2Node: ["seed"],
GeminiNanoBanana2: ["seed"],
GeminiNanoBanana2V2: ["seed"],
BasicScheduler: ["steps", "scheduler", "denoise"],
KSamplerSelect: ["sampler_name"],
CFGGuider: ["cfg"],
@@ -600,9 +623,13 @@ function extractPromptsAPI(wf) {
// MiniMaxH3ImageToVideo等の動画生成オールインワンノード。CLIPTextEncode等を経由せず
// 自ノードの"prompt"入力に直接テキストを持つ(positive/negativeの区別も無い)ため、
// isTextEncoderNode判定を通さずtextMapへ直接投入する(fallbackのtextsに載る)。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo/i.test(ct)) {
textMap.set(id, n.inputs.prompt);
continue;
// Gemini系の画像生成ノード(Nano Banana等)も同様に自ノードの"prompt"入力を持つ。
// FastH3 OmniRef(MiniMaxH3ReferenceToVideo)のように"prompt"が別ノードから配線される場合はリンク先を解決する。
if (/ImageToVideo|TextToVideo|ReferenceToVideo|^Gemini(Image|NanoBanana)/i.test(ct)) {
const pv = n.inputs?.prompt;
const txt = typeof pv === "string" ? pv : Array.isArray(pv) ? resolveLinkedText(wf, pv[0], pv[1] ?? 0) : null;
if (txt) textMap.set(id, txt);
if (pv !== undefined) continue;
}
if (!isTextEncoderNode(ct)) continue;
// "prompt" — TextEncodeQwenImageEdit(Plus)/TextEncodeBooguEdit and similar Image Edit
@@ -643,8 +670,11 @@ function extractPromptsAPI(wf) {
// negative_prompt directly, so textMap (single text per node) can't represent both
// roles.
const srcNode = wf[String(val[0])];
if (srcNode?.class_type === "TextEncodeMageFlowEdit" || srcNode?.class_type === "TextEncodeBooguEdit") {
const text = isPos ? srcNode.inputs?.prompt : srcNode.inputs?.negative_prompt;
// TextEncodeFibo2(Fibo 2.0)も同形。promptはPreviewAny→プロンプト強化スイッチ経由でリンクされる。
if (srcNode?.class_type === "TextEncodeMageFlowEdit" || srcNode?.class_type === "TextEncodeBooguEdit"
|| srcNode?.class_type === "TextEncodeFibo2") {
const raw = isPos ? srcNode.inputs?.prompt : srcNode.inputs?.negative_prompt;
const text = Array.isArray(raw) ? resolveLinkedText(wf, raw[0], raw[1] ?? 0) : raw;
if (text && typeof text === "string") { if (isPos) pos.add(text); else neg.add(text); }
continue;
}
+2
View File
@@ -61,6 +61,8 @@ export function applyToGenUI(modelName, modelType) {
__value__: [{ name: stem, strength: 1.0, active: true, expanded: false, clipStrength: 1.0, locked: false }],
};
comfyUI.currentWorkflow[nodeId].inputs.text = `<lora:${stem}:1:1>`;
} else if (comfyEditor.isLoraStackNode(comfyUI.currentWorkflow[nodeId])) {
comfyEditor.applyLoraStack([{ name: comfyEditor.resolveLoraName(modelName) }]);
} else {
comfyUI.currentWorkflow[nodeId].inputs.lora_name = comfyEditor.resolveLoraName(modelName);
}
+31
View File
@@ -199,6 +199,35 @@ function _updateVlmBackendIndicators() {
// ── モデル一覧ロード ─────────────────────────────────────────────
// PixAI Tagger はWD系と推奨しきい値が違う(general 0.17 / character 0.27)ため、
// モデル切替時にスライダーが各モデルの既定値のままなら、新モデルの既定値へ切り替える。
const _WD_DEFAULTS = { thr: 0.35, chr: 0.85 };
const _PIXAI_DEFAULTS = { thr: 0.17, chr: 0.27 };
let _pixaiModels = new Set();
let _thresholdDefaultsBound = false;
function _setupModelThresholdDefaults() {
if (_thresholdDefaultsBound) return;
_thresholdDefaultsBound = true;
[
["wfm-tagger-model", "wfm-tagger-threshold", "wfm-tagger-char-threshold"],
["wfm-tagger-batch-model", "wfm-tagger-batch-threshold", "wfm-tagger-batch-char-threshold"],
].forEach(([modelId, thrId, chrId]) => {
const sel = document.getElementById(modelId);
if (!sel) return;
sel.addEventListener("change", () => {
const to = _pixaiModels.has(sel.value) ? _PIXAI_DEFAULTS : _WD_DEFAULTS;
const from = to === _PIXAI_DEFAULTS ? _WD_DEFAULTS : _PIXAI_DEFAULTS;
[[thrId, from.thr, to.thr], [chrId, from.chr, to.chr]].forEach(([id, oldDef, newDef]) => {
const slider = document.getElementById(id);
if (!slider || Math.abs(parseFloat(slider.value) - oldDef) > 0.005) return;
slider.value = newDef;
slider.dispatchEvent(new Event("input"));
});
});
});
}
async function _loadModels() {
try {
const res = await fetch("/wfm/tagger/models");
@@ -210,6 +239,8 @@ async function _loadModels() {
sel.innerHTML = `<option value="">${t("taggerNoModel")}</option>` +
models.map(m => `<option value="${m.name}">[${m.type}] ${m.name}</option>`).join("");
});
_pixaiModels = new Set(models.filter(m => m.pixai).map(m => m.name));
_setupModelThresholdDefaults();
} catch (e) {
console.warn("tagger: _loadModels error", e);
}
File diff suppressed because it is too large Load Diff
+8 -4
View File
@@ -13,7 +13,7 @@ import { setSourcePreview } from "./video-preview.js";
import { showToast } from "./app.js";
import { t } from "./i18n.js";
import { addClipFromFile, setBgmFromFile, addPipFromFile, addSoundFromFile } from "./video-edit-tab.js";
import { setBlockImageFromFile } from "./video-plan-tab.js";
import { setBlockImageFromFile, isReferenceImagePlan } from "./video-plan-tab.js";
// Sentinel for the "All Video Assets" option — not a real backend group, since
// Gallery's group filter only ever matches one group at a time. Selecting it
@@ -249,8 +249,8 @@ function _renderDetail(img) {
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-asset-set-bgm" style="width:100%;margin-top:${isAudioFile(img) ? "12" : "6"}px;display:${isVideoFile(img) || isAudioFile(img) ? "block" : "none"};">${t("videoAssetSetAsBgm")}</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-asset-add-sound" style="width:100%;margin-top:6px;display:${isAudioFile(img) ? "block" : "none"};">${t("videoAssetAddAsSound")}</button>
<div id="wfm-video-asset-set-plan-image-row" style="display:${isVideoFile(img) || isAudioFile(img) ? "none" : "flex"};gap:6px;margin-top:6px;">
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-asset-set-first" style="flex:1;">${t("videoAssetSetAsFirst")}</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-asset-set-last" style="flex:1;">${t("videoAssetSetAsLast")}</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-asset-set-first" style="flex:1;">${t(isReferenceImagePlan() ? "videoAssetSetAsRef1" : "videoAssetSetAsFirst")}</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-asset-set-last" style="flex:1;">${t(isReferenceImagePlan() ? "videoAssetSetAsRef2" : "videoAssetSetAsLast")}</button>
</div>
<button type="button" class="wfm-btn wfm-btn-primary wfm-btn-sm" id="wfm-video-asset-open-gallery" style="width:100%;margin-top:6px;">Open in Gallery</button>
`;
@@ -353,7 +353,11 @@ function _renderDetail(img) {
const file = new File([blob], img.filename, { type: blob.type || "image/png" });
await setBlockImageFromFile(which, file);
document.querySelector('.wfm-video-center-panel .wfm-video-subtab-btn[data-video-subtab="plan"]')?.click();
showToast(t(which === "first" ? "videoAssetSetAsFirstDone" : "videoAssetSetAsLastDone", img.filename), "success");
const ref = isReferenceImagePlan();
const doneKey = which === "first"
? (ref ? "videoAssetSetAsRef1Done" : "videoAssetSetAsFirstDone")
: (ref ? "videoAssetSetAsRef2Done" : "videoAssetSetAsLastDone");
showToast(t(doneKey, img.filename), "success");
} catch (err) {
showToast(t("errorWithMsg", err.message), "error");
}
+34 -7
View File
@@ -83,7 +83,8 @@ import {
setSourcePreview, setResultPreview, getActivePreviewVideoElement, getResultPreviewVideoElement,
getPreviewPaneElements,
} from "./video-preview.js";
import { VTEMP_GROUP, ensureVideoGroup } from "./gallery-tab.js";
import { VTEMP_GROUP, ensureVideoGroup, openAudioConvertDialog } from "./gallery-tab.js";
import { escapeHtml } from "./util.js";
const _s = {
clips: [], // { id, name, file, kind:"video"|"image", serverRef:{filename,subfolder,type}|null, duration, width, height, fps, hasAudio, trimStart, trimEnd, crop:{x,y,w,h}(0..1)|null, probing, error }
@@ -1057,13 +1058,13 @@ function _renderCropSection(clip) {
.map((k) => `<option value="${k}">${k === "free" ? t("videoEditCropFree") : k}</option>`)
.join("");
host.innerHTML = `
<div class="wfm-video-edit-section-head">
<div class="wfm-video-edit-section-head wfm-video-edit-crop-head">
<span>${t("videoEditCrop")}</span>
<span style="display:flex;gap:6px;">
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-toggle"></button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-cancel" style="display:${_cropEditing ? "" : "none"};">${t("videoEditCropCancel")}</button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-reset">${t("videoEditCropReset")}</button>
</span>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-toggle"></button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-cancel" style="display:${_cropEditing ? "" : "none"};">${t("videoEditCropCancel")}</button>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-crop-reset">${t("videoEditCropReset")}</button>
<span class="wfm-video-edit-head-sep" aria-hidden="true">|</span>
<button type="button" class="wfm-btn wfm-btn-xs" id="wfm-video-edit-audio-convert" title="${escapeHtml(t("videoEditAudioConvertTitle"))}">${t("videoEditAudioConvert")}</button>
</div>
<div class="wfm-video-edit-crop-row">
<label>${t("videoEditCropAspect")}<select class="wfm-input" id="wfm-video-edit-crop-aspect">${aspectOptions}</select></label>
@@ -1089,6 +1090,7 @@ function _renderCropSection(clip) {
clip.crop = _cropEditing ? { x: 0, y: 0, w: 1, h: 1 } : null;
_commitCrop(clip);
});
document.getElementById("wfm-video-edit-audio-convert").addEventListener("click", () => _openClipAudioConvert(clip));
aspect.addEventListener("change", () => {
_cropAspect = aspect.value;
if (clip.crop) _applyCropAspect(clip);
@@ -1097,6 +1099,31 @@ function _renderCropSection(clip) {
_updateCropInfo(clip);
}
// Audio conversion for the selected clip: reuses Gallery's convert dialog, but the
// clip lives in ComfyUI's input folder, so the backend writes the result into
// output/video (visible in Gallery) instead of next to the source.
function _openClipAudioConvert(clip) {
if (clip.probing || !clip.serverRef) { showToast(t("videoEditClipNotReady"), "info"); return; }
if (clip.kind !== "video" || !clip.hasAudio) { showToast(t("convertNoTarget"), "info"); return; }
openAudioConvertDialog({
count: 1,
hasVideo: true,
allowDelete: false,
allowCopyMeta: false,
convertOne: async (opts) => {
const res = await fetch("/api/wfm/video/edit/convert-audio", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ ...clip.serverRef, ...opts }),
});
const data = await res.json();
if (!data.ok) throw new Error(data.error || `HTTP ${res.status}`);
showToast(t("videoEditAudioConvertSaved", data.filename), "success");
return data;
},
});
}
// Leaves crop-edit mode. keep=true ("Done", or leaving the Edit subtab /
// selecting another clip) keeps the adjusted rect; keep=false ("Cancel")
// puts back the crop the clip had when editing started.
+23 -2
View File
@@ -202,6 +202,14 @@ function _updateFieldHighlights() {
const hasTurboSteps = nodes.turboStepsIdx !== -1;
const hasPromptEnhance = nodes.promptEnhanceIdx !== -1;
// FastH3 OmniRef / Pika-H3-Flex(Reference to Video)では先頭/最終フレームではなく
// 参照画像(ref_image_0/ref_image_1)として渡る。
const isRef = nodes.family === "fasth3";
const firstLabel = document.getElementById("wfm-video-block-first-label");
if (firstLabel) firstLabel.textContent = isRef ? "Reference Image" : "First Image";
const lastLabel = document.getElementById("wfm-video-block-last-label");
if (lastLabel) lastLabel.textContent = isRef ? "Reference Image 2 (optional)" : "Last Image (optional)";
_setFieldActive("wfm-video-block-prompt-label", true);
_setFieldActive("wfm-video-block-duration-label", true);
_setFieldActive("wfm-video-block-first-label", nodes.firstFrameSlot !== -1);
@@ -319,6 +327,17 @@ async function _handleBlockImageUpload(which, file) {
}
}
// True when the loaded template is a Reference-to-Video workflow (FastH3 OmniRef /
// Pika-H3-Flex), whose First/Last Image fields are reference images 1/2 — lets
// video-asset-tab.js label its "Set as First/Last Image" buttons accordingly.
export function isReferenceImagePlan() {
return _isReferenceTemplate();
}
function _isReferenceTemplate() {
return !!_templateWorkflow && locateVideoModelNodes(_templateWorkflow)?.family === "fasth3";
}
// Exported so other modules (video-asset-tab.js's "Set as First/Last Image"
// buttons) can seed the currently-selected Plan block's First/Last Image from
// an already-fetched File — reuses the exact upload + first_image_mode
@@ -661,11 +680,13 @@ function _setRunUiState(running) {
// last_image_filename on the previous block always wins (it's already a known
// input image — no extraction needed); otherwise the previous block's actual
// generated last frame is used (extracted client-side after that block ran).
// Reference-to-Video templates store Reference Image 2 in last_image_filename, which
// is not the previous clip's last frame, so it never short-circuits the extraction.
async function _resolveFirstImage(block, i, prevGeneratedLastFrameRef) {
if (block.first_image_mode === "explicit") return block.first_image_filename || null;
if (block.first_image_mode === "chain_previous" && i > 0) {
const prevBlock = _plan.blocks[i - 1];
if (prevBlock.last_image_filename) return prevBlock.last_image_filename;
if (prevBlock.last_image_filename && !_isReferenceTemplate()) return prevBlock.last_image_filename;
return prevGeneratedLastFrameRef;
}
return null;
@@ -753,7 +774,7 @@ async function _runVideoPlanBatch() {
// skip the extraction entirely when this block already has its own
// explicit last_image_filename (that value is used directly instead).
prevGeneratedLastFrameRef = null;
if (!block.last_image_filename) {
if (!block.last_image_filename || _isReferenceTemplate()) {
const vid = outputMedia.find((m) => isVideoFilename(m.filename));
if (vid) {
try {
+39
View File
@@ -150,6 +150,7 @@ function _applyVideoI18n() {
setText("wfm-video-edit-bgm-hint", "videoEditBgmHint");
setText("wfm-video-edit-sound-btn", "videoEditSoundAdd");
setText("wfm-video-source-add-to-edit", "videoSourceAddToEdit");
setText("wfm-video-source-register-asset", "videoSourceRegisterAsset");
setText("wfm-video-source-label", "videoSourceLabel");
setText("wfm-video-source-hint", "videoSourceHint");
setText("wfm-video-source-drop-label", "videoSourceDropLabel");
@@ -211,6 +212,44 @@ function _wireVideoSourcePanel() {
}
});
// "Register as Asset" — puts whatever is loaded in the Source pane into Gallery's
// curated __Video Assets__ group so it shows up in the Asset subtab. Local files
// are uploaded to input first, then copied into output/video by the backend
// (Gallery only lists the output folder); sources already in output are tagged as-is.
document.getElementById("wfm-video-source-register-asset")?.addEventListener("click", async (e) => {
const btn = e.currentTarget;
let ref = getActivePreviewSource();
if (!ref) { showToast(t("videoNoSourceLoaded"), "error"); return; }
btn.disabled = true;
try {
if (ref.kind === "local") {
const uploaded = await comfyUI.uploadImage(ref.file, ref.file.name);
ref = { kind: "input", filename: uploaded.name, subfolder: uploaded.subfolder || "", type: "input" };
updateActivePreviewSourceRef(ref);
}
const res = await fetch("/api/wfm/video/asset/register", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ filename: ref.filename, subfolder: ref.subfolder || "", type: ref.type || "input" }),
});
const json = await res.json();
if (!res.ok) throw new Error(json.error || `HTTP ${res.status}`);
await ensureVideoGroup();
const addRes = await fetch(`/wfm/gallery/groups/${encodeURIComponent(VIDEO_GROUP)}/add`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ path: json.path }),
});
if (!addRes.ok) throw new Error(`HTTP ${addRes.status}`);
showToast(t("videoSourceAssetRegistered", json.filename), "success");
refreshVideoAssetTab();
} catch (err) {
showToast(t("errorWithMsg", err.message), "error");
} finally {
btn.disabled = false;
}
});
document.getElementById("wfm-video-source-clear")?.addEventListener("click", () => {
setSourcePreview(null, null);
const statusEl = document.getElementById("wfm-video-source-status");
+134 -10
View File
@@ -1,7 +1,7 @@
/**
* Video workflow helpers — model-family detection and node manipulation for
* MiniMax H3 / LTX-2.5 (Text・Image・First&Last-Frame to Video) / Wan2.2 (Text
* to Video) workflows. Pure functions operating on UI-format workflow JSON,
* to Video) / FastH3 OmniRef (MiniMax H3 Reference to Video) workflows. Pure functions operating on UI-format workflow JSON,
* with no DOM/state dependency, so both the Plan tab's per-block batch loop
* and (previously) the single-shot form can share the exact same logic.
*/
@@ -23,10 +23,24 @@ function _widgetIndexOf(node, inputDef) {
return widgetInputs.indexOf(inputDef);
}
// inputs[]にwidget定義を持たない形式で保存されたノード(FastH3 OmniRefテンプレートの
// ResolutionSelector/LoadImageなど)向けの、widgets_valuesの既定の並び順。
const _DEFAULT_WIDGET_ORDER = {
ResolutionSelector: ["aspect_ratio", "megapixels", "multiple"],
LoadImage: ["image", "upload"],
PrimitiveStringMultiline: ["value"],
PrimitiveString: ["value"],
PrimitiveFloat: ["value"],
PrimitiveInt: ["value"],
};
// 上と同じ並び順ルールで、名前から直接インデックスを引く版(ResolutionSelectorや
// LoadImageなど、モデルファミリー間で入力名が揺れないノードに使う)。
export function widgetIndex(node, name) {
const widgetInputs = (node?.inputs || []).filter((inp) => inp.widget);
if (!widgetInputs.length && node && Array.isArray(node.widgets_values)) {
return (_DEFAULT_WIDGET_ORDER[node.type] || []).indexOf(name);
}
return widgetInputs.findIndex((inp) => inp.name === name);
}
@@ -65,7 +79,90 @@ function _detectVideoSubgraph(workflow) {
return null;
}
// MiniMax H3の長さ(フレーム数)は24fpsで17k+5のグリッドに乗る — FastH3テンプレートの
// ComfyMathExpressionと同じ式で秒数から変換する。
function _durationToFrames(seconds) {
const f = Math.max(5, Math.round((Number(seconds) || 0) * 24));
return f + (5 - (f % 17) + 17) % 17;
}
// FastH3 OmniRef(MiniMaxH3ReferenceToVideo)はサブグラフを使わないフラット構成で、
// prompt/width/height/lengthは別ノード(PrimitiveStringMultiline / ResolutionSelector /
// PrimitiveFloat→ComfyMathExpression)から配線される。そのためサブグラフの公開入力ではなく、
// 各入力の配線元ノードを書き込み先として特定する(未配線ならモデルノード自身のwidget)。
function _locateFastH3Nodes(workflow) {
const instanceNode = workflow.nodes.find((n) => n.type === "MiniMaxH3ReferenceToVideo" && n.mode !== 4 && n.mode !== 2);
if (!instanceNode || !Array.isArray(instanceNode.widgets_values)) return null;
const nodeById = (id) => workflow.nodes.find((n) => n.id === id) || null;
const sourceOf = (node, inputName) => {
const inp = (node?.inputs || []).find((i) => i.name === inputName);
if (!inp || inp.link == null) return null;
const link = workflow.links.find((l) => l[0] === inp.link);
return link ? nodeById(link[1]) : null;
};
// prompt — 配線元がPrimitiveString(Multiline)ならその値を、未配線なら自ノードのwidgetを書く。
let promptNode = instanceNode, promptIdx = widgetIndex(instanceNode, "prompt");
const promptSrc = sourceOf(instanceNode, "prompt");
if (promptSrc) {
if (promptSrc.type !== "PrimitiveStringMultiline" && promptSrc.type !== "PrimitiveString") return null;
promptNode = promptSrc;
promptIdx = widgetIndex(promptSrc, "value");
}
// length — 秒数のPrimitiveFloat(→ComfyMathExpressionでフレーム数へ変換)が配線元なら
// そこへ秒数を書く。未配線なら自ノードのlength widgetへフレーム数に変換して書く。
let durationNode = instanceNode, durationIdx = widgetIndex(instanceNode, "length"), durationAsFrames = true;
let lengthSrc = sourceOf(instanceNode, "length");
if (lengthSrc?.type === "ComfyMathExpression") lengthSrc = sourceOf(lengthSrc, "values.a");
if (lengthSrc) {
if (lengthSrc.type !== "PrimitiveFloat" && lengthSrc.type !== "PrimitiveInt") return null;
durationNode = lengthSrc;
durationIdx = widgetIndex(lengthSrc, "value");
durationAsFrames = false;
}
if (promptIdx === -1 || durationIdx === -1) return null;
const widthSrc = sourceOf(instanceNode, "width");
const resolutionNode = widthSrc?.type === "ResolutionSelector" ? widthSrc : null;
const widthIdx = widthSrc ? -1 : widgetIndex(instanceNode, "width");
const heightIdx = sourceOf(instanceNode, "height") ? -1 : widgetIndex(instanceNode, "height");
// 参照画像はPlanの"First Image"/"Last Image"欄を流用し、1枚目(ref_image_0)/2枚目
// (ref_image_1)として扱う(UI上は"Reference Image"/"Reference Image 2"表記)。最終フレームの
// 概念は無いため、前ブロックの最終フレーム連結(chain_previous)は生成された最終フレームを
// 次ブロックの1枚目の参照画像として渡す形になる(video-plan-tab.js _resolveFirstImage参照)。
const refSlot = (name) => instanceNode.inputs.findIndex((i) => i.name === name);
const refLoadImage = (name) => {
const src = sourceOf(instanceNode, name);
return src?.type === "LoadImage" ? src : null;
};
const firstFrameSlot = refSlot("ref_images.ref_image_0");
const loadImageNode = refLoadImage("ref_images.ref_image_0");
const lastFrameSlot = refSlot("ref_images.ref_image_1");
const lastLoadImageNode = refLoadImage("ref_images.ref_image_1");
// noise_seedはcomfyUI.generate()が全ノード一括で上書きする(applyBlockToWorkflow参照)ため、
// ここではUI上の有効表示のためにRandomNoiseの有無だけを見る。
const hasRandomNoise = workflow.nodes.some((n) => n.type === "RandomNoise" && n.mode !== 4 && n.mode !== 2);
return {
family: "fasth3", sgDef: null, instanceNode, promptNode, durationNode, durationAsFrames,
loadImageNode, lastLoadImageNode, resolutionNode,
firstFrameSlot, lastFrameSlot, promptIdx, durationIdx,
widthIdx, heightIdx, noiseSeedIdx: hasRandomNoise ? 0 : -1,
turboModeIdx: -1, turboStrengthIdx: -1, turboStepsIdx: -1, promptEnhanceIdx: -1,
// 参照画像は任意(0枚でも可)。PlanでNone/Clearにした欄は、テンプレートのLoadImageが
// 接続されていても外す — 外さないとUI上は未指定なのにテンプレートの画像が使われてしまう。
disconnectUnsetFrames: true,
};
}
export function locateVideoModelNodes(workflow) {
if (!Array.isArray(workflow?.nodes) || !Array.isArray(workflow?.links)) return null;
if (workflow.nodes.some((n) => n.type === "MiniMaxH3ReferenceToVideo")) return _locateFastH3Nodes(workflow);
const detected = _detectVideoSubgraph(workflow);
if (!detected) return null;
const { family, sgDef } = detected;
@@ -138,7 +235,8 @@ export function locateVideoModelNodes(workflow) {
const heightIdx = resolutionNode ? -1 : _widgetIndexOf(instanceNode, heightInput);
return {
family, sgDef, instanceNode, loadImageNode, lastLoadImageNode, resolutionNode,
family, sgDef, instanceNode, promptNode: instanceNode, durationNode: instanceNode, durationAsFrames: false,
loadImageNode, lastLoadImageNode, resolutionNode,
firstFrameSlot, lastFrameSlot, promptIdx, durationIdx,
widthIdx, heightIdx, noiseSeedIdx, turboModeIdx, turboStrengthIdx, turboStepsIdx, promptEnhanceIdx,
};
@@ -149,17 +247,20 @@ export function locateVideoModelNodes(workflow) {
// fields from whatever the workflow file already had.
export function readTemplateDefaults(nodes) {
const {
instanceNode, resolutionNode, loadImageNode, lastLoadImageNode, promptIdx, durationIdx,
family, instanceNode, promptNode, durationNode, durationAsFrames, resolutionNode, loadImageNode, lastLoadImageNode,
promptIdx, durationIdx,
widthIdx, heightIdx, noiseSeedIdx, turboModeIdx, turboStrengthIdx, turboStepsIdx, promptEnhanceIdx,
} = nodes;
const rawDuration = durationNode.widgets_values[durationIdx];
const arIdx = widgetIndex(resolutionNode, "aspect_ratio");
const mpIdx = widgetIndex(resolutionNode, "megapixels");
const multIdx = widgetIndex(resolutionNode, "multiple");
const fnIdx = widgetIndex(loadImageNode, "image");
const lastFnIdx = widgetIndex(lastLoadImageNode, "image");
return {
prompt: instanceNode.widgets_values[promptIdx] ?? "",
duration: instanceNode.widgets_values[durationIdx] ?? 2,
prompt: promptNode.widgets_values[promptIdx] ?? "",
// durationAsFrames(FastH3でlengthが未配線)の場合はフレーム数を24fpsで秒数へ戻す。
duration: rawDuration == null ? 2 : (durationAsFrames ? Math.round((rawDuration / 24) * 10) / 10 : rawDuration),
hasResolution: !!resolutionNode,
aspectRatio: (resolutionNode && arIdx !== -1) ? resolutionNode.widgets_values[arIdx] : null,
megapixels: (resolutionNode && mpIdx !== -1) ? resolutionNode.widgets_values[mpIdx] : null,
@@ -172,7 +273,7 @@ export function readTemplateDefaults(nodes) {
width: widthIdx !== -1 ? instanceNode.widgets_values[widthIdx] : null,
height: heightIdx !== -1 ? instanceNode.widgets_values[heightIdx] : null,
hasNoiseSeed: noiseSeedIdx !== -1,
noiseSeed: noiseSeedIdx !== -1 ? instanceNode.widgets_values[noiseSeedIdx] : null,
noiseSeed: (noiseSeedIdx !== -1 && family !== "fasth3") ? instanceNode.widgets_values[noiseSeedIdx] : null,
hasTurboMode: turboModeIdx !== -1,
turboMode: turboModeIdx !== -1 ? instanceNode.widgets_values[turboModeIdx] : null,
hasTurboStrength: turboStrengthIdx !== -1,
@@ -184,6 +285,23 @@ export function readTemplateDefaults(nodes) {
};
}
// instanceNodeのtargetSlot入力の接続を外す(リンク削除+両端の参照を解除)。配線元が
// LoadImageで他に出力先が無くなった場合は、生成記録に未使用の画像が残らないようノードごと除く。
function _disconnectInput(clone, instanceNode, targetSlot) {
const inp = instanceNode.inputs?.[targetSlot];
if (!inp || inp.link == null) return;
const linkId = inp.link;
const link = clone.links.find((l) => l[0] === linkId);
const src = link ? clone.nodes.find((n) => n.id === link[1]) : null;
const out = src?.outputs?.[link?.[2]];
if (Array.isArray(out?.links)) out.links = out.links.filter((id) => id !== linkId);
clone.links = clone.links.filter((l) => l[0] !== linkId);
inp.link = null;
if (src?.type === "LoadImage" && !(src.outputs || []).some((o) => o.links?.length)) {
clone.nodes = clone.nodes.filter((n) => n !== src);
}
}
// first_frame/last_frameが未接続のワークフローに対して、画像が指定された時だけ
// LoadImageノードを新規注入する共通ヘルパー。ノードID/リンクIDはclone内の実際の
// 最大値+1で採番するため、重複ID/リンクID不整合は起きない
@@ -228,15 +346,17 @@ export function injectFrameNode(clone, instanceNode, targetSlot, filename) {
// touched when a filename is actually given: an existing LoadImage node gets
// its widget overwritten, a missing one gets injected on demand, and leaving
// both unset keeps the slot disconnected (bypassed) exactly like the
// template's own clean state.
// template's own clean state. Reference-to-Video templates (disconnectUnsetFrames)
// additionally drop a template-wired LoadImage when its field is left unset.
export function applyBlockToWorkflow(clone, nodes, params) {
const {
instanceNode, resolutionNode, loadImageNode, lastLoadImageNode, promptIdx, durationIdx, firstFrameSlot, lastFrameSlot,
instanceNode, promptNode, durationNode, durationAsFrames, resolutionNode, loadImageNode, lastLoadImageNode,
promptIdx, durationIdx, firstFrameSlot, lastFrameSlot,
widthIdx, heightIdx, turboModeIdx, turboStrengthIdx, turboStepsIdx, promptEnhanceIdx,
} = nodes;
instanceNode.widgets_values[promptIdx] = params.prompt || "";
instanceNode.widgets_values[durationIdx] = params.duration;
promptNode.widgets_values[promptIdx] = params.prompt || "";
durationNode.widgets_values[durationIdx] = durationAsFrames ? _durationToFrames(params.duration) : params.duration;
const arIdx = widgetIndex(resolutionNode, "aspect_ratio");
const mpIdx = widgetIndex(resolutionNode, "megapixels");
@@ -264,6 +384,8 @@ export function applyBlockToWorkflow(clone, nodes, params) {
} else if (firstFrameSlot !== -1) {
injectFrameNode(clone, instanceNode, firstFrameSlot, params.firstImageFilename);
}
} else if (nodes.disconnectUnsetFrames && firstFrameSlot !== -1) {
_disconnectInput(clone, instanceNode, firstFrameSlot);
}
if (params.lastImageFilename) {
if (lastLoadImageNode) {
@@ -272,5 +394,7 @@ export function applyBlockToWorkflow(clone, nodes, params) {
} else if (lastFrameSlot !== -1) {
injectFrameNode(clone, instanceNode, lastFrameSlot, params.lastImageFilename);
}
} else if (nodes.disconnectUnsetFrames && lastFrameSlot !== -1) {
_disconnectInput(clone, instanceNode, lastFrameSlot);
}
}
+5 -1
View File
@@ -65,7 +65,11 @@ async function _checkConversion(raw, filename) {
} catch (e) {
return { status: "error", lines: [t("compatConvertFailed", e.message || String(e))] };
}
const objectInfo = await comfyWorkflow.getObjectInfo();
// Only the node types in use are needed — the full /object_info can take tens of seconds
const usedTypes = [...new Set(Object.values(api || {}).map((n) => n?.class_type).filter(Boolean))];
let objectInfo = await comfyWorkflow.getObjectInfoForTypes(usedTypes);
// Nothing known at all: either every type is missing or the server is unreachable — only the full snapshot can tell
if (Object.keys(objectInfo).length === 0 && usedTypes.length > 0) objectInfo = await comfyWorkflow.getObjectInfo();
if (format === "api") subs = _comboMismatches(api, objectInfo);
const ids = Object.keys(api || {});
-2
View File
@@ -1110,8 +1110,6 @@ function openDetailModal(wf) {
getRawWorkflow(wf.filename)
.then((raw) => setFormatBadge(document.getElementById("wfm-detail-format-badge"), comfyWorkflow.detectFormat(raw, wf.filename)))
.catch(() => {});
// Warm the /object_info cache (large; ~10 s on first fetch) so the check button answers quickly
comfyWorkflow.getObjectInfo();
document.getElementById("wfm-detail-compat-check")?.addEventListener("click", async () => {
const btn = document.getElementById("wfm-detail-compat-check");
const el = document.getElementById("wfm-detail-compat-result");
+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
+71 -29
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>
@@ -335,23 +337,28 @@
<!-- Tab: Input — left sub-col: Prompt/Image (tabbed), right sub-col: Raw JSON -->
<div id="wfm-gen-subtab-input" class="wfm-gen-subtab-content active">
<div class="wfm-gen-tab-cols">
<div class="wfm-gen-params-col">
<div class="wfm-input-inner-tabnav">
<button class="wfm-input-inner-tab active" data-input-tab="prompt">Prompt</button>
<button class="wfm-input-inner-tab" data-input-tab="image">Image</button>
</div>
<div id="wfm-input-panel-prompt" class="wfm-input-inner-panel">
<div id="wfm-gen-prompt-fields">
<p class="wfm-placeholder">Load a workflow to edit prompts</p>
<div class="wfm-gen-params-col wfm-gen-params-col--input">
<!-- Prompt (3) | Image (2) の2カラム。params-colの幅が狭いとImageがPromptの下へ折り返す(CSSコンテナクエリ) -->
<div class="wfm-input-split">
<div id="wfm-input-panel-prompt" class="wfm-input-inner-panel wfm-input-inner-panel--prompt">
<div class="wfm-input-panel-title">Prompt</div>
<div id="wfm-gen-prompt-fields">
<p class="wfm-placeholder">Load a workflow to edit prompts</p>
</div>
</div>
</div>
<div id="wfm-input-panel-image" class="wfm-input-inner-panel" style="display:none;">
<div id="wfm-gen-image-fields">
<p class="wfm-placeholder">Load a workflow to set input images</p>
<div id="wfm-input-panel-image" class="wfm-input-inner-panel wfm-input-inner-panel--image">
<div class="wfm-input-panel-title">Image</div>
<div id="wfm-gen-image-fields">
<p class="wfm-placeholder">Load a workflow to set input images</p>
</div>
</div>
</div>
</div>
<div class="wfm-gen-rawjson-col" id="wfm-gen-rawjson-col-input"></div>
<div class="wfm-gen-rawjson-col wfm-gen-rawjson-col--collapsible" id="wfm-gen-rawjson-col-input">
<button type="button" id="wfm-gen-rawjson-collapse-btn" class="wfm-rawjson-collapse-btn" title="Collapse / expand Raw JSON">
<span class="wfm-rawjson-collapse-icon">»</span><span class="wfm-rawjson-collapse-label">Raw JSON</span>
</button>
</div>
</div>
</div>
@@ -1349,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>
@@ -1424,13 +1432,14 @@
<h3 id="wfm-help-gen-card-tabs-title">Tab Layout</h3>
<ul>
<li id="wfm-help-gen-3">5-tab layout — Input (Prompt + Image), Model, Settings, Feeder, Batch — Input/Model/Settings each include a Raw JSON column for instant preview and direct editing</li>
<li id="wfm-help-gen-4">Input tab: inner tabs — <b>Prompt</b> and <b>Image</b> (drag-and-drop upload); Prompt tab has Positive Prompt, Negative Prompt, and an <b>Embeddings</b> selector at the bottom — select a model, set Weight (default 1.0), then click <b>Paste</b> to insert <code>(embedding:Name:weight)</code> at the cursor position of the last focused textarea (defaults to Positive if neither is focused); a <b>↺</b> button next to each Apply button reverts the textarea to the node's currently applied value; select text (or just place the cursor on a word/parenthesis block) and press <b>Ctrl+↑/↓</b> to adjust its emphasis weight in <code>(text:weight)</code> syntax by ±0.05 — the parentheses are removed automatically when the weight returns to 1.0</li>
<li id="wfm-help-gen-4">Input tab: <b>Prompt</b> (left) and <b>Image</b> (right, about 3:2) are shown side by side on one screen (drag-and-drop upload); when the Prompt/Image area gets narrow (about 720px or less) Image wraps under Prompt, and the Raw JSON column can be collapsed to a slim strip at the right edge with its <b>»</b> button (Input tab only; remembered); the Prompt area has Positive Prompt, Negative Prompt, and an <b>Embeddings</b> selector at the bottom — select a model, set Weight (default 1.0), then click <b>Paste</b> to insert <code>(embedding:Name:weight)</code> at the cursor position of the last focused textarea (defaults to Positive if neither is focused); a <b>↺</b> button next to each Apply button reverts the textarea to the node's currently applied value; select text (or just place the cursor on a word/parenthesis block) and press <b>Ctrl+↑/↓</b> to adjust its emphasis weight in <code>(text:weight)</code> syntax by ±0.05 — the parentheses are removed automatically when the weight returns to 1.0</li>
<li id="wfm-help-gen-5">Model tab: Checkpoint, VAE, Diffusion Model (UNETLoader / UnetLoaderGGUF / LoaderGGUF), Text Encoder (CLIPLoader / DualCLIPLoader / ClipLoaderGGUF / DualClipLoaderGGUF — type and device selectors; DualCLIP shows two clip selectors) are always shown; ControlNet and Hypernetwork (with Strength field) are collapsed by default since they're used less often — click their header to expand; LoRA (Single/Stack tabs) has its own column to the right; all selectors have a filter; LoRA Stack — Apply writes all active LoRAs to the target node and simultaneously inserts LoRA syntax and CivitAI trigger words into the Positive prompt; re-applying updates the prompt by removing inactive LoRAs and re-adding active ones</li>
<li id="wfm-help-gen-28">Model tab — Highlight color: the label of each model type (Checkpoint, VAE, Diffusion Model, Text Encoder, ControlNet, Hypernetwork) and the LoRA column header turn a distinct color (default bright green) when the loaded workflow actually contains that type of node; this stays visible even while ControlNet/Hypernetwork are collapsed, so you can tell at a glance whether they're in use without expanding them; the color is customizable in the Settings tab</li>
<li id="wfm-help-gen-6">Settings tab: KSampler and Latent Image side by side, each at 50% width</li>
<li id="wfm-help-gen-31">LTX-2.5 and Wan2.2 video workflows also work when loaded as regular workflows in this tab (not just the dedicated Video tab): Positive/Negative Prompt detection follows LTX-2.5's LTXVDualCFGGuider / LTXVConditioning nodes to find the actual prompt text, and the Settings tab's Latent Image section recognizes Wan2.2's EmptyHunyuanLatentVideo and LTX-2.5's EmptyLTXVLatentVideo nodes (with an added Length (frames) field) instead of showing "No EmptyLatentImage node found"; generating from these workflows also gets the same extended timeout as MiniMax H3 video generations</li>
<li id="wfm-help-gen-7">Raw JSON always visible in the right column of each tab — edit directly and Apply to reload the workflow; if the loaded workflow has Bypass or Mute nodes, a note listing them appears above the search bar (Bypass nodes are excluded with their wires reconnected around them; Mute nodes are excluded with no reconnection, matching ComfyUI itself); the search bar highlights matches and scrolls to them without moving the cursor into the editor, so typing right after a search can't accidentally overwrite the JSON — click into the editor first to actually edit</li>
<li id="wfm-help-gen-30">The <b>Save</b> button (right end of the subtab bar) is hidden while the <b>Batch</b> or <b>Lab</b> subtab is active, since those work on workflow copies / their own Plan files rather than the currently loaded workflow; it reappears on Input/Model/Settings/Feeder</li>
<li id="wfm-help-gen-32"><b>Partner API nodes</b> (Nano Banana / Gemini image nodes, etc.): GenerateUI can run workflows that contain ComfyUI's partner API nodes. These nodes need Comfy credentials in the /prompt request — ComfyUI's own screen adds them automatically, but a separate page cannot — so add <code>COMFY_API_KEY=...</code> (a Comfy API key issued at platform.comfy.org) to the plugin's .env file and restart ComfyUI. With the key set, GenerateUI sends the request through the plugin server, which adds the key only when the workflow contains a partner API node (the key never reaches the browser); usage is billed as Comfy credits. A Gemini image node's prompt appears in the Prompt tab, and its reference images go through LoadImage nodes in the Image tab. Sample: ws_nano_banana_2_1_t2i</li>
</ul>
</div>
<div class="wfm-help-card">
@@ -1463,12 +1472,12 @@
<div class="wfm-help-card">
<h3 id="wfm-help-gen-card-lora-title">Model Tab — LoRA Details</h3>
<ul>
<li id="wfm-help-gen-20">Two ways LoRAs are attached: a chain of standard <b>LoraLoader</b> nodes (one LoRA per node — add more by chaining additional nodes) or a single <b>Lora Loader (LoraManager)</b> node (from the ComfyUI-Lora-Manager custom node pack) that holds a list of LoRAs internally, each with its own active/model-strength/clip-strength; the Single/Stack tabs below adapt automatically depending on which type the target node is</li>
<li id="wfm-help-gen-21">Single tab: pick one LoRA + Str M/Str C, then Apply — for a Lora Manager node this <b>replaces its entire internal LoRA list with just this one entry</b>, discarding any others it had</li>
<li id="wfm-help-gen-20">Three ways LoRAs are attached: a chain of standard <b>LoraLoader</b> nodes (one LoRA per node — add more by chaining additional nodes), a single <b>Lora Loader (LoraManager)</b> node (from the ComfyUI-Lora-Manager custom node pack) that holds a list of LoRAs internally, each with its own active/model-strength/clip-strength, or ComfyUI's native <b>Load LoRA (Model)</b> + <b>Load LoRA (Text Encoder)</b> node pair (v0.40+; each holds up to 20 rows of LoRA / strength / enabled — the Model node takes Str M, the Text Encoder node takes Str C, and Apply writes both nodes together; API-format workflows only for now, because ComfyUI frontend 1.55.17 cannot add rows to these nodes in its own graph editor); the Single/Stack tabs below adapt automatically depending on which type the target node is</li>
<li id="wfm-help-gen-21">Single tab: pick one LoRA + Str M/Str C, then Apply — for a Lora Manager node this <b>replaces its entire internal LoRA list with just this one entry</b>, discarding any others it had; the native Load LoRA nodes likewise have all their rows replaced by this single row</li>
<li id="wfm-help-gen-22">Stack tab — Use Stack Group checkbox (shown only when a Lora Manager node exists in the workflow): <b>OFF</b> (the default whenever a workflow is loaded) shows and edits the LoRAs actually configured in the workflow's Lora Manager node itself; <b>ON</b> shows and edits the "Stack" group registered in the Models tab instead; switching either direction clears the node's LoRA list first, then loads it from the newly selected source; switching back to OFF restores exactly the LoRA list that was present when the workflow was loaded (captured as a snapshot at load time)</li>
<li id="wfm-help-gen-23">Stack tab controls: each row has an active checkbox and Str M / Str C fields; the header "Stack" checkbox toggles all rows at once; the +/- step buttons adjust the strength of all currently active rows together; a "Showing: LoRAs currently in workflow" / "Showing: registered Stack group" label indicates which source is currently displayed; Apply writes the full list back to the target node and also appends LoRA syntax + CivitAI trigger words to the Positive prompt</li>
<li id="wfm-help-gen-24">Caution for <b>CLIP Text Encode edit+</b> (CLIPTextEncodeEditPlus) nodes: when a Lora Manager node's trigger_words output feeds this node's text1 input (RAW/EDIT/front/back modes combine text1 with the editable text_edit field), trigger words are already included automatically at generation time; clicking a LoRA Apply button or turning on Use Stack Group additionally writes LoRA syntax/trigger words into text_edit, duplicating them — leave Use Stack Group off and avoid the LoRA Apply buttons if you want the workflow's original prompt and LoRA composition to stay unmodified</li>
<li id="wfm-help-gen-29">Bypass button (⛔, in the LoRA column header, next to Refresh Stack group): forces the target LoRA node's strength to 0 — strength_model/strength_clip for a standard LoraLoader, or every entry's strength/clipStrength for a Lora Manager node (its LoRA list is kept intact, not replaced) — without touching the actual ComfyUI node's mode; click again to restore the exact values that were there before toggling; targets whichever node Single/Stack Apply default to (the workflow's Lora Manager node if it has one, else the first LoRA node); clicking a Single or Stack Apply button clears the bypass state so it can't silently reassert itself on a later toggle</li>
<li id="wfm-help-gen-29">Bypass button (⛔, in the LoRA column header, next to Refresh Stack group): forces the target LoRA node's strength to 0 — strength_model/strength_clip for a standard LoraLoader, every entry's strength/clipStrength for a Lora Manager node (its LoRA list is kept intact, not replaced), or every row's strength on both native Load LoRA nodes (Model and Text Encoder; rows kept) — without touching the actual ComfyUI node's mode; click again to restore the exact values that were there before toggling; targets whichever node Single/Stack Apply default to (the workflow's Lora Manager node if it has one, else the first LoRA node); clicking a Single or Stack Apply button clears the bypass state so it can't silently reassert itself on a later toggle</li>
</ul>
</div>
</div>
@@ -1808,12 +1817,13 @@
<li id="wfm-help-gallery-17"><b>Send GenUI Image</b> button (toolbar, next to Image Edit): uploads the selected image to ComfyUI and sets it as the input for the first LoadImage node in the GenerateUI tab; automatically switches to GenerateUI → Input → Image; requires a workflow with at least one LoadImage node to be loaded first</li>
<li id="wfm-help-gallery-27"><b>Send to LI node</b> button (toolbar, next to Send GenUI Image): uploads the selected image and writes its filename into the image widget of the currently selected node on the ComfyUI canvas (falling back to the first LoadImage-type node found) — same destination as Image Edit tab's Send to LI node; requires Workflow Studio to have been opened from ComfyUI's top menu button</li>
<li id="wfm-help-gallery-31"><b>Send to LV node</b> button (toolbar, next to Send to LI node): the video equivalent — uploads the selected video and writes its filename into the file widget of the currently selected node, which must be ComfyUI's native <b>Load Video</b> node; only enabled when the selected item is a video (mp4/webm); requires Workflow Studio to have been opened from ComfyUI's top menu button</li>
<li id="wfm-help-gallery-37"><b>Send CC Layout / Send CC Image</b> buttons (toolbar, shown only when this Gallery is opened inside ComfyUI Comic Creator; v0.8.11): Send CC Layout sends the selected image to the Layout tab's selected panel / overlay (an MP4 goes to the Video tool); Send CC Image switches to Comic Creator's Image tab and loads the selected image there (as a new layer if a document is open, otherwise as a new canvas; videos are not supported)</li>
<li id="wfm-help-gallery-28"><b>Create PSD</b> bulk button: combines all selected images into a single layered PSD file and downloads it — each image becomes its own layer (named after the file), positioned top-left on a canvas sized to the largest selected image; the last selected image ends up on top Convert... bulk button (shown when audio/video files are selected): converts audio files — or extracts the audio track of videos — to FLAC / MP3 / Opus / M4A / WAV (bitrate, sample rate, channels selectable) into the same folder as new files; prompt/workflow tags are carried over for formats that can hold them (WAV cannot), favorite/tags/memo/groups can be carried over, and the originals can optionally be deleted afterwards.</li>
<li id="wfm-help-gallery-29"><b>Edit as Layers</b> bulk button: switches to the Image Edit tab and opens all selected images at once, each as an independent layer (video files in the selection are skipped); the last selected image ends up on top</li>
<li id="wfm-help-gallery-33">Semantic Search (v0.8.2): the S button next to the search box turns semantic search on. When ON, the search box finds images by meaning using Gemini Embedding 2 or the local EmbeddingGemma 2 (e.g. 'sunset city street') - press Enter to search; results are ordered by similarity with a score badge. When OFF it is the normal filename/tag/prompt search. Turning S on also shows a second toolbar row with Similar, the update button, the settings button and the result count. The settings button (gear) opens a window to build/update/delete the index for the selected folder (optionally with subfolders); choose the model with the radio buttons (Gemini needs GEMINI_API_KEY in the plugin's .env + a ComfyUI restart; EmbeddingGemma 2 runs locally and downloads its model on first use). Switching model or vector size needs 'Rebuild all'. Searches cover the selected folder tree; sort and tag/group filters do not apply to semantic results</li>
<li id="wfm-help-gallery-33">Semantic Search (v0.8.2): the S button next to the search box turns semantic search on. When ON, the search box finds images by meaning using Gemini Embedding 2 or EmbeddingGemma 2 running in Ollama (e.g. 'sunset city street') - press Enter to search; results are ordered by similarity with a score badge. When OFF it is the normal filename/tag/prompt search. Turning S on also shows a second toolbar row with Similar, the update button, the settings button and the result count. The settings button (gear) opens a window to build/update/delete the index for the selected folder (optionally with subfolders); choose the model with the radio buttons (Gemini needs GEMINI_API_KEY in the plugin's .env + a ComfyUI restart; EmbeddingGemma 2 needs Ollama running locally with the model downloaded: ollama pull embeddinggemma-2:740m or embeddinggemma-2:440m). Switching model or vector size needs 'Rebuild all'. Searches cover the selected folder tree; sort and tag/group filters do not apply to semantic results</li>
<li id="wfm-help-gallery-34">Similar toggle and update button (second toolbar row, shown while S is ON): Similar shows images similar to the selected one (an image not yet indexed is embedded on the fly). Selecting another image keeps the list as is; press the update button to show images similar to the newly selected one, or press Similar again to return to the normal list. Changing folder, Clear filters or turning S off also leaves similar mode</li>
<li id="wfm-help-gallery-35">EmbeddingGemma 2 performance: by default it runs on the CPU with half of the cores (about 6 s per image at full precision). Image precision trades accuracy for speed (Standard is about 2.5x and Light about 5x faster; vectors differ, so changing it needs 'Rebuild all'); fewer CPU threads keep the PC lighter while generating images. To use an NVIDIA GPU, install onnxruntime-gpu into ComfyUI's Python (pip uninstall onnxruntime, then pip install onnxruntime-gpu; the CUDA runtime/cuDNN that ComfyUI's PyTorch uses is picked up) and restart ComfyUI: indexing then takes about 0.1 s per image (measured on an RTX 4070, about 45x faster than the CPU) and the results are identical to the CPU's. DirectML is not supported (its vision model fails to run). The model is released from memory when indexing finishes and reloaded on the next search</li>
<li id="wfm-help-gallery-36">Modal tabs and the similarity threshold: the Semantic settings window has three tabs - Index (target folder, rebuild mode, progress, delete all), Model (Gemini / EmbeddingGemma 2, vector size, device, CPU threads, image precision, connection test) and Search. On the Search tab you can set a minimum score for similar-image results (e.g. 0.6 shows only images scoring 0.6 or higher), a minimum score for text search, and the maximum number of results. Scores differ by model, so each model keeps its own values; the list header shows the active threshold</li>
<li id="wfm-help-gallery-35">EmbeddingGemma 2 runs in Ollama (the built-in ONNX runtime was removed, so onnxruntime-gpu is no longer needed for it). On the Model tab set the Ollama URL (default http://localhost:11434; other hosts must be listed in WFS_ALLOWED_BACKEND_HOSTS) and the model size: 740m (text + image + audio) or 440m (text + image, smaller). Both return identical vectors, so you can switch sizes without rebuilding; the ':latest' tag is the same as 740m and is used when 740m is not downloaded. 270m and 570m cannot embed images and are not offered. Indexes made with the earlier ONNX version keep working (the vectors match closely; use 'Rebuild all' to regenerate them exactly). Images are sent 4 at a time (about 0.1-0.2 s per image with an NVIDIA GPU). The model is unloaded from VRAM when indexing finishes and Ollama reloads it on the next search</li>
<li id="wfm-help-gallery-36">Modal tabs and the similarity threshold: the Semantic settings window has three tabs - Index (target folder, rebuild mode, progress, delete all), Model (Gemini / EmbeddingGemma 2, vector size, Ollama URL, model size, connection test) and Search. On the Search tab you can set a minimum score for similar-image results (e.g. 0.6 shows only images scoring 0.6 or higher), a minimum score for text search, and the maximum number of results. Scores differ by model, so each model keeps its own values; the list header shows the active threshold</li>
</ul>
</div>
<div class="wfm-help-card">
@@ -1993,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>
@@ -2130,20 +2167,20 @@
<div class="wfm-help-page" id="wfm-help-page-video">
<h2 id="wfm-help-video-title">Video Tab</h2>
<p id="wfm-help-video-desc">A dedicated video generation tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First &amp; Last Frame to Video), and Wan2.2 (Text to Video) workflows, independent of the GenerateUI tab. The center panel's Plan / Edit / Asset subtabs handle batch generation, clip editing, and browsing generated videos; the sidebar's Project subtab handles saved plans (while Plan is active) or saved Edit projects (while Edit is active).</p>
<p id="wfm-help-video-desc">A dedicated video generation tab for MiniMax H3 (Image to Video), LTX-2.5 (Text / Image / First &amp; Last Frame to Video), Wan2.2 (Text to Video), and FastH3 OmniRef (MiniMax H3 Reference to Video) workflows, independent of the GenerateUI tab. The center panel's Plan / Edit / Asset subtabs handle batch generation, clip editing, and browsing generated videos; the sidebar's Project subtab handles saved plans (while Plan is active) or saved Edit projects (while Edit is active).</p>
<div class="wfm-help-card">
<ul>
<li id="wfm-help-video-1">Plan subtab: the topbar's settings row holds Aspect Ratio / Megapixels / Multiple / Duration (seconds) / Noise Seed as this plan's base settings — Duration always reflects the currently selected block (each block keeps its own value), the rest are plan-wide. A second row below adds Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance, each enabled only for workflows that actually support it (see helpVideo2). Split the timeline into blocks with the + Split / + Block / Delete buttons — each block has its own Prompt, Duration, and First/Last Image — First Image can be None, an explicit image, or "use previous block's last frame" (an explicit Last Image on the previous block always wins over extracting one from its generated video). Click Run to generate every block in order; Pause/Cancel work mid-run.</li>
<li id="wfm-help-video-2">A plan with a single block behaves exactly like the old one-shot form. Model selection (UNet / CLIP / VAE / Audio VAE) is fixed to the loaded workflow's defaults. For workflows with no ResolutionSelector node (e.g. Wan2.2, LTX-2.5 First & Last Frame to Video), the Aspect Ratio / Megapixels / Multiple fields are disabled and the workflow's own Width / Height become directly editable instead. Turbo Mode / Strength / Steps only apply to MiniMax H3's turbo LoRA, and Prompt Enhance only to LTX-2.5 — both stay disabled for other model families. Noise Seed is disabled for the one workflow that doesn't expose it: Wan2.2 Text-to-Video.</li>
<li id="wfm-help-video-3">Use the "Load in Video" button in the Workflow tab's detail modal to load a workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, or a Wan2.2 Text-to-Video node — this starts a fresh single-block plan seeded from the workflow's own current values. Unsupported workflows show an error instead.</li>
<li id="wfm-help-video-3">Use the "Load in Video" button in the Workflow tab's detail modal to load a workflow containing a MiniMax H3 Image-to-Video node, an LTX-2.5 Text/Image/First&Last-Frame-to-Video node, a Wan2.2 Text-to-Video node, or a FastH3 OmniRef (MiniMax H3 Reference-to-Video) node — for FastH3 / Pika-H3-Flex the First Image and Last Image fields become Reference Image (ref_image_0) and Reference Image 2 (ref_image_1); leaving either one empty (None / Clear) disconnects that reference input even if the workflow had an image wired to it; Reference Image 2 is never used as the previous block's last frame for "Use previous block's last frame" (the actually generated last frame is used instead) — this starts a fresh single-block plan seeded from the workflow's own current values. Unsupported workflows show an error instead.</li>
<li id="wfm-help-video-4">Generated videos (mp4) automatically appear in the Asset subtab's Video Temp group, and can also be browsed and played back in the Gallery tab. Organizing keepers into Video Assets is entirely up to you, on your own schedule.</li>
<li id="wfm-help-video-5">The center panel shows two previews: the left one shows either the video you select in the Asset subtab or whatever you drop/pick in the Video Source panel on its left (Clear resets it to empty), letting you use the Frame/GIF tools without running the loaded video workflow first; the right one always shows the most recently generated clip.</li>
<li id="wfm-help-video-5">The center panel shows two previews: the left one shows either the video you select in the Asset subtab or whatever you drop/pick in the Video Source panel on its left (Clear resets it to empty; "Register as Asset" copies the loaded video into the output folder and tags it into Video Assets so it shows up in the Asset subtab), letting you use the Frame/GIF tools without running the loaded video workflow first; the right one always shows the most recently generated clip.</li>
<li id="wfm-help-video-6">Frame tab (right panel): play/seek the preview video to the position you want, click Capture Frame to grab that frame client-side, then Save to Output to write it as a PNG into ComfyUI's output folder — check "Add to Video Assets group" first to also tag the saved frame into Gallery's Video Assets group.</li>
<li id="wfm-help-video-7">GIF tab (right panel): set Start/End (seconds), FPS, and an optional Max Width, then Convert to GIF — the server decodes the video and encodes an animated GIF into ComfyUI's output folder.</li>
<li id="wfm-help-video-8">Chaining: setting a block's First Image to "use previous block's last frame" continues smoothly from the previous clip — if that previous block has its own explicit Last Image, that image is used directly; otherwise the actual last frame of its generated video is extracted automatically.</li>
<li id="wfm-help-video-9">Project tab (sidebar): lists saved Video Plans while the center Plan subtab is active, or saved Edit projects while the center Edit subtab is active (thumbnail/block or clip count, last updated) — click one to load it, or delete it with the × button; clicking the same tab again collapses the panel.</li>
<li id="wfm-help-video-10">Highlight color: the Prompt / Duration / First Image / Last Image / Aspect Ratio / Megapixels / Multiple / Noise Seed / Width / Height / Turbo Mode / Strength / Steps / Prompt Enhance labels turn the same highlight color as the GenerateUI Model tab (customizable in the Settings tab) when the loaded workflow actually supports that field — e.g. for a Wan2.2 workflow (no ResolutionSelector node), the Aspect Ratio / Megapixels / Multiple labels stay unhighlighted while Width / Height light up instead.</li>
<li id="wfm-help-video-11">Edit subtab: a lightweight clip timeline for trimming and concatenating video/image clips outside of generation. Add clips via the Video Source panel's "Add to Edit" button or the Asset subtab's "Send to Edit" button, then drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, and Clear to empty the timeline (this also resets the Audio section). The trim panel for the selected video clip shows a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges — image clips instead get a simple hold-duration field. ▶ Preview plays every ready clip back-to-back (trimmed to its in/out points) in the right-hand result preview; Export builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into the Video Temp group automatically. The Audio section of the export panel controls the soundtrack: "Keep original audio" (with its own volume in dB) keeps each clip's audio aligned to its segment even across multiple clips (image clips contribute silence), and "BGM..." lays one audio file over the whole video with its own volume and start offset (a longer BGM is cut to the video length). Each clip can also carry text overlays ("+ Add text" under the trim panel: text, start/end seconds within the clip, size as % of frame height, color, 9-position anchor, outline, background box); they are previewed live over the Source/Result panes and burned in on Export as a final pass. The BGM can be chosen with "BGM...", by dropping an audio/video file onto the Audio section, or with "Set as BGM" on a video in the Asset subtab (its audio track is used). Video clips can also be cropped: "Edit crop" shows a draggable/resizable rectangle over the Source preview (optionally locked to 16:9 / 9:16 / 1:1 / 4:3 / 3:4) — "Done" keeps it, "Cancel" restores the crop from before editing, and switching to another subtab/tab ends editing like Done; the export size becomes the first video clip's cropped size, and other clips of a different size are center-fit to it. ↶/↷ in the timeline toolbar (or Ctrl+Z / Ctrl+Y) undo and redo edits to clips, trims, crops, text and audio settings. The export panel's Save/Save As/Load buttons persist the timeline itself (clip order, trim points, crop, text overlays, audio/BGM settings, and which uploaded file each clip and the BGM refer to) as a JSON project file on the server. The project only stores references to those files in ComfyUI's input folder, so Load re-fetches each clip from its saved server reference and re-probes it — the original files must still exist (Settings → Full Backup can bundle them with "Include media used by Video Edit projects"). These saved projects also show up in the sidebar's Project tab whenever the Edit subtab is active (see the Project tab item).</li>
<li id="wfm-help-video-11">Edit subtab: a lightweight clip timeline for trimming and concatenating video/image clips outside of generation. Add clips via the Video Source panel's "Add to Edit" button or the Asset subtab's "Send to Edit" button, then drag blocks to reorder (or use the ◀/▶ toolbar buttons), Duplicate/Delete the selected clip, and Clear to empty the timeline (this also resets the Audio section). The trim panel for the selected video clip shows a time ruler, a draggable playhead synced to the Source preview, and draggable in/out handles with time badges — image clips instead get a simple hold-duration field. ▶ Preview plays every ready clip back-to-back (trimmed to its in/out points) in the right-hand result preview; Export builds and runs the actual ComfyUI graph (trim → concatenate if more than one clip → save), tagging the result into the Video Temp group automatically. The Audio section of the export panel controls the soundtrack: "Keep original audio" (with its own volume in dB) keeps each clip's audio aligned to its segment even across multiple clips (image clips contribute silence), and "BGM..." lays one audio file over the whole video with its own volume and start offset (a longer BGM is cut to the video length). Each clip can also carry text overlays ("+ Add text" under the trim panel: text, start/end seconds within the clip, size as % of frame height, color, 9-position anchor, outline, background box); they are previewed live over the Source/Result panes and burned in on Export as a final pass. The BGM can be chosen with "BGM...", by dropping an audio/video file onto the Audio section, or with "Set as BGM" on a video in the Asset subtab (its audio track is used). Video clips can also be cropped: "Edit crop" shows a draggable/resizable rectangle over the Source preview (optionally locked to 16:9 / 9:16 / 1:1 / 4:3 / 3:4) — "Done" keeps it, "Cancel" restores the crop from before editing, and switching to another subtab/tab ends editing like Done; the export size becomes the first video clip's cropped size, and other clips of a different size are center-fit to it. The "Convert audio..." button next to the crop buttons converts the selected video clip's audio track to FLAC / MP3 / Opus / M4A / WAV (same dialog as Gallery's Convert) and saves it into the output/video folder. ↶/↷ in the timeline toolbar (or Ctrl+Z / Ctrl+Y) undo and redo edits to clips, trims, crops, text and audio settings. The export panel's Save/Save As/Load buttons persist the timeline itself (clip order, trim points, crop, text overlays, audio/BGM settings, and which uploaded file each clip and the BGM refer to) as a JSON project file on the server. The project only stores references to those files in ComfyUI's input folder, so Load re-fetches each clip from its saved server reference and re-probes it — the original files must still exist (Settings → Full Backup can bundle them with "Include media used by Video Edit projects"). These saved projects also show up in the sidebar's Project tab whenever the Edit subtab is active (see the Project tab item).</li>
<li id="wfm-help-video-12">Asset subtab (center panel, next to Plan/Edit): browses every video/image tagged into Video Assets or Video Temp (via the group dropdown, or "All Video Assets" for both). Search filters by filename; the ▦/☰ buttons switch between a thumbnail grid and a table (filename/updated/tags). Selecting an item shows its tags/memo, loads it into the center preview, and offers "Send to Edit" (queues it as a clip in the Edit subtab) plus, for images only, "Set as First Image"/"Set as Last Image" (uploads it straight into the currently-selected Plan block, switching to the Plan subtab). Audio files tagged into Video Assets also appear (&quot;Audio Only&quot; filter): the detail panel gets a player plus &quot;Set as BGM&quot; and &quot;Add as sound&quot; (places it on the Edit subtab's Audio track at the selected clip's start).</li>
</ul>
</div>
@@ -2210,8 +2247,8 @@
<div class="wfm-help-card">
<h3 id="wfm-help-trouble-card-semantic-title">Semantic Search (Gallery)</h3>
<ul>
<li id="wfm-help-trouble-10">GPU not detected for EmbeddingGemma 2 (Semantic settings &gt; Model says 'No GPU detected', or the connection test reports CPU): the onnxruntime in ComfyUI's Python is the CPU build, so 'CUDAExecutionProvider' is missing. Fix: stop ComfyUI (files in use cannot be replaced), then in ComfyUI's Python run 'pip uninstall -y onnxruntime onnxruntime-gpu' followed by 'pip install --no-deps onnxruntime-gpu', and start ComfyUI again. It can silently return to the CPU build later: other packages that require 'onnxruntime' (e.g. insightface, rtmlib, qwen-tts) make pip install the CPU build over the GPU files whenever they are installed or updated, so if the GPU disappears after adding a custom node, repeat the fix. Requires an NVIDIA GPU with the CUDA runtime/cuDNN that ComfyUI's PyTorch uses; DirectML is not supported. Without a GPU the CPU is used automatically (slower)</li>
<li id="wfm-help-trouble-11">Semantic Search with Gemini says 'GEMINI_API_KEY is not set' or the key is rejected: add GEMINI_API_KEY=your-key (no leading #) to the plugin's .env file (copy .env.example), then restart ComfyUI - the .env file is only read at startup. Get a key at Google AI Studio. If you do not want to use the API, choose EmbeddingGemma 2 (local, no key) in Semantic settings &gt; Model</li>
<li id="wfm-help-trouble-10">EmbeddingGemma 2 says 'Cannot reach Ollama' or 'not downloaded': start Ollama (it must be running while indexing and searching) and check the Ollama URL in Semantic settings &gt; Model; download the model with 'ollama pull embeddinggemma-2:740m' (or embeddinggemma-2:440m). If indexing fails now and then with 'connection was forcibly closed' errors, security software that filters per-app traffic (e.g. AdGuard) may be interrupting ollama.exe - exclude Ollama from filtering. Failed requests are retried automatically; images that still fail are counted as failed and are picked up again by the next 'New / changed images only' run</li>
<li id="wfm-help-trouble-11">Semantic Search with Gemini says 'GEMINI_API_KEY is not set' or the key is rejected: add GEMINI_API_KEY=your-key (no leading #) to the plugin's .env file (copy .env.example), then restart ComfyUI - the .env file is only read at startup. Get a key at Google AI Studio. If you do not want to use the API, choose EmbeddingGemma 2 (Ollama, local, no key) in Semantic settings &gt; Model</li>
<li id="wfm-help-trouble-12">Semantic Search or Similar shows no results: results only include images that are already indexed inside the selected folder (a green dot in the folder tree means the folder is fully indexed) - build the index from the gear button first, and select a folder that contains indexed images. After changing the model, vector size or image precision, choose 'Rebuild all'. A minimum score set in Semantic settings &gt; Search can also hide everything; set it to 0 to check. The first search after indexing takes a few seconds because the local model is reloaded</li>
</ul>
</div>
@@ -2303,7 +2340,8 @@
<button id="wfm-gallery-send-genui-image-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to GenerateUI Image input">Send GenUI Image</button>
<button id="wfm-gallery-send-li-node-btn" class="wfm-btn wfm-btn-sm" title="Upload and write selected image's filename into the selected node's image widget (e.g. LoadImage)">Send to LI node</button>
<button id="wfm-gallery-send-lv-node-btn" class="wfm-btn wfm-btn-sm" title="Upload and write selected video's filename into the selected node's file widget (native Load Video node)">Send to LV node</button>
<button id="wfm-gallery-send-cc-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to ComfyUI Comic Creator's selected panel" style="display:none;">Send CC</button>
<button id="wfm-gallery-send-cc-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to ComfyUI Comic Creator's Layout tab (selected panel / overlay)" style="display:none;">Send CC Layout</button>
<button id="wfm-gallery-send-cc-image-btn" class="wfm-btn wfm-btn-sm" title="Send selected image to ComfyUI Comic Creator's Image tab" style="display:none;">Send CC Image</button>
</div>
<!-- Semantic Search ON時の2行目: 類似画像 / 更新 / 設定 / 結果件数 -->
<div id="wfm-gallery-sem-row" class="wfm-toolbar-row wfm-gallery-sem-row" style="display:none;">
@@ -2847,8 +2885,9 @@
<input type="file" accept="video/*,image/*" id="wfm-video-source-file" style="display:none;">
</label>
</div>
<div style="display:flex;gap:6px;align-items:center;margin-top:6px;">
<span class="wfm-i2i-status" id="wfm-video-source-status" style="flex:1;"></span>
<div class="wfm-i2i-status wfm-video-source-status-line" id="wfm-video-source-status"></div>
<div class="wfm-video-source-actions">
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-register-asset">Register as Asset</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-add-to-edit">Add to Edit</button>
<button type="button" class="wfm-btn wfm-btn-sm" id="wfm-video-source-clear">Clear</button>
</div>
@@ -3386,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 -->
+63 -20
View File
@@ -652,17 +652,6 @@ window.wfmOpenMaskEditorForNode = async (imageDataUrl, maskDataUrl) => {
});
if (!resp.ok) throw new Error("Failed to send image to Mask Editor One");
// WFS側で既にマスクレイヤーを描いていた場合、それを初期マスクとしてそのまま引き継ぐ
// (applyImageAndMaskToMaskEditorOneNode の layer_data 形式と同じスキーマ)
if (maskDataUrl) {
const layerWidget = node.widgets?.find((w) => w.name === "layer_data");
if (layerWidget) {
layerWidget.value = JSON.stringify({
layers: [{ visible: true, opacity: 1, operation: "add", imageData: maskDataUrl }],
});
}
}
// ノード側のプレビュー/モーダル背景を、送信した画像に同期させる
node._bgDataUrl = imageDataUrl;
node._bgImg = await new Promise((r) => {
@@ -672,6 +661,29 @@ window.wfmOpenMaskEditorForNode = async (imageDataUrl, maskDataUrl) => {
img.src = imageDataUrl;
});
node._previewMode = "image";
// ワークフロー保存/再読み込み時に古い画像が復元されないよう、node.properties.bg_image を同期する
// (mask-editor-one 側が node._persistBgDataUrl を提供している場合のみ。旧バージョンでは無視)
if (typeof node._persistBgDataUrl === "function") {
node._persistBgDataUrl(imageDataUrl, "wfs_image.png").catch(() => {});
}
// WFS側で既にマスクレイヤーを描いていた場合、それを初期マスクとしてそのまま引き継ぐ
// (applyImageAndMaskToMaskEditorOneNode の layer_data 形式と同じスキーマ。
// width/height は送信画像のサイズで、ノードプレビュー復元時のレイヤーサイズ決定に使われる)
if (maskDataUrl) {
const layerWidget = node.widgets?.find((w) => w.name === "layer_data");
if (layerWidget) {
const layerData = {
layers: [{ visible: true, opacity: 1, operation: "add", imageData: maskDataUrl }],
};
if (node._bgImg) {
layerData.width = node._bgImg.naturalWidth;
layerData.height = node._bgImg.naturalHeight;
}
layerWidget.value = JSON.stringify(layerData);
}
}
node.setDirtyCanvas?.(true, true);
const prevMaskUrl = node._maskDataUrl;
@@ -2962,10 +2974,16 @@ function _wfmFlattenSubgraphs(workflow, objectInfo) {
}
const outerWidgetInputs = (node.inputs || []).filter((inp) => inp.widget);
// widgets_values_named (name-keyed copy saved by newer frontends, e.g. MOSS-Image): outer inputs[]
// may omit widget ports (seed/steps/...) while widgets_values holds every port, so the index
// lookup below would drift — see static/js/comfyui-workflow.js _flattenSubgraphs.
const namedOuter = node.widgets_values_named;
const hasNamedOuter = !!namedOuter && typeof namedOuter === "object";
outerWidgetInputs.forEach((inp, widgetIdx) => {
if (inp.link != null) return;
if (widgetIdx >= (node.widgets_values || []).length) return;
const outerValue = node.widgets_values[widgetIdx];
const useNamed = hasNamedOuter && Object.prototype.hasOwnProperty.call(namedOuter, inp.name);
if (!useNamed && widgetIdx >= (node.widgets_values || []).length) return;
const outerValue = useNamed ? namedOuter[inp.name] : node.widgets_values[widgetIdx];
const portIdx = (sgDef.inputs || []).findIndex((p) => p.name === inp.name);
if (portIdx === -1) return;
@@ -3214,7 +3232,12 @@ function _extractDiffusionModels(wf) {
if (!wf || typeof wf !== "object") return [];
const _UNET_TYPES = new Set(["UNETLoader", "UnetLoaderGGUF", "UNETLoaderGGUF"]);
if (Array.isArray(wf.nodes)) return _collectUnique(_collectAllNodes(wf).filter(n => _UNET_TYPES.has(n.type)).map(n => n.widgets_values?.[0]));
return _collectUnique(Object.values(wf).filter(n => _UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name));
// Gemini系の画像生成ノード(Nano Banana等、API形式)は"model"入力がモデル名(例: "Gemini Nano Banana 2.1")
const _isGeminiImage = (ct) => /^Gemini(Image|NanoBanana)/.test(ct ?? "");
return _collectUnique([
...Object.values(wf).filter(n => _UNET_TYPES.has(n?.class_type)).map(n => n.inputs?.unet_name),
...Object.values(wf).filter(n => _isGeminiImage(n?.class_type)).map(n => typeof n.inputs?.model === "string" ? n.inputs.model : undefined),
]);
}
function _extractTextEncoders(wf) {
if (!wf || typeof wf !== "object") return [];
@@ -3240,7 +3263,7 @@ function _extractTextEncoders(wf) {
}
function _extractLoRAs(wf) {
if (!wf || typeof wf !== "object") return [];
const results = [], seen = new Set();
const results = [], seen = new Set(), stackNames = new Set();
function add(name, sm, sc) {
if (!name || typeof name !== "string" || name === "None" || seen.has(name)) return;
seen.add(name);
@@ -3263,6 +3286,19 @@ function _extractLoRAs(wf) {
if (ct === "LoraLoader") add(n.inputs?.lora_name, n.inputs?.strength_model, n.inputs?.strength_clip);
else if (ct === "LoraLoaderModelOnly") add(n.inputs?.lora_name, n.inputs?.strength, 1.0);
else if (ct === "ImageMetadataLoRALoader") { for (let i = 1; i <= 3; i++) add(n.inputs?.[`lora_${i}`], n.inputs?.[`strength_model_${i}`], n.inputs?.[`strength_clip_${i}`]); }
else if (ct === "LoadLoraModel" || ct === "LoadLoraTextEncoder") {
// Native stack node: DynamicGroup rows are flat API keys "loras.<row>.<field>".
// Model node carries the model strength, Text Encoder node the clip strength.
const isModel = ct === "LoadLoraModel";
for (const [k, name] of Object.entries(n.inputs || {})) {
const m = /^loras\.(\d+)\.lora_name$/.exec(k);
if (!m || typeof name !== "string" || n.inputs[`loras.${m[1]}.enabled`] === false) continue;
const s = n.inputs[`loras.${m[1]}.strength`];
const hit = stackNames.has(name) && results.find((r) => r.name === name);
if (hit) hit[isModel ? "strength_model" : "strength_clip"] = parseFloat(s) || 1.0;
else { add(name, isModel ? s : 1.0, isModel ? 1.0 : s); stackNames.add(name); }
}
}
else if (ct === "Lora Loader (LoraManager)") {
const lorasData = n.inputs?.loras;
const list = lorasData?.__value__ ?? (Array.isArray(lorasData) ? lorasData : null);
@@ -3524,9 +3560,13 @@ function _extractPromptsAPI(wf) {
// MiniMaxH3ImageToVideo等の動画生成オールインワンノード。CLIPTextEncode等を経由せず
// 自ノードの"prompt"入力に直接テキストを持つ(positive/negativeの区別も無い)ため、
// _isTextEncoderNode判定を通さずtextMapへ直接投入する(fallbackのtextsに載る)。
if (typeof n.inputs?.prompt === "string" && /ImageToVideo|TextToVideo/i.test(ct)) {
textMap.set(id, n.inputs.prompt);
continue;
// Gemini系の画像生成ノード(Nano Banana等)も同様に自ノードの"prompt"入力を持つ。
// FastH3 OmniRef(MiniMaxH3ReferenceToVideo)のように"prompt"が別ノードから配線される場合はリンク先を解決する。
if (/ImageToVideo|TextToVideo|ReferenceToVideo|^Gemini(Image|NanoBanana)/i.test(ct)) {
const pv = n.inputs?.prompt;
const txt = typeof pv === "string" ? pv : Array.isArray(pv) ? _resolveLinkedText(wf, pv[0], pv[1] ?? 0) : null;
if (txt) textMap.set(id, txt);
if (pv !== undefined) continue;
}
if (!_isTextEncoderNode(ct)) continue;
// "prompt" — TextEncodeQwenImageEdit(Plus)/TextEncodeBooguEdit and similar Image Edit
@@ -3561,8 +3601,11 @@ function _extractPromptsAPI(wf) {
// TextEncodeMageFlowEdit / TextEncodeBooguEdit — 1ノードでprompt/negative_prompt両方を
// 直接持つため、textMap(1ノード1テキスト)では両ロールを表現できない
const srcNode = wf[String(val[0])];
if (srcNode?.class_type === "TextEncodeMageFlowEdit" || srcNode?.class_type === "TextEncodeBooguEdit") {
const txt = isPos ? srcNode.inputs?.prompt : srcNode.inputs?.negative_prompt;
// TextEncodeFibo2(Fibo 2.0)も同形。promptはPreviewAny→プロンプト強化スイッチ経由でリンクされる。
if (srcNode?.class_type === "TextEncodeMageFlowEdit" || srcNode?.class_type === "TextEncodeBooguEdit"
|| srcNode?.class_type === "TextEncodeFibo2") {
const raw = isPos ? srcNode.inputs?.prompt : srcNode.inputs?.negative_prompt;
const txt = Array.isArray(raw) ? _resolveLinkedText(wf, raw[0], raw[1] ?? 0) : raw;
if (txt && typeof txt === "string") { if (isPos) pos.add(txt); else neg.add(txt); }
continue;
}
+246
View File
@@ -0,0 +1,246 @@
{
"id": "ws-nano-banana-2-1-t2i",
"revision": 0,
"last_node_id": 2,
"last_link_id": 1,
"nodes": [
{
"id": 1,
"type": "GeminiNanoBanana2V2",
"pos": [
100,
100
],
"size": [
400,
398
],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [
{
"localized_name": "prompt",
"name": "prompt",
"type": "STRING",
"widget": {
"name": "prompt"
},
"link": null
},
{
"localized_name": "aspect_ratio",
"name": "model.aspect_ratio",
"type": "COMBO",
"widget": {
"name": "model.aspect_ratio"
},
"link": null
},
{
"localized_name": "resolution",
"name": "model.resolution",
"type": "COMBO",
"widget": {
"name": "model.resolution"
},
"link": null
},
{
"localized_name": "thinking_level",
"name": "model.thinking_level",
"type": "COMBO",
"widget": {
"name": "model.thinking_level"
},
"link": null
},
{
"localized_name": "image_1",
"name": "model.images.image_1",
"shape": 7,
"type": "IMAGE",
"link": null
},
{
"localized_name": "files",
"name": "model.files",
"shape": 7,
"type": "GEMINI_INPUT_FILES",
"link": null
},
{
"localized_name": "model",
"name": "model",
"type": "COMFY_DYNAMICCOMBO_V3",
"widget": {
"name": "model"
},
"link": null
},
{
"localized_name": "seed",
"name": "seed",
"type": "INT",
"widget": {
"name": "seed"
},
"link": null
},
{
"localized_name": "response_modalities",
"name": "response_modalities",
"type": "COMBO",
"widget": {
"name": "response_modalities"
},
"link": null
},
{
"localized_name": "system_prompt",
"name": "system_prompt",
"shape": 7,
"type": "STRING",
"widget": {
"name": "system_prompt"
},
"link": null
},
{
"localized_name": "temperature",
"name": "temperature",
"shape": 7,
"type": "FLOAT",
"widget": {
"name": "temperature"
},
"link": null
},
{
"localized_name": "top_p",
"name": "top_p",
"shape": 7,
"type": "FLOAT",
"widget": {
"name": "top_p"
},
"link": null
}
],
"outputs": [
{
"localized_name": "IMAGE",
"name": "IMAGE",
"type": "IMAGE",
"links": [
1
]
},
{
"localized_name": "STRING",
"name": "STRING",
"type": "STRING",
"links": null
},
{
"localized_name": "thought_image",
"name": "thought_image",
"type": "IMAGE",
"links": null
}
],
"properties": {
"Node name for S&R": "GeminiNanoBanana2V2"
},
"widgets_values": [
"a cute watercolor illustration of a red fox in a forest",
"Gemini Nano Banana 2.1",
"auto",
"1K",
"MEDIUM",
42,
"randomize",
"IMAGE",
"You are an expert image-generation engine. You must ALWAYS produce an image.\nInterpret all user input—regardless of format, intent, or abstraction—as literal visual directives for image composition.\nIf a prompt is conversational or lacks specific visual details, you must creatively invent a concrete visual scenario that depicts the concept.\nPrioritize generating the visual representation above any text, formatting, or conversational requests.",
1,
0.95
],
"color": "#432",
"bgcolor": "#653",
"title": "Nano Banana 2.1"
},
{
"id": 2,
"type": "SaveImage",
"pos": [
700,
100
],
"size": [
270,
58
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{
"localized_name": "images",
"name": "images",
"type": "IMAGE",
"link": 1
},
{
"localized_name": "filename_prefix",
"name": "filename_prefix",
"type": "STRING",
"widget": {
"name": "filename_prefix"
},
"link": null
}
],
"outputs": [
{
"localized_name": "images",
"name": "images",
"type": "IMAGE",
"links": null
}
],
"properties": {
"Node name for S&R": "SaveImage"
},
"widgets_values": [
"nano_banana"
],
"widgets_values_named": {
"filename_prefix": "ComfyUI"
}
}
],
"links": [
[
1,
1,
0,
2,
0,
"IMAGE"
]
],
"groups": [],
"config": {},
"extra": {
"bvSmartPipeRootId": "fab0b8d3-84d9-402b-a229-8e739ac71670",
"bvSmartPipeRoutes": {},
"ds": {
"scale": 1.0545043882575544,
"offset": [
944.7666109676784,
628.4452835934753
]
}
},
"version": 0.4
}