This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-13 17:36:00 +09:00
1 parent 31a8c54423
commit 4720ff19e7
153 files changed
+9782 -6185

No files matched your search

+129 -161
View File
@@ -16,7 +16,6 @@
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Switch from '$lib/components/common/Switch.svelte';
import Tags from './common/Tags.svelte';
import { getToolServerData } from '$lib/apis';
import { slugify } from '$lib/utils';
import {
verifyToolServerConnection,
@@ -36,7 +35,6 @@
export let show = false;
export let edit = false;
export let direct = false;
export let connection: any = null;
let inputElement = null;
@@ -196,50 +194,36 @@
}
}
if (direct) {
const res = await getToolServerData(
auth_type === 'bearer' ? key : auth_type === 'session' ? localStorage.token : null,
path.includes('://') ? path : `${url}${path.startsWith('/') ? '' : '/'}${path}`
).catch((err) => {
toast.error($i18n.t('Connection failed'));
});
if (res) {
toast.success($i18n.t('Connection successful'));
console.debug('Connection successful', res);
const res = await verifyToolServerConnection(localStorage.token, {
url,
path,
type,
auth_type,
headers: headers ? JSON.parse(headers) : undefined,
key,
config: {
enable: enable,
access_grants: accessGrants
},
info: {
id,
name,
description,
...(oauthAuthTypes.includes(auth_type)
? {
...(oauthServerUrl ? { oauth_server_url: oauthServerUrl } : {}),
...(oauthScope ? { oauth_scope: oauthScope } : {}),
oauth_resource_parameter: oauthResourceParameter
}
: {})
}
} else {
const res = await verifyToolServerConnection(localStorage.token, {
url,
path,
type,
auth_type,
headers: headers ? JSON.parse(headers) : undefined,
key,
config: {
enable: enable,
access_grants: accessGrants
},
info: {
id,
name,
description,
...(oauthAuthTypes.includes(auth_type)
? {
...(oauthServerUrl ? { oauth_server_url: oauthServerUrl } : {}),
...(oauthScope ? { oauth_scope: oauthScope } : {}),
oauth_resource_parameter: oauthResourceParameter
}
: {})
}
}).catch((err) => {
toast.error($i18n.t('Connection failed'));
});
}).catch((err) => {
toast.error($i18n.t('Connection failed'));
});
if (res) {
toast.success(verifySuccessMessage());
console.debug('Connection successful', res);
}
if (res) {
toast.success(verifySuccessMessage());
console.debug('Connection successful', res);
}
};
@@ -313,7 +297,7 @@
path,
auth_type,
...(!direct && ['', 'openapi'].includes(type) ? { forward_cookies: forwardCookies } : {}),
...(['', 'openapi'].includes(type) ? { forward_cookies: forwardCookies } : {}),
headers: headers ? JSON.parse(headers) : undefined,
key,
@@ -399,7 +383,7 @@
path,
auth_type,
...(!direct && ['', 'openapi'].includes(type) ? { forward_cookies: forwardCookies } : {}),
...(['', 'openapi'].includes(type) ? { forward_cookies: forwardCookies } : {}),
headers: headers ? JSON.parse(headers) : undefined,
key,
@@ -577,26 +561,20 @@
<div class=" text-xs text-gray-500">{$i18n.t('Type')}</div>
<div class="">
{#if !direct}
<button
on:click={() => {
type = ['', 'openapi'].includes(type) ? 'mcp' : 'openapi';
}}
type="button"
class=" text-xs text-gray-700 dark:text-gray-300"
>
{#if ['', 'openapi'].includes(type)}
{$i18n.t('settings.admin.integrations.openApi.label')}
{:else if type === 'mcp'}
{$i18n.t('settings.admin.integrations.mcp.label')}
<span class="text-gray-500">{$i18n.t('Streamable HTTP')}</span>
{/if}
</button>
{:else}
<div class="text-xs text-gray-700 dark:text-gray-300">
{$i18n.t('settings.personal.tools.openApi.label')}
</div>
{/if}
<button
on:click={() => {
type = ['', 'openapi'].includes(type) ? 'mcp' : 'openapi';
}}
type="button"
class=" text-xs text-gray-700 dark:text-gray-300"
>
{#if ['', 'openapi'].includes(type)}
{$i18n.t('settings.admin.integrations.openApi.label')}
{:else if type === 'mcp'}
{$i18n.t('settings.admin.integrations.mcp.label')}
<span class="text-gray-500">{$i18n.t('Streamable HTTP')}</span>
{/if}
</button>
</div>
</div>
</div>
@@ -618,43 +596,41 @@
/>
</div>
</div>
{#if !direct}
<div class="flex flex-col flex-1">
<div class="flex justify-between mb-0.5">
<label for="enter-id" class={`text-xs text-gray-500`}>
{#if type === 'mcp'}
{$i18n.t('Connection ID')}
{:else}
{$i18n.t('ID')}
<span class="opacity-50">({$i18n.t('optional')})</span>
{/if}</label
>
</div>
<Tooltip
className="flex flex-1 items-center"
tippyOptions={{ trigger: 'mouseenter focusin' }}
content={type === 'mcp' && oauthAuthTypes.includes(auth_type)
? edit
? $i18n.t(
'Identifies this connection in Open WebUI, separately from the OAuth client ID.'
)
: $i18n.t(
'Generated from the name, or enter your own. Identifies this connection in Open WebUI, separately from the OAuth client ID.'
)
: ''}
<div class="flex flex-col flex-1">
<div class="flex justify-between mb-0.5">
<label for="enter-id" class={`text-xs text-gray-500`}>
{#if type === 'mcp'}
{$i18n.t('Connection ID')}
{:else}
{$i18n.t('ID')}
<span class="opacity-50">({$i18n.t('optional')})</span>
{/if}</label
>
<input
id="enter-id"
class={`w-full flex-1 text-sm font-mono ${inputClass}`}
type="text"
bind:value={id}
placeholder="auto"
autocomplete="off"
required={type === 'mcp' && edit}
/>
</Tooltip>
</div>
{/if}
<Tooltip
className="flex flex-1 items-center"
tippyOptions={{ trigger: 'mouseenter focusin' }}
content={type === 'mcp' && oauthAuthTypes.includes(auth_type)
? edit
? $i18n.t(
'Identifies this connection in Open WebUI, separately from the OAuth client ID.'
)
: $i18n.t(
'Generated from the name, or enter your own. Identifies this connection in Open WebUI, separately from the OAuth client ID.'
)
: ''}
>
<input
id="enter-id"
class={`w-full flex-1 text-sm font-mono ${inputClass}`}
type="text"
bind:value={id}
placeholder="auto"
autocomplete="off"
required={type === 'mcp' && edit}
/>
</Tooltip>
</div>
</div>
<div class="flex flex-col w-full mt-1 mb-1.5">
@@ -800,12 +776,10 @@
<option value="bearer">{$i18n.t('Bearer')}</option>
<option value="session">{$i18n.t('Session')}</option>
{#if !direct}
<option value="system_oauth">{$i18n.t('OAuth')}</option>
{#if type === 'mcp'}
<option value="oauth_2.1">{$i18n.t('OAuth 2.1')}</option>
<option value="oauth_2.1_static">{$i18n.t('OAuth 2.1 (Static)')}</option>
{/if}
<option value="system_oauth">{$i18n.t('OAuth')}</option>
{#if type === 'mcp'}
<option value="oauth_2.1">{$i18n.t('OAuth 2.1')}</option>
<option value="oauth_2.1_static">{$i18n.t('OAuth 2.1 (Static)')}</option>
{/if}
</select>
</div>
@@ -884,19 +858,17 @@
{$i18n.t('Advanced')}
</button>
{#if !direct}
<AccessButton
className="mt-2"
on:click={() => {
showAccessControlModal = true;
}}
label={$i18n.t('Access Control')}
/>
{/if}
<AccessButton
className="mt-2"
on:click={() => {
showAccessControlModal = true;
}}
label={$i18n.t('Access Control')}
/>
</div>
{#if showAdvanced}
{#if !direct && ['', 'openapi'].includes(type)}
{#if ['', 'openapi'].includes(type)}
<div class="flex items-center justify-between gap-3 mt-2">
<div>
<label for="forward-cookies" class="text-xs text-gray-500">
@@ -1024,55 +996,51 @@
</div>
{/if}
{#if !direct}
<div class="flex gap-2 mt-2">
<div class="flex flex-col w-full">
<label
for="headers-input"
class={`mb-0.5 text-xs text-gray-500
`}>{$i18n.t('Headers')}</label
<div class="flex gap-2 mt-2">
<div class="flex flex-col w-full">
<label
for="headers-input"
class={`mb-0.5 text-xs text-gray-500
`}>{$i18n.t('Headers')}</label
>
<div class="flex-1">
<Tooltip
content={$i18n.t(
'Enter additional headers in JSON format (e.g. {"X-Custom-Header": "value"}'
)}
>
<div class="flex-1">
<Tooltip
content={$i18n.t(
'Enter additional headers in JSON format (e.g. {"X-Custom-Header": "value"}'
)}
>
<Textarea
className="w-full text-sm outline-hidden"
bind:value={headers}
placeholder={$i18n.t('Enter additional headers in JSON format')}
required={false}
minSize={30}
/>
</Tooltip>
</div>
<Textarea
className="w-full text-sm outline-hidden"
bind:value={headers}
placeholder={$i18n.t('Enter additional headers in JSON format')}
required={false}
minSize={30}
/>
</Tooltip>
</div>
</div>
{/if}
{/if}
{#if !direct}
<hr class=" border-gray-100/50 dark:border-gray-700/10 my-2.5 w-full" />
<div class="flex flex-col w-full mt-2">
<label for="function-name-filter-list" class={`mb-1 text-xs text-gray-500`}
>{$i18n.t('Function Name Filter List')}</label
>
<div class="flex-1">
<input
id="function-name-filter-list"
class={`w-full text-sm ${inputClass}`}
type="text"
bind:value={functionNameFilterList}
placeholder={$i18n.t('Enter function name filter list (e.g. func1, !func2)')}
autocomplete="off"
/>
</div>
</div>
{/if}
<hr class=" border-gray-100/50 dark:border-gray-700/10 my-2.5 w-full" />
<div class="flex flex-col w-full mt-2">
<label for="function-name-filter-list" class={`mb-1 text-xs text-gray-500`}
>{$i18n.t('Function Name Filter List')}</label
>
<div class="flex-1">
<input
id="function-name-filter-list"
class={`w-full text-sm ${inputClass}`}
type="text"
bind:value={functionNameFilterList}
placeholder={$i18n.t('Enter function name filter list (e.g. func1, !func2)')}
autocomplete="off"
/>
</div>
</div>
</div>
{#if type === 'mcp'}