mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +02:00
Fix duplicated docs for non-quoted docs
This commit is contained in:
@@ -61,11 +61,16 @@ def _process_documents(
|
|||||||
if not documents:
|
if not documents:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
top_documents = [
|
seen_docs_identifiers = set(already_displayed_doc_identifiers)
|
||||||
d
|
top_documents: list[SearchDoc] = []
|
||||||
for d in documents
|
for d in documents:
|
||||||
if d.semantic_identifier not in already_displayed_doc_identifiers
|
if d.semantic_identifier in seen_docs_identifiers:
|
||||||
][:_NUM_DOCS_TO_DISPLAY]
|
continue
|
||||||
|
seen_docs_identifiers.add(d.semantic_identifier)
|
||||||
|
top_documents.append(d)
|
||||||
|
if len(top_documents) >= _NUM_DOCS_TO_DISPLAY:
|
||||||
|
break
|
||||||
|
|
||||||
top_documents_str = "\n".join(
|
top_documents_str = "\n".join(
|
||||||
[f"- <{d.link}|{d.semantic_identifier}>" for d in top_documents]
|
[f"- <{d.link}|{d.semantic_identifier}>" for d in top_documents]
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user