go: do not respect disabled zen models
This commit is contained in:
@@ -132,7 +132,7 @@ export async function handler(
|
|||||||
retry,
|
retry,
|
||||||
stickyProvider,
|
stickyProvider,
|
||||||
)
|
)
|
||||||
validateModelSettings(authInfo)
|
validateModelSettings(billingSource, authInfo)
|
||||||
updateProviderKey(authInfo, providerInfo)
|
updateProviderKey(authInfo, providerInfo)
|
||||||
logger.metric({ provider: providerInfo.id })
|
logger.metric({ provider: providerInfo.id })
|
||||||
|
|
||||||
@@ -768,9 +768,10 @@ export async function handler(
|
|||||||
return "balance"
|
return "balance"
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateModelSettings(authInfo: AuthInfo) {
|
function validateModelSettings(billingSource: BillingSource, authInfo: AuthInfo) {
|
||||||
if (!authInfo) return
|
if (billingSource === "lite") return
|
||||||
if (authInfo.isDisabled) throw new ModelError(t("zen.api.error.modelDisabled"))
|
if (billingSource === "anonymous") return
|
||||||
|
if (authInfo!.isDisabled) throw new ModelError(t("zen.api.error.modelDisabled"))
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateProviderKey(authInfo: AuthInfo, providerInfo: ProviderInfo) {
|
function updateProviderKey(authInfo: AuthInfo, providerInfo: ProviderInfo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user