From c553e258375d2672f1cfc860410011ae11a0e404 Mon Sep 17 00:00:00 2001 From: Tarraann Date: Tue, 18 Jul 2023 18:02:30 +0530 Subject: [PATCH] Date changes --- superagi/controllers/vector_dbs.py | 8 +++++--- superagi/helper/time_helper.py | 2 +- superagi/models/vector_dbs.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/superagi/controllers/vector_dbs.py b/superagi/controllers/vector_dbs.py index c9f1601aa..abfb8b7c0 100644 --- a/superagi/controllers/vector_dbs.py +++ b/superagi/controllers/vector_dbs.py @@ -26,11 +26,13 @@ def get_marketplace_vectordb_list(): @router.get("/user/list") def get_user_connected_vector_db_list(organisation = Depends(get_user_organisation)): vector_db_list = Vectordbs.get_vector_db_from_organisation(db.session, organisation) + print(vector_db_list) if vector_db_list: for vector in vector_db_list: - update_time = str(vector.updated_at) - update_time = get_time_difference(update_time, datetime.now()) - vector_db_list["updated_at"] = update_time["years"] + update_time = get_time_difference(vector.updated_at, str(datetime.now())) + vector.updated_at = update_time["years"] + print("/////////////////////") + print(vector_db_list) return vector_db_list @router.get("/get/db/details/{vector_db_id}") diff --git a/superagi/helper/time_helper.py b/superagi/helper/time_helper.py index bc1b9f51d..ae6d222cc 100644 --- a/superagi/helper/time_helper.py +++ b/superagi/helper/time_helper.py @@ -6,7 +6,7 @@ def get_time_difference(timestamp1, timestamp2): # Parse the given timestamp parsed_timestamp1 = datetime.strptime(str(timestamp1), time_format) - parsed_timestamp2 = datetime.strptime(timestamp2, time_format) + parsed_timestamp2 = datetime.strptime(str(timestamp2), time_format) # Calculate the time difference time_difference = parsed_timestamp2 - parsed_timestamp1 diff --git a/superagi/models/vector_dbs.py b/superagi/models/vector_dbs.py index c753972a2..9f2b29fa8 100644 --- a/superagi/models/vector_dbs.py +++ b/superagi/models/vector_dbs.py @@ -32,7 +32,7 @@ def __repr__(self): Returns: str: String representation of the Vector db. """ - return f"Vector(id={self.id}, name='{self.name}', db_type='{self.db_type}' organisation_id={self.organisation_id}" + return f"Vector(id={self.id}, name='{self.name}', db_type='{self.db_type}' organisation_id={self.organisation_id}, updated_at={self.updated_at})" @classmethod def get_vector_db_from_id(cls, session, vector_db_id):