enh: openapi tool server custom path

This commit is contained in:
Timothy Jaeryang Baek 2025-04-04 08:31:13 -06:00
parent a32bb850fa
commit 77fa11098a
2 changed files with 7 additions and 4 deletions

View File

@ -262,7 +262,7 @@ export const stopTask = async (token: string, id: string) => {
export const getToolServerData = async (token: string, url: string) => { export const getToolServerData = async (token: string, url: string) => {
let error = null; let error = null;
const res = await fetch(`${url}/openapi.json`, { const res = await fetch(`${url}`, {
method: 'GET', method: 'GET',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
@ -304,10 +304,13 @@ export const getToolServersData = async (i18n, servers: object[]) => {
servers servers
.filter((server) => server?.config?.enable) .filter((server) => server?.config?.enable)
.map(async (server) => { .map(async (server) => {
const data = await getToolServerData(server?.key, server?.url).catch((err) => { const data = await getToolServerData(
server?.key,
server?.url + (server?.path ?? '/openapi.json')
).catch((err) => {
toast.error( toast.error(
i18n.t(`Failed to connect to {{URL}} OpenAPI tool server`, { i18n.t(`Failed to connect to {{URL}} OpenAPI tool server`, {
URL: server?.url URL: server?.url + (server?.path ?? '/openapi.json')
}) })
); );
return null; return null;

View File

@ -56,8 +56,8 @@
show = false; show = false;
url = ''; url = '';
key = '';
path = '/openapi.json'; path = '/openapi.json';
key = '';
auth_type = 'bearer'; auth_type = 'bearer';
enable = true; enable = true;