From acd299a8224466c9b24d4f270ab764de1f23d478 Mon Sep 17 00:00:00 2001 From: Dane Madsen Date: Wed, 24 Apr 2024 16:29:59 +1000 Subject: [PATCH] check localhost --- lib/classes/ollama_model.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/classes/ollama_model.dart b/lib/classes/ollama_model.dart index f09ff0bf..5ed52f99 100644 --- a/lib/classes/ollama_model.dart +++ b/lib/classes/ollama_model.dart @@ -74,6 +74,14 @@ class OllamaModel extends LargeLanguageModel { @override Future resetUri() async { + // Check Localhost + if ((await _checkIpForOllama('127.0.0.1')).isNotEmpty) { + uri = 'http://127.0.0.1:11434'; + notifyListeners(); + return; + } + + // If ip is set, check if it's valid if (_ip.isNotEmpty && (await _checkIpForOllama(_ip)).isNotEmpty) { uri = 'http://$_ip:11434'; notifyListeners();