diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js index 638add64..bec618c6 100644 --- a/ui/media/js/dnd.js +++ b/ui/media/js/dnd.js @@ -194,6 +194,28 @@ const TASK_MAPPING = { readUI: () => vaeModelField.value, parse: (val) => val }, + use_hypernetwork_model: { name: 'Hypernetwork model', + setUI: (use_hypernetwork_model) => { + const oldVal = hypernetworkModelField.value + + if (use_hypernetwork_model !== '') { + use_hypernetwork_model = getModelPath(use_hypernetwork_model, ['.pt']) + use_hypernetwork_model = use_hypernetwork_model !== '' ? use_hypernetwork_model : oldVal + } + hypernetworkModelField.value = use_hypernetwork_model + hypernetworkModelField.dispatchEvent(new Event('change')) + }, + readUI: () => hypernetworkModelField.value, + parse: (val) => val + }, + hypernetwork_strength: { name: 'Hypernetwork Strength', + setUI: (hypernetwork_strength) => { + hypernetworkStrengthField.value = hypernetwork_strength + updateHypernetworkStrengthSlider() + }, + readUI: () => parseFloat(hypernetworkStrengthField.value), + parse: (val) => parseFloat(val) + }, num_outputs: { name: 'Parallel Images', setUI: (num_outputs) => { @@ -338,7 +360,9 @@ const TASK_TEXT_MAPPING = { use_upscale: 'Use Upscaling', sampler: 'Sampler', negative_prompt: 'Negative Prompt', - use_stable_diffusion_model: 'Stable Diffusion model' + use_stable_diffusion_model: 'Stable Diffusion model', + use_hypernetwork_model: 'Hypernetwork model', + hypernetwork_strength: 'Hypernetwork Strength' } const afterPromptRe = /^\s*Width\s*:\s*\d+\s*(?:\r\n|\r|\n)+\s*Height\s*:\s*\d+\s*(\r\n|\r|\n)+Seed\s*:\s*\d+\s*$/igm function parseTaskFromText(str) { diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 9586980f..051fdc9e 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -1175,6 +1175,12 @@ hypernetworkStrengthSlider.addEventListener('input', updateHypernetworkStrength) hypernetworkStrengthField.addEventListener('input', updateHypernetworkStrengthSlider) updateHypernetworkStrength() +function updateHypernetworkStrengthContainer() { + document.querySelector("#hypernetwork_strength_container").style.display = (hypernetworkModelField.value === "" ? 'none' : '') +} +hypernetworkModelField.addEventListener('change', updateHypernetworkStrengthContainer) +updateHypernetworkStrengthContainer() + /********************* JPEG Quality **********************/ function updateOutputQuality() { outputQualityField.value = 0 | outputQualitySlider.value @@ -1249,6 +1255,10 @@ async function getModels() { vaeOptions.forEach(createModelOptions(vaeModelField, selectedVaeModel)) hypernetworkOptions.forEach(createModelOptions(hypernetworkModelField, selectedHypernetworkModel)) + stableDiffusionModelField.dispatchEvent(new Event('change')) + vaeModelField.dispatchEvent(new Event('change')) + hypernetworkModelField.dispatchEvent(new Event('change')) + // TODO: set default for model here too SETTINGS[sd_model_setting_key].default = stableDiffusionOptions[0] if (getSetting(sd_model_setting_key) == '' || SETTINGS[sd_model_setting_key].value == '') {