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) => {
let error = null;
const res = await fetch(`${url}/openapi.json`, {
const res = await fetch(`${url}`, {
method: 'GET',
headers: {
Accept: 'application/json',
@ -304,10 +304,13 @@ export const getToolServersData = async (i18n, servers: object[]) => {
servers
.filter((server) => server?.config?.enable)
.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(
i18n.t(`Failed to connect to {{URL}} OpenAPI tool server`, {
URL: server?.url
URL: server?.url + (server?.path ?? '/openapi.json')
})
);
return null;

View File

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