Stable Diffusion: migrate stale flux1 VAE selection, snap VAE setting to offered list
| @@ -740,6 +740,16 @@ async function loadSettings() { | ||
| 740 | 740 | extension_settings.sd.lora_strength = 1.0; |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | + // The flux workflows moved from a hardcoded flux2 VAE to %vae%; a leftover | |
| 744 | + // flux1 selection ('ae.safetensors') would fail pod-side validation. | |
| 745 | + const migrateVae = (config) => { | |
| 746 | + if (config && config.vae === 'ae.safetensors') { | |
| 747 | + config.vae = 'flux2-vae.safetensors'; | |
| 748 | + } | |
| 749 | + }; | |
| 750 | + migrateVae(extension_settings.sd); | |
| 751 | + (extension_settings.sd.settings_preset_chain ?? []).forEach(entry => migrateVae(entry?.preset)); | |
| 752 | + | |
| 743 | 753 | if (typeof extension_settings.sd.comfy_workflow_prefs !== 'object' || !extension_settings.sd.comfy_workflow_prefs) { |
| 744 | 754 | extension_settings.sd.comfy_workflow_prefs = {}; |
| 745 | 755 | } |
| @@ -4001,7 +4011,10 @@ async function loadVaes() { | ||
| 4001 | 4011 | $('#sd_vae').append(option); |
| 4002 | 4012 | } |
| 4003 | 4013 | |
| 4004 | - if (!extension_settings.sd.vae && vaes.length > 0 && vaes[0] !== 'N/A') { | |
| 4014 | + // Snap to the first real entry when nothing is selected OR the saved value | |
| 4015 | + // is not offered (otherwise the dropdown displays the first option while | |
| 4016 | + // generations keep sending the stale saved value). | |
| 4017 | + if (vaes.length > 0 && vaes[0] !== 'N/A' && !vaes.includes(extension_settings.sd.vae)) { | |
| 4005 | 4018 | extension_settings.sd.vae = vaes[0]; |
| 4006 | 4019 | $('#sd_vae').val(extension_settings.sd.vae).trigger('change'); |
| 4007 | 4020 | } |