mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-10 07:50:15 -03:00
feat(recipes): add recipe rematch WebSocket progress channel
This commit is contained in:
@@ -22,6 +22,8 @@ class WebSocketManager:
|
||||
self._auto_organize_progress: Optional[Dict[str, Any]] = None
|
||||
# Add recipe repair progress tracking
|
||||
self._recipe_repair_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()
|
||||
|
||||
async def handle_connection(self, request: web.Request) -> web.WebSocketResponse:
|
||||
@@ -223,6 +225,30 @@ class WebSocketManager:
|
||||
status = self._recipe_repair_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"""
|
||||
# Store progress data in memory
|
||||
self._recipe_rematch_progress = data
|
||||
|
||||
# Broadcast via WebSocket
|
||||
await self.broadcast(data)
|
||||
|
||||
def get_recipe_rematch_progress(self) -> Optional[Dict[str, Any]]:
|
||||
"""Get current recipe rematch progress"""
|
||||
return self._recipe_rematch_progress
|
||||
|
||||
def cleanup_recipe_rematch_progress(self):
|
||||
"""Clear recipe rematch progress data if it is in a finished state"""
|
||||
if self._recipe_rematch_progress and self._recipe_rematch_progress.get('status') in ['completed', 'cancelled', 'error']:
|
||||
self._recipe_rematch_progress = None
|
||||
|
||||
def is_recipe_rematch_running(self) -> bool:
|
||||
"""Check if recipe rematch is currently running"""
|
||||
if not self._recipe_rematch_progress:
|
||||
return False
|
||||
status = self._recipe_rematch_progress.get('status')
|
||||
return status in ['started', 'processing']
|
||||
|
||||
def is_auto_organize_running(self) -> bool:
|
||||
"""Check if auto-organize is currently running"""
|
||||
if not self._auto_organize_progress:
|
||||
|
||||
Reference in New Issue
Block a user