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:external dataset weight rerank bug (#24533)

huangzhuo194998473e9d4f29
diff --git a/api/core/rag/rerank/weight_rerank.py b/api/core/rag/rerank/weight_rerank.py
index cbc96037bf2..80de746e297 100644
--- a/api/core/rag/rerank/weight_rerank.py
+++ b/api/core/rag/rerank/weight_rerank.py
@@ -39,9 +39,16 @@ class WeightRerankRunner(BaseRerankRunner):
unique_documents = []
doc_ids = set()
for document in documents:
- if document.metadata is not None and document.metadata["doc_id"] not in doc_ids:
+ if (
+ document.provider == "dify"
+ and document.metadata is not None
+ and document.metadata["doc_id"] not in doc_ids
+ ):
doc_ids.add(document.metadata["doc_id"])
unique_documents.append(document)
+ else:
+ if document not in unique_documents:
+ unique_documents.append(document)
documents = unique_documents