From 9044abf3bb78eb6ce139102191b79b98cee654f1 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 23 Feb 2026 01:40:53 -0600 Subject: [PATCH] chore: format --- backend/open_webui/main.py | 11 ++- backend/open_webui/models/chats.py | 4 +- backend/open_webui/models/tools.py | 6 +- backend/open_webui/routers/files.py | 4 +- backend/open_webui/routers/tools.py | 19 ++++- backend/open_webui/utils/logger.py | 4 +- backend/open_webui/utils/middleware.py | 11 ++- package-lock.json | 4 +- package.json | 2 +- src/lib/apis/models/index.ts | 7 +- .../admin/Settings/Interface.svelte | 5 +- src/lib/components/app/AppSidebar.svelte | 5 +- src/lib/components/chat/Chat.svelte | 5 +- .../chat/MessageInput/InputMenu.svelte | 3 +- .../components/chat/Messages/Citations.svelte | 8 +- .../ResponseMessage/RegenerateMenu.svelte | 16 ++-- .../chat/ModelSelector/Selector.svelte | 4 +- src/lib/components/chat/Overview/Node.svelte | 4 +- .../chat/Placeholder/FolderTitle.svelte | 6 +- .../Settings/Advanced/AdvancedParams.svelte | 80 +++++++++---------- .../components/common/ConfirmDialog.svelte | 4 +- src/lib/components/common/Dropdown.svelte | 9 +-- .../components/common/ToolCallDisplay.svelte | 7 +- .../icons/ArrowTurnDownRight.svelte | 8 +- .../components/icons/Bars3BottomLeft.svelte | 8 +- src/lib/components/icons/CalendarSolid.svelte | 8 +- src/lib/components/icons/CameraSolid.svelte | 8 +- src/lib/components/icons/ChartBar.svelte | 8 +- src/lib/components/icons/Cog6Solid.svelte | 8 +- .../components/icons/CommandLineSolid.svelte | 8 +- .../icons/DocumentArrowUpSolid.svelte | 8 +- .../components/icons/DocumentChartBar.svelte | 8 +- src/lib/components/icons/GlobeAltSolid.svelte | 8 +- src/lib/components/icons/MicSolid.svelte | 8 +- src/lib/components/icons/PencilSolid.svelte | 8 +- src/lib/components/icons/PhotoSolid.svelte | 8 +- src/lib/components/icons/SparklesSolid.svelte | 8 +- src/lib/components/icons/User.svelte | 8 +- .../components/icons/UserCircleSolid.svelte | 8 +- src/lib/components/icons/UserPlusSolid.svelte | 8 +- src/lib/components/icons/UsersSolid.svelte | 8 +- src/lib/components/icons/WrenchSolid.svelte | 8 +- src/lib/components/layout/Navbar/Menu.svelte | 36 ++++++--- .../components/layout/Sidebar/ChatMenu.svelte | 36 ++++++--- src/lib/components/workspace/Models.svelte | 4 +- .../workspace/Models/ModelEditor.svelte | 7 +- src/lib/i18n/locales/ar-BH/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ar/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/bg-BG/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/bn-BD/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/bo-TB/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/bs-BA/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ca-ES/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ceb-PH/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/cs-CZ/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/da-DK/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/de-DE/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/dg-DG/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/el-GR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/en-GB/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/en-US/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/es-ES/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/et-EE/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/eu-ES/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/fa-IR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/fi-FI/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/fr-CA/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/fr-FR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/gl-ES/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/he-IL/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/hi-IN/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/hr-HR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/hu-HU/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/id-ID/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ie-GA/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/it-IT/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ja-JP/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ka-GE/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/kab-DZ/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ko-KR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/lt-LT/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/lv-LV/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ms-MY/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/nb-NO/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/nl-NL/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/pa-IN/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/pl-PL/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/pt-BR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/pt-PT/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ro-RO/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ru-RU/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/sk-SK/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/sr-RS/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/sv-SE/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/th-TH/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/tk-TM/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/tr-TR/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ug-CN/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/uk-UA/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/ur-PK/translation.json | 70 +++++++++++++--- .../i18n/locales/uz-Cyrl-UZ/translation.json | 70 +++++++++++++--- .../i18n/locales/uz-Latn-Uz/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/vi-VN/translation.json | 70 +++++++++++++--- src/lib/i18n/locales/zh-CN/translation.json | 46 +++++++++-- src/lib/i18n/locales/zh-TW/translation.json | 46 +++++++++-- 105 files changed, 3884 insertions(+), 661 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 322b00638e..d1e8039561 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -1700,7 +1700,11 @@ async def chat_completion( ) model_info_params = { **default_model_params, - **(model_info.params.model_dump() if model_info and model_info.params else {}), + **( + model_info.params.model_dump() + if model_info and model_info.params + else {} + ), } # Check base model existence for custom models @@ -1716,7 +1720,10 @@ async def chat_completion( default_models[0].strip() if default_models[0] else None ) - if fallback_model_id and fallback_model_id in request.app.state.MODELS: + if ( + fallback_model_id + and fallback_model_id in request.app.state.MODELS + ): # Update model and form_data so routing uses the fallback model's type model = request.app.state.MODELS[fallback_model_id] form_data["model"] = fallback_model_id diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index 7b490102b7..8c6eb830b5 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -631,7 +631,9 @@ class ChatTable: with get_db_context(db) as db: # Use subquery to delete chat_messages for shared chats shared_chat_id_subquery = ( - db.query(Chat.id).filter_by(user_id=f"shared-{chat_id}").scalar_subquery() + db.query(Chat.id) + .filter_by(user_id=f"shared-{chat_id}") + .scalar_subquery() ) db.query(ChatMessage).filter( ChatMessage.chat_id.in_(shared_chat_id_subquery) diff --git a/backend/open_webui/models/tools.py b/backend/open_webui/models/tools.py index 62fe71abee..f813ce21cd 100644 --- a/backend/open_webui/models/tools.py +++ b/backend/open_webui/models/tools.py @@ -190,7 +190,11 @@ class ToolsTable: return tools def get_tools_by_user_id( - self, user_id: str, permission: str = "write", defer_content: bool = False, db: Optional[Session] = None + self, + user_id: str, + permission: str = "write", + defer_content: bool = False, + db: Optional[Session] = None, ) -> list[ToolUserModel]: tools = self.get_tools(defer_content=defer_content, db=db) user_group_ids = { diff --git a/backend/open_webui/routers/files.py b/backend/open_webui/routers/files.py index 5fbbbf3cc4..68ef37afe4 100644 --- a/backend/open_webui/routers/files.py +++ b/backend/open_webui/routers/files.py @@ -165,9 +165,7 @@ def process_uploaded_file( request.app.state.config, "STT_SUPPORTED_CONTENT_TYPES", [] ) - if strict_match_mime_type( - stt_supported_content_types, content_type - ): + if strict_match_mime_type(stt_supported_content_types, content_type): file_path_processed = Storage.get_file(file_path) result = transcribe( request, file_path_processed, file_metadata, user diff --git a/backend/open_webui/routers/tools.py b/backend/open_webui/routers/tools.py index b2d35ccc6c..531cfe16a7 100644 --- a/backend/open_webui/routers/tools.py +++ b/backend/open_webui/routers/tools.py @@ -65,12 +65,18 @@ async def get_tools( # Local Tools for tool in Tools.get_tools(defer_content=True, db=db): - tool_module = request.app.state.TOOLS.get(tool.id) if hasattr(request.app.state, 'TOOLS') else None + tool_module = ( + request.app.state.TOOLS.get(tool.id) + if hasattr(request.app.state, "TOOLS") + else None + ) tools.append( ToolUserResponse( **{ **tool.model_dump(), - "has_user_valves": hasattr(tool_module, "UserValves") if tool_module else False, + "has_user_valves": ( + hasattr(tool_module, "UserValves") if tool_module else False + ), } ) ) @@ -212,8 +218,13 @@ async def get_tool_list( or any( g.permission == "write" and ( - (g.principal_type == "user" and (g.principal_id == user.id or g.principal_id == "*")) - or (g.principal_type == "group" and g.principal_id in user_group_ids) + ( + g.principal_type == "user" + and (g.principal_id == user.id or g.principal_id == "*") + ) + or ( + g.principal_type == "group" and g.principal_id in user_group_ids + ) ) for g in tool.access_grants ) diff --git a/backend/open_webui/utils/logger.py b/backend/open_webui/utils/logger.py index 506b526b9a..283f37ea66 100644 --- a/backend/open_webui/utils/logger.py +++ b/backend/open_webui/utils/logger.py @@ -62,9 +62,7 @@ def _json_sink(message: "Message") -> None: log_entry["extra"] = record["extra"] if record["exception"] is not None: - log_entry["error"] = "".join( - record["exception"].format_exception() - ).rstrip() + log_entry["error"] = "".join(record["exception"].format_exception()).rstrip() sys.stdout.write(json.dumps(log_entry, ensure_ascii=False, default=str) + "\n") sys.stdout.flush() diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index a2fd61bbbe..763d74bd13 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -2330,7 +2330,8 @@ async def process_chat_payload(request, form_data, user, metadata, model): ) in request.app.state.config.TOOL_SERVER_CONNECTIONS: if ( server_connection.get("type", "") == "mcp" - and server_connection.get("info", {}).get("id") == server_id + and server_connection.get("info", {}).get("id") + == server_id ): mcp_server_connection = server_connection break @@ -2391,8 +2392,8 @@ async def process_chat_payload(request, form_data, user, metadata, model): if ENABLE_FORWARD_USER_INFO_HEADERS and user: headers = include_user_info_headers(headers, user) if metadata and metadata.get("chat_id"): - headers[FORWARD_SESSION_INFO_HEADER_CHAT_ID] = metadata.get( - "chat_id" + headers[FORWARD_SESSION_INFO_HEADER_CHAT_ID] = ( + metadata.get("chat_id") ) if metadata and metadata.get("message_id"): headers[FORWARD_SESSION_INFO_HEADER_MESSAGE_ID] = ( @@ -2410,7 +2411,9 @@ async def process_chat_payload(request, form_data, user, metadata, model): ).get("function_name_filter_list", "") if isinstance(function_name_filter_list, str): - function_name_filter_list = function_name_filter_list.split(",") + function_name_filter_list = function_name_filter_list.split( + "," + ) tool_specs = await mcp_clients[server_id].list_tool_specs() for tool_spec in tool_specs: diff --git a/package-lock.json b/package-lock.json index c00d8c1c3a..467452cac3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "open-webui", - "version": "0.8.3", + "version": "0.8.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "open-webui", - "version": "0.8.3", + "version": "0.8.4", "dependencies": { "@azure/msal-browser": "^4.5.0", "@codemirror/lang-javascript": "^6.2.2", diff --git a/package.json b/package.json index 5c6198522f..e4f677ee7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-webui", - "version": "0.8.3", + "version": "0.8.4", "private": true, "scripts": { "dev": "npm run pyodide:fetch && vite dev --host", diff --git a/src/lib/apis/models/index.ts b/src/lib/apis/models/index.ts index b6362a5986..05f273c306 100644 --- a/src/lib/apis/models/index.ts +++ b/src/lib/apis/models/index.ts @@ -281,7 +281,12 @@ export const updateModelById = async (token: string, id: string, model: object) return res; }; -export const updateModelAccessGrants = async (token: string, id: string, name: string, accessGrants: any[]) => { +export const updateModelAccessGrants = async ( + token: string, + id: string, + name: string, + accessGrants: any[] +) => { let error = null; const res = await fetch(`${WEBUI_API_BASE_URL}/models/model/access/update`, { diff --git a/src/lib/components/admin/Settings/Interface.svelte b/src/lib/components/admin/Settings/Interface.svelte index f36805ddc4..db7f1b6146 100644 --- a/src/lib/components/admin/Settings/Interface.svelte +++ b/src/lib/components/admin/Settings/Interface.svelte @@ -38,7 +38,6 @@ taskConfig = await updateTaskConfig(localStorage.token, taskConfig); }; - let workspaceModels = null; let baseModels = null; @@ -73,9 +72,7 @@ console.debug('models', models); } catch (err) { console.error('Failed to initialize Interface settings:', err); - toast.error( - err?.detail ?? err?.message ?? $i18n.t('Failed to load Interface settings') - ); + toast.error(err?.detail ?? err?.message ?? $i18n.t('Failed to load Interface settings')); models = []; } }; diff --git a/src/lib/components/app/AppSidebar.svelte b/src/lib/components/app/AppSidebar.svelte index 2e8544040d..8c367c86e9 100644 --- a/src/lib/components/app/AppSidebar.svelte +++ b/src/lib/components/app/AppSidebar.svelte @@ -6,7 +6,10 @@ let selected = ''; -