mirror of
http://88.130.71.182:3000/BlitTech/contexta_be.git
synced 2026-06-13 08:45:24 +00:00
fixed bugs
This commit is contained in:
@@ -29,7 +29,6 @@ class VectorStoreService:
|
||||
self.client = get_qdrant_client()
|
||||
|
||||
def create_collection(self, collection_name: str) -> bool:
|
||||
"""Create a new collection for a chatbot"""
|
||||
try:
|
||||
self.client.create_collection(
|
||||
collection_name=collection_name,
|
||||
@@ -38,6 +37,12 @@ class VectorStoreService:
|
||||
distance=Distance.COSINE,
|
||||
),
|
||||
)
|
||||
# Create payload index for filtering/deleting by document_id
|
||||
self.client.create_payload_index(
|
||||
collection_name=collection_name,
|
||||
field_name="document_id",
|
||||
field_schema="keyword",
|
||||
)
|
||||
logger.info(f"Created collection: {collection_name}")
|
||||
return True
|
||||
except Exception as e:
|
||||
@@ -102,12 +107,12 @@ class VectorStoreService:
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""Search for similar vectors"""
|
||||
try:
|
||||
results = self.client.search(
|
||||
results = self.client.query_points(
|
||||
collection_name=collection_name,
|
||||
query_vector=query_vector,
|
||||
query=query_vector,
|
||||
limit=limit,
|
||||
score_threshold=score_threshold,
|
||||
)
|
||||
).points
|
||||
return [
|
||||
{
|
||||
"id": str(r.id),
|
||||
|
||||
Reference in New Issue
Block a user