This commit is contained in:
Timothy Jaeryang Baek 2025-09-08 19:12:20 +04:00
parent 4cea3a57be
commit 30d1dc2c60
2 changed files with 24 additions and 2 deletions

View file

@ -354,8 +354,19 @@ export const getToolServersData = async (servers: object[]) => {
.filter((server) => server?.config?.enable) .filter((server) => server?.config?.enable)
.map(async (server) => { .map(async (server) => {
let error = null; let error = null;
let toolServerToken = null;
const auth_type = server?.auth_type ?? 'bearer';
if (auth_type === 'bearer') {
toolServerToken = server?.key;
} else if (auth_type === 'none') {
// No authentication
} else if (auth_type === 'session') {
toolServerToken = localStorage.token;
}
const data = await getToolServerData( const data = await getToolServerData(
(server?.auth_type ?? 'bearer') === 'bearer' ? server?.key : localStorage.token, toolServerToken,
(server?.path ?? '').includes('://') (server?.path ?? '').includes('://')
? server?.path ? server?.path
: `${server?.url}${(server?.path ?? '').startsWith('/') ? '' : '/'}${server?.path}` : `${server?.url}${(server?.path ?? '').startsWith('/') ? '' : '/'}${server?.path}`

View file

@ -222,8 +222,19 @@
if (toolServer) { if (toolServer) {
console.log(toolServer); console.log(toolServer);
let toolServerToken = null;
const auth_type = toolServer?.auth_type ?? 'bearer';
if (auth_type === 'bearer') {
toolServerToken = toolServer?.key;
} else if (auth_type === 'none') {
// No authentication
} else if (auth_type === 'session') {
toolServerToken = localStorage.token;
}
const res = await executeToolServer( const res = await executeToolServer(
(toolServer?.auth_type ?? 'bearer') === 'bearer' ? toolServer?.key : localStorage.token, toolServerToken,
toolServer.url, toolServer.url,
data?.name, data?.name,
data?.params, data?.params,