downloadModel method
Future<void>
downloadModel({
- String model = "qwen3-0.6",
- CactusProgressCallback? downloadProcessCallback,
Implementation
Future<void> downloadModel({
final String model = "qwen3-0.6",
final CactusProgressCallback? downloadProcessCallback,
}) async {
if (await _isModelDownloaded(model)) {
return;
}
final currentModel = await Supabase.getModel(model);
if (currentModel == null) {
throw Exception('Failed to get model $model');
}
final actualFilename = currentModel.downloadUrl.split('?').first.split('/').last;
final task = DownloadTask(
url: currentModel.downloadUrl,
filename: actualFilename,
folder: currentModel.slug,
);
final success = await DownloadService.downloadAndExtractModels([task], downloadProcessCallback);
if (!success) {
throw Exception('Failed to download and extract model $model from ${currentModel.downloadUrl}');
}
}