Skip to content

Commit

Permalink
Date changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarraann committed Jul 18, 2023
1 parent bc69d3e commit c553e25
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions superagi/controllers/vector_dbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion superagi/helper/time_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion superagi/models/vector_dbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c553e25

Please sign in to comment.