Stable Diffusion: LoRA strength slider, %vae%/%lora% editor placeholders, catalog-derived VAE list for RunPod proxy
| @@ -13,6 +13,8 @@ | ||
| 13 | 13 | <li data-placeholder="negative_prompt" class="sd_comfy_workflow_editor_not_found">"%negative_prompt%"</li> |
| 14 | 14 | <li data-placeholder="model" class="sd_comfy_workflow_editor_not_found">"%model%"</li> |
| 15 | 15 | <li data-placeholder="vae" class="sd_comfy_workflow_editor_not_found">"%vae%"</li> |
| 16 | + <li data-placeholder="lora" class="sd_comfy_workflow_editor_not_found">"%lora%"</li> | |
| 17 | + <li data-placeholder="lora_strength" class="sd_comfy_workflow_editor_not_found">"%lora_strength%"</li> | |
| 16 | 18 | <li data-placeholder="sampler" class="sd_comfy_workflow_editor_not_found">"%sampler%"</li> |
| 17 | 19 | <li data-placeholder="scheduler" class="sd_comfy_workflow_editor_not_found">"%scheduler%"</li> |
| 18 | 20 | <li data-placeholder="steps" class="sd_comfy_workflow_editor_not_found">"%steps%"</li> |
| @@ -381,6 +381,10 @@ const defaultSettings = { | ||
| 381 | 381 | |
| 382 | 382 | // Selected LoRA for comfy workflows using the %lora% placeholder |
| 383 | 383 | lora: '', |
| 384 | + lora_strength: 1.0, | |
| 385 | + lora_strength_min: 0.0, | |
| 386 | + lora_strength_max: 2.0, | |
| 387 | + lora_strength_step: 0.05, | |
| 384 | 388 | |
| 385 | 389 | // Per-workflow remembered selections ({ [workflow]: { model, lora } }); |
| 386 | 390 | // part of preset snapshots, so each chain provider keeps its own map. |
| @@ -732,6 +736,10 @@ async function loadSettings() { | ||
| 732 | 736 | extension_settings.sd.lora = ''; |
| 733 | 737 | } |
| 734 | 738 | |
| 739 | + if (typeof extension_settings.sd.lora_strength !== 'number') { | |
| 740 | + extension_settings.sd.lora_strength = 1.0; | |
| 741 | + } | |
| 742 | + | |
| 735 | 743 | if (typeof extension_settings.sd.comfy_workflow_prefs !== 'object' || !extension_settings.sd.comfy_workflow_prefs) { |
| 736 | 744 | extension_settings.sd.comfy_workflow_prefs = {}; |
| 737 | 745 | } |
| @@ -755,6 +763,7 @@ async function loadSettings() { | ||
| 755 | 763 | $('#sd_height').val(extension_settings.sd.height).trigger('input'); |
| 756 | 764 | $('#sd_hr_scale').val(extension_settings.sd.hr_scale).trigger('input'); |
| 757 | 765 | $('#sd_denoising_strength').val(extension_settings.sd.denoising_strength).trigger('input'); |
| 766 | + $('#sd_lora_strength').val(extension_settings.sd.lora_strength ?? 1.0).trigger('input'); | |
| 758 | 767 | $('#sd_hr_second_pass_steps').val(extension_settings.sd.hr_second_pass_steps).trigger('input'); |
| 759 | 768 | $('#sd_novel_anlas_guard').prop('checked', extension_settings.sd.novel_anlas_guard); |
| 760 | 769 | $('#sd_novel_sm').prop('checked', extension_settings.sd.novel_sm); |
| @@ -2455,6 +2464,12 @@ function onDenoisingStrengthInput() { | ||
| 2455 | 2464 | saveSettingsDebounced(); |
| 2456 | 2465 | } |
| 2457 | 2466 | |
| 2467 | +function onLoraStrengthInput() { | |
| 2468 | + extension_settings.sd.lora_strength = Number($('#sd_lora_strength').val()); | |
| 2469 | + $('#sd_lora_strength_value').val(extension_settings.sd.lora_strength.toFixed(2)); | |
| 2470 | + saveSettingsDebounced(); | |
| 2471 | +} | |
| 2472 | + | |
| 2458 | 2473 | function onHrSecondPassStepsInput() { |
| 2459 | 2474 | extension_settings.sd.hr_second_pass_steps = Number($('#sd_hr_second_pass_steps').val()); |
| 2460 | 2475 | $('#sd_hr_second_pass_steps_value').val(extension_settings.sd.hr_second_pass_steps); |
| @@ -4020,6 +4035,15 @@ async function loadComfyVaes() { | ||
| 4020 | 4035 | if (extension_settings.sd.comfy_type === comfyTypes.runpod_serverless) { |
| 4021 | 4036 | return ['N/A']; |
| 4022 | 4037 | } |
| 4038 | + if (isRunpodProxyUrl(extension_settings.sd.comfy_url)) { | |
| 4039 | + // Derive the VAE list from the catalog's download manifests (dest under | |
| 4040 | + // vae/) instead of querying the pod, which may be cold. | |
| 4041 | + const vaes = getRunpodCatalog() | |
| 4042 | + .flatMap(m => parseRunpodFiles(m.downloads)) | |
| 4043 | + .filter(f => /^vae\//i.test(f.dest)) | |
| 4044 | + .map(f => f.dest.split('/').pop()); | |
| 4045 | + return [...new Set(vaes)]; | |
| 4046 | + } | |
| 4023 | 4047 | if (!extension_settings.sd.comfy_url) { |
| 4024 | 4048 | return []; |
| 4025 | 4049 | } |
| @@ -5698,6 +5722,7 @@ async function generateComfyImage(prompt, negativePrompt, signal) { | ||
| 5698 | 5722 | 'model', |
| 5699 | 5723 | 'vae', |
| 5700 | 5724 | 'lora', |
| 5725 | + 'lora_strength', | |
| 5701 | 5726 | 'sampler', |
| 5702 | 5727 | 'scheduler', |
| 5703 | 5728 | 'steps', |
| @@ -7264,6 +7289,7 @@ export async function init() { | ||
| 7264 | 7289 | $('#sd_hr_upscaler').on('change', onHrUpscalerChange); |
| 7265 | 7290 | $('#sd_hr_scale').on('input', onHrScaleInput); |
| 7266 | 7291 | $('#sd_denoising_strength').on('input', onDenoisingStrengthInput); |
| 7292 | + $('#sd_lora_strength').on('input', onLoraStrengthInput); | |
| 7267 | 7293 | $('#sd_hr_second_pass_steps').on('input', onHrSecondPassStepsInput); |
| 7268 | 7294 | $('#sd_novel_anlas_guard').on('input', onNovelAnlasGuardInput); |
| 7269 | 7295 | $('#sd_novel_view_anlas').on('click', onViewAnlasClick); |
| @@ -506,6 +506,16 @@ | ||
| 506 | 506 | </div> |
| 507 | 507 | |
| 508 | 508 | <div class="flex-container"> |
| 509 | + <div class="alignitemscenter flex-container flexFlowColumn flexGrow flexShrink gap0 flexBasis48p" data-sd-source="comfy"> | |
| 510 | + <small> | |
| 511 | + <span data-i18n="LoRA strength">LoRA strength</span> | |
| 512 | + </small> | |
| 513 | + <input class="neo-range-slider" type="range" id="sd_lora_strength" name="sd_lora_strength" min="{{lora_strength_min}}" max="{{lora_strength_max}}" step="{{lora_strength_step}}" value="{{lora_strength}}" > | |
| 514 | + <input class="neo-range-input" type="number" id="sd_lora_strength_value" data-for="sd_lora_strength" min="{{lora_strength_min}}" max="{{lora_strength_max}}" step="{{lora_strength_step}}" value="{{lora_strength}}" > | |
| 515 | + </div> | |
| 516 | + </div> | |
| 517 | + | |
| 518 | + <div class="flex-container"> | |
| 509 | 519 | <div class="flex1" data-sd-source="extras,horde,auto,drawthings,novel,vlad,comfy,sdcpp"> |
| 510 | 520 | <label for="sd_sampler" data-i18n="Sampling method">Sampling method</label> |
| 511 | 521 | <select id="sd_sampler" class="text_pole"></select> |