Merge pull request #4989 from ConnectAI-E/hotfix/cf-ai-gateway

update custom bytedance models, and update labels in setting page
This commit is contained in:
LiuElric 2024-07-12 23:10:25 +08:00 committed by GitHub
commit 8e4d26163a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 9 deletions

View File

@ -1195,8 +1195,7 @@ export function Settings() {
<ListItem <ListItem
title={Locale.Settings.Access.Baidu.Endpoint.Title} title={Locale.Settings.Access.Baidu.Endpoint.Title}
subTitle={ subTitle={
Locale.Settings.Access.Anthropic.Endpoint.SubTitle + Locale.Settings.Access.Baidu.Endpoint.SubTitle
Baidu.ExampleEndpoint
} }
> >
<input <input

View File

@ -360,7 +360,7 @@ const cn = {
}, },
Endpoint: { Endpoint: {
Title: "接口地址", Title: "接口地址",
SubTitle: "样例:", SubTitle: "不支持自定义前往.env配置",
}, },
}, },
ByteDance: { ByteDance: {

View File

@ -326,7 +326,7 @@ const en: LocaleType = {
Endpoint: { Endpoint: {
Title: "Endpoint Address", Title: "Endpoint Address",
SubTitle: "Example:", SubTitle: "Example: ",
}, },
ApiVerion: { ApiVerion: {
@ -347,7 +347,7 @@ const en: LocaleType = {
}, },
Endpoint: { Endpoint: {
Title: "Endpoint Address", Title: "Endpoint Address",
SubTitle: "Example:", SubTitle: "not supported, configure in .env",
}, },
}, },
ByteDance: { ByteDance: {
@ -358,7 +358,7 @@ const en: LocaleType = {
}, },
Endpoint: { Endpoint: {
Title: "Endpoint Address", Title: "Endpoint Address",
SubTitle: "Example:", SubTitle: "Example: ",
}, },
}, },
Alibaba: { Alibaba: {
@ -369,7 +369,7 @@ const en: LocaleType = {
}, },
Endpoint: { Endpoint: {
Title: "Endpoint Address", Title: "Endpoint Address",
SubTitle: "Example:", SubTitle: "Example: ",
}, },
}, },
CustomModel: { CustomModel: {
@ -385,7 +385,7 @@ const en: LocaleType = {
Endpoint: { Endpoint: {
Title: "Endpoint Address", Title: "Endpoint Address",
SubTitle: "Example:", SubTitle: "Example: ",
}, },
ApiVersion: { ApiVersion: {

View File

@ -71,10 +71,14 @@ export function collectModelTable(
} }
// 2. if model not exists, create new model with available value // 2. if model not exists, create new model with available value
if (count === 0) { if (count === 0) {
const [customModelName, customProviderName] = name.split("@"); let [customModelName, customProviderName] = name.split("@");
const provider = customProvider( const provider = customProvider(
customProviderName || customModelName, customProviderName || customModelName,
); );
// swap name and displayName for bytedance
if (displayName && provider.providerName == "ByteDance") {
[customModelName, displayName] = [displayName, customModelName];
}
modelTable[`${customModelName}@${provider?.id}`] = { modelTable[`${customModelName}@${provider?.id}`] = {
name: customModelName, name: customModelName,
displayName: displayName || customModelName, displayName: displayName || customModelName,