Skip to content

Commit bf13397

Browse files
committed
perf: reslove conflict
2 parents df1bfdb + 52800c4 commit bf13397

5 files changed

Lines changed: 37 additions & 50 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,3 +310,5 @@ dist
310310
cypress/videos
311311
cypress/screenshots
312312
.vscode/settings.json
313+
314+
/backend/open_webui/jms/data/

backend/open_webui/env.py

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,17 @@ def parse_section(section):
204204

205205
SAFE_MODE = os.environ.get("SAFE_MODE", "false").lower() == "true"
206206

207-
208207
####################################
209208
# ENABLE_FORWARD_USER_INFO_HEADERS
210209
####################################
211210

212211
ENABLE_FORWARD_USER_INFO_HEADERS = (
213-
os.environ.get("ENABLE_FORWARD_USER_INFO_HEADERS", "False").lower() == "true"
212+
os.environ.get("ENABLE_FORWARD_USER_INFO_HEADERS", "False").lower() == "true"
214213
)
215214

216215
# Experimental feature, may be removed in future
217216
ENABLE_STAR_SESSIONS_MIDDLEWARE = (
218-
os.environ.get("ENABLE_STAR_SESSIONS_MIDDLEWARE", "False").lower() == "true"
217+
os.environ.get("ENABLE_STAR_SESSIONS_MIDDLEWARE", "False").lower() == "true"
219218
)
220219

221220
####################################
@@ -346,7 +345,7 @@ def parse_section(section):
346345
DATABASE_POOL_RECYCLE = 3600
347346

348347
DATABASE_ENABLE_SQLITE_WAL = (
349-
os.environ.get("DATABASE_ENABLE_SQLITE_WAL", "False").lower() == "true"
348+
os.environ.get("DATABASE_ENABLE_SQLITE_WAL", "False").lower() == "true"
350349
)
351350

352351
DATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVAL = os.environ.get(
@@ -361,11 +360,11 @@ def parse_section(section):
361360
DATABASE_USER_ACTIVE_STATUS_UPDATE_INTERVAL = 0.0
362361

363362
RESET_CONFIG_ON_START = (
364-
os.environ.get("RESET_CONFIG_ON_START", "False").lower() == "true"
363+
os.environ.get("RESET_CONFIG_ON_START", "False").lower() == "true"
365364
)
366365

367366
ENABLE_REALTIME_CHAT_SAVE = (
368-
os.environ.get("ENABLE_REALTIME_CHAT_SAVE", "False").lower() == "true"
367+
os.environ.get("ENABLE_REALTIME_CHAT_SAVE", "False").lower() == "true"
369368
)
370369

371370
ENABLE_QUERIES_CACHE = os.environ.get("ENABLE_QUERIES_CACHE", "False").lower() == "true"
@@ -412,10 +411,10 @@ def parse_section(section):
412411
WEBUI_AUTH = os.environ.get("WEBUI_AUTH", "True").lower() == "true"
413412

414413
ENABLE_INITIAL_ADMIN_SIGNUP = (
415-
os.environ.get("ENABLE_INITIAL_ADMIN_SIGNUP", "False").lower() == "true"
414+
os.environ.get("ENABLE_INITIAL_ADMIN_SIGNUP", "False").lower() == "true"
416415
)
417416
ENABLE_SIGNUP_PASSWORD_CONFIRMATION = (
418-
os.environ.get("ENABLE_SIGNUP_PASSWORD_CONFIRMATION", "False").lower() == "true"
417+
os.environ.get("ENABLE_SIGNUP_PASSWORD_CONFIRMATION", "False").lower() == "true"
419418
)
420419

421420
WEBUI_AUTH_TRUSTED_EMAIL_HEADER = os.environ.get(
@@ -426,9 +425,8 @@ def parse_section(section):
426425
"WEBUI_AUTH_TRUSTED_GROUPS_HEADER", None
427426
)
428427

429-
430428
BYPASS_MODEL_ACCESS_CONTROL = (
431-
os.environ.get("BYPASS_MODEL_ACCESS_CONTROL", "False").lower() == "true"
429+
os.environ.get("BYPASS_MODEL_ACCESS_CONTROL", "False").lower() == "true"
432430
)
433431

434432
WEBUI_AUTH_SIGNOUT_REDIRECT_URL = os.environ.get(
@@ -449,37 +447,37 @@ def parse_section(section):
449447
WEBUI_SESSION_COOKIE_SAME_SITE = os.environ.get("WEBUI_SESSION_COOKIE_SAME_SITE", "lax")
450448

451449
WEBUI_SESSION_COOKIE_SECURE = (
452-
os.environ.get("WEBUI_SESSION_COOKIE_SECURE", "false").lower() == "true"
450+
os.environ.get("WEBUI_SESSION_COOKIE_SECURE", "false").lower() == "true"
453451
)
454452

455453
WEBUI_AUTH_COOKIE_SAME_SITE = os.environ.get(
456454
"WEBUI_AUTH_COOKIE_SAME_SITE", WEBUI_SESSION_COOKIE_SAME_SITE
457455
)
458456

459457
WEBUI_AUTH_COOKIE_SECURE = (
460-
os.environ.get(
461-
"WEBUI_AUTH_COOKIE_SECURE",
462-
os.environ.get("WEBUI_SESSION_COOKIE_SECURE", "false"),
463-
).lower()
464-
== "true"
458+
os.environ.get(
459+
"WEBUI_AUTH_COOKIE_SECURE",
460+
os.environ.get("WEBUI_SESSION_COOKIE_SECURE", "false"),
461+
).lower()
462+
== "true"
465463
)
466464

467465
if WEBUI_AUTH and WEBUI_SECRET_KEY == "":
468466
raise ValueError(ERROR_MESSAGES.ENV_VAR_NOT_FOUND)
469467

470468
ENABLE_COMPRESSION_MIDDLEWARE = (
471-
os.environ.get("ENABLE_COMPRESSION_MIDDLEWARE", "True").lower() == "true"
469+
os.environ.get("ENABLE_COMPRESSION_MIDDLEWARE", "True").lower() == "true"
472470
)
473471

474472
####################################
475473
# OAUTH Configuration
476474
####################################
477475
ENABLE_OAUTH_EMAIL_FALLBACK = (
478-
os.environ.get("ENABLE_OAUTH_EMAIL_FALLBACK", "False").lower() == "true"
476+
os.environ.get("ENABLE_OAUTH_EMAIL_FALLBACK", "False").lower() == "true"
479477
)
480478

481479
ENABLE_OAUTH_ID_TOKEN_COOKIE = (
482-
os.environ.get("ENABLE_OAUTH_ID_TOKEN_COOKIE", "True").lower() == "true"
480+
os.environ.get("ENABLE_OAUTH_ID_TOKEN_COOKIE", "True").lower() == "true"
483481
)
484482

485483
OAUTH_CLIENT_INFO_ENCRYPTION_KEY = os.environ.get(
@@ -523,7 +521,6 @@ def parse_section(section):
523521
)
524522
)
525523

526-
527524
####################################
528525
# MODELS
529526
####################################
@@ -537,7 +534,6 @@ def parse_section(section):
537534
except Exception:
538535
MODELS_CACHE_TTL = 1
539536

540-
541537
####################################
542538
# CHAT
543539
####################################
@@ -556,7 +552,6 @@ def parse_section(section):
556552
except Exception:
557553
CHAT_RESPONSE_STREAM_DELTA_CHUNK_SIZE = 1
558554

559-
560555
CHAT_RESPONSE_MAX_TOOL_CALL_RETRIES = os.environ.get(
561556
"CHAT_RESPONSE_MAX_TOOL_CALL_RETRIES", "30"
562557
)
@@ -569,21 +564,19 @@ def parse_section(section):
569564
except Exception:
570565
CHAT_RESPONSE_MAX_TOOL_CALL_RETRIES = 30
571566

572-
573567
####################################
574568
# WEBSOCKET SUPPORT
575569
####################################
576570

577571
ENABLE_WEBSOCKET_SUPPORT = (
578-
os.environ.get("ENABLE_WEBSOCKET_SUPPORT", "True").lower() == "true"
572+
os.environ.get("ENABLE_WEBSOCKET_SUPPORT", "True").lower() == "true"
579573
)
580574

581-
582575
WEBSOCKET_MANAGER = os.environ.get("WEBSOCKET_MANAGER", "")
583576

584577
WEBSOCKET_REDIS_URL = os.environ.get("WEBSOCKET_REDIS_URL", REDIS_URL)
585578
WEBSOCKET_REDIS_CLUSTER = (
586-
os.environ.get("WEBSOCKET_REDIS_CLUSTER", str(REDIS_CLUSTER)).lower() == "true"
579+
os.environ.get("WEBSOCKET_REDIS_CLUSTER", str(REDIS_CLUSTER)).lower() == "true"
587580
)
588581

589582
websocket_redis_lock_timeout = os.environ.get("WEBSOCKET_REDIS_LOCK_TIMEOUT", "60")
@@ -596,7 +589,6 @@ def parse_section(section):
596589
WEBSOCKET_SENTINEL_HOSTS = os.environ.get("WEBSOCKET_SENTINEL_HOSTS", "")
597590
WEBSOCKET_SENTINEL_PORT = os.environ.get("WEBSOCKET_SENTINEL_PORT", "26379")
598591

599-
600592
AIOHTTP_CLIENT_TIMEOUT = os.environ.get("AIOHTTP_CLIENT_TIMEOUT", "")
601593

602594
if AIOHTTP_CLIENT_TIMEOUT == "":
@@ -607,9 +599,8 @@ def parse_section(section):
607599
except Exception:
608600
AIOHTTP_CLIENT_TIMEOUT = 300
609601

610-
611602
AIOHTTP_CLIENT_SESSION_SSL = (
612-
os.environ.get("AIOHTTP_CLIENT_SESSION_SSL", "True").lower() == "true"
603+
os.environ.get("AIOHTTP_CLIENT_SESSION_SSL", "True").lower() == "true"
613604
)
614605

615606
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST = os.environ.get(
@@ -625,7 +616,6 @@ def parse_section(section):
625616
except Exception:
626617
AIOHTTP_CLIENT_TIMEOUT_MODEL_LIST = 10
627618

628-
629619
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA = os.environ.get(
630620
"AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA", "10"
631621
)
@@ -640,12 +630,10 @@ def parse_section(section):
640630
except Exception:
641631
AIOHTTP_CLIENT_TIMEOUT_TOOL_SERVER_DATA = 10
642632

643-
644633
AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL = (
645-
os.environ.get("AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL", "True").lower() == "true"
634+
os.environ.get("AIOHTTP_CLIENT_SESSION_TOOL_SERVER_SSL", "True").lower() == "true"
646635
)
647636

648-
649637
####################################
650638
# SENTENCE TRANSFORMERS
651639
####################################
@@ -655,7 +643,6 @@ def parse_section(section):
655643
if SENTENCE_TRANSFORMERS_BACKEND == "":
656644
SENTENCE_TRANSFORMERS_BACKEND = "torch"
657645

658-
659646
SENTENCE_TRANSFORMERS_MODEL_KWARGS = os.environ.get(
660647
"SENTENCE_TRANSFORMERS_MODEL_KWARGS", ""
661648
)
@@ -669,14 +656,12 @@ def parse_section(section):
669656
except Exception:
670657
SENTENCE_TRANSFORMERS_MODEL_KWARGS = None
671658

672-
673659
SENTENCE_TRANSFORMERS_CROSS_ENCODER_BACKEND = os.environ.get(
674660
"SENTENCE_TRANSFORMERS_CROSS_ENCODER_BACKEND", ""
675661
)
676662
if SENTENCE_TRANSFORMERS_CROSS_ENCODER_BACKEND == "":
677663
SENTENCE_TRANSFORMERS_CROSS_ENCODER_BACKEND = "torch"
678664

679-
680665
SENTENCE_TRANSFORMERS_CROSS_ENCODER_MODEL_KWARGS = os.environ.get(
681666
"SENTENCE_TRANSFORMERS_CROSS_ENCODER_MODEL_KWARGS", ""
682667
)
@@ -697,7 +682,7 @@ def parse_section(section):
697682
ENABLE_VERSION_UPDATE_CHECK = (
698683
os.environ.get("ENABLE_VERSION_UPDATE_CHECK", "false").lower() == "true"
699684
)
700-
OFFLINE_MODE = os.environ.get("OFFLINE_MODE", "false").lower() == "true"
685+
OFFLINE_MODE = os.environ.get("OFFLINE_MODE", "false").lower() == "false"
701686

702687
if OFFLINE_MODE:
703688
os.environ["HF_HUB_OFFLINE"] = "1"
@@ -732,7 +717,6 @@ def parse_section(section):
732717
AUDIT_EXCLUDED_PATHS = [path.strip() for path in AUDIT_EXCLUDED_PATHS]
733718
AUDIT_EXCLUDED_PATHS = [path.lstrip("/") for path in AUDIT_EXCLUDED_PATHS]
734719

735-
736720
####################################
737721
# OPENTELEMETRY
738722
####################################
@@ -752,19 +736,19 @@ def parse_section(section):
752736
"OTEL_LOGS_EXPORTER_OTLP_ENDPOINT", OTEL_EXPORTER_OTLP_ENDPOINT
753737
)
754738
OTEL_EXPORTER_OTLP_INSECURE = (
755-
os.environ.get("OTEL_EXPORTER_OTLP_INSECURE", "False").lower() == "true"
739+
os.environ.get("OTEL_EXPORTER_OTLP_INSECURE", "False").lower() == "true"
756740
)
757741
OTEL_METRICS_EXPORTER_OTLP_INSECURE = (
758-
os.environ.get(
759-
"OTEL_METRICS_EXPORTER_OTLP_INSECURE", str(OTEL_EXPORTER_OTLP_INSECURE)
760-
).lower()
761-
== "true"
742+
os.environ.get(
743+
"OTEL_METRICS_EXPORTER_OTLP_INSECURE", str(OTEL_EXPORTER_OTLP_INSECURE)
744+
).lower()
745+
== "true"
762746
)
763747
OTEL_LOGS_EXPORTER_OTLP_INSECURE = (
764-
os.environ.get(
765-
"OTEL_LOGS_EXPORTER_OTLP_INSECURE", str(OTEL_EXPORTER_OTLP_INSECURE)
766-
).lower()
767-
== "true"
748+
os.environ.get(
749+
"OTEL_LOGS_EXPORTER_OTLP_INSECURE", str(OTEL_EXPORTER_OTLP_INSECURE)
750+
).lower()
751+
== "true"
768752
)
769753
OTEL_SERVICE_NAME = os.environ.get("OTEL_SERVICE_NAME", "open-webui")
770754
OTEL_RESOURCE_ATTRIBUTES = os.environ.get(
@@ -808,7 +792,6 @@ def parse_section(section):
808792
PIP_OPTIONS = os.getenv("PIP_OPTIONS", "").split()
809793
PIP_PACKAGE_INDEX_OPTIONS = os.getenv("PIP_PACKAGE_INDEX_OPTIONS", "").split()
810794

811-
812795
####################################
813796
# PROGRESSIVE WEB APP OPTIONS
814797
####################################

backend/open_webui/utils/middleware.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,7 @@ def restricted_import(name, globals=None, locals=None, fromlist=(), level=0):
31133113
command_handler.command_record = CommandRecord(
31143114
input=user_message, output=data['content']
31153115
)
3116+
asyncio.create_task(command_handler.record_command())
31163117
asyncio.create_task(ReplayHandler(chat_id).write_input(data['content']))
31173118

31183119
if not ENABLE_REALTIME_CHAT_SAVE:

src/lib/components/chat/Navbar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
{#if !chat?.id}
117117
<Tooltip content={$i18n.t(`Temporary Chat`)}>
118118
<button
119-
class="flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition"
119+
class="flex cursor-pointer px-2 py-2 rounded-xl hover:bg-gray-50 dark:hover:bg-gray-850 transition hidden"
120120
id="temporary-chat-button"
121121
on:click={async () => {
122122
if (($settings?.temporaryChatByDefault ?? false) && $temporaryChatEnabled) {

src/lib/components/layout/Sidebar.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
toggleChatPinnedStatusById,
4040
getChatById,
4141
updateChatFolderIdById,
42-
importChat
42+
importChat,
43+
getChatListBySearchText
4344
} from '$lib/apis/chats';
4445
import { createNewFolder, getFolders, updateFolderParentIdById } from '$lib/apis/folders';
4546
import { WEBUI_BASE_URL } from '$lib/constants';

0 commit comments

Comments
 (0)