|
|
|
|
@ -35,7 +35,6 @@ class LicenseModel(BaseModel):
|
|
|
|
|
status: LicenseStatus = LicenseStatus.NONE
|
|
|
|
|
expired_at: str = ""
|
|
|
|
|
product_id: str = ""
|
|
|
|
|
available_team_members: int = 0
|
|
|
|
|
available_workspaces: int = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -59,6 +58,7 @@ class FeatureModel(BaseModel):
|
|
|
|
|
model_load_balancing_enabled: bool = False
|
|
|
|
|
dataset_operator_enabled: bool = False
|
|
|
|
|
webapp_copyright_enabled: bool = False
|
|
|
|
|
available_team_members: int = 0
|
|
|
|
|
|
|
|
|
|
# pydantic configs
|
|
|
|
|
model_config = ConfigDict(protected_namespaces=())
|
|
|
|
|
@ -92,6 +92,7 @@ class FeatureService:
|
|
|
|
|
|
|
|
|
|
if dify_config.ENTERPRISE_ENABLED:
|
|
|
|
|
features.webapp_copyright_enabled = True
|
|
|
|
|
cls._fulfill_parms_from_license(features, tenant_id)
|
|
|
|
|
|
|
|
|
|
return features
|
|
|
|
|
|
|
|
|
|
@ -123,6 +124,11 @@ class FeatureService:
|
|
|
|
|
features.model_load_balancing_enabled = dify_config.MODEL_LB_ENABLED
|
|
|
|
|
features.dataset_operator_enabled = dify_config.DATASET_OPERATOR_ENABLED
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def _fulfill_parms_from_license(cls, features: FeatureModel, tenant_id: str):
|
|
|
|
|
license_info = EnterpriseService.get_info(tenant_id)["License"]
|
|
|
|
|
features.available_team_members = license_info["availableTeamMembers"]
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def _fulfill_params_from_billing_api(cls, features: FeatureModel, tenant_id: str):
|
|
|
|
|
billing_info = BillingService.get_info(tenant_id)
|
|
|
|
|
@ -209,8 +215,8 @@ class FeatureService:
|
|
|
|
|
if "productId" in license_info:
|
|
|
|
|
features.license.product_id = license_info["productId"]
|
|
|
|
|
|
|
|
|
|
if "availableTeamMembers" in license_info:
|
|
|
|
|
features.license.available_team_members = license_info["availableTeamMembers"]
|
|
|
|
|
# if "availableTeamMembers" in license_info:
|
|
|
|
|
# features.license.available_team_members = license_info["availableTeamMembers"]
|
|
|
|
|
|
|
|
|
|
if "availableWorkspaces" in license_info:
|
|
|
|
|
features.license.available_workspaces = license_info["availableWorkspaces"]
|
|
|
|
|
|