fix(video): exclude dropdown separators from model resolution

The registry helpers filtered only the 'None' placeholder, so the eleven
LTX separator rows resolved as models and a POST naming one reached
load_model with a null repo. is_model() now covers both sentinel kinds.
This commit is contained in:
CalamitousFelicitousness
2026-08-14 01:14:27 +01:00
parent e72dee3fe1
commit c04fe7c9db
2 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -244,7 +244,7 @@ class APIVideo:
if engine is not None and family.lower() != engine.lower():
continue
for m in rows:
if m.name == 'None':
if not models_def.is_model(m):
continue
items.append(ItemVideoModel(
engine=family,
+9 -4
View File
@@ -738,23 +738,28 @@ except Exception as e:
log.error(f'Networks: type="video" {e}')
def is_model(row: Model) -> bool:
"""Rows that name a loadable model; the 'None' placeholder and the dropdown separators do not."""
return row.name != 'None' and not row.name.startswith('')
def engines() -> list[str]:
"""Engine families with at least one real model, sentinel rows excluded."""
return [engine for engine, rows in models.items() if any(row.name != 'None' for row in rows)]
return [engine for engine, rows in models.items() if any(is_model(row) for row in rows)]
def model_names(engine: str) -> list[str]:
"""Real model names for an engine, sentinel rows excluded."""
return [row.name for row in models.get(engine, []) if row.name != 'None']
return [row.name for row in models.get(engine, []) if is_model(row)]
def find(engine: str, name: str) -> Model | None:
"""Case-insensitive exact-name lookup; the 'None' sentinel rows are not models."""
"""Case-insensitive exact-name lookup; sentinel rows are not models."""
for family, rows in models.items():
if family.lower() != (engine or '').lower():
continue
for row in rows:
if row.name != 'None' and row.name.lower() == (name or '').lower():
if is_model(row) and row.name.lower() == (name or '').lower():
return row
return None