Explorar el Código

hotfix: bytedance custom models

lloydzhou hace 1 año
padre
commit
46d3e7884b
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      app/utils/model.ts

+ 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,