Skip to content

Commit 98473e9

Browse files
huangzhuo1949huangzhuo
andauthored
fix:external dataset weight rerank bug (#24533)
Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com>
1 parent 13d3271 commit 98473e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

api/core/rag/rerank/weight_rerank.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,16 @@ def run(
3939
unique_documents = []
4040
doc_ids = set()
4141
for document in documents:
42-
if document.metadata is not None and document.metadata["doc_id"] not in doc_ids:
42+
if (
43+
document.provider == "dify"
44+
and document.metadata is not None
45+
and document.metadata["doc_id"] not in doc_ids
46+
):
4347
doc_ids.add(document.metadata["doc_id"])
4448
unique_documents.append(document)
49+
else:
50+
if document not in unique_documents:
51+
unique_documents.append(document)
4552

4653
documents = unique_documents
4754

0 commit comments

Comments
 (0)