Skip to content

Commit 8927c9b

Browse files
committed
refac
1 parent 422a476 commit 8927c9b

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

backend/open_webui/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ async def initialize_runtime_config(app: FastAPI):
556556

557557
for tool_server_connection in connections:
558558
if tool_server_connection.get('type', 'openapi') == 'mcp':
559-
server_id = tool_server_connection.get('info', {}).get('id')
559+
server_id = (tool_server_connection.get('info') or {}).get('id')
560560
auth_type = tool_server_connection.get('auth_type', 'none')
561561

562562
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:
22572257
tool_server_connections = await Config.get('tool_server.connections', []) or []
22582258
for idx, conn in enumerate(tool_server_connections):
22592259
if conn.get('type', 'openapi') == server_type:
2260-
info = conn.get('info', {})
2260+
info = conn.get('info') or {}
22612261
if info.get('id') == server_id:
22622262
connection = conn
22632263
connection_idx = idx
@@ -2275,7 +2275,7 @@ async def register_client(request, client_id: str) -> bool:
22752275
try:
22762276
if auth_type == 'oauth_2.1_static':
22772277
# Static credentials: rebuild from admin-provided credentials + fresh metadata
2278-
info = connection.get('info', {})
2278+
info = connection.get('info') or {}
22792279
oauth_client_id = info.get('oauth_client_id') or ''
22802280
oauth_client_secret = info.get('oauth_client_secret') or ''
22812281
if not oauth_client_id or not oauth_client_secret:
@@ -2312,7 +2312,7 @@ async def register_client(request, client_id: str) -> bool:
23122312
connections[connection_idx] = {
23132313
**connection,
23142314
'info': {
2315-
**connection.get('info', {}),
2315+
**(connection.get('info') or {}),
23162316
'oauth_client_info': encrypt_data(oauth_client_info.model_dump(mode='json')),
23172317
},
23182318
}

backend/open_webui/models/chats.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class ChatTitleIdResponse(BaseModel):
179179
updated_at: int
180180
created_at: int
181181
last_read_at: int | None = None
182+
snippet: str | None = None
182183

183184

184185
class SharedChatResponse(BaseModel):

src/lib/components/layout/SearchModal.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,11 @@
697697
<div class="text-ellipsis line-clamp-1 w-full">
698698
{chat?.title}
699699
</div>
700+
{#if chat?.snippet}
701+
<div class="text-xs text-gray-500 dark:text-gray-400 line-clamp-2 mt-0.5">
702+
{chat.snippet}
703+
</div>
704+
{/if}
700705
</a>
701706
{/if}
702707

0 commit comments

Comments
 (0)