mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
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.
This commit is contained in:
@ -368,6 +368,14 @@ 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');
|
||||||
|
if (extension_settings.sd.source === sources.stability) {
|
||||||
|
stabilityHiddenControls.hide();
|
||||||
|
$('#sd_resolution').parent().hide();
|
||||||
|
} else {
|
||||||
|
stabilityHiddenControls.show();
|
||||||
|
$('#sd_resolution').parent().show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadSettings() {
|
async function loadSettings() {
|
||||||
@ -452,6 +460,11 @@ async function loadSettings() {
|
|||||||
$('#sd_wand_visible').prop('checked', extension_settings.sd.wand_visible);
|
$('#sd_wand_visible').prop('checked', extension_settings.sd.wand_visible);
|
||||||
$('#sd_command_visible').prop('checked', extension_settings.sd.command_visible);
|
$('#sd_command_visible').prop('checked', extension_settings.sd.command_visible);
|
||||||
$('#sd_interactive_visible').prop('checked', extension_settings.sd.interactive_visible);
|
$('#sd_interactive_visible').prop('checked', extension_settings.sd.interactive_visible);
|
||||||
|
$('#sd_stability_key').val(extension_settings.sd.stability_key);
|
||||||
|
$('#sd_stability_engine').val(extension_settings.sd.stability_engine);
|
||||||
|
$('#sd_stability_style_preset').val(extension_settings.sd.stability_style_preset);
|
||||||
|
$('#sd_stability_aspect_ratio').val(extension_settings.sd.stability_aspect_ratio);
|
||||||
|
$('#sd_stability_output_format').val(extension_settings.sd.stability_output_format);
|
||||||
|
|
||||||
for (const style of extension_settings.sd.styles) {
|
for (const style of extension_settings.sd.styles) {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
@ -1227,7 +1240,7 @@ async function onModelChange() {
|
|||||||
extension_settings.sd.model = $('#sd_model').find(':selected').val();
|
extension_settings.sd.model = $('#sd_model').find(':selected').val();
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
|
|
||||||
const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations];
|
const cloudSources = [sources.horde, sources.novel, sources.openai, sources.togetherai, sources.pollinations, sources.stability];
|
||||||
|
|
||||||
if (cloudSources.includes(extension_settings.sd.source)) {
|
if (cloudSources.includes(extension_settings.sd.source)) {
|
||||||
return;
|
return;
|
||||||
@ -1620,11 +1633,7 @@ async function loadModels() {
|
|||||||
models = await loadPollinationsModels();
|
models = await loadPollinationsModels();
|
||||||
break;
|
break;
|
||||||
case sources.stability:
|
case sources.stability:
|
||||||
models = [
|
models = await loadStabilityModels();
|
||||||
{ value: 'stable-image-ultra', text: 'Stable Image Ultra' },
|
|
||||||
{ value: 'stable-image-core', text: 'Stable Image Core' },
|
|
||||||
{ value: 'stable-diffusion-3', text: 'Stable Diffusion 3' },
|
|
||||||
];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1669,6 +1678,22 @@ async function generateStabilityImage(prompt, negativePrompt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadStabilityModels() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
value: 'stable-image-ultra',
|
||||||
|
text: 'Stable Image Ultra',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'stable-image-core',
|
||||||
|
text: 'Stable Image Core',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'stable-diffusion-3',
|
||||||
|
text: 'Stable Diffusion 3',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
async function loadPollinationsModels() {
|
async function loadPollinationsModels() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@ -3300,6 +3325,8 @@ function isValidState() {
|
|||||||
return secret_state[SECRET_KEYS.TOGETHERAI];
|
return secret_state[SECRET_KEYS.TOGETHERAI];
|
||||||
case sources.pollinations:
|
case sources.pollinations:
|
||||||
return true;
|
return true;
|
||||||
|
case sources.stability:
|
||||||
|
return !!extension_settings.sd.stability_key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user