Skip to content

Commit

Permalink
[mob] Skip deleting downloaded models
Browse files Browse the repository at this point in the history
  • Loading branch information
ua741 committed Nov 7, 2024
1 parent 27f55b1 commit 19ccc53
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions mobile/lib/services/machine_learning/ml_indexing_isolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,23 @@ class MLIndexingIsolate extends SuperIsolate {
}
}

Future<void> cleanupLocalIndexingModels() async {
Future<void> cleanupLocalIndexingModels({bool delete = false}) async {
if (!areModelsDownloaded) return;
await _releaseModels();

final List<String> remoteModelPaths = [];
if (delete) {
final List<String> remoteModelPaths = [];

for (final model in MLModels.values) {
if (!model.isIndexingModel) continue;
final mlModel = model.model;
remoteModelPaths.add(mlModel.modelRemotePath);
}

await RemoteAssetsService.instance.cleanupSelectedModels(remoteModelPaths);
for (final model in MLModels.values) {
if (!model.isIndexingModel) continue;
final mlModel = model.model;
remoteModelPaths.add(mlModel.modelRemotePath);
}
await RemoteAssetsService.instance
.cleanupSelectedModels(remoteModelPaths);

areModelsDownloaded = false;
areModelsDownloaded = false;
}
}

Future<void> _releaseModels() async {
Expand Down

0 comments on commit 19ccc53

Please sign in to comment.