Timothy Jaeryang Baek 4 月之前
父節點
當前提交
e4573d0b6c
共有 2 個文件被更改,包括 4 次插入6 次删除
  1. 1 1
      backend/open_webui/main.py
  2. 3 5
      src/routes/+layout.svelte

+ 1 - 1
backend/open_webui/main.py

@@ -933,7 +933,7 @@ async def get_app_config(request: Request):
             "enable_api_key": app.state.config.ENABLE_API_KEY,
             "enable_signup": app.state.config.ENABLE_SIGNUP,
             "enable_login_form": app.state.config.ENABLE_LOGIN_FORM,
-            "disable_websocket_polling": ENABLE_WEBSOCKET_SUPPORT,
+            "enable_websocket": ENABLE_WEBSOCKET_SUPPORT,
             **(
                 {
                     "enable_web_search": app.state.config.ENABLE_RAG_WEB_SEARCH,

+ 3 - 5
src/routes/+layout.svelte

@@ -38,15 +38,14 @@
 	let loaded = false;
 	const BREAKPOINT = 768;
 
-	const setupSocket = (disableWebSocketPolling) => {
-		console.log('Disabled websocket polling', disableWebSocketPolling);
+	const setupSocket = (enableWebsocket) => {
 		const _socket = io(`${WEBUI_BASE_URL}` || undefined, {
 			reconnection: true,
 			reconnectionDelay: 1000,
 			reconnectionDelayMax: 5000,
 			randomizationFactor: 0.5,
 			path: '/ws/socket.io',
-			transports: disableWebSocketPolling ? ['websocket'] : ['polling', 'websocket'],
+			transports: enableWebsocket ? ['websocket'] : ['polling', 'websocket'],
 			auth: { token: localStorage.token }
 		});
 
@@ -127,9 +126,8 @@
 			await config.set(backendConfig);
 			await WEBUI_NAME.set(backendConfig.name);
 
-			const disableWebSocketPolling = backendConfig.features.disable_websocket_polling === true;
 			if ($config) {
-				setupSocket(disableWebSocketPolling);
+				setupSocket($config.features?.enable_websocket ?? true);
 
 				if (localStorage.token) {
 					// Get Session User Info