add moonshot api

This commit is contained in:
lloydzhou
2024-08-01 11:55:22 +08:00
parent f5499ff699
commit 40cbabc330
7 changed files with 460 additions and 0 deletions

View File

@@ -39,6 +39,10 @@ const DEFAULT_ALIBABA_URL = isApp
? DEFAULT_API_HOST + "/api/proxy/alibaba"
: ApiPath.Alibaba;
const DEFAULT_MOONSHOT_URL = isApp
? DEFAULT_API_HOST + "/api/proxy/moonshot"
: ApiPath.Moonshot;
const DEFAULT_STABILITY_URL = isApp
? DEFAULT_API_HOST + "/api/proxy/stability"
: ApiPath.Stability;
@@ -82,6 +86,10 @@ const DEFAULT_ACCESS_STATE = {
alibabaUrl: DEFAULT_ALIBABA_URL,
alibabaApiKey: "",
// moonshot
moonshotUrl: DEFAULT_MOONSHOT_URL,
moonshotApiKey: "",
//stability
stabilityUrl: DEFAULT_STABILITY_URL,
stabilityApiKey: "",
@@ -134,6 +142,10 @@ export const useAccessStore = createPersistStore(
return ensure(get(), ["alibabaApiKey"]);
},
isValidMoonshot() {
return ensure(get(), ["moonshotApiKey"]);
},
isAuthorized() {
this.fetch();
@@ -146,6 +158,7 @@ export const useAccessStore = createPersistStore(
this.isValidBaidu() ||
this.isValidByteDance() ||
this.isValidAlibaba() ||
this.isValidMoonshot() ||
!this.enabledAccessControl() ||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
);