From 8a9f8627017bd0a74cbd647891552b26e56aabb7 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 8 Sep 2025 19:07:00 +0400 Subject: [PATCH] refac --- src/lib/components/AddConnectionModal.svelte | 130 ++++++++++++------ src/lib/components/AddServerModal.svelte | 7 - .../Connections/OllamaConnection.svelte | 1 + .../Connections/OpenAIConnection.svelte | 8 +- .../Settings/Connections/Connection.svelte | 6 - 5 files changed, 91 insertions(+), 61 deletions(-) diff --git a/src/lib/components/AddConnectionModal.svelte b/src/lib/components/AddConnectionModal.svelte index fd19c0b302..02784a7abb 100644 --- a/src/lib/components/AddConnectionModal.svelte +++ b/src/lib/components/AddConnectionModal.svelte @@ -31,6 +31,7 @@ let url = ''; let key = ''; + let auth_type = 'bearer'; let connectionType = 'external'; let azure = false; @@ -73,6 +74,7 @@ { url, key, + auth_type, config: { azure: azure, api_version: apiVersion @@ -140,6 +142,7 @@ const connection = { url, key, + auth_type, config: { enable: enable, tags: tags, @@ -157,6 +160,7 @@ url = ''; key = ''; + auth_type = 'bearer'; prefixId = ''; tags = []; modelIds = []; @@ -167,6 +171,8 @@ url = connection.url; key = connection.key; + auth_type = connection.auth_type ?? 'bearer'; + enable = connection.config?.enable ?? true; tags = connection.config?.tags ?? []; prefixId = connection.config?.prefix_id ?? ''; @@ -305,23 +311,63 @@
-
{$i18n.t('Auth')} - {$i18n.t('Key')} -
-
- +
+
+ +
+ +
+ {#if auth_type === 'bearer'} + + {:else if auth_type === 'none'} +
+ {$i18n.t('No authentication')} +
+ {:else if auth_type === 'session'} +
+ {$i18n.t('Forwards system user session credentials to authenticate')} +
+ {:else if auth_type === 'oauth'} +
+ {$i18n.t('Forwards system user OAuth access token to authenticate')} +
+ {/if} +
+
+
- {:else if auth_type === 'request_headers'} -
- {$i18n.t('Forwards system user headers to authenticate')} -
{/if}
diff --git a/src/lib/components/admin/Settings/Connections/OllamaConnection.svelte b/src/lib/components/admin/Settings/Connections/OllamaConnection.svelte index 48976f0769..3e25965391 100644 --- a/src/lib/components/admin/Settings/Connections/OllamaConnection.svelte +++ b/src/lib/components/admin/Settings/Connections/OllamaConnection.svelte @@ -71,6 +71,7 @@ class="w-full text-sm bg-transparent outline-hidden" placeholder={$i18n.t('Enter URL (e.g. http://localhost:11434)')} bind:value={url} + readonly={true} /> diff --git a/src/lib/components/admin/Settings/Connections/OpenAIConnection.svelte b/src/lib/components/admin/Settings/Connections/OpenAIConnection.svelte index b82e47be76..a4c2ada059 100644 --- a/src/lib/components/admin/Settings/Connections/OpenAIConnection.svelte +++ b/src/lib/components/admin/Settings/Connections/OpenAIConnection.svelte @@ -69,6 +69,7 @@ placeholder={$i18n.t('API Base URL')} bind:value={url} autocomplete="off" + readonly={true} /> {#if pipeline} @@ -94,13 +95,6 @@ {/if} - - diff --git a/src/lib/components/chat/Settings/Connections/Connection.svelte b/src/lib/components/chat/Settings/Connections/Connection.svelte index ea9089f2f1..c8a5ec152a 100644 --- a/src/lib/components/chat/Settings/Connections/Connection.svelte +++ b/src/lib/components/chat/Settings/Connections/Connection.svelte @@ -72,12 +72,6 @@ autocomplete="off" /> - -