feat: add claude and bard

This commit is contained in:
Yidadaa
2023-11-07 23:22:11 +08:00
parent 5610f423d0
commit cdf0311d27
20 changed files with 580 additions and 394 deletions

View File

@@ -6,23 +6,22 @@ export function bearer(value: string) {
return `Bearer ${value.trim()}`;
}
export function getAuthHeaders(apiKey = "") {
export function getAuthKey(apiKey = "") {
const accessStore = useAccessStore.getState();
const isApp = !!getClientConfig()?.isApp;
let headers: Record<string, string> = {};
let authKey = "";
if (apiKey) {
// use user's api key first
headers.Authorization = bearer(apiKey);
authKey = bearer(apiKey);
} else if (
accessStore.enabledAccessControl() &&
!isApp &&
!!accessStore.accessCode
) {
// or use access code
headers.Authorization = bearer(ACCESS_CODE_PREFIX + accessStore.accessCode);
authKey = bearer(ACCESS_CODE_PREFIX + accessStore.accessCode);
}
return headers;
return authKey;
}

View File

@@ -1,5 +0,0 @@
export const COMMON_PROVIDER_CONFIG = {
customModels: "",
models: [] as string[],
autoFetchModels: false, // fetch available models from server or not
};