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: TenantAccountJoin has no attribute 'query' (#19445)

非法操作220db55e7166
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 2d391ea7c2f..eca706a3d24 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -108,12 +108,15 @@ class AccountService:
if account.status == AccountStatus.BANNED.value:
raise Unauthorized("Account is banned.")
- current_tenant = TenantAccountJoin.query.filter_by(account_id=account.id, current=True).first()
+ current_tenant = db.session.query(TenantAccountJoin).filter_by(account_id=account.id, current=True).first()
if current_tenant:
account.set_tenant_id(current_tenant.tenant_id)
else:
available_ta = (
- TenantAccountJoin.query.filter_by(account_id=account.id).order_by(TenantAccountJoin.id.asc()).first()
+ db.session.query(TenantAccountJoin)
+ .filter_by(account_id=account.id)
+ .order_by(TenantAccountJoin.id.asc())
+ .first()
)
if not available_ta:
return None