From 8927c9bb3d4b04f4fc8e443f42089f2a551276bc Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 29 Jun 2026 05:14:34 -0500 Subject: [PATCH] refac --- backend/open_webui/main.py | 8 ++++---- backend/open_webui/models/chats.py | 1 + src/lib/components/layout/SearchModal.svelte | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index aa93d27328..594149d343 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -556,7 +556,7 @@ async def initialize_runtime_config(app: FastAPI): for tool_server_connection in connections: if tool_server_connection.get('type', 'openapi') == 'mcp': - server_id = tool_server_connection.get('info', {}).get('id') + server_id = (tool_server_connection.get('info') or {}).get('id') auth_type = tool_server_connection.get('auth_type', 'none') if server_id and auth_type in ('oauth_2.1', 'oauth_2.1_static'): @@ -2257,7 +2257,7 @@ async def register_client(request, client_id: str) -> bool: tool_server_connections = await Config.get('tool_server.connections', []) or [] for idx, conn in enumerate(tool_server_connections): if conn.get('type', 'openapi') == server_type: - info = conn.get('info', {}) + info = conn.get('info') or {} if info.get('id') == server_id: connection = conn connection_idx = idx @@ -2275,7 +2275,7 @@ async def register_client(request, client_id: str) -> bool: try: if auth_type == 'oauth_2.1_static': # Static credentials: rebuild from admin-provided credentials + fresh metadata - info = connection.get('info', {}) + info = connection.get('info') or {} oauth_client_id = info.get('oauth_client_id') or '' oauth_client_secret = info.get('oauth_client_secret') or '' if not oauth_client_id or not oauth_client_secret: @@ -2312,7 +2312,7 @@ async def register_client(request, client_id: str) -> bool: connections[connection_idx] = { **connection, 'info': { - **connection.get('info', {}), + **(connection.get('info') or {}), 'oauth_client_info': encrypt_data(oauth_client_info.model_dump(mode='json')), }, } diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index ca1a2dcd67..acbbf06591 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -179,6 +179,7 @@ class ChatTitleIdResponse(BaseModel): updated_at: int created_at: int last_read_at: int | None = None + snippet: str | None = None class SharedChatResponse(BaseModel): diff --git a/src/lib/components/layout/SearchModal.svelte b/src/lib/components/layout/SearchModal.svelte index 7d007a6fed..23049b43a4 100644 --- a/src/lib/components/layout/SearchModal.svelte +++ b/src/lib/components/layout/SearchModal.svelte @@ -697,6 +697,11 @@
{chat?.title}
+ {#if chat?.snippet} +
+ {chat.snippet} +
+ {/if} {/if}