Skip to content

Commit

Permalink
fix #590
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Jul 15, 2024
1 parent faeb021 commit 77b57f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/classes/providers/large_language_models/ollama_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';

class OllamaModel extends LargeLanguageModel {
static bool _nearbyDevicesPermissionDenied = false;

@override
LargeLanguageModelType get type => LargeLanguageModelType.ollama;

Expand Down Expand Up @@ -273,6 +275,10 @@ class OllamaModel extends LargeLanguageModel {
return true;
}

if (_nearbyDevicesPermissionDenied) {
return false;
}

// Get sdk version
final sdk = await DeviceInfoPlugin()
.androidInfo
Expand All @@ -294,6 +300,7 @@ class OllamaModel extends LargeLanguageModel {
return true;
} else {
Logger.log("Nearby Devices - permission denied");
_nearbyDevicesPermissionDenied = true;
return false;
}
}
Expand Down

0 comments on commit 77b57f3

Please sign in to comment.