M20: stabilize production acceptance
This commit is contained in:
@@ -53,15 +53,15 @@ def _deduplicate_sources(sources: list[SourceCard]) -> list[SourceCard]:
|
||||
|
||||
RAGcore document/version UUIDs change across uploads, so they are not useful
|
||||
deduplication keys. Human-visible citation identity is the normalized title,
|
||||
section and excerpt.
|
||||
section. Chunks from the same unsectioned document collapse into one card; distinct
|
||||
named sections remain independently citable.
|
||||
"""
|
||||
seen: set[tuple[str, str, str]] = set()
|
||||
seen: set[tuple[str, str]] = set()
|
||||
unique: list[SourceCard] = []
|
||||
for source in sources:
|
||||
key = (
|
||||
source.title.strip().casefold(),
|
||||
source.section.strip().casefold(),
|
||||
" ".join(source.excerpt.split()).casefold(),
|
||||
)
|
||||
if key in seen:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user