Fix created_at handling in FAISS vector db
This commit is contained in:
@@ -107,7 +107,7 @@ class FaissVectorDBStorage(BaseVectorStorage):
|
|||||||
if not data:
|
if not data:
|
||||||
return
|
return
|
||||||
|
|
||||||
current_time = time.time()
|
current_time = int(time.time())
|
||||||
|
|
||||||
# Prepare data for embedding
|
# Prepare data for embedding
|
||||||
list_data = []
|
list_data = []
|
||||||
@@ -425,7 +425,7 @@ class FaissVectorDBStorage(BaseVectorStorage):
|
|||||||
if not metadata:
|
if not metadata:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return {**metadata, "id": metadata.get("__id__")}
|
return {**metadata, "id": metadata.get("__id__"), "created_at": metadata.get("__created_at__")}
|
||||||
|
|
||||||
async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]:
|
async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]:
|
||||||
"""Get multiple vector data by their IDs
|
"""Get multiple vector data by their IDs
|
||||||
@@ -445,7 +445,7 @@ class FaissVectorDBStorage(BaseVectorStorage):
|
|||||||
if fid is not None:
|
if fid is not None:
|
||||||
metadata = self._id_to_meta.get(fid, {})
|
metadata = self._id_to_meta.get(fid, {})
|
||||||
if metadata:
|
if metadata:
|
||||||
results.append({**metadata, "id": metadata.get("__id__")})
|
results.append({**metadata, "id": metadata.get("__id__"), "created_at": metadata.get("__created_at__")})
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user