hotfix
This commit is contained in:
parent
236736deea
commit
4fdd997108
|
@ -48,13 +48,14 @@ export const FunctionToolService = {
|
||||||
: plugin?.authType == "bearer"
|
: plugin?.authType == "bearer"
|
||||||
? ` Bearer ${plugin?.authToken}`
|
? ` Bearer ${plugin?.authToken}`
|
||||||
: plugin?.authToken;
|
: plugin?.authToken;
|
||||||
|
const authLocation = plugin?.authLocation || "header";
|
||||||
const definition = yaml.load(plugin.content) as any;
|
const definition = yaml.load(plugin.content) as any;
|
||||||
const serverURL = definition?.servers?.[0]?.url;
|
const serverURL = definition?.servers?.[0]?.url;
|
||||||
const baseURL = !!plugin?.usingProxy ? "/api/proxy" : serverURL;
|
const baseURL = !!plugin?.usingProxy ? "/api/proxy" : serverURL;
|
||||||
const headers: Record<string, string | undefined> = {
|
const headers: Record<string, string | undefined> = {
|
||||||
"X-Base-URL": !!plugin?.usingProxy ? serverURL : undefined,
|
"X-Base-URL": !!plugin?.usingProxy ? serverURL : undefined,
|
||||||
};
|
};
|
||||||
if (plugin?.authLocation == "header") {
|
if (authLocation == "header") {
|
||||||
headers[headerName] = tokenValue;
|
headers[headerName] = tokenValue;
|
||||||
}
|
}
|
||||||
const api = new OpenAPIClientAxios({
|
const api = new OpenAPIClientAxios({
|
||||||
|
@ -122,9 +123,9 @@ export const FunctionToolService = {
|
||||||
delete args[p?.name];
|
delete args[p?.name];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (plugin?.authLocation == "query") {
|
if (authLocation == "query") {
|
||||||
parameters[headerName] = tokenValue;
|
parameters[headerName] = tokenValue;
|
||||||
} else if (plugin?.authLocation == "body") {
|
} else if (authLocation == "body") {
|
||||||
args[headerName] = tokenValue;
|
args[headerName] = tokenValue;
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
Loading…
Reference in New Issue