Selaa lähdekoodia

go: do not respect disabled zen models

Frank 4 kuukautta sitten
vanhempi
sitoutus
2d502d6ffe
1 muutettua tiedostoa jossa 5 lisäystä ja 4 poistoa
  1. 5 4
      packages/console/app/src/routes/zen/util/handler.ts

+ 5 - 4
packages/console/app/src/routes/zen/util/handler.ts

@@ -132,7 +132,7 @@ export async function handler(
         retry,
         stickyProvider,
       )
-      validateModelSettings(authInfo)
+      validateModelSettings(billingSource, authInfo)
       updateProviderKey(authInfo, providerInfo)
       logger.metric({ provider: providerInfo.id })
 
@@ -768,9 +768,10 @@ export async function handler(
     return "balance"
   }
 
-  function validateModelSettings(authInfo: AuthInfo) {
-    if (!authInfo) return
-    if (authInfo.isDisabled) throw new ModelError(t("zen.api.error.modelDisabled"))
+  function validateModelSettings(billingSource: BillingSource, authInfo: AuthInfo) {
+    if (billingSource === "lite") return
+    if (billingSource === "anonymous") return
+    if (authInfo!.isDisabled) throw new ModelError(t("zen.api.error.modelDisabled"))
   }
 
   function updateProviderKey(authInfo: AuthInfo, providerInfo: ProviderInfo) {