feat: dev done

This commit is contained in:
butterfly
2024-04-07 11:32:57 +08:00
19 changed files with 1031 additions and 32 deletions

View File

@@ -36,6 +36,11 @@ const DEFAULT_ACCESS_STATE = {
googleApiKey: "",
googleApiVersion: "v1",
// anthropic
anthropicApiKey: "",
anthropicApiVersion: "2023-06-01",
anthropicUrl: "",
// server config
needCode: true,
hideUserApiKey: false,
@@ -67,6 +72,10 @@ export const useAccessStore = createPersistStore(
return ensure(get(), ["googleApiKey"]);
},
isValidAnthropic() {
return ensure(get(), ["anthropicApiKey"]);
},
isAuthorized() {
this.fetch();
@@ -75,6 +84,7 @@ export const useAccessStore = createPersistStore(
this.isValidOpenAI() ||
this.isValidAzure() ||
this.isValidGoogle() ||
this.isValidAnthropic() ||
!this.enabledAccessControl() ||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
);