fix: gemini authentication error

This commit is contained in:
Hk-Gosuto
2023-12-30 11:36:45 +08:00
parent 2a9b36f626
commit 98b5ace66e
2 changed files with 8 additions and 6 deletions

View File

@@ -180,11 +180,7 @@ export function getHeaders(ignoreHeaders?: boolean) {
};
}
const isAzure = accessStore.provider === ServiceProvider.Azure;
const authHeader = isGoogle
? "x-goog-api-key"
: isAzure
? "api-key"
: "Authorization";
let authHeader = isAzure ? "api-key" : "Authorization";
const apiKey = isGoogle
? accessStore.googleApiKey
: isAzure
@@ -197,6 +193,7 @@ export function getHeaders(ignoreHeaders?: boolean) {
// use user's api key first
if (validString(apiKey)) {
authHeader = isGoogle ? "x-goog-api-key" : authHeader;
headers[authHeader] = makeBearer(apiKey);
} else if (
accessStore.enabledAccessControl() &&