diff --git a/src/lib/components/admin/Settings/Images.svelte b/src/lib/components/admin/Settings/Images.svelte index e15991fc7..af89bca1b 100644 --- a/src/lib/components/admin/Settings/Images.svelte +++ b/src/lib/components/admin/Settings/Images.svelte @@ -117,11 +117,16 @@ if (res) { config = res; + if (!config.replicate) { + config.replicate = { + REPLICATE_API_TOKEN: '' + }; + } } if (config.enabled) { backendConfig.set(await getBackendConfig()); - await getModels(); + getModels(); } }; @@ -191,14 +196,8 @@ } } - imageGenerationConfig = await getImageGenerationConfig(localStorage.token).catch((error) => { - toast.error(`${error}`); - return null; - }); - - // Load models first, then they'll be available when the UI renders if (config.enabled) { - await getModels(); + getModels(); } if (config.comfyui.COMFYUI_WORKFLOW) { @@ -224,6 +223,15 @@ node_ids: typeof n.node_ids === 'string' ? n.node_ids : n.node_ids.join(',') }; }); + + const imageConfigRes = await getImageGenerationConfig(localStorage.token).catch((error) => { + toast.error(`${error}`); + return null; + }); + + if (imageConfigRes) { + imageGenerationConfig = imageConfigRes; + } } }); @@ -293,21 +301,18 @@
{$i18n.t('Image Generation Engine')}
@@ -637,28 +642,15 @@ /> - {:else if config.engine === 'replicate'} -
-
{$i18n.t('Replicate Settings')}
-
-
-
- {$i18n.t('Replicate API Token')} -
-
- { - await updateConfigHandler(); - // Refresh models after API token change - if (config.enabled && config.replicate.REPLICATE_API_TOKEN) { - await getModels(); - } - }} - /> -
-
+ {:else if config?.engine === 'replicate'} +
+
{$i18n.t('Replicate API Config')}
+ +
+
{/if} @@ -673,17 +665,20 @@
- - - + /> + + {#each models ?? [] as model} - + {/each} - +