Lagt till backend och modules från yaml-filen
This commit is contained in:
@@ -26,6 +26,11 @@ class GlobalState:
|
|||||||
cls._instance.logger.info(" __new__(cls): Logger in GlobalState created: %s", cls._instance.logger)
|
cls._instance.logger.info(" __new__(cls): Logger in GlobalState created: %s", cls._instance.logger)
|
||||||
cls._instance.llm = "phi3:mini" # Default LLM for queries. TODO: Check with ollama server that it actually exists
|
cls._instance.llm = "phi3:mini" # Default LLM for queries. TODO: Check with ollama server that it actually exists
|
||||||
cls._instance.backend_api_ep = "http://localhost:5005/api/chat" # Default backend API endpoint
|
cls._instance.backend_api_ep = "http://localhost:5005/api/chat" # Default backend API endpoint
|
||||||
|
# Try making things more aligned with the outline of the yaml file
|
||||||
|
cls._instance.backend = dict() # Holds info on which server the clients connect to
|
||||||
|
cls._instance.models = [] # A list that holds info on which models are available for use (server url, model name, provider et cetera)
|
||||||
|
# logging - already done in __new__, perhaps change layout later
|
||||||
|
|
||||||
return cls._instance
|
return cls._instance
|
||||||
|
|
||||||
def configure_logging(self, level=None):
|
def configure_logging(self, level=None):
|
||||||
@@ -73,3 +78,20 @@ class GlobalState:
|
|||||||
"""Getter for backend API endpoint"""
|
"""Getter for backend API endpoint"""
|
||||||
return self.backend_api_ep
|
return self.backend_api_ep
|
||||||
|
|
||||||
|
def set_backend(self, backend=None):
|
||||||
|
"""Set backend that web clients connect to"""
|
||||||
|
self.backend = backend
|
||||||
|
|
||||||
|
def get_backend(self):
|
||||||
|
"""Getter for backend that web clients connect to"""
|
||||||
|
return self.backend
|
||||||
|
|
||||||
|
def set_models(self, models=None):
|
||||||
|
"""Set the list of models."""
|
||||||
|
self.models = models
|
||||||
|
if not isinstance(models, list):
|
||||||
|
raise ValueError("Models must be a list")
|
||||||
|
|
||||||
|
def get_models(self):
|
||||||
|
"""Return the list of models"""
|
||||||
|
return self.models
|
||||||
Reference in New Issue
Block a user