{ loading = true; if (imageGenerationEngine === 'openai') { await updateOpenAIKey(localStorage.token, OPENAI_API_KEY); } await updateDefaultImageGenerationModel(localStorage.token, selectedModel); await updateImageSize(localStorage.token, imageSize).catch((error) => { toast.error(error); return null; }); await updateImageSteps(localStorage.token, steps).catch((error) => { toast.error(error); return null; }); dispatch('save'); loading = false; }} >
{$i18n.t('Image Settings')}
{$i18n.t('Image Generation Engine')}
{ await updateImageGeneration(); }} >
{$i18n.t('Default (Automatic1111)')}
{$i18n.t('Open AI (Dall-E)')}
{$i18n.t('Image Generation (Experimental)')}
{ if (imageGenerationEngine === '' && AUTOMATIC1111_BASE_URL === '') { toast.error($i18n.t('AUTOMATIC1111 Base URL is required.')); enableImageGeneration = false; } else if (imageGenerationEngine === 'openai' && OPENAI_API_KEY === '') { toast.error($i18n.t('OpenAI API Key is required.')); enableImageGeneration = false; } else { enableImageGeneration = !enableImageGeneration; } updateImageGeneration(); }} type="button" > {#if enableImageGeneration === true}
{$i18n.t('On')}
{:else}
{$i18n.t('Off')}
{/if}
{#if imageGenerationEngine === ''}
{$i18n.t('AUTOMATIC1111 Base URL')}
{ // updateOllamaAPIUrlHandler(); updateAUTOMATIC1111UrlHandler(); }} >
{$i18n.t('Include `--api` flag when running stable-diffusion-webui')}
{$i18n.t('(e.g. `sh webui.sh --api`)')}
{:else if imageGenerationEngine === 'openai'}
{$i18n.t('OpenAI API Key')}
{/if} {#if enableImageGeneration}
{$i18n.t('Set Default Model')}
{#if !selectedModel}
{$i18n.t('Select a model')}
{/if} {#each models ?? [] as model}
{model.name}
{/each}
{$i18n.t('Set Image Size')}
{$i18n.t('Set Steps')}
{/if}
{$i18n.t('Save')} {#if loading}
{/if}