feat: remove self-host

This commit is contained in:
Joe 2024-09-29 20:59:28 +08:00
parent cd88f27cd5
commit 067955c2b1

View File

@ -188,15 +188,7 @@ class AccountService:
email=email, name=name, interface_language=interface_language, password=password email=email, name=name, interface_language=interface_language, password=password
) )
# SELF_HOSTED Just create account, not create tenant TenantService.create_owner_tenant_if_not_exist(account=account)
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()
return account return account
@ -684,18 +676,12 @@ class RegisterService:
if open_id is not None or provider is not None: if open_id is not None or provider is not None:
AccountService.link_account_integrate(provider, open_id, account) AccountService.link_account_integrate(provider, open_id, account)
if dify_config.EDITION != "SELF_HOSTED": if not dify_config.ALLOW_CREATE_WORKSPACE:
if not dify_config.ALLOW_CREATE_WORKSPACE: raise WorkSpaceNotAllowedCreateError()
raise WorkSpaceNotAllowedCreateError() tenant = TenantService.create_tenant(f"{account.name}'s Workspace")
tenant = TenantService.create_tenant(f"{account.name}'s Workspace") TenantService.create_tenant_member(tenant, account, role="owner")
TenantService.create_tenant_member(tenant, account, role="owner") account.current_tenant = tenant
account.current_tenant = tenant tenant_was_created.send(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
db.session.commit() db.session.commit()
except WorkSpaceNotAllowedCreateError: except WorkSpaceNotAllowedCreateError: