mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 03:01:27 -03:00
feat(settings): filename templates for download and bulk rename (#1071)
Add per-model-type filename templates ({model_name}, {version_name},
{base_model}, {author}, {first_tag}, {hash_short}, {original_name}) so
downloaded files get informative names instead of e.g. V1.safetensors.
Empty template keeps the current filename (opt-in, off by default).
- apply template automatically after downloads; rename conflicts keep
the original name and never fail the download
- record original_file_name in metadata on rename for traceability
- bulk apply via GET|POST /api/lm/{prefix}/apply-filename-template with
WebSocket progress, sharing the auto-organize lock
- settings UI lives in the new Organization tab with validation, live
preview, and per-type 'apply to library' actions
This commit is contained in:
@@ -20,6 +20,8 @@ class WebSocketManager:
|
||||
self._last_init_progress: Dict[str, Dict[str, Any]] = {}
|
||||
# Add auto-organize progress tracking
|
||||
self._auto_organize_progress: Optional[Dict[str, Any]] = None
|
||||
# Add filename template progress tracking
|
||||
self._filename_template_progress: Optional[Dict[str, Any]] = None
|
||||
# Add recipe rematch progress tracking
|
||||
self._recipe_rematch_progress: Optional[Dict[str, Any]] = None
|
||||
self._auto_organize_lock = asyncio.Lock()
|
||||
@@ -205,6 +207,26 @@ class WebSocketManager:
|
||||
def cleanup_auto_organize_progress(self):
|
||||
"""Clear auto-organize progress data"""
|
||||
self._auto_organize_progress = None
|
||||
|
||||
async def broadcast_filename_template_progress(self, data: Dict[str, Any]):
|
||||
"""Broadcast filename template progress to connected clients"""
|
||||
self._filename_template_progress = data
|
||||
await self.broadcast(data)
|
||||
|
||||
def get_filename_template_progress(self) -> Optional[Dict[str, Any]]:
|
||||
"""Get current filename template progress"""
|
||||
return self._filename_template_progress
|
||||
|
||||
def cleanup_filename_template_progress(self):
|
||||
"""Clear filename template progress data"""
|
||||
self._filename_template_progress = None
|
||||
|
||||
def is_filename_template_running(self) -> bool:
|
||||
"""Check if a filename template operation is currently running"""
|
||||
if not self._filename_template_progress:
|
||||
return False
|
||||
status = self._filename_template_progress.get('status')
|
||||
return status in ['started', 'processing']
|
||||
|
||||
async def broadcast_recipe_rematch_progress(self, data: Dict[str, Any]):
|
||||
"""Broadcast recipe rematch progress to connected clients"""
|
||||
|
||||
Reference in New Issue
Block a user