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

@@ -422,8 +422,12 @@ export class BaseModelApiClient {
throw new Error('Failed to save metadata');
}
state.virtualScroller.updateSingleItem(filePath, data);
return response.json();
const result = await response.json();
state.virtualScroller.updateSingleItem(filePath, {
...data,
auto_tags: result.auto_tags,
});
return result;
} finally {
state.loadingManager.hide();
}
@@ -448,7 +452,10 @@ export class BaseModelApiClient {
const result = await response.json();
if (result.success && result.tags) {
state.virtualScroller.updateSingleItem(filePath, { tags: result.tags });
state.virtualScroller.updateSingleItem(filePath, {
tags: result.tags,
auto_tags: result.auto_tags,
});
}
return result;