This commit is contained in:
2026-04-24 01:23:56 +03:30
parent 5acee1fa2c
commit 31f4bf5d38
16 changed files with 518 additions and 192 deletions
+18 -9
View File
@@ -102,7 +102,7 @@ class QdrantVectorStore:
) -> list[dict]:
"""
جستجوی شباهت بر اساس query vector.
از query_points استفاده می‌کند (qdrant-client >= 2.0).
روی نسخه‌های جدید از query_points و روی نسخه‌های قدیمی‌تر از search استفاده می‌کند.
sensor_uuid: اجباری — فقط chunks مربوط به این سنسور یا __global__ برگردانده می‌شود.
kb_name: اختیاری — فیلتر بر اساس پایگاه دانش (chat/irrigation/fertilization).
اگر مشخص شود، فقط chunks همان KB و __all__ برگردانده می‌شود.
@@ -141,14 +141,23 @@ class QdrantVectorStore:
if must_conditions:
query_filter = qmodels.Filter(must=must_conditions)
response = self.client.query_points(
collection_name=self.qdrant.collection_name,
query=query_vector,
limit=limit,
score_threshold=score_threshold,
query_filter=query_filter,
)
points = getattr(response, "points", []) or []
if hasattr(self.client, "query_points"):
response = self.client.query_points(
collection_name=self.qdrant.collection_name,
query=query_vector,
limit=limit,
score_threshold=score_threshold,
query_filter=query_filter,
)
points = getattr(response, "points", []) or []
else:
points = self.client.search(
collection_name=self.qdrant.collection_name,
query_vector=query_vector,
limit=limit,
score_threshold=score_threshold,
query_filter=query_filter,
)
return [
{