diff --git a/backend/open_webui/retrieval/utils.py b/backend/open_webui/retrieval/utils.py index 371a2313eb..6d7aec94f7 100644 --- a/backend/open_webui/retrieval/utils.py +++ b/backend/open_webui/retrieval/utils.py @@ -641,7 +641,7 @@ def merge_and_sort_query_results(query_results: list[dict], k: int) -> dict: if isinstance(document, str): doc_hash = (metadata or {}).get(CHUNK_HASH_KEY) or _content_hash(document) - if doc_hash not in combined.keys(): + if doc_hash not in combined: combined[doc_hash] = (distance, document, metadata) continue # if doc is new, no further comparison is needed diff --git a/backend/open_webui/routers/users.py b/backend/open_webui/routers/users.py index 2078ebc0c4..d736c038bc 100644 --- a/backend/open_webui/routers/users.py +++ b/backend/open_webui/routers/users.py @@ -515,7 +515,7 @@ async def update_user_settings_by_session_user( if ( user.role != 'admin' and ui_settings is not None - and 'toolServers' in ui_settings.keys() + and 'toolServers' in ui_settings and not await has_permission( user.id, 'features.direct_tool_servers',