{ saveHandler(); }} >
{#if config && imageGenerationConfig}
{$i18n.t('Image Settings')}
{$i18n.t('Image Generation (Experimental)')}
{ const enabled = e.detail; if (enabled) { if ( config.engine === 'automatic1111' && config.automatic1111.AUTOMATIC1111_BASE_URL === '' ) { toast.error($i18n.t('AUTOMATIC1111 Base URL is required.')); config.enabled = false; } else if ( config.engine === 'comfyui' && config.comfyui.COMFYUI_BASE_URL === '' ) { toast.error($i18n.t('ComfyUI Base URL is required.')); config.enabled = false; } else if (config.engine === 'openai' && config.openai.OPENAI_API_KEY === '') { toast.error($i18n.t('OpenAI API Key is required.')); config.enabled = false; } } updateConfigHandler(); }} />
{$i18n.t('Image Generation Engine')}
{ updateConfigHandler(); }} >
{$i18n.t('Default (Open AI)')}
{$i18n.t('ComfyUI')}
{$i18n.t('Automatic1111')}
{#if (config?.engine ?? 'automatic1111') === 'automatic1111'}
{$i18n.t('AUTOMATIC1111 Base URL')}
{ await updateConfigHandler(); const res = await verifyConfigUrl(localStorage.token).catch((error) => { toast.error(error); return null; }); if (res) { toast.success($i18n.t('Server connection verified')); } }} >
{$i18n.t('Include `--api` flag when running stable-diffusion-webui')}
{$i18n.t('(e.g. `sh webui.sh --api`)')}
{$i18n.t('AUTOMATIC1111 Api Auth String')}
{$i18n.t('Include `--api-auth` flag when running stable-diffusion-webui')}
{$i18n .t('(e.g. `sh webui.sh --api --api-auth username_password`)') .replace('_', ':')}
{$i18n.t('Set Sampler')}
{#each samplers ?? [] as sampler}
{sampler}
{/each}
{$i18n.t('Set Scheduler')}
{#each schedulers ?? [] as scheduler}
{scheduler}
{/each}
{$i18n.t('Set CFG Scale')}
{:else if config?.engine === 'comfyui'}
{$i18n.t('ComfyUI Base URL')}
{ await updateConfigHandler(); const res = await verifyConfigUrl(localStorage.token).catch((error) => { toast.error(error); return null; }); if (res) { toast.success($i18n.t('Server connection verified')); } }} >
{$i18n.t('ComfyUI Workflow')}
{#if config.comfyui.COMFYUI_WORKFLOW}
{/if}
{ const file = e.target.files[0]; const reader = new FileReader(); reader.onload = (e) => { config.comfyui.COMFYUI_WORKFLOW = e.target.result; e.target.value = null; }; reader.readAsText(file); }} />
{ document.getElementById('upload-comfyui-workflow-input')?.click(); }} > {$i18n.t('Click here to upload a workflow.json file.')}
{$i18n.t('Make sure to export a workflow.json file as API format from ComfyUI.')}
{#if config.comfyui.COMFYUI_WORKFLOW}
{$i18n.t('ComfyUI Workflow Nodes')}
{#each requiredWorkflowNodes as node}
{node.type}{node.type === 'prompt' ? '*' : ''}
{/each}
{$i18n.t('*Prompt node ID(s) are required for image generation')}
{/if} {:else if config?.engine === 'openai'}
{$i18n.t('OpenAI API Config')}
{/if}
{#if config?.enabled}
{$i18n.t('Set Default Model')}
{#each models ?? [] as model}
{model.name}
{/each}
{$i18n.t('Set Image Size')}
{$i18n.t('Set Steps')}
{/if} {/if}
{$i18n.t('Save')} {#if loading}
{/if}