mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 11:11:26 -03:00
feat(recipes): add Unknown base-model filter bucket for undetermined recipes
Normalize undetermined recipe base_model to None in RecipeFormatParser (previously ''). get_base_models now reports an "Unknown" bucket backed by a dedicated __unknown__ marker, and the listing filter matches it against recipes whose base model is falsy. Frontend renders the bucket label as "Unknown" while filtering via the marker. Tests: handler, scanner, parser, and frontend filtering.
This commit is contained in:
@@ -111,6 +111,36 @@ async def test_recipe_format_parser_populates_checkpoint(monkeypatch):
|
||||
assert result["model"] == checkpoint
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_recipe_format_parser_base_model_defaults_to_none_when_unknown(monkeypatch):
|
||||
class _FakeScanner:
|
||||
pass
|
||||
|
||||
# No checkpoint and empty base_model -> unknown renders as None (not "")
|
||||
result = await _parse(
|
||||
monkeypatch,
|
||||
{"title": "T", "base_model": "", "loras": [], "gen_params": {}},
|
||||
_FakeScanner(),
|
||||
)
|
||||
assert result["base_model"] is None
|
||||
|
||||
# Missing base_model key behaves the same
|
||||
result = await _parse(
|
||||
monkeypatch,
|
||||
{"title": "T", "loras": [], "gen_params": {}},
|
||||
_FakeScanner(),
|
||||
)
|
||||
assert result["base_model"] is None
|
||||
|
||||
# A real base_model in recipe metadata is kept
|
||||
result = await _parse(
|
||||
monkeypatch,
|
||||
{"title": "T", "base_model": "Illustrious", "loras": [], "gen_params": {}},
|
||||
_FakeScanner(),
|
||||
)
|
||||
assert result["base_model"] == "Illustrious"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_recipe_format_parser_marks_lora_in_library_by_version(monkeypatch):
|
||||
async def fake_metadata_provider():
|
||||
|
||||
Reference in New Issue
Block a user