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: segments query missing idx hit (#1072)

takatost2191312bb947
diff --git a/api/core/tool/dataset_retriever_tool.py b/api/core/tool/dataset_retriever_tool.py
index ea63fd6be94..46deff497bf 100644
--- a/api/core/tool/dataset_retriever_tool.py
+++ b/api/core/tool/dataset_retriever_tool.py
@@ -98,7 +98,8 @@ class DatasetRetrieverTool(BaseTool):
hit_callback.on_tool_end(documents)
document_context_list = []
index_node_ids = [document.metadata['doc_id'] for document in documents]
- segments = DocumentSegment.query.filter(DocumentSegment.completed_at.isnot(None),
+ segments = DocumentSegment.query.filter(DocumentSegment.dataset_id == self.dataset_id,
+ DocumentSegment.completed_at.isnot(None),
DocumentSegment.status == 'completed',
DocumentSegment.enabled == True,
DocumentSegment.index_node_id.in_(index_node_ids)