Fixed: Ollama instance wasn't shutting down
This commit is contained in:
parent
4b17601baf
commit
ad25d5a50f
@ -7,14 +7,19 @@ port = 11435
|
||||
data_dir = os.getenv("XDG_DATA_HOME")
|
||||
|
||||
def start():
|
||||
global instance
|
||||
instance = subprocess.Popen(["/app/bin/ollama", "serve"], env={**os.environ, 'OLLAMA_HOST': f"127.0.0.1:{port}", "HOME": data_dir}, stderr=subprocess.PIPE, text=True)
|
||||
print("Starting Alpaca's Ollama instance...")
|
||||
sleep(1)
|
||||
print("Started Alpaca's Ollama instance")
|
||||
|
||||
def stop():
|
||||
if instance: instance.kill()
|
||||
print("Stopped Alpaca's Ollama instance")
|
||||
global instance
|
||||
if instance:
|
||||
instance.kill()
|
||||
instance.wait()
|
||||
instance = None
|
||||
print("Stopped Alpaca's Ollama instance")
|
||||
|
||||
def reset():
|
||||
stop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user