mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 04:40:40 -07:00
fix: warn user when no models to migrate during storage change (#433)
When user attempts to change model storage location with no models downloaded, the migration API returns moved=0 early. Previously the UI would still call setCustomModelsDir() and restart the server, causing unexpected behavior (hang/connection lost). This change checks migrationResult.moved === 0 and shows a helpful toast message instead of proceeding with the storage change. Fixes: #426 Co-authored-by: fuleinist <[email protected]>
This commit is contained in:
@@ -977,7 +977,19 @@ export function ModelManagement() {
|
||||
});
|
||||
try {
|
||||
// Start the migration (background task)
|
||||
await apiClient.migrateModels(newDir);
|
||||
const migrationResult = await apiClient.migrateModels(newDir);
|
||||
|
||||
// If no models to migrate, warn user and skip the change
|
||||
if (migrationResult.moved === 0) {
|
||||
setMigrating(false);
|
||||
setMigrationProgress(null);
|
||||
toast({
|
||||
title: 'No models to migrate',
|
||||
description: 'Download at least one model before changing the storage location.',
|
||||
});
|
||||
setPendingMigrateDir(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// Connect to SSE for progress
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user