mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 11:56:55 +08:00
add credit next_credit_reset_date
This commit is contained in:
parent
09998612e7
commit
c0ed353c10
@ -131,6 +131,7 @@ class FeatureModel(BaseModel):
|
|||||||
# pydantic configs
|
# pydantic configs
|
||||||
model_config = ConfigDict(protected_namespaces=())
|
model_config = ConfigDict(protected_namespaces=())
|
||||||
knowledge_pipeline: KnowledgePipeline = KnowledgePipeline()
|
knowledge_pipeline: KnowledgePipeline = KnowledgePipeline()
|
||||||
|
next_credit_reset_date: int = 0
|
||||||
|
|
||||||
|
|
||||||
class KnowledgeRateLimitModel(BaseModel):
|
class KnowledgeRateLimitModel(BaseModel):
|
||||||
@ -278,6 +279,9 @@ class FeatureService:
|
|||||||
|
|
||||||
if "knowledge_pipeline_publish_enabled" in billing_info:
|
if "knowledge_pipeline_publish_enabled" in billing_info:
|
||||||
features.knowledge_pipeline.publish_enabled = billing_info["knowledge_pipeline_publish_enabled"]
|
features.knowledge_pipeline.publish_enabled = billing_info["knowledge_pipeline_publish_enabled"]
|
||||||
|
|
||||||
|
if "next_credit_reset_date" in billing_info:
|
||||||
|
features.next_credit_reset_date = billing_info["next_credit_reset_date"]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _fulfill_params_from_enterprise(cls, features: SystemFeatureModel):
|
def _fulfill_params_from_enterprise(cls, features: SystemFeatureModel):
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
from dify.api.configs import feature
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
@ -31,7 +32,8 @@ class WorkspaceService:
|
|||||||
assert tenant_account_join is not None, "TenantAccountJoin not found"
|
assert tenant_account_join is not None, "TenantAccountJoin not found"
|
||||||
tenant_info["role"] = tenant_account_join.role
|
tenant_info["role"] = tenant_account_join.role
|
||||||
|
|
||||||
can_replace_logo = FeatureService.get_features(tenant.id).can_replace_logo
|
feature = FeatureService.get_features(tenant.id)
|
||||||
|
can_replace_logo = feature.can_replace_logo
|
||||||
|
|
||||||
if can_replace_logo and TenantService.has_roles(tenant, [TenantAccountRole.OWNER, TenantAccountRole.ADMIN]):
|
if can_replace_logo and TenantService.has_roles(tenant, [TenantAccountRole.OWNER, TenantAccountRole.ADMIN]):
|
||||||
base_url = dify_config.FILES_URL
|
base_url = dify_config.FILES_URL
|
||||||
@ -47,6 +49,9 @@ class WorkspaceService:
|
|||||||
"replace_webapp_logo": replace_webapp_logo,
|
"replace_webapp_logo": replace_webapp_logo,
|
||||||
}
|
}
|
||||||
if dify_config.EDITION == "CLOUD":
|
if dify_config.EDITION == "CLOUD":
|
||||||
|
|
||||||
|
tenant_info["next_credit_reset_date"] = feature.next_credit_reset_date
|
||||||
|
|
||||||
from services.credit_pool_service import CreditPoolService
|
from services.credit_pool_service import CreditPoolService
|
||||||
|
|
||||||
paid_pool = CreditPoolService.get_pool(tenant_id=tenant.id, pool_type="paid")
|
paid_pool = CreditPoolService.get_pool(tenant_id=tenant.id, pool_type="paid")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user