Models are listed with their titles
This commit is contained in:
+9
-2
@@ -10,6 +10,7 @@ from fastapi.responses import Response
|
||||
from pydantic import BaseModel
|
||||
|
||||
from core.domains import Domain
|
||||
from core.models import title
|
||||
from persistance import registry
|
||||
from webapi.runs import dagster
|
||||
|
||||
@@ -25,10 +26,16 @@ class Version(BaseModel):
|
||||
reports: list[str]
|
||||
|
||||
|
||||
class Model(BaseModel):
|
||||
name: str
|
||||
title: str # as the pages name it
|
||||
|
||||
|
||||
@router.get("/{domain}")
|
||||
def models(domain: Domain) -> list[str]:
|
||||
def models(domain: Domain) -> list[Model]:
|
||||
"""The domain's registered models, with their names on screen."""
|
||||
prefix = f"{domain.value}."
|
||||
return [n.removeprefix(prefix) for n in registry.names(prefix)]
|
||||
return [Model(name=n.removeprefix(prefix), title=title(n)) for n in registry.names(prefix)]
|
||||
|
||||
|
||||
@router.get("/{domain}/{name}/versions")
|
||||
|
||||
Reference in New Issue
Block a user