Merge remote-tracking branch 'upstream/main' into dev

# Conflicts:
#	app/components/chat.tsx
#	app/components/home.tsx
#	app/components/settings.tsx
#	app/components/sidebar.tsx
#	app/config/server.ts
#	app/constant.ts
#	app/layout.tsx
#	app/store/access.ts
#	app/utils/model.ts
This commit is contained in:
sijinhui
2024-07-25 21:22:36 +08:00
35 changed files with 1789 additions and 190 deletions

View File

@@ -176,6 +176,19 @@ export class ClientApi {
}
}
export function getBearerToken(
apiKey: string,
noBearer: boolean = false,
): string {
return validString(apiKey)
? `${noBearer ? "" : "Bearer "}${apiKey.trim()}`
: "";
}
export function validString(x: string): boolean {
return x?.length > 0;
}
export function getHeaders() {
const accessStore = useAccessStore.getState();
const chatStore = useChatStore.getState();
@@ -222,15 +235,6 @@ export function getHeaders() {
return isAzure ? "api-key" : isAnthropic ? "x-api-key" : "Authorization";
}
function getBearerToken(apiKey: string, noBearer: boolean = false): string {
return validString(apiKey)
? `${noBearer ? "" : "Bearer "}${apiKey.trim()}`
: "";
}
function validString(x: string): boolean {
return x?.length > 0;
}
const {
isGoogle,
isAzure,