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: Parent instance <DocumentSegment at 0x7955b5572c90> is not bound… (#29377)

wangxiaoleie205182e1f9c
diff --git a/api/core/rag/datasource/retrieval_service.py b/api/core/rag/datasource/retrieval_service.py
index cbd7cbeb644..e644e754ec9 100644
--- a/api/core/rag/datasource/retrieval_service.py
+++ b/api/core/rag/datasource/retrieval_service.py
@@ -483,7 +483,7 @@ class RetrievalService:
DocumentSegment.status == "completed",
DocumentSegment.id == segment_id,
)
- segment = db.session.scalar(document_segment_stmt)
+ segment = session.scalar(document_segment_stmt)
if segment:
segment_file_map[segment.id] = [attachment_info]
else:
@@ -496,7 +496,7 @@ class RetrievalService:
DocumentSegment.status == "completed",
DocumentSegment.index_node_id == index_node_id,
)
- segment = db.session.scalar(document_segment_stmt)
+ segment = session.scalar(document_segment_stmt)
if not segment:
continue