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: transaction not commit during long LLM calls (#1213)

takatost32d9b6181ce3
diff --git a/api/core/conversation_message_task.py b/api/core/conversation_message_task.py
index 6eefff76d22..49c9cba0828 100644
--- a/api/core/conversation_message_task.py
+++ b/api/core/conversation_message_task.py
@@ -112,7 +112,7 @@ class ConversationMessageTask:
)
db.session.add(self.conversation)
- db.session.flush()
+ db.session.commit()
self.message = Message(
app_id=self.app_model_config.app_id,
@@ -197,6 +197,7 @@ class ConversationMessageTask:
def on_chain_end(self, message_chain: MessageChain, chain_result: ChainResult):
message_chain.output = json.dumps(chain_result.completion)
+ db.session.commit()
self._pub_handler.pub_chain(message_chain)
@@ -262,6 +263,7 @@ class ConversationMessageTask:
)
db.session.add(dataset_query)
+ db.session.commit()
def on_dataset_query_finish(self, resource: List):
if resource and len(resource) > 0: