Merge pull request #1030 from eldar702/fix/none-metadata-residual-guards

fix: guard None metadata/doc in tool_check_duplicate and Layer1/Layer2
This commit is contained in:
Igor Lins e Silva
2026-05-06 01:51:24 -03:00
committed by GitHub
4 changed files with 113 additions and 2 deletions
+4 -2
View File
@@ -742,8 +742,10 @@ def tool_check_duplicate(content: str, threshold: float = 0.9):
dist = results["distances"][0][i]
similarity = round(1 - dist, 3)
if similarity >= threshold:
meta = results["metadatas"][0][i]
doc = results["documents"][0][i]
# Chroma 1.5.x can return None for partially-flushed rows;
# coerce to empty sentinels so downstream .get() is safe.
meta = results["metadatas"][0][i] or {}
doc = results["documents"][0][i] or ""
duplicates.append(
{
"id": drawer_id,