feat: enhance model move functionality with cache entry updates

- Return cache entry data from model move operations for immediate UI updates
- Add recalculate_type parameter to update_single_model_cache for proper type adjustment
- Propagate cache entry through API layer to frontend MoveManager
- Enable virtual scroller to update moved items with new cache data
This commit is contained in:
Will Miao
2025-12-31 10:33:22 +08:00
parent 2b239c3747
commit 8120716cd8
4 changed files with 39 additions and 15 deletions

View File

@@ -496,12 +496,15 @@ class ModelMoveService:
'new_file_path': file_path
}
new_file_path = await self.scanner.move_model(file_path, target_path)
if new_file_path:
move_result = await self.scanner.move_model(file_path, target_path)
if move_result:
new_file_path = move_result.get("new_path")
cache_entry = move_result.get("cache_entry")
return {
'success': True,
'original_file_path': file_path,
'new_file_path': new_file_path
'new_file_path': new_file_path,
'cache_entry': cache_entry
}
else:
return {
@@ -539,7 +542,8 @@ class ModelMoveService:
"original_file_path": file_path,
"new_file_path": result.get('new_file_path'),
"success": result['success'],
"message": result.get('message', result.get('error', 'Unknown'))
"message": result.get('message', result.get('error', 'Unknown')),
"cache_entry": result.get('cache_entry')
})
success_count = sum(1 for r in results if r["success"])