Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models Marketplace bug fix for dev #1266

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)

Check warning on line 141 in superagi/controllers/models_controller.py

View check run for this annotation

Codecov / codecov/patch

superagi/controllers/models_controller.py#L139-L141

Added lines #L139 - L141 were not covered by tests

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