getStorageStats method
Gets storage statistics for installed models
Phase 5.3: Delegates to Modern API (ModelRepository) instead of checking manual _installedModels map.
Implementation
@override
Future<Map<String, int>> getStorageStats() async {
await _ensureInitialized();
// Phase 5: Delegate to Modern API
final registry = ServiceRegistry.instance;
final repository = registry.modelRepository;
// Get all installed models from repository
final allInstalled = await repository.listInstalled();
final installedCount = allInstalled.length;
// Count by type
final inferenceCount = allInstalled.where((m) => m.type == repo.ModelType.inference).length;
final embeddingCount = allInstalled.where((m) => m.type == repo.ModelType.embedding).length;
return {
'protectedFiles': installedCount,
'totalSizeBytes': 0, // Unknown for web URLs (no local file system)
'totalSizeMB': 0,
'inferenceModels': inferenceCount,
'embeddingModels': embeddingCount,
};
}