Stability AI code fix. > "break;" line had space before word. Oops. > Stability hides steps, cfg, height, etc. when selected. > Settings are loaded and saved. > isValid state is modified now for Stability. Oops. > Skips remote function for Stability.
| @@ -368,6 +368,14 @@ function toggleSourceControls() { | ||
| 368 | 368 | const source = $(this).data('sd-source').split(','); |
| 369 | 369 | $(this).toggle(source.includes(extension_settings.sd.source)); |
| 370 | 370 | }); |
| 371 | + const stabilityHiddenControls = $('#sd_steps, #sd_scale, #sd_sampler, #sd_scheduler, #sd_width, #sd_height, #sd_hr_upscaler, #sd_clip_skip'); | |
| 372 | + if (extension_settings.sd.source === sources.stability) { | |
| 373 | + stabilityHiddenControls.hide(); | |
| 374 | + $('#sd_resolution').parent().hide(); | |
| 375 | + } else { | |
| 376 | + stabilityHiddenControls.show(); | |
| 377 | + $('#sd_resolution').parent().show(); | |
| 378 | + } | |
| 371 | 379 | } |
| 372 | 380 | |
| 373 | 381 | async function loadSettings() { |
| @@ -452,6 +460,11 @@ async function loadSettings() { | ||
| 452 | 460 | $('#sd_wand_visible').prop('checked', extension_settings.sd.wand_visible); |
| 453 | 461 | $('#sd_command_visible').prop('checked', extension_settings.sd.command_visible); |
| 454 | 462 | $('#sd_interactive_visible').prop('checked', extension_settings.sd.interactive_visible); |
| 463 | + $('#sd_stability_key').val(extension_settings.sd.stability_key); | |
| 464 | + $('#sd_stability_engine').val(extension_settings.sd.stability_engine); | |
| 465 | + $('#sd_stability_style_preset').val(extension_settings.sd.stability_style_preset); | |
| 466 | + $('#sd_stability_aspect_ratio').val(extension_settings.sd.stability_aspect_ratio); | |
| 467 | + $('#sd_stability_output_format').val(extension_settings.sd.stability_output_format); | |
| 455 | 468 | |
| 456 | 469 | for (const style of extension_settings.sd.styles) { |
| 457 | 470 | const option = document.createElement('option'); |
| @@ -1227,7 +1240,7 @@ async function onModelChange() { | ||
| 1227 | 1240 | extension_settings.sd.model = $('#sd_model').find(':selected').val(); |
| 1228 | 1241 | saveSettingsDebounced(); |
| 1229 | 1242 | |
| 1230 | 1243 | const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations, sources.stability]; |
| 1231 | 1244 | |
| 1232 | 1245 | if (cloudSources.includes(extension_settings.sd.source)) { |
| 1233 | 1246 | return; |
| @@ -1619,12 +1632,8 @@ async function loadModels() { | ||
| 1619 | 1632 | case sources.pollinations: |
| 1620 | 1633 | models = await loadPollinationsModels(); |
| 1621 | 1634 | break; |
| 1622 | 1635 | case sources.stability: |
| 1623 | 1636 | models = [await loadStabilityModels(); |
| 1624 | - { value: 'stable-image-ultra', text: 'Stable Image Ultra' }, | |
| 1625 | - { value: 'stable-image-core', text: 'Stable Image Core' }, | |
| 1626 | - { value: 'stable-diffusion-3', text: 'Stable Diffusion 3' }, | |
| 1627 | - ]; | |
| 1628 | 1637 | break; |
| 1629 | 1638 | } |
| 1630 | 1639 | |
| @@ -1669,6 +1678,22 @@ async function generateStabilityImage(prompt, negativePrompt) { | ||
| 1669 | 1678 | } |
| 1670 | 1679 | } |
| 1671 | 1680 | |
| 1681 | +async function loadStabilityModels() { | |
| 1682 | + return [ | |
| 1683 | + { | |
| 1684 | + value: 'stable-image-ultra', | |
| 1685 | + text: 'Stable Image Ultra', | |
| 1686 | + }, | |
| 1687 | + { | |
| 1688 | + value: 'stable-image-core', | |
| 1689 | + text: 'Stable Image Core', | |
| 1690 | + }, | |
| 1691 | + { | |
| 1692 | + value: 'stable-diffusion-3', | |
| 1693 | + text: 'Stable Diffusion 3', | |
| 1694 | + }, | |
| 1695 | + ]; | |
| 1696 | +} | |
| 1672 | 1697 | async function loadPollinationsModels() { |
| 1673 | 1698 | return [ |
| 1674 | 1699 | { |
| @@ -3300,6 +3325,8 @@ function isValidState() { | ||
| 3300 | 3325 | return secret_state[SECRET_KEYS.TOGETHERAI]; |
| 3301 | 3326 | case sources.pollinations: |
| 3302 | 3327 | return true; |
| 3328 | + case sources.stability: | |
| 3329 | + return !!extension_settings.sd.stability_key; | |
| 3303 | 3330 | } |
| 3304 | 3331 | } |
| 3305 | 3332 | |