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