From 7cdd7b6ad76b588b976452cbb4d1a8f780b737d6 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 14 Nov 2023 08:00:21 +1100 Subject: [PATCH] feat(api): simplifiy `list_model_records` handler --- invokeai/app/api/routers/model_records.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/invokeai/app/api/routers/model_records.py b/invokeai/app/api/routers/model_records.py index 51a4481acb..1eb31ab772 100644 --- a/invokeai/app/api/routers/model_records.py +++ b/invokeai/app/api/routers/model_records.py @@ -42,15 +42,12 @@ async def list_model_records( """Get a list of models.""" record_store = ApiDependencies.invoker.services.model_records if base_models and len(base_models) > 0: - models_raw = [] + found_models: list[AnyModelConfig] = [] for base_model in base_models: - models_raw.extend( - [x.model_dump() for x in record_store.search_by_attr(base_model=base_model, model_type=model_type)] - ) + found_models.extend(record_store.search_by_attr(base_model=base_model, model_type=model_type)) else: - models_raw = [x.model_dump() for x in record_store.search_by_attr(model_type=model_type)] - models = ModelsListValidator.validate_python({"models": models_raw}) - return models + found_models = record_store.search_by_attr(model_type=model_type) + return ModelsList(models=found_models) @model_records_router.get(