From c004b4ecb5b04f007d652919db73d749fcc0bd12 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 27 Jul 2026 04:38:46 -0400 Subject: [PATCH] chore: format --- backend/open_webui/config.py | 6 +---- backend/open_webui/models/chats.py | 4 +--- backend/open_webui/retrieval/web/utils.py | 6 ++--- backend/open_webui/routers/auths.py | 3 ++- backend/open_webui/routers/channels.py | 4 +++- backend/open_webui/routers/folders.py | 6 +++-- backend/open_webui/tools/builtin.py | 10 ++++---- backend/open_webui/utils/middleware.py | 19 +++++---------- .../admin/Settings/Documents.svelte | 4 +++- src/lib/components/chat/Chat.svelte | 6 ++++- src/lib/i18n/locales/ar-BH/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ar/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/az-AZ/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/bg-BG/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/bn-BD/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/bo-TB/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/bs-BA/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ca-ES/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ceb-PH/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/cs-CZ/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/da-DK/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/de-DE/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/dg-DG/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/el-GR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/en-GB/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/en-US/translation.json | 21 +++++++++++++---- src/lib/i18n/locales/es-ES/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/et-EE/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/eu-ES/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/fa-IR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/fi-FI/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/fil-PH/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/fr-CA/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/fr-FR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/gl-ES/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/he-IL/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/hi-IN/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/hr-HR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/hu-HU/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/id-ID/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ie-GA/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/it-IT/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ja-JP/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ka-GE/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/kab-DZ/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ko-KR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/lt-LT/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/lv-LV/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ms-MY/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/nb-NO/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/nl-NL/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/pa-IN/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/pl-PL/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/pt-BR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/pt-PT/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ro-RO/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ru-RU/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/sk-SK/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/sl-SI/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/sr-RS/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/sv-SE/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ta-IN/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/th-TH/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/tk-TM/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/tr-TR/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ug-CN/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/uk-UA/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/ur-PK/translation.json | 23 +++++++++++++++---- .../i18n/locales/uz-Cyrl-UZ/translation.json | 23 +++++++++++++++---- .../i18n/locales/uz-Latn-UZ/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/vi-VN/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/zh-CN/translation.json | 23 +++++++++++++++---- src/lib/i18n/locales/zh-TW/translation.json | 23 +++++++++++++++---- 73 files changed, 1165 insertions(+), 350 deletions(-) diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index b0b08c90ab..ec541f5a33 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -855,11 +855,7 @@ CONTENT_EXTRACTION_ENGINE = os.getenv('CONTENT_EXTRACTION_ENGINE', '').lower() content_extraction_supported_media_mime_types = os.getenv('CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES') CONTENT_EXTRACTION_SUPPORTED_MEDIA_MIME_TYPES = ( - [ - mime_type.strip() - for mime_type in content_extraction_supported_media_mime_types.split(',') - if mime_type.strip() - ] + [mime_type.strip() for mime_type in content_extraction_supported_media_mime_types.split(',') if mime_type.strip()] if content_extraction_supported_media_mime_types is not None else None ) diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 279b037fdf..26e9dd3fc1 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -870,9 +870,7 @@ class ChatTable: **message, 'id': message.get('id') or message_id, 'parentId': message_parent_id if message_parent_id is not None else parent_id, - 'childrenIds': ( - message.get('childrenIds') if isinstance(message.get('childrenIds'), list) else [] - ), + 'childrenIds': (message.get('childrenIds') if isinstance(message.get('childrenIds'), list) else []), 'role': role, 'timestamp': message.get('timestamp') or int(time.time()), } diff --git a/backend/open_webui/retrieval/web/utils.py b/backend/open_webui/retrieval/web/utils.py index 5d143e9d5c..8c13689fab 100644 --- a/backend/open_webui/retrieval/web/utils.py +++ b/backend/open_webui/retrieval/web/utils.py @@ -91,11 +91,11 @@ def _is_global_addr(ip: str) -> bool: embedded.extend(addr.teredo) b = addr.packed - if b[:12] == b"\x00" * 12: + if b[:12] == b'\x00' * 12: embedded.append(ipaddress.IPv4Address(b[12:])) - elif b[:12] == b"\x00\x64\xff\x9b" + b"\x00" * 8: + elif b[:12] == b'\x00\x64\xff\x9b' + b'\x00' * 8: embedded.append(ipaddress.IPv4Address(b[12:])) - elif b[:6] == b"\x00\x64\xff\x9b\x00\x01": + elif b[:6] == b'\x00\x64\xff\x9b\x00\x01': if b[8] != 0: return False embedded.append(ipaddress.IPv4Address(bytes((b[6], b[7], b[9], b[10])))) diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index 5648a19a1e..a5f4bca140 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -764,7 +764,8 @@ async def signin( user_id=trusted_header_user_id(email), ) except IntegrityError: - pass + if not await Users.get_user_by_email(email.lower(), db=db): + raise user = await Auths.authenticate_user_by_email(email, db=db) if user: diff --git a/backend/open_webui/routers/channels.py b/backend/open_webui/routers/channels.py index 7bef2eb9d8..33472ba1b6 100644 --- a/backend/open_webui/routers/channels.py +++ b/backend/open_webui/routers/channels.py @@ -990,7 +990,9 @@ async def model_response_handler(request, channel, message, user, db=None): response_parent_id = ( message.parent_id if message.parent_id - else (message.id if await Config.get('channels.model_response_mode', 'thread') == 'thread' else None) + else ( + message.id if await Config.get('channels.model_response_mode', 'thread') == 'thread' else None + ) ) response_message, channel = await new_message_handler( diff --git a/backend/open_webui/routers/folders.py b/backend/open_webui/routers/folders.py index 3221e984a0..511d3ee002 100644 --- a/backend/open_webui/routers/folders.py +++ b/backend/open_webui/routers/folders.py @@ -186,8 +186,10 @@ async def create_folder( detail=ERROR_MESSAGES.DEFAULT('Error creating folder'), ) - if form_data.data and 'files' in form_data.data and not await can_read_all_folder_files( - form_data.data['files'], user, db=db + if ( + form_data.data + and 'files' in form_data.data + and not await can_read_all_folder_files(form_data.data['files'], user, db=db) ): raise HTTPException( status_code=status.HTTP_403_FORBIDDEN, diff --git a/backend/open_webui/tools/builtin.py b/backend/open_webui/tools/builtin.py index 03b18ca655..1b721f19a1 100644 --- a/backend/open_webui/tools/builtin.py +++ b/backend/open_webui/tools/builtin.py @@ -2423,9 +2423,9 @@ async def query_chat_files( items=file_items, queries=[query], embedding_function=( - lambda queries, prefix: embedding_function(queries, prefix=prefix, user=user_model) - if embedding_function - else None + lambda queries, prefix: ( + embedding_function(queries, prefix=prefix, user=user_model) if embedding_function else None + ) ), k=count, reranking_function=( @@ -3155,9 +3155,7 @@ async def query_knowledge_files( __request__, collection_names=collection_names, queries=[query], - embedding_function=lambda queries, prefix: embedding_function( - queries, prefix=prefix, user=user_model - ), + embedding_function=lambda queries, prefix: embedding_function(queries, prefix=prefix, user=user_model), k=count, ) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 9e76cca824..7f756b4366 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -2871,10 +2871,7 @@ async def process_chat_payload(request, form_data, user, metadata, model): for item in get_attached_knowledge(model, metadata): if not item.get('id') or not item.get('type'): continue - attrs = ( - f'type="{escape(str(item["type"]), quote=True)}" ' - f'id="{escape(str(item["id"]), quote=True)}"' - ) + attrs = f'type="{escape(str(item["type"]), quote=True)}" id="{escape(str(item["id"]), quote=True)}"' if item.get('name'): attrs += f' name="{escape(str(item["name"]), quote=True)}"' if item.get('source'): @@ -2946,9 +2943,7 @@ async def process_chat_payload(request, form_data, user, metadata, model): ) if resolved_model_system_prompt: system_content = ( - f'{resolved_model_system_prompt}\n{system_content}' - if system_content - else resolved_model_system_prompt + f'{resolved_model_system_prompt}\n{system_content}' if system_content else resolved_model_system_prompt ) metadata['system_prompt'] = system_content or None metadata['user_prompt'] = get_last_user_message(form_data['messages']) @@ -3779,9 +3774,7 @@ async def streaming_chat_response_handler(response, ctx): } filter_functions = ( - await get_filter_functions(request, model, metadata.get('filter_ids', [])) - if ENABLE_PLUGINS - else [] + await get_filter_functions(request, model, metadata.get('filter_ids', [])) if ENABLE_PLUGINS else [] ) # Standard streaming response handler @@ -4500,9 +4493,9 @@ async def streaming_chat_response_handler(response, ctx): str, ): current_response_tool_call['function']['arguments'] = '' - current_response_tool_call['function'][ - 'arguments' - ] += delta_arguments + current_response_tool_call['function']['arguments'] += ( + delta_arguments + ) # Emit pending tool calls in real-time if response_tool_calls: diff --git a/src/lib/components/admin/Settings/Documents.svelte b/src/lib/components/admin/Settings/Documents.svelte index 86248b170c..3f2911ff36 100644 --- a/src/lib/components/admin/Settings/Documents.svelte +++ b/src/lib/components/admin/Settings/Documents.svelte @@ -415,7 +415,9 @@