Delar variabler enhetligt nu genom global_state
This commit is contained in:
@@ -52,18 +52,19 @@ def configure():
|
|||||||
logger.debug("configure(): This logger now has effective log level %s", logger.getEffectiveLevel())
|
logger.debug("configure(): This logger now has effective log level %s", logger.getEffectiveLevel())
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
# Extract and export API endpoint as
|
# Extract and export backend API
|
||||||
# envrionment variable
|
# 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.get('backend'), dict): # Look for 'backend' key
|
||||||
if isinstance(updated_config['backend'].get('url'), str): # Look for 'url' key
|
if isinstance(updated_config['backend'].get('url'), str): # Look for 'url' key
|
||||||
url = updated_config['backend'].get('url')
|
url = updated_config['backend'].get('url')
|
||||||
if isinstance(updated_config['backend'].get('api'), str): # Look for 'api' key
|
if isinstance(updated_config['backend'].get('api'), str): # Look for 'api' key
|
||||||
api = updated_config['backend'].get('api')
|
api = updated_config['backend'].get('api')
|
||||||
backend_api_ep = url+api # Extract API endpoint if defined
|
# backend_api_ep = url+api # Extract API endpoint if defined
|
||||||
logger.debug("BE_API_ENDPOINT is set to '{}'".format(backend_api_ep))
|
logger.debug(f"Constructing endpoint address as url+api: {url+api}")
|
||||||
os.environ['BE_API_ENDPOINT'] = backend_api_ep # Look into alternative way to share this with backend.py
|
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)
|
# Extract Ollama parameters (url, api_key, model)
|
||||||
|
|||||||
Reference in New Issue
Block a user