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: Fix database connection leak in EasyUIBasedGenerateTaskPipeline (#24815)

耐小心d5a521eef2b4
diff --git a/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py b/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py
index 471118c8cb1..e3b917067fc 100644
--- a/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py
+++ b/api/core/app/task_pipeline/easy_ui_based_generate_task_pipeline.py
@@ -472,9 +472,10 @@ class EasyUIBasedGenerateTaskPipeline(BasedGenerateTaskPipeline):
:param event: agent thought event
:return:
"""
- agent_thought: Optional[MessageAgentThought] = (
- db.session.query(MessageAgentThought).where(MessageAgentThought.id == event.agent_thought_id).first()
- )
+ with Session(db.engine, expire_on_commit=False) as session:
+ agent_thought: Optional[MessageAgentThought] = (
+ session.query(MessageAgentThought).where(MessageAgentThought.id == event.agent_thought_id).first()
+ )
if agent_thought:
return AgentThoughtStreamResponse(