mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 16:53:04 +08:00
feat: support baidu model
This commit is contained in:
@@ -47,6 +47,11 @@ const DEFAULT_ACCESS_STATE = {
|
||||
anthropicApiVersion: "2023-06-01",
|
||||
anthropicUrl: "",
|
||||
|
||||
// baidu
|
||||
baiduUrl: "",
|
||||
baiduApiKey: "",
|
||||
baiduSecretKey: "",
|
||||
|
||||
// server config
|
||||
needCode: true,
|
||||
hideUserApiKey: false,
|
||||
@@ -83,6 +88,10 @@ export const useAccessStore = createPersistStore(
|
||||
return ensure(get(), ["anthropicApiKey"]);
|
||||
},
|
||||
|
||||
isValidBaidu() {
|
||||
return ensure(get(), ["baiduApiKey", "baiduSecretKey"]);
|
||||
},
|
||||
|
||||
isAuthorized() {
|
||||
this.fetch();
|
||||
|
||||
@@ -92,6 +101,7 @@ export const useAccessStore = createPersistStore(
|
||||
this.isValidAzure() ||
|
||||
this.isValidGoogle() ||
|
||||
this.isValidAnthropic() ||
|
||||
this.isValidBaidu() ||
|
||||
!this.enabledAccessControl() ||
|
||||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
|
||||
);
|
||||
|
@@ -368,6 +368,8 @@ export const useChatStore = createPersistStore(
|
||||
api = new ClientApi(ModelProvider.GeminiPro);
|
||||
} else if (modelConfig.providerName == ServiceProvider.Anthropic) {
|
||||
api = new ClientApi(ModelProvider.Claude);
|
||||
} else if (modelConfig.providerName == ServiceProvider.Baidu) {
|
||||
api = new ClientApi(ModelProvider.Ernie);
|
||||
} else {
|
||||
api = new ClientApi(ModelProvider.GPT);
|
||||
}
|
||||
@@ -552,6 +554,8 @@ export const useChatStore = createPersistStore(
|
||||
api = new ClientApi(ModelProvider.GeminiPro);
|
||||
} else if (modelConfig.providerName == ServiceProvider.Anthropic) {
|
||||
api = new ClientApi(ModelProvider.Claude);
|
||||
} else if (modelConfig.providerName == ServiceProvider.Baidu) {
|
||||
api = new ClientApi(ModelProvider.Ernie);
|
||||
} else {
|
||||
api = new ClientApi(ModelProvider.GPT);
|
||||
}
|
||||
|
Reference in New Issue
Block a user