Skip to content

Commit

Permalink
Solved for time
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarraann committed Jul 18, 2023
1 parent 87060b7 commit 42fef8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion superagi/controllers/knowledges.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fastapi_sqlalchemy import db
from fastapi import HTTPException, Depends, Query, status
from fastapi import APIRouter
from datetime import datetime
from superagi.config.config import get_config
from superagi.helper.auth import get_user_organisation
from superagi.models.knowledges import Knowledges
Expand All @@ -12,6 +13,7 @@
from superagi.models.vector_db_configs import VectordbConfigs
from superagi.vector_store.vector_factory import VectorFactory
from superagi.vector_embeddings.vector_embedding_factory import VectorEmbeddingFactory
from superagi.helper.time_helper import get_time_difference

router = APIRouter()

Expand Down Expand Up @@ -71,6 +73,9 @@ def get_knowledge_details(knowledge_name: str):
# knowledge_config_data["use_cases"] = eval(knowledge_config_data["use_cases"])
knowledge_data_with_config = knowledge_data | knowledge_config_data
knowledge_data_with_config["install_number"] = MarketPlaceStats.get_knowledge_installation_number(knowledge_data_with_config["id"])
# knowledge_data_with_config["updated_at"] = '2023-07-18 08:06:52.803273'
# knowledge_data_with_config["updated_at"] = datetime.strptime(knowledge_data_with_config["updated_at"], "%Y-%m-%d %H:%M:%S.%f")
knowledge_data_with_config["updated_at"] = datetime.strftime(knowledge_data_with_config["updated_at"], '%d %B %Y')
return knowledge_data_with_config

@router.get("/marketplace/details/{knowledge_name}")
Expand Down Expand Up @@ -111,7 +116,7 @@ def delete_user_knowledge(knowledge_id: int):
Knowledges.delete_knowledge(db.session, knowledge_id)
return {"success": True}
except:
return f"No Knowledge found for {knowledge_id}."
return {"success": False}

@router.get("/install/{knowledge_name}/index/{vector_db_index_id}")
def install_selected_knowledge(knowledge_name: str, vector_db_index_id: int, organisation = Depends(get_user_organisation)):
Expand Down
4 changes: 4 additions & 0 deletions superagi/controllers/vector_dbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from fastapi import HTTPException, Depends
from fastapi import APIRouter
from superagi.config.config import get_config
from datetime import datetime
from superagi.helper.time_helper import get_current_time
from superagi.models.vector_dbs import Vectordbs
from superagi.helper.auth import get_user_organisation
from superagi.models.vector_db_configs import VectordbConfigs
Expand All @@ -24,6 +26,8 @@ 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)
# update_time = get_current_time(vector_db_list["updated_at"], datetime.now())
# vector_db_list["updated_at"] = update_time["years"]
return vector_db_list

@router.get("/get/db/details/{vector_db_id}")
Expand Down

0 comments on commit 42fef8a

Please sign in to comment.