wip: doubao

This commit is contained in:
Dogtiti
2024-07-06 14:59:37 +08:00
parent 2d1f522aaf
commit 9b3b4494ba
10 changed files with 475 additions and 0 deletions

View File

@@ -47,6 +47,10 @@ const DEFAULT_ACCESS_STATE = {
anthropicApiVersion: "2023-06-01",
anthropicUrl: "",
// bytedance
bytedanceApiKey: "",
bytedanceUrl: "",
// server config
needCode: true,
hideUserApiKey: false,
@@ -83,6 +87,10 @@ export const useAccessStore = createPersistStore(
return ensure(get(), ["anthropicApiKey"]);
},
isValidByteDance() {
return ensure(get(), ["bytedanceApiKey"]);
},
isAuthorized() {
this.fetch();
@@ -92,6 +100,7 @@ export const useAccessStore = createPersistStore(
this.isValidAzure() ||
this.isValidGoogle() ||
this.isValidAnthropic() ||
this.isValidByteDance() ||
!this.enabledAccessControl() ||
(this.enabledAccessControl() && ensure(get(), ["accessCode"]))
);

View File

@@ -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.ByteDance) {
api = new ClientApi(ModelProvider.Doubao);
} 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.ByteDance) {
api = new ClientApi(ModelProvider.Doubao);
} else {
api = new ClientApi(ModelProvider.GPT);
}