diff --git a/superagi/controllers/models_controller.py b/superagi/controllers/models_controller.py index f3704d05c..2521f9abd 100644 --- a/superagi/controllers/models_controller.py +++ b/superagi/controllers/models_controller.py @@ -131,8 +131,16 @@ def get_marketplace_models_list(page: int = 0): query = db.session.query(Models).filter(Models.org_id == organisation_id) if page < 0: models = query.all() - models = query.offset(page * page_size).limit(page_size).all() - return models + else: + models = query.offset(page * page_size).limit(page_size).all() + + models_list = [] + for model in models: + model_dict = model.__dict__ + model_dict["provider"] = db.session.query(ModelsConfig).filter(ModelsConfig.id == model.model_provider_id).first().provider + models_list.append(model_dict) + + return models_list @router.get("/get/models_details", status_code=200) diff --git a/superagi/models/models.py b/superagi/models/models.py index ccd5cdcf5..5a58b74d6 100644 --- a/superagi/models/models.py +++ b/superagi/models/models.py @@ -79,8 +79,6 @@ def get_model_install_details(cls, session, marketplace_models, organisation_id, else: model["is_installed"] = installed_models_dict.get(model["model_name"], False) model["installs"] = model_counts_dict.get(model["model_name"], 0) - model["provider"] = session.query(ModelsConfig).filter( - ModelsConfig.id == model["model_provider_id"]).first().provider except TypeError as e: logging.error("Error Occurred: %s", e)