Stability AI changes to models.

> Engine = V2beta Image Generation
> Models now shows API models.
> Hidden steps, height, etc.
This commit is contained in:
WBlair1
2024-07-01 12:04:23 -07:00
parent 4b356fbc60
commit 84b8f77107
2 changed files with 24 additions and 18 deletions

View File

@ -368,7 +368,7 @@ function toggleSourceControls() {
const source = $(this).data('sd-source').split(','); const source = $(this).data('sd-source').split(',');
$(this).toggle(source.includes(extension_settings.sd.source)); $(this).toggle(source.includes(extension_settings.sd.source));
}); });
const stabilityHiddenControls = $('#sd_steps, #sd_scale, #sd_sampler, #sd_scheduler, #sd_width, #sd_height, #sd_hr_upscaler, #sd_clip_skip'); 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');
if (extension_settings.sd.source === sources.stability) { if (extension_settings.sd.source === sources.stability) {
stabilityHiddenControls.hide(); stabilityHiddenControls.hide();
$('#sd_resolution').parent().hide(); $('#sd_resolution').parent().hide();
@ -1679,21 +1679,29 @@ async function generateStabilityImage(prompt, negativePrompt) {
} }
async function loadStabilityModels() { async function loadStabilityModels() {
return [ if (!extension_settings.sd.stability_key) {
{ console.debug('Stability API key is not set.');
value: 'stable-image-ultra', return [];
text: 'Stable Image Ultra', }
},
{ try {
value: 'stable-image-core', const response = await fetch('/api/sd/stability/models', {
text: 'Stable Image Core', method: 'GET',
}, headers: getRequestHeaders(),
{ });
value: 'stable-diffusion-3',
text: 'Stable Diffusion 3', if (!response.ok) {
}, throw new Error('Failed to fetch Stability AI models');
]; }
const data = await response.json();
return data.map(model => ({ value: model.id, text: model.name }));
} catch (error) {
console.error('Error fetching Stability AI models:', error);
return [];
}
} }
async function loadPollinationsModels() { async function loadPollinationsModels() {
return [ return [
{ {

View File

@ -207,9 +207,7 @@
<div class="flex1"> <div class="flex1">
<label for="sd_stability_engine">Engine</label> <label for="sd_stability_engine">Engine</label>
<select id="sd_stability_engine"> <select id="sd_stability_engine">
<option value="stable-image-ultra">Stable Image Ultra</option> <option value="v2beta">V2beta Image Generation</option>
<option value="stable-image-core">Stable Image Core</option>
<option value="stable-diffusion-3">Stable Diffusion 3</option>
</select> </select>
</div> </div>
<div class="flex1"> <div class="flex1">