New provider PPIO support

This commit is contained in:
saikidev
2025-02-13 16:41:54 +08:00
parent 12863f5213
commit c0826d2275
14 changed files with 567 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import {
XAI_BASE_URL,
CHATGLM_BASE_URL,
SILICONFLOW_BASE_URL,
PPIO_BASE_URL,
} from "../constant";
import { getHeaders } from "../client/api";
import { getClientConfig } from "../config/client";
@@ -59,6 +60,8 @@ const DEFAULT_SILICONFLOW_URL = isApp
? SILICONFLOW_BASE_URL
: ApiPath.SiliconFlow;
const DEFAULT_PPIO_URL = isApp ? PPIO_BASE_URL : ApiPath.PPIO;
const DEFAULT_ACCESS_STATE = {
accessCode: "",
useCustomConfig: false,
@@ -132,6 +135,10 @@ const DEFAULT_ACCESS_STATE = {
siliconflowUrl: DEFAULT_SILICONFLOW_URL,
siliconflowApiKey: "",
// ppio
ppioUrl: DEFAULT_PPIO_URL,
ppioApiKey: "",
// server config
needCode: true,
hideUserApiKey: false,
@@ -219,6 +226,10 @@ export const useAccessStore = createPersistStore(
return ensure(get(), ["siliconflowApiKey"]);
},
isValidPPIO() {
return ensure(get(), ["ppioApiKey"]);
},
isAuthorized() {
this.fetch();
@@ -238,6 +249,7 @@ export const useAccessStore = createPersistStore(
this.isValidXAI() ||
this.isValidChatGLM() ||
this.isValidSiliconFlow() ||
this.isValidPPIO() ||
!this.enabledAccessControl() ||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
);