diff --git a/src/lib/components/AddServerModal.svelte b/src/lib/components/AddServerModal.svelte index f9970e4e8..ca07e8b88 100644 --- a/src/lib/components/AddServerModal.svelte +++ b/src/lib/components/AddServerModal.svelte @@ -25,7 +25,11 @@ export let connection = null; let url = ''; + let openApiPath = '/openapi.json'; + + let auth_type = 'bearer'; let key = ''; + let enable = true; let loading = false; @@ -57,7 +61,10 @@ const init = () => { if (connection) { url = connection.url; - key = connection.key; + openApiPath = connection.openApiPath ?? '/openapi.json'; + + auth_type = connection.auth_type ?? 'bearer'; + key = connection?.key ?? ''; enable = connection.config?.enable ?? true; } @@ -125,9 +132,20 @@ required /> + +
+ +
-
+
@@ -135,22 +153,41 @@
- {$i18n.t(`WebUI will make requests to "{{url}}/openapi.json"`, { - url: url + {$i18n.t(`WebUI will make requests to "{{url}}{{path}}"`, { + url: url, + path: openApiPath })}
-
{$i18n.t('Key')}
+
{$i18n.t('Auth')}
-
- +
+
+ +
+ +
+ {#if auth_type === 'bearer'} + + {:else if auth_type === 'session'} +
+ {$i18n.t('Forwards system user session credentials to authenticate')} +
+ {/if} +
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 530802cc7..f572c971c 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -205,7 +205,8 @@ }; const executeTool = async (data, cb) => { - const toolServer = $toolServers?.find((server) => server.url === data.server?.url); + const toolServer = $settings?.toolServers?.find((server) => server.url === data.server?.url); + const toolServerData = $toolServers?.find((server) => server.url === data.server?.url); console.log('executeTool', data, toolServer); @@ -215,7 +216,7 @@ toolServer.url, data?.name, data?.params, - toolServer + toolServerData ); console.log('executeToolServer', res);