From 80dcae194bf45084263585aa2ef8e6dfe6192593 Mon Sep 17 00:00:00 2001 From: jeffser Date: Wed, 11 Sep 2024 10:36:07 -0600 Subject: [PATCH] Fixed Ollama instance sometimes failing to give version --- src/connection_handler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/connection_handler.py b/src/connection_handler.py index 3c28c79..9249c6c 100644 --- a/src/connection_handler.py +++ b/src/connection_handler.py @@ -107,8 +107,11 @@ class instance(): logger.info("Starting Alpaca's Ollama instance...") logger.debug(params) logger.info("Started Alpaca's Ollama instance") - v_str = subprocess.check_output("ollama -v", shell=True).decode('utf-8') - logger.info('Ollama version: {}'.format(v_str.split('client version is ')[1].strip())) + try: + v_str = subprocess.check_output("ollama -v", shell=True).decode('utf-8') + logger.info(v_str.split('\n')[1].strip('Warning: ').strip()) + except Exception as e: + logger.error(e) self.instance = instance if not self.idle_timer: self.start_timer()