feat: Implement Vertex AI support for Anthropic and Google models

This commit is contained in:
ryanhex53
2024-11-09 23:11:53 +08:00
parent 108069a0c6
commit 5222c2b6a7
11 changed files with 399 additions and 17 deletions

View File

@@ -317,7 +317,14 @@ export function getHeaders(ignoreHeaders: boolean = false) {
if (bearerToken) {
headers[authHeader] = bearerToken;
} else if (isEnabledAccessControl && validString(accessStore.accessCode)) {
}
// ensure access code is being sent when access control is enabled,
// this will fix an issue where the access code is not being sent when provider is google, azure or anthropic
if (
isEnabledAccessControl &&
validString(accessStore.accessCode) &&
authHeader !== "Authorization"
) {
headers["Authorization"] = getBearerToken(
ACCESS_CODE_PREFIX + accessStore.accessCode,
);