62 Commits
Author SHA1 Message Date
Jason HokuandPR #25 Contributor 78c9bcab3f Merge PR #25: Add Krea-2 CLIP type support
* Adds krea2 to supported CLIP types in config builder
* Preserves Additional Random Seeds feature from main

Co-Authored-By: PR #25 Contributor
2026-07-19 12:49:49 -07:00
Jason Hoku bf40928abc feat: add krea2 CLIP type support (prep for PR merge) 2026-07-19 12:49:38 -07:00
ConnerMong-NotADev 5ad054fd11 Adding krea2 CLIP type to Update config_builder_node.py
As far as I can tell, this is the only modification required. Tests succeed in my local env..
2026-07-19 14:06:31 -05:00
Jason Hoku 23185fa521 feat(run-settings): add 'Additional Random Seeds' to Builder UI
Wires the existing add_random_seeds_to_gens parameter (already in
generation_orchestrator.py:824) through the full Run Settings pipeline:

1. Builder UI: state default + _addRunSetting widget (int, 0-100, default 0)
2. config_builder_node.py: emits into session_settings in configs_json
3. sampler_node.py: reads from session_settings, overrides the local variable

The generation loop already handles it — generates N extra images per config
with random seeds when > 0. Previously hardcoded to 0 with no UI path.

Based on PR #21 by external contributor, rebased onto current main with
full pipeline wiring.

Tests: 118/118 pass.
2026-05-26 11:50:48 -07:00
Jason Hoku 32d1287059 feat(api): include civitai_available in lookup_triggers response
Lets the Builder UI know whether the ComfyUI-USCG-CivitAI companion is
installed, so it can show small inline install notices in the trigger-
words section and the 2 'Lookup Metadata from CivitAI' buttons.
2026-05-19 18:50:02 -07:00
Jason Hoku b9591a543a refactor: route civitai_fetch_by_hash through civitai.py facade
Both config_builder_node.py and lora_utils.py now import from .civitai
instead of .network_utils. network_utils.py becomes unreferenced and
gets deleted in the next commit.
2026-05-19 18:47:18 -07:00
Jason HokuandClaude Sonnet 4.6 7c809e5dfb feat: integrate Kohya Deep Shrink (PatchModelAddDownscale) into Builder UI
Adds a new SUB-GROUP 4 in the Builder UI's "Extra Model & Sampling
Options" section with all 7 params from ComfyUI's built-in
PatchModelAddDownscale node:
- block_number (int, default 3)
- downscale_factor (float, default 2.0)
- start_percent / end_percent (float 0-1, default 0.0 / 0.35)
- downscale_after_skip (bool, default true)
- downscale_method / upscale_method (combo: bicubic/nearest-exact/
  bilinear/area/bislerp, default bicubic)

Toggle checkbox controls whether the patch is applied. State plumbs:
config_array.use_deep_shrink/* (JS) -> state_to_configs_json -> per-
config entries -> expand_configs base_combos -> generate_image -> looks
up PatchModelAddDownscale via NODE_CLASS_MAPPINGS and calls .patch() to
patch the model before sampling. Logs an "Applied
PatchModelAddDownscale" line on each gen for visibility.

Mirrors the existing model_sampling_override / use_advanced_sampling
patterns for consistency. Hidden on LTX video config arrays since the
patch targets the SDXL/SD UNet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 12:22:25 -07:00
Jason HokuandClaude Opus 4.7 a1cb7c3346 chore: vae_batch_size + flush_batch_every default 4 → 1
User feedback: 1 is a more sensible default for typical generation —
smaller VAE batches keep VRAM lower, and flushing every gen makes the
dashboard show progress immediately.

Updated everywhere:
- sampler_node run_tests fallback defaults (post-widget-removal)
- conf-builder-main.js initial state + migration backfill
- conf-builder-config-management.js renderRunSettingsSection
  state-init defaults + _addRunSetting defaultValue
- config_builder_node.py state_to_configs_json emit fallback +
  except-clause fallback for both fields

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 11:56:19 -07:00
Jason HokuandClaude Opus 4.7 62c2a0f9ab refactor: remove session_name output socket from UltimateConfigBuilder
session_name is now carried inside configs_json via _session_settings
(emitted unconditionally as of e570f6b, honored by sampler_node.run_tests).
The dedicated output socket was redundant — and now that the
SamplerGridTester's session_name widget is gone (commit 30e3aa9),
nothing on the downstream side reads it anyway.

Workflows that wired BuilderUI.session_name -> somewhere will have that
wire silently dropped by ComfyUI on load. No action needed for users
who only use the configs_json wire (the typical setup).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 13:48:36 -07:00
Jason HokuandClaude Opus 4.7 e570f6b58b fix: Run Settings — start_at_job persistence + unconditional override emission
Three issues in 7a2c3c9:

1. start_at_job's onchange handler used setDirtyCanvas() instead of
   saveState() — changes never reached the lora_config widget value.
   Fixed to call saveState().

2. The 6 run-settings emissions were gated on "non-default" values
   (e.g. lora_triggerwords_mode only emitted when != "None"). Result:
   a user setting Builder UI to its default could not override the
   Generator widget if the user had previously set that widget to
   something non-default. Builder UI is now authoritative — emit all
   values unconditionally. start_at_job and image_format also
   switched to unconditional emission for consistency.

3. session_name had no plumbing path. Added emission in
   state_to_configs_json and an override branch in sampler_node so
   the Builder UI's session_name field overrides the generator widget.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 13:25:10 -07:00
Jason HokuandClaude Opus 4.7 a3ad11116a fix: VAE — honor bypass state + omit "vae" key when nothing selected
Two bugs in state_to_configs_json's VAE emission:

1. Bypass (unchecked) VAEs were still sent through — vae_bypass_states
   was never consulted in the filter. Now filtered alongside the
   None/empty check.

2. When no VAE remained (empty list, all bypassed, or only "None"),
   the config emitted "vae": "None" — the orchestrator interpreted
   that as a model filename and threw "vae model with filename 'None'
   not found". Now the "vae" key is OMITTED entirely so the generator
   falls back to its default behavior (no per-config VAE override),
   matching the pattern already used for text_encoders/clip_type/etc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 12:40:16 -07:00
Jason HokuandClaude Opus 4.7 7a2c3c905e feat: Builder UI Run Settings — top-of-UI placement + 6 generator-node overrides
Phase 1 of consolidating run-level config into the Builder UI. The
Builder UI's "Run Settings" section is now rendered at the TOP of the UI
(was previously below config arrays) and gains six new fields with help
tooltips:

- overwrite_existing (bool, default false)
- flush_batch_every (int, default 4)
- lora_triggerwords_mode (enum: None / Append To End / Append To Start /
  Read From Config, default None)
- save_conditioning_cache_to_file (bool, default false)
- enable_model_cache (bool, default false)
- vae_batch_size (int, default 4, range -1..64)

State plumbs through state_to_configs_json -> _session_settings ->
sampler_node.run_tests -> run_generation_loop. Builder UI values
override the corresponding widgets on UltimateSamplerGrid when set
(non-default). Widget values remain the fallback so existing workflows
keep working without changes.

Logs an "⚙️ <name> overridden by Builder UI: <value>" line whenever an
override fires, so it's obvious in the console.

Next: once the user has tested this thoroughly, the corresponding
widgets on the SamplerGridTester node can be removed/hidden to
simplify the generator UX (deferred — coordinate with user).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 09:21:14 -07:00
Jason HokuandClaude Opus 4.7 5482878edc fix: drop seed/denoise/clip_type from schema-drift validator
These keys legitimately aren't set in pre-orchestrator configs:
- seed: filled by expand_configs (node-level seed widget or per-entry override)
- denoise: filled by run_generation_loop from the denoise widget
- clip_type: only set when model_type != "checkpoint"

The validator was a stale leftover from the pre-single-source-of-truth era.
Trimming false positives. Still warns on actual typos / dropped fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 12:52:43 -07:00
Jason HokuandClaude Opus 4.7 490c5196ef feat: configurable image save format (webp/png/jpg)
Adds a dropdown to the Builder UI's Run Settings section letting users
pick the saved image file format. Default remains webp (current
behavior). State plumbed through state_to_configs_json ->
_session_settings -> orchestrator -> save_image_to_disk.

PNG users will see lossless saves; JPG users smaller files at quality 95.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 13:05:10 -07:00
Jason HokuandClaude Opus 4.7 4fb4fea5ed fix: lock Compare Strengths to single-bracket form (no Cartesian)
When the user types '0.5, 1.0' they want 2 outputs (lora at 0.5, lora
at 1.0 — both model and clip mirroring), not 4 outputs (Cartesian
m×c). The bug was that we wrote both _model AND _clip side-channel
arrays, so Python emitted 'name:[m]:[c]' which the orchestrator
correctly interpreted as Cartesian.

JS: collapse the two-input compare section to a single 'Strengths:'
input. Never write _clip to lora_weight_arrays.

Python: process_lora_array now emits 'name:[m_arr]' (no clip part)
when only _model array is present. The generator's existing
parse_lora_definition defaults clip=model when the third segment
is missing, giving N configs with locked semantics.

Drops the Cartesian path entirely. Backward compat retained: if a
saved workflow has both arrays (legacy), the dual-bracket form is
still emitted so the orchestrator can Cartesian-expand as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 11:27:39 -07:00
Jason HokuandClaude Opus 4.7 9ff76dd8ab feat: add POST /configbuilder/preview endpoint
Both runtime (generate_config) and preview now invoke
state_to_configs_json — single source of truth, drift-proof.
The Builder UI will fetch this endpoint instead of running a
parallel JS transformer (next commit removes that JS code).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 09:55:49 -07:00
Jason HokuandClaude Opus 4.7 d07657c85b refactor: extract state_to_configs_json as single transformer
Eliminates the JS<->Python drift bug class by making one Python function
the source of truth for state -> configs_json. Both the runtime
(generate_config) and the new preview endpoint (next commit) call it.
Adds golden test for the lora-strength-arrays bracket case that just
broke (regression guard).

Also loads the real config_builder_node module in conftest.py (instead
of a bare stub) so that tests against UltimateConfigBuilder methods work
correctly. Stubs network_utils before loading to satisfy the relative
import.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 09:44:12 -07:00
Jason Hoku a3478c01cb fix: ltx latent_upscaler reads from latent_upscale_models/ folder, not upscale_models/ 2026-04-25 19:43:10 -07:00
Jason Hoku 0b0781f838 fix: ltx config flattening in py generate_config + trust model type before file picked 2026-04-25 19:19:48 -07:00
Jason Hoku cbc82026bc fix: route all config_builder prints through safe_print to avoid Windows OSError 2026-04-22 17:33:35 -07:00
Jason HokuandClaude Opus 4.6 9de031ad94 fix: safe_print in generate_config to survive Windows stdout corruption
Windows users occasionally see 'OSError [Errno 22] Invalid argument'
from colorama's write_plain_text when stdout gets into a bad state
(often after a long-running or interrupted session). This crashed the
Config Builder node at its very first print statement, breaking the
entire workflow.

Adds a module-level safe_print() helper that:
1. Tries normal print() first
2. Falls back to raw sys.__stdout__.write on OSError/ValueError
3. Silently drops the message if even that fails

generate_config() now aliases print = safe_print at the top so every
print call in the function is automatically resilient without renaming
each one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 19:00:31 -07:00
Jason HokuandClaude Opus 4.6 4d362b8c6f feat: config schema validation warns on JS/Python field sync drift
Adds a validation check in generate_config() that compares each output
config's keys against the expected set (sampler, scheduler, steps, cfg,
model, lora, etc.). Logs a warning with the missing keys if any are
absent, catching dual-codepath sync drift before it causes runtime bugs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 22:27:24 -07:00
Jason HokuandClaude Opus 4.6 7b437f0e2f feat: instant model loading with localStorage cache + background polling
Performance improvements for Builder UI model/LoRA loading:

localStorage persistent cache:
- Model lists cached to localStorage on first fetch
- On page reload, cached data renders instantly (no network wait)
- Cache expires after 24 hours, cleared on explicit Refresh Models
- Saves all categories: checkpoints, diffusion, GGUF, text encoders,
  VAEs, upscale models, samplers, schedulers, clip types

Background count polling:
- New /configbuilder/model_counts endpoint returns file counts per
  category (fast — uses folder_paths internal stat-based cache)
- Frontend polls every 30s, compares counts to last known values
- On change: auto-refreshes model lists and re-renders UI
- No manual Refresh Models needed when adding new models

Deduplicated /object_info:
- Shared _getObjectInfo() cache ensures the expensive /object_info
  endpoint is called at most once per session (was called 2-3x)
- getAvailableLoras() and getAvailableModels() share the cached response

Polling lifecycle:
- Starts after initial render, stops when node is removed
- Only active while ConfigBuilder node exists on canvas

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 11:13:18 -07:00
Jason HokuandClaude Opus 4.6 0691c26d77 feat: add Flux2 support — CLIP type, model sampling, and override
- Add "flux2" to clip_types and dual_clip_types lists so CLIPType.FLUX2
  is correctly passed to ComfyUI's text encoder loader
- Add "flux2" model_sampling_override option in Builder UI dropdown
- Implement ModelSamplingFlux2 handler using fixed shift (default 2.02,
  matching ComfyUI's Flux2 supported_models.py)
- Handle "flux2" in config_builder_node.py config generation with
  default shift value

Users with Flux2 models (Klein, etc.) should set:
- CLIP Type: flux2
- Model Sampling Override: Flux2
- For best results: enable Advanced Sampling with Flux2 Scheduler

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 20:50:46 -07:00
Jason HokuandClaude Opus 4.6 9b8f01ea48 feat: add Start At Job # option for custom job resume/skipping
New 'Run Settings' section in Builder UI with a job number input.
When set > 0, the generation loop skips all jobs before that number.
Useful for resuming at a specific point without relying on
auto-detection. Flows through session settings to the orchestrator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 16:00:43 -07:00
Jason HokuandClaude Opus 4.6 c0f4def625 feat: wire run_upscales_at_end through config export and Python
Added to JS convertStateToConfigs() and Python generate_config()
session settings dict.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 02:26:35 -07:00
Jason HokuandClaude Opus 4.6 d6ced4aebc fix: always include all config fields to prevent manifest data loss
Fields like vae, seed_behavior, model_type, attention_mode,
model_prompt_prefix/suffix, sampling overrides, lora_omit_triggers,
and trigger append settings are now always included with defaults
instead of being conditionally omitted. This prevents data loss when
sessions are reloaded from manifests with toggled-off sections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 20:14:56 -07:00
Jason HokuandClaude Opus 4.6 77b30a3ca6 refactor: migrate config_builder_node.py CivitAI calls to network gateway
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 02:16:02 -07:00
JasonHokuandClaude Opus 4.6 89b6ce4eb1 feat: upscale pipelines system + save pre-upscale + HiRes prompt adjust
Replace flat upscale configs with pipeline/steps/repeat architecture:
- Pipelines run independently from base image
- Steps chain sequentially within a pipeline
- Steps support repeat count for iterative refinement

Add "Save Pre-Upscaled Output" option to also keep the base image.

Add "Adjust Prompt During HiRes Fix" with prepend/append/replace
behaviors. HiRes-adjusted prompts are batch pre-encoded for efficiency.
Results written to manifest metadata and exposed as label overlays.

Fix fmtVal scoping error in buildLabelOverlay (was referenced outside
the upscale block where it was defined).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:33:04 -07:00
JasonHokuandClaude Opus 4.6 7c1b6ffc8c feat: add upscale model discovery from ComfyUI folder system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:33:30 -07:00
JasonHokuandClaude Opus 4.6 91b8598ac3 feat: add seed settings, canvas flicker fix, upscaling & GPU cooldown
- Seed: expanded per-gen behavior + new full run seed behavior (random/increment/decrement before/after entire run)
- Canvas: fix flicker during simultaneous pan+zoom via requestAnimationFrame batching
- Upscaling: 3 session-level modes (HiRes fix, model upscale, model+HiRes) with tiled VAE support
- Cooldown: configurable GPU breaks between generations with optional VRAM clearing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 14:00:06 -07:00
JasonHoku 8fbf7568d2 Fixed image resolution settings not outputting to config_json 2026-03-07 17:31:54 -08:00
JasonHokuandClaude Opus 4.6 9987d38f9b fix: Custom Prompts section — session load, checkbox toggle, and count display
Three bugs fixed:

1. Global Prompt data was incorrectly loaded into Custom Prompts when
   loading a session. Added _prompt_source flag ("global"/"custom") to
   configs so the round-trip loader can distinguish between them and
   restore global prompts to the correct section.

2. Checkbox toggle was not visually broken but appeared non-functional
   because bug #1 caused global prompts to populate custom prompt fields,
   making the state confusing. Now correctly separated.

3. Prompt combination count in the section header was only computed at
   render time and never updated when groups changed. Added live update
   via updatePromptCountDisplay() in the onChange callback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:04:08 -08:00
JasonHokuandClaude Opus 4.6 5e7ad22cc7 fix: backslash in f-string, dashboard focus stealing, VAE config priority, column hotkeys
- Fix Python 3.10 SyntaxError: extract backslash replace() out of f-string
  expression in config_builder_node.py (issue #12)

- Fix dashboard iframe stealing focus from ComfyUI on every live update
  by removing viewport.focus() from render/update paths in logic_virtual.js

- Intercept Ctrl+S in dashboard iframe and forward to ComfyUI parent
  window so workflow save works instead of triggering browser Save As dialog

- Config Builder VAE settings now override sampler node's remote_vae_endpoint
  via config_overrides_vae flag in generation_orchestrator.py flush logic

- Fix Shift+1-9 column hotkeys: use e.code instead of e.key since Shift
  produces symbols (!@#$) not digits for e.key on standard keyboards

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:41:44 -08:00
JasonHokuandClaude Opus 4.6 2146e4926c Refactor Distribution Settings: always-visible toggle + embedded config
Distribution Settings section:
- Always visible at top with On/Off toggle
- Settings collapse when toggled off, expand when on
- No longer conditionally rendered

Distribution config output/input removal (clean break):
- Config Builder: RETURN_TYPES reduced from 3 to 2 outputs
- distribution_config embedded in configs_json as _distribution key
- Output format: {"configs": [...], "_distribution": {...}}
- Sampler node: Removed distribution_config optional input
- Sampler extracts _distribution from configs_json automatically
- Backward compatible: plain array configs_json still works
- JSON Preview shows full output including _distribution when enabled
- Session loader handles both old array and new object formats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 15:59:10 -08:00
JasonHokuandClaude Opus 4.6 e71fe8ed91 Add Sync Models to Workers checkbox and config passthrough
New toggle in Distribution Settings section. Flag flows through
distribution_config JSON as sync_models_to_workers boolean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 15:04:08 -08:00
JasonHokuandClaude Opus 4.6 39695f5e52 Implement Tasks 2-5: tag diff, sidebar nav, section reorg, headers
Task 2: Backend compares fresh CivitAI trainedWords with stored
loras_tags.json on force_refresh. Frontend shows diff banner with
Update/Keep buttons in the LoRA metadata modal.

Task 4: Per-config sidebar navigation — numbered cog icons per config
array with hover-expandable sub-section icons (Models, TE, VAE, LoRAs).
Section IDs added to all sub-sections for scroll targeting.

Task 5: Distribution Settings moved to top of layout. Extra Model &
Sampling Options moved inside Models as sub-section. TE header upgraded
to match section toggle style with brighter color. VAE header lightened
(#444 bg, #cc66ff text). LoRAs header brightened (#4499ff).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 15:08:54 -08:00
JasonHoku 2c15fe035a fix remote vae on distribution worker 2026-02-28 21:56:12 -08:00
JasonHokuandClaude Opus 4.6 ee4451f3a2 Add custom lora trigger word editor with modal UI and backend endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 21:27:26 -08:00
JasonHokuandClaude Opus 4.6 87e37563f2 Enhance CivitAI modals: re-fetch button, save JSON, force_refresh
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 21:11:09 -08:00
JasonHokuandClaude Opus 4.6 feb8ebc5c4 feat: parse extra model & sampling options in config builder
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:22:00 -08:00
JasonHoku 822373227c Optional Text Encoder On Master Only & Serve To Workers & More Distrib Logging 2026-02-26 20:11:59 -08:00
JasonHoku cfb75e7922 Create Run Distribution System 2026-02-26 15:37:55 -08:00
JasonHoku 731db142d9 builder ui updates, features & dash prompt analyize copy favorites to clipboard tool 2026-02-19 15:44:06 -08:00
JasonHoku 2e1c1d1fdf Fix caching and calling of model/lora civitai lookup 2026-02-16 16:19:07 -08:00
JasonHoku 67a8cf65dd Integrate New Security Rules From Comfy Registry Scans. 2026-02-16 16:03:05 -08:00
JasonHoku 9518630662 fix on/off model switch not outputting to config_json 2026-02-16 13:49:44 -08:00
JasonHoku f3582fb190 add model lookup on civitai button 2026-02-16 00:50:34 -08:00
JasonHoku 3c06847167 Add dropdown selection and list building options for availableSamplers/availableSchedulers in builder UI 2026-02-15 13:49:22 -08:00
JasonHoku f7ec7cca23 implement vae selection in UI & vae iteration tools 2026-02-14 23:36:38 -08:00