mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-27 01:40:33 -04:00
fix: stop injecting memories and memory tools when memory is switched off (#30228)
This commit is contained in:
@@ -2683,7 +2683,12 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
||||
form_data['messages'],
|
||||
)
|
||||
|
||||
if 'memory' in features and features['memory'] and await Config.get('memories.system_context.enable'):
|
||||
if (
|
||||
'memory' in features
|
||||
and features['memory']
|
||||
and await Config.get('memories.enable')
|
||||
and await Config.get('memories.system_context.enable')
|
||||
):
|
||||
# features is client-supplied; re-check the permission the native FC path enforces.
|
||||
if getattr(user, 'role', None) == 'admin' or await has_permission(
|
||||
getattr(user, 'id', ''),
|
||||
|
||||
@@ -542,6 +542,7 @@ async def get_builtin_tools(
|
||||
# Helper to check user-level feature permission (admins always pass)
|
||||
user = extra_params.get('__user__', {})
|
||||
config = await Config.get_many(
|
||||
'memories.enable',
|
||||
'web.search.enable',
|
||||
'image_generation.enable',
|
||||
'images.edit.enable',
|
||||
@@ -655,6 +656,7 @@ async def get_builtin_tools(
|
||||
# Add memory tools when memory is enabled and the model allows this builtin category.
|
||||
if (
|
||||
is_builtin_tool_enabled('memory')
|
||||
and config.get('memories.enable')
|
||||
and features.get('memory')
|
||||
and get_model_capability('memory')
|
||||
and await has_user_permission('memories')
|
||||
|
||||
Reference in New Issue
Block a user