Stability AI changes to models. > Engine = V2beta Image Generation > Models now shows API models. > Hidden steps, height, etc.

84b8f771072c98c8f51f9af6a9220360a71a92b0

WBlair1 <wolfgangblair1@gmail.com>

2 files changed, +24 -18Showing whitespace changes
public/scripts/extensions/stable-diffusion/index.js+23 -15
@@ -368,7 +368,7 @@ function toggleSourceControls() {
368368 const source = $(this).data('sd-source').split(',');
369369 $(this).toggle(source.includes(extension_settings.sd.source));
370370 });
371371 const stabilityHiddenControls = $('#sd_steps, #sd_scale, #sd_sampler, #sd_scheduler, #sd_width, #sd_height, #sd_hr_upscaler, #sd_clip_skip, #sd_steps_value, #sd_scale_value');
372372 if (extension_settings.sd.source === sources.stability) {
373373 stabilityHiddenControls.hide();
374374 $('#sd_resolution').parent().hide();
@@ -1679,21 +1679,29 @@ async function generateStabilityImage(prompt, negativePrompt) {
16791679}
16801680
16811681async function loadStabilityModels() {
1682- return [
1682+ if (!extension_settings.sd.stability_key) {
1683- {
1683+ console.debug('Stability API key is not set.');
1684- value: 'stable-image-ultra',
1684+ return [];
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- ];
16961685 }
1686+
1687+ try {
1688+ const response = await fetch('/api/sd/stability/models', {
1689+ method: 'GET',
1690+ headers: getRequestHeaders(),
1691+ });
1692+
1693+ if (!response.ok) {
1694+ throw new Error('Failed to fetch Stability AI models');
1695+ }
1696+
1697+ const data = await response.json();
1698+ return data.map(model => ({ value: model.id, text: model.name }));
1699+ } catch (error) {
1700+ console.error('Error fetching Stability AI models:', error);
1701+ return [];
1702+ }
1703+}
1704+
16971705async function loadPollinationsModels() {
16981706 return [
16991707 {
public/scripts/extensions/stable-diffusion/settings.html+1 -3
@@ -207,9 +207,7 @@
207207 <div class="flex1">
208208 <label for="sd_stability_engine">Engine</label>
209209 <select id="sd_stability_engine">
210210 <option value="stable-image-ultrav2beta">StableV2beta Image UltraGeneration</option>
211- <option value="stable-image-core">Stable Image Core</option>
212- <option value="stable-diffusion-3">Stable Diffusion 3</option>
213211 </select>
214212 </div>
215213 <div class="flex1">