fix: Fix database connection leak in EasyUIBasedGenerateTaskPipeline (#24815)

This commit is contained in:
耐小心
2025-09-01 14:48:56 +08:00
committed by GitHub
parent 1b401063e8
commit d5a521eef2

View File

@@ -472,9 +472,10 @@ class EasyUIBasedGenerateTaskPipeline(BasedGenerateTaskPipeline):
:param event: agent thought event :param event: agent thought event
:return: :return:
""" """
agent_thought: Optional[MessageAgentThought] = ( with Session(db.engine, expire_on_commit=False) as session:
db.session.query(MessageAgentThought).where(MessageAgentThought.id == event.agent_thought_id).first() agent_thought: Optional[MessageAgentThought] = (
) session.query(MessageAgentThought).where(MessageAgentThought.id == event.agent_thought_id).first()
)
if agent_thought: if agent_thought:
return AgentThoughtStreamResponse( return AgentThoughtStreamResponse(