Ver Fonte

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

update custom bytedance models, and update labels in setting page
LiuElric há 1 ano atrás
pai
commit
8e4d26163a
4 ficheiros alterados com 12 adições e 9 exclusões
  1. 1 2
      app/components/settings.tsx
  2. 1 1
      app/locales/cn.ts
  3. 5 5
      app/locales/en.ts
  4. 5 1
      app/utils/model.ts

+ 1 - 2
app/components/settings.tsx

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

+ 1 - 1
app/locales/cn.ts

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

+ 5 - 5
app/locales/en.ts

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

+ 5 - 1
app/utils/model.ts

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