feat: add model type context to tag suggestions

- Pass modelType parameter to setupTagEditMode function
- Implement model type aware priority tag suggestions
- Add model type normalization and resolution logic
- Handle suggestion state reset when model type changes
- Maintain backward compatibility with existing functionality

The changes enable context-aware tag suggestions based on model type, improving tag relevance and user experience when editing tags for different model types.
This commit is contained in:
Will Miao
2025-10-11 20:36:38 +08:00
parent b0847f6b87
commit ec9b37eb53
6 changed files with 293 additions and 32 deletions

View File

@@ -66,7 +66,11 @@ export class BulkManager {
if (!container) {
return;
}
getPriorityTagSuggestions().then((tags) => {
const currentType = state.currentPageType;
if (!currentType || currentType === 'recipes') {
return;
}
getPriorityTagSuggestions(currentType).then((tags) => {
if (!container.isConnected) {
return;
}
@@ -619,17 +623,22 @@ export class BulkManager {
container.className = 'metadata-suggestions-container';
container.innerHTML = `<div class="metadata-suggestions-loading">${translate('settings.priorityTags.loadingSuggestions', 'Loading suggestions…')}</div>`;
getPriorityTagSuggestions().then((tags) => {
if (!container.isConnected) {
return;
}
this.renderBulkSuggestionItems(container, tags);
this.updateBulkSuggestionsDropdown();
}).catch(() => {
if (container.isConnected) {
container.innerHTML = '';
}
});
const currentType = state.currentPageType;
if (!currentType || currentType === 'recipes') {
container.innerHTML = '';
} else {
getPriorityTagSuggestions(currentType).then((tags) => {
if (!container.isConnected) {
return;
}
this.renderBulkSuggestionItems(container, tags);
this.updateBulkSuggestionsDropdown();
}).catch(() => {
if (container.isConnected) {
container.innerHTML = '';
}
});
}
dropdown.appendChild(container);
return dropdown;