diff --git a/api/services/account_service.py b/api/services/account_service.py index ad2a27f74f..47455615c0 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -188,15 +188,7 @@ class AccountService: email=email, name=name, interface_language=interface_language, password=password ) - # SELF_HOSTED Just create account, not create tenant - if dify_config.EDITION != "SELF_HOSTED": - TenantService.create_owner_tenant_if_not_exist(account=account) - else: - # SElF_HOST just have one tenant - tenant = Tenant.query.first() - TenantService.create_tenant_member(tenant, account, role="user") - account.current_tenant = tenant - db.session.commit() + TenantService.create_owner_tenant_if_not_exist(account=account) return account @@ -684,18 +676,12 @@ class RegisterService: if open_id is not None or provider is not None: AccountService.link_account_integrate(provider, open_id, account) - if dify_config.EDITION != "SELF_HOSTED": - if not dify_config.ALLOW_CREATE_WORKSPACE: - raise WorkSpaceNotAllowedCreateError() - tenant = TenantService.create_tenant(f"{account.name}'s Workspace") - TenantService.create_tenant_member(tenant, account, role="owner") - account.current_tenant = tenant - tenant_was_created.send(tenant) - else: - # SELF_HOSTED just have one tenant - tenant = Tenant.query.first() - TenantService.create_tenant_member(tenant, account, role="user") - account.current_tenant = tenant + if not dify_config.ALLOW_CREATE_WORKSPACE: + raise WorkSpaceNotAllowedCreateError() + tenant = TenantService.create_tenant(f"{account.name}'s Workspace") + TenantService.create_tenant_member(tenant, account, role="owner") + account.current_tenant = tenant + tenant_was_created.send(tenant) db.session.commit() except WorkSpaceNotAllowedCreateError: