execute_template() was loading models from disk on every call, bypassing
the WorkflowGenerator's instance-level _model_cache. This caused models
to be fully reloaded (unloaded then loaded from disk) on every generation
run for all template-based families (SDXL, Flux1, Flux2, WAN, etc.).
Pass cached model tuples from WorkflowGenerator._model_cache into
execute_template() so it reuses already-loaded models instead of
reloading from disk each time. Also cache model B in the template
code path (previously only cached in the hardcoded fallback path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: VAE and CLIP were loaded in Python unconditionally before
the template/fallback branch split. For diffusion model families (flux1,
flux2, wan, ltxv, zimage) _load_model_from_path returns vae_a=None and
clip_a=None (no bundled VAE/CLIP in the diffusion checkpoint). When the
user selected (Default), vae_name was empty / started with '(' and
_load_vae returned None → FileNotFoundError.
Fix in workflow_generator.py:
- Remove the VAE/CLIP load block that was unconditionally before the
template/fallback branch.
- Template path: execute_template handles its own VAE/CLIP loading from
the template JSON values, which are already correct (patch_template
leaves them untouched when (Default) is selected).
- Hardcoded fallback path: VAE/CLIP are now loaded inside the else block
with a clear, actionable error message if (Default) is used on a
family that has no bundled VAE.
Fix in workflow_executor.py:
- Improve the VAE not-found error message to tell the user which file
was expected and where to put it.
- workflow_executor.py: new in-process template execution engine
- load_template() / patch_template() / execute_template()
- WAN Video i2v latent via WanImageToVideo node
- Dual-step math: total=high+low, high=[0..H], low=[H..100]
- loras_to_text() for PromptApplyLora JSON serialisation
- workflow_families.py: split wan → wan_image / wan_video_i2v / wan_video_t2v
- Added FAMILY_WORKFLOW_STEMS mapping family keys to api/ file stems
- Sampler strategy: wan_image → single KSampler, wan_video → dual KSamplerAdvanced
- tools/convert_to_api.py: UI JSON → API JSON conversion script (8 workflows)
- workflows/api/: 16 new files (api.json + map.json) for:
flux_1, flux_2, qwen_image, sdxl, wan_image, wan_video_i2v, wan_video_t2v, z_image
- workflow_generator.py:
- execute() now uses template-driven path first (load_template → patch → execute_template)
- Falls back to hardcoded samplers when no template exists (sd15, ltxv)
- Added source_image optional param for WAN i2v
- Added steps_high / steps_low override parsing from JS
- Strategy check updated: wan → wan_video for both i2v and t2v
- workflow_generator.js:
- makeSection(): collapsible with chevron toggle, all start collapsed
- updateWanVisibility(): handles wan_image / wan_video_i2v / wan_video_t2v
- Steps (High) / Steps (Low) rows added to SAMPLER section (WAN Video only)
- Standard Steps row hidden when WAN Video family selected
- LoRA Stack A title: 'LoRA Stack (High)' for WAN Video, 'LoRA Stack' otherwise
- LoRA Stack B: visible only for wan_video_i2v / wan_video_t2v
- Model B row: visible only for WAN Video families
- syncHidden(), applyOverrides(), updateUI() updated for steps_high/steps_low
- Section _setNode() wired up after _weRecalc is defined