From 86374c91fefb24e78e16346c22ef939d85d94785 Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Tue, 30 Jul 2024 23:41:42 +0200 Subject: [PATCH] Delar variabler enhetligt nu genom global_state --- smartassist/src/startservices.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/smartassist/src/startservices.py b/smartassist/src/startservices.py index f0bd39d..96ae6e2 100644 --- a/smartassist/src/startservices.py +++ b/smartassist/src/startservices.py @@ -52,18 +52,19 @@ def configure(): logger.debug("configure(): This logger now has effective log level %s", logger.getEffectiveLevel()) #################################### - # Extract and export API endpoint as - # envrionment variable + # Extract and export backend API + # endpoint as global state variable #################################### - backend_api_ep = 'http://localhost:5005/api/chat' # Default API endpoint if isinstance(updated_config.get('backend'), dict): # Look for 'backend' key if isinstance(updated_config['backend'].get('url'), str): # Look for 'url' key url = updated_config['backend'].get('url') if isinstance(updated_config['backend'].get('api'), str): # Look for 'api' key api = updated_config['backend'].get('api') - backend_api_ep = url+api # Extract API endpoint if defined - logger.debug("BE_API_ENDPOINT is set to '{}'".format(backend_api_ep)) - os.environ['BE_API_ENDPOINT'] = backend_api_ep # Look into alternative way to share this with backend.py + # backend_api_ep = url+api # Extract API endpoint if defined + logger.debug(f"Constructing endpoint address as url+api: {url+api}") + global_state.set_backend_api_ep(url+api) # Extract API endpoint if defined and set in global_state + logger.debug(f"Backend API endpoint is set to {global_state.get_backend_api_ep()}") + # os.environ['BE_API_ENDPOINT'] = backend_api_ep # Look into alternative way to share this with backend.py #################################### # Extract Ollama parameters (url, api_key, model)