This commit is contained in:
Timothy Jaeryang Baek 2024-12-18 18:32:19 -08:00
parent 8f51681801
commit e4573d0b6c
2 changed files with 4 additions and 6 deletions

View File

@ -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,

View File

@ -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