Better checker for Ollama instance missing
This commit is contained in:
parent
19a8aade60
commit
79a7840f24
@ -2,7 +2,7 @@
|
||||
"""
|
||||
Handles requests to remote and integrated instances of Ollama
|
||||
"""
|
||||
import json, os, requests, subprocess, threading
|
||||
import json, os, requests, subprocess, threading, shutil
|
||||
from .internal import data_dir, cache_dir
|
||||
from logging import getLogger
|
||||
from time import sleep
|
||||
@ -92,6 +92,7 @@ class instance():
|
||||
self.idle_timer.start()
|
||||
|
||||
def start(self):
|
||||
if shutil.which('ollama'):
|
||||
if not os.path.isdir(os.path.join(cache_dir, 'tmp/ollama')):
|
||||
os.mkdir(os.path.join(cache_dir, 'tmp/ollama'))
|
||||
self.instance = None
|
||||
@ -111,6 +112,11 @@ class instance():
|
||||
self.instance = instance
|
||||
if not self.idle_timer:
|
||||
self.start_timer()
|
||||
else:
|
||||
self.remote = True
|
||||
if not self.remote_url:
|
||||
self.remote_url = 'http://0.0.0.0:11434'
|
||||
window.connection_error()
|
||||
|
||||
def stop(self):
|
||||
if self.idle_timer:
|
||||
|
@ -777,12 +777,6 @@ Generate a title following these rules:
|
||||
if show_launch_dialog:
|
||||
GLib.idle_add(self.launch_dialog.present, self)
|
||||
|
||||
#Check if Ollama instance doesn't exists
|
||||
if not shutil.which('ollama'):
|
||||
remote = True
|
||||
if not remote_url:
|
||||
remote_url = 'http://0.0.0.0:11434'
|
||||
|
||||
#Instance
|
||||
self.launch_level_bar.set_value(0)
|
||||
self.launch_status.set_description(_('Loading instance'))
|
||||
|
Loading…
x
Reference in New Issue
Block a user