feat: add support for iFLYTEK Spark API (接入讯飞星火模型)

This commit is contained in:
webws
2024-08-03 17:20:26 +08:00
committed by song
parent f900283b09
commit b2c1644d69
13 changed files with 556 additions and 1 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,
@@ -103,6 +107,11 @@ const DEFAULT_ACCESS_STATE = {
tencentSecretKey: "",
tencentSecretId: "",
// iflytek
iflytekUrl: DEFAULT_IFLYTEK_URL,
iflytekApiKey: "",
iflytekApiSecret: "",
// server config
needCode: true,
hideUserApiKey: false,
@@ -158,6 +167,9 @@ export const useAccessStore = createPersistStore(
isValidMoonshot() {
return ensure(get(), ["moonshotApiKey"]);
},
isValidIflytek() {
return ensure(get(), ["iflytekApiKey"]);
},
isAuthorized() {
this.fetch();
@@ -173,6 +185,7 @@ export const useAccessStore = createPersistStore(
this.isValidAlibaba() ||
this.isValidTencent ||
this.isValidMoonshot() ||
this.isValidIflytek() ||
!this.enabledAccessControl() ||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
);