mirror of
https://github.com/open-webui/open-webui
synced 2024-12-28 14:52:23 +00:00
refac
This commit is contained in:
parent
8f51681801
commit
e4573d0b6c
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user