elksmmx 12 часов назад
Родитель
Сommit
7fc9728856
2 измененных файлов с 3 добавлено и 0 удалено
  1. 2 0
      knowhub/server.py
  2. 1 0
      knowhub/vector_store.py

+ 2 - 0
knowhub/server.py

@@ -474,6 +474,8 @@ class KnowledgeProcessor:
                 limit=10
             )
             candidates = [c for c in candidates if c["id"] != kid]
+            # 只保留相似度 >= 0.75 的候选,低于阈值的 task 语义差异太大,直接视为 none
+            candidates = [c for c in candidates if c.get("score", 0) >= 0.75]
 
             if not candidates:
                 milvus_store.update(kid, {"status": "approved", "updated_at": now})

+ 1 - 0
knowhub/vector_store.py

@@ -198,6 +198,7 @@ class MilvusStore:
                 "updated_at": hit.entity.get("updated_at") * 1000 if hit.entity.get("updated_at") else None,
                 "status": hit.entity.get("status", "approved"),
                 "relationships": json.loads(hit.entity.get("relationships") or "[]"),
+                "score": hit.score,
             }
             for hit in results[0]
         ]