mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 15:57:06 +08:00
Signed-off-by: yyh <yuanyouhuilyz@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: CodingOnStar <hanxujiang@dify.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Coding On Star <447357187@qq.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: statxc <tyleradams93226@gmail.com>
15 lines
493 B
TypeScript
15 lines
493 B
TypeScript
import type { ModelProvider } from './declarations'
|
|
import { IS_CLOUD_EDITION } from '@/config'
|
|
|
|
type CreditAwareProvider = Pick<ModelProvider, 'provider' | 'system_configuration'>
|
|
|
|
export const providerSupportsCredits = (
|
|
provider: CreditAwareProvider | undefined,
|
|
trialModels: readonly string[] | undefined,
|
|
): boolean => {
|
|
if (!IS_CLOUD_EDITION || !provider?.system_configuration.enabled)
|
|
return false
|
|
|
|
return !!provider.provider && !!trialModels?.includes(provider.provider)
|
|
}
|