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: xxx is not bound to a Session (#24966)

Willb5216df4feff
diff --git a/api/core/app/apps/advanced_chat/app_generator.py b/api/core/app/apps/advanced_chat/app_generator.py
index 74e282fdcd5..561af7bacf3 100644
--- a/api/core/app/apps/advanced_chat/app_generator.py
+++ b/api/core/app/apps/advanced_chat/app_generator.py
@@ -453,7 +453,7 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator):
# release database connection, because the following new thread operations may take a long time
db.session.refresh(workflow)
db.session.refresh(message)
- db.session.refresh(user)
+ # db.session.refresh(user)
db.session.close()
# return response or stream generator
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 50ce171ded8..b12d4623bbf 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -145,7 +145,10 @@ class AccountService:
if naive_utc_now() - account.last_active_at > timedelta(minutes=10):
account.last_active_at = naive_utc_now()
db.session.commit()
-
+ # NOTE: make sure account is accessible outside of a db session
+ # This ensures that it will work correctly after upgrading to Flask version 3.1.2
+ db.session.refresh(account)
+ db.session.close()
return account
@staticmethod