From abd994343036b37dc4789fdd9f05b9e881ef4f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=B7=A8=E9=BE=99?= Date: Sat, 18 Apr 2026 18:12:32 +0800 Subject: [PATCH] Fix migration dialog hanging when no models are present (#439) When migrating model path with an empty cache, backend returned early without emitting migration completion SSE, causing frontend overlay to hang. This patch emits complete status for empty migrations. --- backend/routes/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/routes/models.py b/backend/routes/models.py index d9ee1e8f..7cbb7b04 100644 --- a/backend/routes/models.py +++ b/backend/routes/models.py @@ -135,14 +135,15 @@ async def migrate_models(request: models.ModelMigrateRequest): if destination.resolve().is_relative_to(source.resolve()): raise HTTPException(status_code=400, detail="Destination cannot be inside the current cache directory") + progress_manager = get_progress_manager() model_dirs = [d for d in source.iterdir() if d.name.startswith("models--") and d.is_dir()] if not model_dirs: + progress_manager.update_progress("migration", 1, 1, status="complete") + progress_manager.mark_complete("migration") return {"moved": 0, "errors": [], "source": str(source), "destination": str(destination)} destination.mkdir(parents=True, exist_ok=True) - progress_manager = get_progress_manager() - same_fs = False try: same_fs = source.stat().st_dev == destination.stat().st_dev