feat(settings): empty filename template reverts to recorded original filename (#1071)

Redefine the empty download filename template from a no-op to a bulk
revert: FilenameTemplateUseCase resolves the target from each model's
recorded original_file_name sidecar entry (skipping models without one),
which resolves follow-ups 1 and 2 with a single coherent semantic shared
by the download and bulk-apply paths.

Also replace the browser-native confirm() with a self-managed
confirmation modal (filenameTemplateConfirmModal) that stacks above the
settings modal, since ModalManager would close the settings modal when
opening a registered one.
This commit is contained in:
Will Miao
2026-09-19 10:44:43 +08:00
parent 78d38b449e
commit 474da1b264
17 changed files with 388 additions and 110 deletions
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "Möchten Sie in Etappen prüfen? Wechseln Sie in den Massenmodus, wählen Sie die benötigten Modelle aus und nutzen Sie anschließend \"Auswahl auf Updates prüfen\".",
"action": "Alles prüfen"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "Tags zu mehreren Modellen hinzufügen",
"description": "Tags hinzufügen zu",
+9 -4
View File
@@ -683,15 +683,15 @@
},
"filenameTemplates": {
"title": "Filename Templates",
"help": "Configure filenames for downloaded models per model type. Leave empty to keep the original filename. The original filename is always preserved in the model's metadata.",
"help": "Configure filenames for downloaded models per model type. Leave empty to keep original filenames on download; applying an empty template restores the recorded original filenames of previously renamed models. The original filename is always preserved in the model's metadata.",
"availablePlaceholders": "Available placeholders:",
"templatePlaceholder": "Enter filename template (e.g., {base_model}-{model_name}-{version_name})",
"applyButton": "Apply to Library Now",
"applyHelp": "Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"applyHelp": "Renames all existing files of this model type according to the template; with an empty template, restores the recorded original filenames instead. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "Valid (keep original filename)",
"restoreOriginal": "Valid (empty template restores original filenames)",
"invalidChars": "Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "Invalid placeholder: {placeholder}",
"validTemplate": "Valid template"
@@ -1626,6 +1626,11 @@
"tip": "To work in smaller batches, switch to bulk mode, choose the ones you need, then use \"Check Updates for Selected\".",
"action": "Check All"
},
"filenameTemplateConfirm": {
"titleApply": "Apply filename template to library?",
"titleRevert": "Restore original filenames?",
"revertButton": "Restore Original Filenames"
},
"bulkAddTags": {
"title": "Add Tags to Multiple Models",
"description": "Add tags to",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "¿Quieres hacerlo por partes? Activa el modo por lotes, selecciona los modelos que necesites y usa \"Comprobar actualizaciones para la selección\".",
"action": "Comprobar todo"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "Añadir etiquetas a múltiples modelos",
"description": "Añadir etiquetas a",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "Besoin de procéder par étapes ? Passez en mode groupé, sélectionnez les modèles souhaités puis utilisez \"Vérifier les mises à jour pour la sélection\".",
"action": "Tout vérifier"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "Ajouter des tags à plusieurs modèles",
"description": "Ajouter des tags à",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "רוצים לחלק למנות קטנות? עברו למצב בכמות גדולה, בחרו את המודלים הדרושים ואז השתמשו ב\"בדוק עדכונים לנבחרים\".",
"action": "בדוק הכל"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "הוסף תגיות למספר מודלים",
"description": "הוסף תגיות ל-",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "少しずつ確認したい場合は一括モードに切り替え、必要なモデルを選んで「選択項目の更新を確認」を使ってください。",
"action": "すべて確認"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "複数モデルにタグを追加",
"description": "タグを追加するモデル:",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "나눠서 진행하고 싶다면 일괄 모드로 전환해 필요한 모델만 선택한 뒤 \"선택 항목 업데이트 확인\"을 사용하세요.",
"action": "전체 확인"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "여러 모델에 태그 추가",
"description": "다음에 태그를 추가합니다:",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "Хотите проверять по частям? Переключитесь в массовый режим, выберите нужные модели и используйте \"Проверить обновления для выбранных\".",
"action": "Проверить всё"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "Добавить теги к нескольким моделям",
"description": "Добавить теги к",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "想分批进行?切换到批量模式,选中需要的模型,然后使用“检查所选更新”。",
"action": "检查全部"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "批量添加标签",
"description": "为多个模型添加标签",
+7 -2
View File
@@ -689,9 +689,9 @@
"applyButton": "[TODO: Translate] Apply to Library Now",
"applyHelp": "[TODO: Translate] Renames all existing files of this model type according to the template. Warning: renaming changes the relative path seen by ComfyUI loaders, so existing workflows referencing the old filename may need to be updated. The original filename is preserved in each model's metadata.",
"confirmApply": "[TODO: Translate] Rename all existing files of this model type according to the filename template? This changes the relative path seen by ComfyUI loaders. The original filename is preserved in each model's metadata.",
"emptyTemplateInfo": "[TODO: Translate] No filename template configured for this model type — original filenames are kept, nothing to apply.",
"confirmRevert": "[TODO: Translate] Restore the recorded original filenames of all previously renamed files of this model type? This changes the relative path seen by ComfyUI loaders. Files without a recorded original filename are skipped.",
"validation": {
"keepOriginal": "[TODO: Translate] Valid (keep original filename)",
"restoreOriginal": "[TODO: Translate] Valid (empty template restores original filenames)",
"invalidChars": "[TODO: Translate] Invalid characters detected (a filename cannot contain / \\ < > : \" | ? *)",
"invalidPlaceholder": "[TODO: Translate] Invalid placeholder: {placeholder}",
"validTemplate": "[TODO: Translate] Valid template"
@@ -1626,6 +1626,11 @@
"tip": "想分批處理?切換到批次模式,選擇需要的模型,然後使用「檢查所選更新」。",
"action": "全部檢查"
},
"filenameTemplateConfirm": {
"titleApply": "[TODO: Translate] Apply filename template to library?",
"titleRevert": "[TODO: Translate] Restore original filenames?",
"revertButton": "[TODO: Translate] Restore Original Filenames"
},
"bulkAddTags": {
"title": "新增標籤到多個模型",
"description": "新增標籤到",