Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydzhou committed Sep 3, 2024
1 parent 236736d commit 4fdd997
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/store/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ export const FunctionToolService = {
: plugin?.authType == "bearer"
? ` Bearer ${plugin?.authToken}`
: plugin?.authToken;
const authLocation = plugin?.authLocation || "header";
const definition = yaml.load(plugin.content) as any;
const serverURL = definition?.servers?.[0]?.url;
const baseURL = !!plugin?.usingProxy ? "/api/proxy" : serverURL;
const headers: Record<string, string | undefined> = {
"X-Base-URL": !!plugin?.usingProxy ? serverURL : undefined,
};
if (plugin?.authLocation == "header") {
if (authLocation == "header") {
headers[headerName] = tokenValue;
}
const api = new OpenAPIClientAxios({
Expand Down Expand Up @@ -122,9 +123,9 @@ export const FunctionToolService = {
delete args[p?.name];
});
}
if (plugin?.authLocation == "query") {
if (authLocation == "query") {
parameters[headerName] = tokenValue;
} else if (plugin?.authLocation == "body") {
} else if (authLocation == "body") {
args[headerName] = tokenValue;
}
// @ts-ignore
Expand Down

0 comments on commit 4fdd997

Please sign in to comment.