Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: update current tenant id of account when switching tenant (#2530)

Bowen Liang9ecc736c30bc
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 17999c9e25c..e35d325ae47 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -282,9 +282,9 @@ class TenantService:
else:
TenantAccountJoin.query.filter(TenantAccountJoin.account_id == account.id, TenantAccountJoin.tenant_id != tenant_id).update({'current': False})
tenant_account_join.current = True
- db.session.commit()
# Set the current tenant for the account
account.current_tenant_id = tenant_account_join.tenant_id
+ db.session.commit()
@staticmethod
def get_tenant_members(tenant: Tenant) -> list[Account]: