Skip to content

Commit 0e12c44

Browse files
feat(models): expand and rationalize model catalog (#45)
1 parent f640565 commit 0e12c44

15 files changed

Lines changed: 1148 additions & 167 deletions

app/admin_queries.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,20 @@ def collect_entries(self) -> list[schemas.AdminModelEntry]:
175175
catalog_entries = [
176176
self.build_entry(model) for model in self.ctx.manager.catalog if self.is_visible(model)
177177
]
178+
catalog_ids = {entry.id for entry in catalog_entries}
179+
retired_entries = [
180+
self.build_entry(model)
181+
for installed in self.ctx.manager.installed()
182+
if installed.retired
183+
and installed.id not in catalog_ids
184+
and (model := self.ctx.manager.catalog_model(installed.id)) is not None
185+
]
178186
custom_entries = [
179187
self.build_custom_entry(custom)
180188
for custom in self.ctx.manager.installed()
181189
if custom.id.startswith("custom:")
182190
]
183-
return catalog_entries + custom_entries
191+
return catalog_entries + retired_entries + custom_entries
184192

185193
def is_visible(self, model: Any) -> bool:
186194
if self.system.is_apple_silicon:
@@ -216,6 +224,9 @@ def build_entry(self, model: Any) -> schemas.AdminModelEntry:
216224
downloaded_bytes=download.downloaded_bytes if download else None,
217225
total_bytes=download.total_bytes if download else None,
218226
error=resolution[2],
227+
retired=model.retired,
228+
replacement_id=model.replacement_id,
229+
retirement_reason=model.retirement_reason,
219230
)
220231

221232
def build_custom_entry(self, custom: Any) -> schemas.AdminModelEntry:

0 commit comments

Comments
 (0)