feat(ui): merge user tags into auto-tag badges and refresh on tag edit (#918)

- Layer 2 fallback: user tags overlapping with auto-tag categories
  (HIGH/LOW/I2V/T2V/TI2V/Lightning/Turbo) are merged into auto_tags,
  providing manual override when filename-based detection fails.
  Matching is case-insensitive so "high"/"High"/"HIGH" all work.
- Refresh on tag edit: save_metadata and add_tags handlers now return
  recalculated auto_tags in the response; the frontend passes them to
  VirtualScroller.updateSingleItem so badges update immediately without
  requiring a page reload.
- 8 new test cases for Layer 2 fallback and case-insensitive matching.
This commit is contained in:
Will Miao
2026-05-20 22:48:44 +08:00
parent 9ce56dd40c
commit 78303b2a5e
7 changed files with 150 additions and 39 deletions

View File

@@ -255,7 +255,7 @@ def test_tag_update_service_adds_unique_tags(tmp_path: Path) -> None:
cache_updates.append(metadata)
return True
tags = asyncio.run(
tags, auto_tags = asyncio.run(
service.add_tags(
file_path=str(tmp_path / "model.safetensors"),
new_tags=["new", "existing"],
@@ -265,5 +265,6 @@ def test_tag_update_service_adds_unique_tags(tmp_path: Path) -> None:
)
assert tags == ["existing", "new"]
assert auto_tags == []
assert manager.saved
assert cache_updates