Skip to content

Commit

Permalink
Models Marketplace bug fix for main (#1267)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedan2506 authored Sep 20, 2023
1 parent 3d45d32 commit e153500
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 10 additions & 2 deletions superagi/controllers/models_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,16 @@ def get_marketplace_knowledge_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)
Expand Down
2 changes: 0 additions & 2 deletions superagi/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit e153500

Please sign in to comment.