From a1d09eae9590e83969f422e3998be0bc060157a0 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 19 Nov 2025 03:23:33 -0500 Subject: [PATCH] chore: format --- backend/open_webui/env.py | 16 ++++++------ backend/open_webui/models/users.py | 4 ++- .../retrieval/vector/dbs/pgvector.py | 4 +-- .../retrieval/vector/dbs/s3vector.py | 25 +++++++++---------- backend/open_webui/routers/prompts.py | 4 ++- backend/open_webui/socket/main.py | 8 +++--- .../components/chat/Settings/Interface.svelte | 6 +---- .../components/layout/Sidebar/ChatItem.svelte | 3 ++- src/lib/i18n/locales/ar-BH/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ar/translation.json | 19 +++++++++++--- src/lib/i18n/locales/bg-BG/translation.json | 19 +++++++++++--- src/lib/i18n/locales/bn-BD/translation.json | 19 +++++++++++--- src/lib/i18n/locales/bo-TB/translation.json | 19 +++++++++++--- src/lib/i18n/locales/bs-BA/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ca-ES/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ceb-PH/translation.json | 19 +++++++++++--- src/lib/i18n/locales/cs-CZ/translation.json | 19 +++++++++++--- src/lib/i18n/locales/da-DK/translation.json | 19 +++++++++++--- src/lib/i18n/locales/de-DE/translation.json | 19 +++++++++++--- src/lib/i18n/locales/dg-DG/translation.json | 19 +++++++++++--- src/lib/i18n/locales/el-GR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/en-GB/translation.json | 19 +++++++++++--- src/lib/i18n/locales/en-US/translation.json | 22 +++++++++++----- src/lib/i18n/locales/es-ES/translation.json | 19 +++++++++++--- src/lib/i18n/locales/et-EE/translation.json | 19 +++++++++++--- src/lib/i18n/locales/eu-ES/translation.json | 19 +++++++++++--- src/lib/i18n/locales/fa-IR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/fi-FI/translation.json | 19 +++++++++++--- src/lib/i18n/locales/fr-CA/translation.json | 19 +++++++++++--- src/lib/i18n/locales/fr-FR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/gl-ES/translation.json | 19 +++++++++++--- src/lib/i18n/locales/he-IL/translation.json | 19 +++++++++++--- src/lib/i18n/locales/hi-IN/translation.json | 19 +++++++++++--- src/lib/i18n/locales/hr-HR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/hu-HU/translation.json | 19 +++++++++++--- src/lib/i18n/locales/id-ID/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ie-GA/translation.json | 19 +++++++++++--- src/lib/i18n/locales/it-IT/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ja-JP/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ka-GE/translation.json | 19 +++++++++++--- src/lib/i18n/locales/kab-DZ/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ko-KR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/lt-LT/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ms-MY/translation.json | 19 +++++++++++--- src/lib/i18n/locales/nb-NO/translation.json | 19 +++++++++++--- src/lib/i18n/locales/nl-NL/translation.json | 19 +++++++++++--- src/lib/i18n/locales/pa-IN/translation.json | 19 +++++++++++--- src/lib/i18n/locales/pl-PL/translation.json | 19 +++++++++++--- src/lib/i18n/locales/pt-BR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/pt-PT/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ro-RO/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ru-RU/translation.json | 19 +++++++++++--- src/lib/i18n/locales/sk-SK/translation.json | 19 +++++++++++--- src/lib/i18n/locales/sr-RS/translation.json | 19 +++++++++++--- src/lib/i18n/locales/sv-SE/translation.json | 19 +++++++++++--- src/lib/i18n/locales/th-TH/translation.json | 19 +++++++++++--- src/lib/i18n/locales/tk-TM/translation.json | 19 +++++++++++--- src/lib/i18n/locales/tr-TR/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ug-CN/translation.json | 19 +++++++++++--- src/lib/i18n/locales/uk-UA/translation.json | 19 +++++++++++--- src/lib/i18n/locales/ur-PK/translation.json | 19 +++++++++++--- .../i18n/locales/uz-Cyrl-UZ/translation.json | 19 +++++++++++--- .../i18n/locales/uz-Latn-Uz/translation.json | 19 +++++++++++--- src/lib/i18n/locales/vi-VN/translation.json | 19 +++++++++++--- src/lib/i18n/locales/zh-CN/translation.json | 19 +++++++++++--- src/lib/i18n/locales/zh-TW/translation.json | 19 +++++++++++--- 66 files changed, 964 insertions(+), 211 deletions(-) diff --git a/backend/open_webui/env.py b/backend/open_webui/env.py index 288b08dd16..6ec03493f7 100644 --- a/backend/open_webui/env.py +++ b/backend/open_webui/env.py @@ -604,12 +604,10 @@ if WEBSOCKET_REDIS_OPTIONS == "": WEBSOCKET_REDIS_OPTIONS = None else: try: - WEBSOCKET_REDIS_OPTIONS = json.loads( - WEBSOCKET_REDIS_OPTIONS - ) + WEBSOCKET_REDIS_OPTIONS = json.loads(WEBSOCKET_REDIS_OPTIONS) except Exception: log.warning("Invalid WEBSOCKET_REDIS_OPTIONS, defaulting to None") - WEBSOCKET_REDIS_OPTIONS = None + WEBSOCKET_REDIS_OPTIONS = None WEBSOCKET_REDIS_URL = os.environ.get("WEBSOCKET_REDIS_URL", REDIS_URL) WEBSOCKET_REDIS_CLUSTER = ( @@ -625,14 +623,18 @@ except ValueError: WEBSOCKET_SENTINEL_HOSTS = os.environ.get("WEBSOCKET_SENTINEL_HOSTS", "") WEBSOCKET_SENTINEL_PORT = os.environ.get("WEBSOCKET_SENTINEL_PORT", "26379") -WEBSOCKET_SERVER_LOGGING = os.environ.get("WEBSOCKET_SERVER_LOGGING", "False").lower() == "true" -WEBSOCKET_SERVER_ENGINEIO_LOGGING = os.environ.get("WEBSOCKET_SERVER_LOGGING", "False").lower() == "true" +WEBSOCKET_SERVER_LOGGING = ( + os.environ.get("WEBSOCKET_SERVER_LOGGING", "False").lower() == "true" +) +WEBSOCKET_SERVER_ENGINEIO_LOGGING = ( + os.environ.get("WEBSOCKET_SERVER_LOGGING", "False").lower() == "true" +) WEBSOCKET_SERVER_PING_TIMEOUT = os.environ.get("WEBSOCKET_SERVER_PING_TIMEOUT", "20") try: WEBSOCKET_SERVER_PING_TIMEOUT = int(WEBSOCKET_SERVER_PING_TIMEOUT) except ValueError: WEBSOCKET_SERVER_PING_TIMEOUT = 20 - + WEBSOCKET_SERVER_PING_INTERVAL = os.environ.get("WEBSOCKET_SERVER_PING_INTERVAL", "25") try: WEBSOCKET_SERVER_PING_INTERVAL = int(WEBSOCKET_SERVER_PING_INTERVAL) diff --git a/backend/open_webui/models/users.py b/backend/open_webui/models/users.py index b9e40abf0b..256d3bc75e 100644 --- a/backend/open_webui/models/users.py +++ b/backend/open_webui/models/users.py @@ -345,7 +345,9 @@ class UsersTable: with get_db() as db: current_timestamp = int(datetime.datetime.now().timestamp()) today_midnight_timestamp = current_timestamp - (current_timestamp % 86400) - query = db.query(User).filter(User.last_active_at > today_midnight_timestamp) + query = db.query(User).filter( + User.last_active_at > today_midnight_timestamp + ) return query.count() def update_user_role_by_id(self, id: str, role: str) -> Optional[UserModel]: diff --git a/backend/open_webui/retrieval/vector/dbs/pgvector.py b/backend/open_webui/retrieval/vector/dbs/pgvector.py index 3ffad4fc48..85c2ef009d 100644 --- a/backend/open_webui/retrieval/vector/dbs/pgvector.py +++ b/backend/open_webui/retrieval/vector/dbs/pgvector.py @@ -209,9 +209,7 @@ class PgvectorClient(VectorDBBase): index_method = "ivfflat" if index_method == "hnsw": - index_options = ( - f"WITH (m = {PGVECTOR_HNSW_M}, ef_construction = {PGVECTOR_HNSW_EF_CONSTRUCTION})" - ) + index_options = f"WITH (m = {PGVECTOR_HNSW_M}, ef_construction = {PGVECTOR_HNSW_EF_CONSTRUCTION})" else: index_options = f"WITH (lists = {PGVECTOR_IVFFLAT_LISTS})" diff --git a/backend/open_webui/retrieval/vector/dbs/s3vector.py b/backend/open_webui/retrieval/vector/dbs/s3vector.py index bada99cde0..e2a7adfd8b 100644 --- a/backend/open_webui/retrieval/vector/dbs/s3vector.py +++ b/backend/open_webui/retrieval/vector/dbs/s3vector.py @@ -116,19 +116,18 @@ class S3VectorClient(VectorDBBase): return filtered_metadata def has_collection(self, collection_name: str) -> bool: - """ - Check if a vector index exists using direct lookup. - This avoids pagination issues with list_indexes() and is significantly faster. - """ - try: - self.client.get_index( - vectorBucketName=self.bucket_name, - indexName=collection_name - ) - return True - except Exception as e: - log.error(f"Error checking if index '{collection_name}' exists: {e}") - return False + """ + Check if a vector index exists using direct lookup. + This avoids pagination issues with list_indexes() and is significantly faster. + """ + try: + self.client.get_index( + vectorBucketName=self.bucket_name, indexName=collection_name + ) + return True + except Exception as e: + log.error(f"Error checking if index '{collection_name}' exists: {e}") + return False def delete_collection(self, collection_name: str) -> None: """ diff --git a/backend/open_webui/routers/prompts.py b/backend/open_webui/routers/prompts.py index c056489e0a..6a957f2547 100644 --- a/backend/open_webui/routers/prompts.py +++ b/backend/open_webui/routers/prompts.py @@ -53,7 +53,9 @@ async def create_new_prompt( user.id, "workspace.prompts", request.app.state.config.USER_PERMISSIONS ) or has_permission( - user.id, "workspace.prompts_import", request.app.state.config.USER_PERMISSIONS + user.id, + "workspace.prompts_import", + request.app.state.config.USER_PERMISSIONS, ) ): raise HTTPException( diff --git a/backend/open_webui/socket/main.py b/backend/open_webui/socket/main.py index 2ef556f987..f79d1dd958 100644 --- a/backend/open_webui/socket/main.py +++ b/backend/open_webui/socket/main.py @@ -70,7 +70,9 @@ if WEBSOCKET_MANAGER == "redis": redis_options=WEBSOCKET_REDIS_OPTIONS, ) else: - mgr = socketio.AsyncRedisManager(WEBSOCKET_REDIS_URL, redis_options=WEBSOCKET_REDIS_OPTIONS) + mgr = socketio.AsyncRedisManager( + WEBSOCKET_REDIS_URL, redis_options=WEBSOCKET_REDIS_OPTIONS + ) sio = socketio.AsyncServer( cors_allowed_origins=SOCKETIO_CORS_ORIGINS, async_mode="asgi", @@ -81,7 +83,7 @@ if WEBSOCKET_MANAGER == "redis": logger=WEBSOCKET_SERVER_LOGGING, ping_interval=WEBSOCKET_SERVER_PING_INTERVAL, ping_timeout=WEBSOCKET_SERVER_PING_TIMEOUT, - engineio_logger=WEBSOCKET_SERVER_ENGINEIO_LOGGING, + engineio_logger=WEBSOCKET_SERVER_ENGINEIO_LOGGING, ) else: sio = socketio.AsyncServer( @@ -93,7 +95,7 @@ else: logger=WEBSOCKET_SERVER_LOGGING, ping_interval=WEBSOCKET_SERVER_PING_INTERVAL, ping_timeout=WEBSOCKET_SERVER_PING_TIMEOUT, - engineio_logger=WEBSOCKET_SERVER_ENGINEIO_LOGGING, + engineio_logger=WEBSOCKET_SERVER_ENGINEIO_LOGGING, ) diff --git a/src/lib/components/chat/Settings/Interface.svelte b/src/lib/components/chat/Settings/Interface.svelte index 1b0d978ae5..7c3939b02c 100644 --- a/src/lib/components/chat/Settings/Interface.svelte +++ b/src/lib/components/chat/Settings/Interface.svelte @@ -396,11 +396,7 @@
-