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

# Conflicts:
#	app/client/api.ts
#	app/components/settings.tsx
#	app/constant.ts
#	src-tauri/tauri.conf.json
This commit is contained in:
sijinhui
2024-08-07 21:11:58 +08:00
18 changed files with 581 additions and 15 deletions

View File

@@ -51,6 +51,10 @@ const DEFAULT_STABILITY_URL = isApp
? DEFAULT_API_HOST + "/api/proxy/stability"
: ApiPath.Stability;
const DEFAULT_IFLYTEK_URL = isApp
? DEFAULT_API_HOST + "/api/proxy/iflytek"
: ApiPath.Iflytek;
const DEFAULT_ACCESS_STATE = {
accessCode: "",
useCustomConfig: false,
@@ -104,6 +108,11 @@ const DEFAULT_ACCESS_STATE = {
tencentSecretKey: "",
tencentSecretId: "",
// iflytek
iflytekUrl: DEFAULT_IFLYTEK_URL,
iflytekApiKey: "",
iflytekApiSecret: "",
// server config
needCode: true,
hideUserApiKey: false,
@@ -162,6 +171,9 @@ export const useAccessStore = createPersistStore(
isValidMoonshot() {
return ensure(get(), ["moonshotApiKey"]);
},
isValidIflytek() {
return ensure(get(), ["iflytekApiKey"]);
},
isAuthorized() {
this.fetch();
@@ -177,6 +189,7 @@ export const useAccessStore = createPersistStore(
this.isValidAlibaba() ||
this.isValidTencent ||
this.isValidMoonshot() ||
this.isValidIflytek() ||
!this.enabledAccessControl() ||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
);