Merge branch 'feat/education-api' into deploy/dev
This commit is contained in:
commit
37a0927689
@ -445,4 +445,7 @@ CREATE_TIDB_SERVICE_JOB_ENABLED=false
|
|||||||
# Maximum number of submitted thread count in a ThreadPool for parallel node execution
|
# Maximum number of submitted thread count in a ThreadPool for parallel node execution
|
||||||
MAX_SUBMIT_COUNT=100
|
MAX_SUBMIT_COUNT=100
|
||||||
# Lockout duration in seconds
|
# Lockout duration in seconds
|
||||||
LOGIN_LOCKOUT_DURATION=86400
|
LOGIN_LOCKOUT_DURATION=86400
|
||||||
|
|
||||||
|
# Education Identity
|
||||||
|
EDUCATION_ENABLED=false
|
@ -844,6 +844,11 @@ class AccountConfig(BaseSettings):
|
|||||||
default=5,
|
default=5,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
EDUCATION_ENABLED: bool = Field(
|
||||||
|
description="whether to enable education identity",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FeatureConfig(
|
class FeatureConfig(
|
||||||
# place the configs in alphabet order
|
# place the configs in alphabet order
|
||||||
|
@ -18,6 +18,11 @@ class BillingModel(BaseModel):
|
|||||||
subscription: SubscriptionModel = SubscriptionModel()
|
subscription: SubscriptionModel = SubscriptionModel()
|
||||||
|
|
||||||
|
|
||||||
|
class EducationModel(BaseModel):
|
||||||
|
enabled: bool = False
|
||||||
|
is_activated: bool = False
|
||||||
|
|
||||||
|
|
||||||
class LimitationModel(BaseModel):
|
class LimitationModel(BaseModel):
|
||||||
size: int = 0
|
size: int = 0
|
||||||
limit: int = 0
|
limit: int = 0
|
||||||
@ -39,6 +44,7 @@ class LicenseModel(BaseModel):
|
|||||||
|
|
||||||
class FeatureModel(BaseModel):
|
class FeatureModel(BaseModel):
|
||||||
billing: BillingModel = BillingModel()
|
billing: BillingModel = BillingModel()
|
||||||
|
education: EducationModel = EducationModel()
|
||||||
members: LimitationModel = LimitationModel(size=0, limit=1)
|
members: LimitationModel = LimitationModel(size=0, limit=1)
|
||||||
apps: LimitationModel = LimitationModel(size=0, limit=10)
|
apps: LimitationModel = LimitationModel(size=0, limit=10)
|
||||||
vector_space: LimitationModel = LimitationModel(size=0, limit=5)
|
vector_space: LimitationModel = LimitationModel(size=0, limit=5)
|
||||||
@ -129,6 +135,7 @@ class FeatureService:
|
|||||||
features.can_replace_logo = dify_config.CAN_REPLACE_LOGO
|
features.can_replace_logo = dify_config.CAN_REPLACE_LOGO
|
||||||
features.model_load_balancing_enabled = dify_config.MODEL_LB_ENABLED
|
features.model_load_balancing_enabled = dify_config.MODEL_LB_ENABLED
|
||||||
features.dataset_operator_enabled = dify_config.DATASET_OPERATOR_ENABLED
|
features.dataset_operator_enabled = dify_config.DATASET_OPERATOR_ENABLED
|
||||||
|
features.education.enabled = dify_config.EDUCATION_ENABLED
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _fulfill_params_from_billing_api(cls, features: FeatureModel, tenant_id: str):
|
def _fulfill_params_from_billing_api(cls, features: FeatureModel, tenant_id: str):
|
||||||
@ -137,7 +144,7 @@ class FeatureService:
|
|||||||
features.billing.enabled = billing_info["enabled"]
|
features.billing.enabled = billing_info["enabled"]
|
||||||
features.billing.subscription.plan = billing_info["subscription"]["plan"]
|
features.billing.subscription.plan = billing_info["subscription"]["plan"]
|
||||||
features.billing.subscription.interval = billing_info["subscription"]["interval"]
|
features.billing.subscription.interval = billing_info["subscription"]["interval"]
|
||||||
features.billing.subscription.education = billing_info["subscription"].get("education", False)
|
features.education.is_activated = billing_info["subscription"].get("education", False)
|
||||||
|
|
||||||
if "members" in billing_info:
|
if "members" in billing_info:
|
||||||
features.members.size = billing_info["members"]["size"]
|
features.members.size = billing_info["members"]["size"]
|
||||||
|
Loading…
Reference in New Issue
Block a user