mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 15:25:29 +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_api_key": app.state.config.ENABLE_API_KEY,
|
||||||
"enable_signup": app.state.config.ENABLE_SIGNUP,
|
"enable_signup": app.state.config.ENABLE_SIGNUP,
|
||||||
"enable_login_form": app.state.config.ENABLE_LOGIN_FORM,
|
"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,
|
"enable_web_search": app.state.config.ENABLE_RAG_WEB_SEARCH,
|
||||||
|
@ -38,15 +38,14 @@
|
|||||||
let loaded = false;
|
let loaded = false;
|
||||||
const BREAKPOINT = 768;
|
const BREAKPOINT = 768;
|
||||||
|
|
||||||
const setupSocket = (disableWebSocketPolling) => {
|
const setupSocket = (enableWebsocket) => {
|
||||||
console.log('Disabled websocket polling', disableWebSocketPolling);
|
|
||||||
const _socket = io(`${WEBUI_BASE_URL}` || undefined, {
|
const _socket = io(`${WEBUI_BASE_URL}` || undefined, {
|
||||||
reconnection: true,
|
reconnection: true,
|
||||||
reconnectionDelay: 1000,
|
reconnectionDelay: 1000,
|
||||||
reconnectionDelayMax: 5000,
|
reconnectionDelayMax: 5000,
|
||||||
randomizationFactor: 0.5,
|
randomizationFactor: 0.5,
|
||||||
path: '/ws/socket.io',
|
path: '/ws/socket.io',
|
||||||
transports: disableWebSocketPolling ? ['websocket'] : ['polling', 'websocket'],
|
transports: enableWebsocket ? ['websocket'] : ['polling', 'websocket'],
|
||||||
auth: { token: localStorage.token }
|
auth: { token: localStorage.token }
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -127,9 +126,8 @@
|
|||||||
await config.set(backendConfig);
|
await config.set(backendConfig);
|
||||||
await WEBUI_NAME.set(backendConfig.name);
|
await WEBUI_NAME.set(backendConfig.name);
|
||||||
|
|
||||||
const disableWebSocketPolling = backendConfig.features.disable_websocket_polling === true;
|
|
||||||
if ($config) {
|
if ($config) {
|
||||||
setupSocket(disableWebSocketPolling);
|
setupSocket($config.features?.enable_websocket ?? true);
|
||||||
|
|
||||||
if (localStorage.token) {
|
if (localStorage.token) {
|
||||||
// Get Session User Info
|
// Get Session User Info
|
||||||
|
Loading…
Reference in New Issue
Block a user