Procházet zdrojové kódy

enh: `TOOL_SERVER_CONNECTIONS` env var support

Timothy Jaeryang Baek před 9 měsíci
rodič
revize
ace3303ff5
1 změnil soubory, kde provedl 10 přidání a 1 odebrání
  1. 10 1
      backend/open_webui/config.py

+ 10 - 1
backend/open_webui/config.py

@@ -921,11 +921,19 @@ OPENAI_API_BASE_URL = "https://api.openai.com/v1"
 # TOOL_SERVERS
 ####################################
 
+try:
+    tool_server_connections = json.loads(
+        os.environ.get("TOOL_SERVER_CONNECTIONS", "[]")
+    )
+except Exception as e:
+    log.exception(f"Error loading TOOL_SERVER_CONNECTIONS: {e}")
+    tool_server_connections = []
+
 
 TOOL_SERVER_CONNECTIONS = PersistentConfig(
     "TOOL_SERVER_CONNECTIONS",
     "tool_server.connections",
-    [],
+    tool_server_connections,
 )
 
 ####################################
@@ -1002,6 +1010,7 @@ if default_prompt_suggestions == []:
             "content": "Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?",
         },
     ]
+
 DEFAULT_PROMPT_SUGGESTIONS = PersistentConfig(
     "DEFAULT_PROMPT_SUGGESTIONS",
     "ui.prompt_suggestions",