Quellcode durchsuchen

fix:external dataset weight rerank bug (#24533)

Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com>
tags/1.8.0
huangzhuo1949 vor 2 Monaten
Ursprung
Commit
98473e9d4f
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden
1 geänderte Dateien mit 8 neuen und 1 gelöschten Zeilen
  1. 8
    1
      api/core/rag/rerank/weight_rerank.py

+ 8
- 1
api/core/rag/rerank/weight_rerank.py Datei anzeigen

@@ -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


Laden…
Abbrechen
Speichern