From 8c7e9aceb28af35767846f978e49453a643bea19 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 1 May 2025 11:34:38 +0800 Subject: [PATCH] Fix time handle bugs for nano vector db --- lightrag/kg/nano_vector_db_impl.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lightrag/kg/nano_vector_db_impl.py b/lightrag/kg/nano_vector_db_impl.py index 589dd9ee..9ff44300 100644 --- a/lightrag/kg/nano_vector_db_impl.py +++ b/lightrag/kg/nano_vector_db_impl.py @@ -291,7 +291,12 @@ class NanoVectorDBStorage(BaseVectorStorage): client = await self._get_client() result = client.get([id]) if result: - return result[0] + dp = result[0] + return { + **dp, + "id": dp.get("__id__"), + "created_at": dp.get("__created_at__"), + } return None async def get_by_ids(self, ids: list[str]) -> list[dict[str, Any]]: @@ -307,7 +312,15 @@ class NanoVectorDBStorage(BaseVectorStorage): return [] client = await self._get_client() - return client.get(ids) + results = client.get(ids) + return [ + { + **dp, + "id": dp.get("__id__"), + "created_at": dp.get("__created_at__"), + } + for dp in results + ] async def drop(self) -> dict[str, str]: """Drop all vector data from storage and clean up resources