Skip to content

Commit 1741141

Browse files
Merge branch 'open-webui:dev' into dev
2 parents 0623339 + 4aacaeb commit 1741141

5 files changed

Lines changed: 36 additions & 12 deletions

File tree

backend/open_webui/utils/telemetry/instrumentors.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor
2323
from opentelemetry.trace import Span, StatusCode
2424
from redis import Redis
25+
from redis.cluster import RedisCluster
2526
from requests import PreparedRequest, Response
2627
from sqlalchemy import Engine
2728
from fastapi import status
@@ -59,16 +60,28 @@ def response_hook(span: Span, request: PreparedRequest, response: Response):
5960
span.set_status(StatusCode.ERROR if response.status_code >= 400 else StatusCode.OK)
6061

6162

62-
def redis_request_hook(span: Span, instance: Redis, args, kwargs):
63+
def redis_request_hook(span: Span, instance: Union[Redis|RedisCluster], args, kwargs):
6364
"""
6465
Redis Request Hook
6566
"""
6667

68+
# In cluster mode, the instance can be of two types:
69+
# - redis.asyncio.cluster.RedisCluster
70+
# - redis.cluster.RedisCluster
71+
# Instead of checking the type, we check if the instance has a nodes_manager attribute.
6772
try:
68-
connection_kwargs: dict = instance.connection_pool.connection_kwargs
69-
host = connection_kwargs.get("host")
70-
port = connection_kwargs.get("port")
71-
db = connection_kwargs.get("db")
73+
db = ""
74+
if hasattr(instance, 'nodes_manager'):
75+
default_node = instance.nodes_manager.default_node
76+
if not default_node:
77+
return
78+
host = default_node.host
79+
port = default_node.port
80+
else:
81+
connection_kwargs: dict = instance.connection_pool.connection_kwargs
82+
host = connection_kwargs.get("host")
83+
port = connection_kwargs.get("port")
84+
db = connection_kwargs.get("db")
7285
span.set_attributes(
7386
{
7487
SpanAttributes.DB_INSTANCE: f"{host}/{db}",

src/lib/components/chat/ShortcutsModal.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<!-- {$i18n.t('New Chat')} -->
7474
<!-- {$i18n.t('New Temporary Chat')} -->
7575
<!-- {$i18n.t('Delete Chat')} -->
76+
<!-- {$i18n.t('Open Model Selector')} -->
7677
<!-- {$i18n.t('Search')} -->
7778
<!-- {$i18n.t('Open Settings')} -->
7879
<!-- {$i18n.t('Show Shortcuts')} -->

src/lib/components/workspace/Prompts/PromptEditor.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@
418418
<div class="mt-1.5">
419419
<Tooltip content={$i18n.t('Click to copy ID')}>
420420
<button
421-
class="text-xs text-gray-500 font-mono bg-gray-50 dark:bg-gray-850 px-2 py-1 rounded-lg cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 transition"
421+
class="text-xs text-gray-500 font-mono px-2 py-1 rounded-lg cursor-pointer hover:underline transition"
422422
on:click={() => {
423423
copyToClipboard(prompt.id);
424424
toast.success($i18n.t('ID copied to clipboard'));
@@ -465,7 +465,7 @@
465465
</div>
466466
{#if selectedHistoryEntry}
467467
<span
468-
class="text-xs text-gray-500 font-mono bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded"
468+
class="text-xs text-gray-500 font-mono bg-gray-100 dark:bg-gray-800 px-1.5 rounded"
469469
>
470470
{selectedHistoryEntry.id.slice(0, 7)}
471471
</span>
@@ -509,9 +509,9 @@
509509
</div>
510510
<!-- Scrollable content -->
511511
<div
512-
class="bg-gray-50 dark:bg-gray-900 rounded-xl px-4 py-3 border border-gray-100 dark:border-gray-800 h-full overflow-y-auto"
512+
class="bg-gray-50 dark:bg-gray-900 rounded-xl px-4 py-3 border border-gray-100/50 dark:border-gray-850/50 h-full overflow-y-auto"
513513
>
514-
<pre class="text-sm whitespace-pre-wrap font-mono pr-8">{selectedHistoryEntry?.snapshot
514+
<pre class="text-xs whitespace-pre-wrap font-mono pr-8">{selectedHistoryEntry?.snapshot
515515
?.content || content}</pre>
516516
</div>
517517
</div>
@@ -623,10 +623,10 @@
623623
<div class="flex">
624624
<!-- Content -->
625625
<button
626-
class="flex-1 text-left px-3.5 py-2 mb-1 rounded-xl transition group
626+
class="flex-1 text-left px-3.5 py-2 mb-1 rounded-2xl transition group
627627
{selectedHistoryEntry?.id === entry.id
628-
? 'bg-gray-50 dark:bg-gray-850'
629-
: 'hover:bg-gray-50 dark:hover:bg-gray-850'}"
628+
? 'bg-gray-100/50 dark:bg-gray-850/50'
629+
: 'hover:bg-gray-100/50 dark:hover:bg-gray-850/50'}"
630630
on:click={() => (selectedHistoryEntry = entry)}
631631
>
632632
<!-- Commit Message -->

src/lib/shortcuts.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export enum Shortcut {
1616
NEW_CHAT = 'newChat',
1717
NEW_TEMPORARY_CHAT = 'newTemporaryChat',
1818
DELETE_CHAT = 'deleteChat',
19+
OPEN_MODEL_SELECTOR = 'openModelSelector',
1920

2021
//Global
2122
SEARCH = 'search',
@@ -58,6 +59,11 @@ export const shortcuts: ShortcutRegistry = {
5859
keys: ['mod', 'shift', 'Backspace', 'Delete'],
5960
category: 'Chat'
6061
},
62+
[Shortcut.OPEN_MODEL_SELECTOR]: {
63+
name: 'Open Model Selector',
64+
keys: ['mod', 'shift', 'M'],
65+
category: 'Chat'
66+
},
6167

6268
//Global
6369
[Shortcut.SEARCH]: {

src/routes/(app)/+layout.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@
230230
event.preventDefault();
231231
showSettings.set(false);
232232
showShortcuts.set(false);
233+
} else if (isShortcutMatch(event, shortcuts[Shortcut.OPEN_MODEL_SELECTOR])) {
234+
console.log('Shortcut triggered: OPEN_MODEL_SELECTOR');
235+
event.preventDefault();
236+
document.getElementById('model-selector-0-button')?.click();
233237
} else if (isShortcutMatch(event, shortcuts[Shortcut.NEW_TEMPORARY_CHAT])) {
234238
console.log('Shortcut triggered: NEW_TEMPORARY_CHAT');
235239
event.preventDefault();

0 commit comments

Comments
 (0)