diff --git a/src/lib/components/admin/Settings/Audio.svelte b/src/lib/components/admin/Settings/Audio.svelte index fab2e06add..863cbe34cc 100644 --- a/src/lib/components/admin/Settings/Audio.svelte +++ b/src/lib/components/admin/Settings/Audio.svelte @@ -210,7 +210,7 @@
-
{$i18n.t('Speech-to-Text')}
+
{$i18n.t('Speech-to-Text')}

@@ -498,7 +498,7 @@
-
{$i18n.t('Text-to-Speech')}
+
{$i18n.t('Text-to-Speech')}

diff --git a/src/lib/components/admin/Settings/CodeExecution.svelte b/src/lib/components/admin/Settings/CodeExecution.svelte index 6050fb26bb..5838a2f4d1 100644 --- a/src/lib/components/admin/Settings/CodeExecution.svelte +++ b/src/lib/components/admin/Settings/CodeExecution.svelte @@ -41,7 +41,7 @@ {#if config}
-
{$i18n.t('General')}
+
{$i18n.t('General')}

@@ -164,7 +164,7 @@
-
{$i18n.t('Code Interpreter')}
+
{$i18n.t('Code Interpreter')}

diff --git a/src/lib/components/admin/Settings/Connections.svelte b/src/lib/components/admin/Settings/Connections.svelte index 100e440d5d..93cf755be8 100644 --- a/src/lib/components/admin/Settings/Connections.svelte +++ b/src/lib/components/admin/Settings/Connections.svelte @@ -219,7 +219,7 @@
{#if ENABLE_OPENAI_API !== null && ENABLE_OLLAMA_API !== null && connectionsConfig !== null}
-
{$i18n.t('General')}
+
{$i18n.t('General')}

diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index 35e0484916..c47031268f 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -317,7 +317,7 @@
-
{$i18n.t('General')}
+
{$i18n.t('General')}

@@ -914,7 +914,7 @@ {#if !RAGConfig.BYPASS_EMBEDDING_AND_RETRIEVAL}
-
{$i18n.t('Embedding')}
+
{$i18n.t('Embedding')}

@@ -1089,7 +1089,7 @@
-
{$i18n.t('Retrieval')}
+
{$i18n.t('Retrieval')}

@@ -1332,7 +1332,7 @@ {/if}
-
{$i18n.t('Files')}
+
{$i18n.t('Files')}

@@ -1444,7 +1444,7 @@
-
{$i18n.t('Integration')}
+
{$i18n.t('Integration')}

@@ -1464,7 +1464,7 @@
-
{$i18n.t('Danger Zone')}
+
{$i18n.t('Danger Zone')}

diff --git a/src/lib/components/admin/Settings/Evaluations.svelte b/src/lib/components/admin/Settings/Evaluations.svelte index 3e760772c7..68f8538829 100644 --- a/src/lib/components/admin/Settings/Evaluations.svelte +++ b/src/lib/components/admin/Settings/Evaluations.svelte @@ -104,7 +104,7 @@ {#if evaluationConfig !== null}
-
{$i18n.t('General')}
+
{$i18n.t('General')}

@@ -119,7 +119,7 @@ {#if evaluationConfig.ENABLE_EVALUATION_ARENA_MODELS}
-
+
{$i18n.t('Manage')}
diff --git a/src/lib/components/admin/Settings/General.svelte b/src/lib/components/admin/Settings/General.svelte index ec01b586fe..580b5ca374 100644 --- a/src/lib/components/admin/Settings/General.svelte +++ b/src/lib/components/admin/Settings/General.svelte @@ -118,11 +118,11 @@ updateHandler(); }} > -
+
{#if adminConfig !== null}
-
{$i18n.t('General')}
+
{$i18n.t('General')}

@@ -280,7 +280,7 @@
-
{$i18n.t('Authentication')}
+
{$i18n.t('Authentication')}

@@ -637,7 +637,7 @@
-
{$i18n.t('Features')}
+
{$i18n.t('Features')}

diff --git a/src/lib/components/admin/Settings/Images.svelte b/src/lib/components/admin/Settings/Images.svelte index 939e82e2fb..a738f35bda 100644 --- a/src/lib/components/admin/Settings/Images.svelte +++ b/src/lib/components/admin/Settings/Images.svelte @@ -18,6 +18,7 @@ import Switch from '$lib/components/common/Switch.svelte'; import Tooltip from '$lib/components/common/Tooltip.svelte'; import Textarea from '$lib/components/common/Textarea.svelte'; + import CodeEditorModal from '$lib/components/common/CodeEditorModal.svelte'; const dispatch = createEventDispatcher(); const i18n = getContext('i18n'); @@ -27,6 +28,7 @@ let models = null; let config = null; + let showComfyUIWorkflowEditor = false; let requiredWorkflowNodes = [ { type: 'prompt', @@ -68,24 +70,48 @@ }; const updateConfigHandler = async () => { - const res = await updateConfig(localStorage.token, config) - .catch((error) => { - toast.error(`${error}`); - return null; - }) - .catch((error) => { - toast.error(`${error}`); - return null; - }); + if ( + config.IMAGE_GENERATION_ENGINE === 'automatic1111' && + config.AUTOMATIC1111_BASE_URL === '' + ) { + toast.error($i18n.t('AUTOMATIC1111 Base URL is required.')); + config.ENABLE_IMAGE_GENERATION = false; + + return null; + } else if (config.IMAGE_GENERATION_ENGINE === 'comfyui' && config.COMFYUI_BASE_URL === '') { + toast.error($i18n.t('ComfyUI Base URL is required.')); + config.ENABLE_IMAGE_GENERATION = false; + + return null; + } else if (config.IMAGE_GENERATION_ENGINE === 'openai' && config.OPENAI_API_KEY === '') { + toast.error($i18n.t('OpenAI API Key is required.')); + config.ENABLE_IMAGE_GENERATION = false; + + return null; + } else if (config.IMAGE_GENERATION_ENGINE === 'gemini' && config.GEMINI_API_KEY === '') { + toast.error($i18n.t('Gemini API Key is required.')); + config.ENABLE_IMAGE_GENERATION = false; + + return null; + } + + const res = await updateConfig(localStorage.token, config).catch((error) => { + toast.error(`${error}`); + return null; + }); if (res) { config = res; + + if (config.ENABLE_IMAGE_GENERATION) { + backendConfig.set(await getBackendConfig()); + getModels(); + } + + return config; } - if (config.enabled) { - backendConfig.set(await getBackendConfig()); - getModels(); - } + return null; }; const validateJSON = (json) => { @@ -121,15 +147,11 @@ }); } - await updateConfig(localStorage.token, config).catch((error) => { - toast.error(`${error}`); - loading = false; - return null; - }); + const res = await updateConfigHandler(); + if (res) { + dispatch('save'); + } - getModels(); - - dispatch('save'); loading = false; }; @@ -179,173 +201,297 @@
{#if config}
-
{$i18n.t('Create Image')}
- -
-
-
-
- {$i18n.t('Image Generation (Experimental)')} -
+
{$i18n.t('Create Image')}
-
- { - const enabled = e.detail; +
- if (enabled) { - if ( - config.IMAGE_GENERATION_ENGINE === 'automatic1111' && - config.AUTOMATIC1111_BASE_URL === '' - ) { - toast.error($i18n.t('AUTOMATIC1111 Base URL is required.')); - config.ENABLE_IMAGE_GENERATION = false; - } else if ( - config.IMAGE_GENERATION_ENGINE === 'comfyui' && - config.COMFYUI_BASE_URL === '' - ) { - toast.error($i18n.t('ComfyUI Base URL is required.')); - config.ENABLE_IMAGE_GENERATION = false; - } else if ( - config.IMAGE_GENERATION_ENGINE === 'openai' && - config.OPENAI_API_KEY === '' - ) { - toast.error($i18n.t('OpenAI API Key is required.')); - config.ENABLE_IMAGE_GENERATION = false; - } else if ( - config.IMAGE_GENERATION_ENGINE === 'gemini' && - config.GEMINI_API_KEY === '' - ) { - toast.error($i18n.t('Gemini API Key is required.')); - config.ENABLE_IMAGE_GENERATION = false; - } - } - - updateConfigHandler(); - }} - /> -
-
-
- - {#if config.enabled} -
-
{$i18n.t('Image Prompt Generation')}
-
- -
-
- {/if} - -
-
{$i18n.t('Image Generation Engine')}
-
- -
-
-
-
- -
- {#if (config?.IMAGE_GENERATION_ENGINE ?? 'automatic1111') === 'automatic1111'} -
-
{$i18n.t('AUTOMATIC1111 Base URL')}
-
-
- +
+
+
+
+ {$i18n.t('Image Generation')} +
-
+
+ + {#if config.ENABLE_IMAGE_GENERATION} +
+
+
+
+ {$i18n.t('Image Prompt Generation')} +
+
+ + +
+
+ {/if} + +
+
+
+
+ {$i18n.t('Image Generation Engine')} +
+
+ + +
+
+ + {#if config.ENABLE_IMAGE_GENERATION} +
+
+
+
+ {$i18n.t('Default Model')} +
+
+ + + - - + + + {#each models ?? [] as model} + + {/each} + + +
-
- {$i18n.t('Include `--api` flag when running stable-diffusion-webui')} - - {$i18n.t('(e.g. `sh webui.sh --api`)')} - -
-
+
+
+
+
+ {$i18n.t('Image Size')} +
+
-
-
- {$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('_', ':')} - + {#if ['comfyui', 'automatic1111', ''].includes(config?.IMAGE_GENERATION_ENGINE)} +
+
+
+
+ {$i18n.t('Steps')} +
+
+ + + + +
+
+ {/if} + {/if} + + {#if config?.IMAGE_GENERATION_ENGINE === 'openai'} +
+
+
+
+ {$i18n.t('OpenAI API Base URL')} +
+
+ +
+
+ +
+
+
-
-
-
-
{$i18n.t('Additional Parameters')}
-
-
+
+
+
+
+ {$i18n.t('OpenAI API Key')} +
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+ {$i18n.t('OpenAI API Version')} +
+
+ +
+
+ +
+
+
+
+ {:else if (config?.IMAGE_GENERATION_ENGINE ?? 'automatic1111') === 'automatic1111'} +
+
+
+
+ {$i18n.t('AUTOMATIC1111 Base URL')} +
+
+ +
+
+ +
+ +
+
+ +
+ {$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('Additional Parameters')} +
+
+
+
+