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 SQL slow query (#2043)

Jyongadd33cb5e646
diff --git a/api/core/tool/dataset_multi_retriever_tool.py b/api/core/tool/dataset_multi_retriever_tool.py
index 97cf7c9dfa9..c9ca7eb04a5 100644
--- a/api/core/tool/dataset_multi_retriever_tool.py
+++ b/api/core/tool/dataset_multi_retriever_tool.py
@@ -94,6 +94,7 @@ class DatasetMultiRetrieverTool(BaseTool):
document_context_list = []
index_node_ids = [document.metadata['doc_id'] for document in all_documents]
segments = DocumentSegment.query.filter(
+ DocumentSegment.dataset_id.in_(self.dataset_ids),
DocumentSegment.completed_at.isnot(None),
DocumentSegment.status == 'completed',
DocumentSegment.enabled == True,