[GH-ISSUE #18603] feat: Add Memory (experimental) as a capability that can be disabled per agent #34179

Closed
opened 2026-04-25 08:05:37 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @vk2r on GitHub (Oct 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18603

Check Existing Issues

  • I have searched all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request.

Problem Description

I have noticed that some agents are indiscriminately using information stored in memory without being asked to do so.
I would like to be able to disable an agent’s ability to retrieve information from memory, in order to have more fine-grained control over what is provided to the LLM.

Desired Solution you'd like

I would like to have the option to enable or disable the memory feature.

Image

Alternatives Considered

No response

Additional Context

No response

Originally created by @vk2r on GitHub (Oct 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18603 ### Check Existing Issues - [x] I have searched all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request. ### Problem Description I have noticed that some agents are indiscriminately using information stored in memory without being asked to do so. I would like to be able to disable an agent’s ability to retrieve information from memory, in order to have more fine-grained control over what is provided to the LLM. ### Desired Solution you'd like I would like to have the option to enable or disable the memory feature. <img width="1486" height="94" alt="Image" src="https://github.com/user-attachments/assets/a226f154-e940-4737-bf8a-baeca6202360" /> ### Alternatives Considered _No response_ ### Additional Context _No response_
Author
Owner

@rgaricano commented on GitHub (Oct 24, 2025):

@vk2r
Hola Victor,
A way to do that without main code changes is with a tool.
Disabling the memory feature in settings and using a tool (model callable) to do the management, and prompting the model how or when it can read/write memories.
Also the tool can have specific instructions or valves...

You can try with a tool like this: Memory_Manager_Tool.py
(I generate it but I haven't been able to test and debug properly; I want to finish other things first.)

Test it, let me know, and we'll improve it.

Memory_Manager_Tool


The tool provides two functions that the model can call:

  • read_memories(query, k): Searches the vector store using VECTOR_DB_CLIENT.search() with the user's collection f"user-memory-{user.id}", returning the top k relevant memories.
       """
        Retrieve relevant memories based on a query.
        Use this when you need to recall information about the user.
        :param query: The search query to find relevant memories
        :param k: Number of memories to retrieve (default: 3)
        :return: Retrieved memories as formatted text
        """
  • write_memory(content): Stores new memories using Memories.insert_new_memory() and VECTOR_DB_CLIENT.upsert(), exactly like the existing memory API endpoints.
        """
        Store a new memory for the user.
        Use this to remember important information about the user.
        :param content: The information to remember
        :return: Confirmation message
        """

When you enable this tool in a chat, the model will see these functions in its tool specifications and can decide when to call them based on the conversation context.
The tool execution happens through chat_completion_tools_handler() in the middleware, giving the model explicit control over memory operations.

How to Use

  1. Create the tool: Go to Workspace → Tools → Create New Tool

  2. Paste the code above into the tool editor

  3. Save the tool - it will be registered in the tools system

  4. Disable automatic memory injection in Settings → Personalization → Memory

  5. Enable the tool in your chat by selecting it from the tools dropdown


Salu2

<!-- gh-comment-id:3444664571 --> @rgaricano commented on GitHub (Oct 24, 2025): @vk2r Hola Victor, A way to do that without main code changes is with a tool. Disabling the memory feature in settings and using a tool (model callable) to do the management, and prompting the model how or when it can read/write memories. Also the tool can have specific instructions or valves... You can try with a tool like this: [Memory_Manager_Tool.py](https://github.com/user-attachments/files/23133746/Memory_Manager_Tool.py) (I generate it but I haven't been able to test and debug properly; I want to finish other things first.) Test it, let me know, and we'll improve it. ### Memory_Manager_Tool ___ The tool provides two functions that the model can call: - read_memories(query, k): Searches the vector store using VECTOR_DB_CLIENT.search() with the user's collection f"user-memory-{user.id}", returning the top k relevant memories. ``` """ Retrieve relevant memories based on a query. Use this when you need to recall information about the user. :param query: The search query to find relevant memories :param k: Number of memories to retrieve (default: 3) :return: Retrieved memories as formatted text """ ``` - write_memory(content): Stores new memories using Memories.insert_new_memory() and VECTOR_DB_CLIENT.upsert(), exactly like the existing memory API endpoints. ``` """ Store a new memory for the user. Use this to remember important information about the user. :param content: The information to remember :return: Confirmation message """ ``` When you enable this tool in a chat, the model will see these functions in its tool specifications and can decide when to call them based on the conversation context. The tool execution happens through chat_completion_tools_handler() in the middleware, giving the model explicit control over memory operations. ### How to Use 1. Create the tool: Go to Workspace → Tools → Create New Tool 2. Paste the code above into the tool editor 3. Save the tool - it will be registered in the tools system 4. Disable automatic memory injection in Settings → Personalization → Memory 5. Enable the tool in your chat by selecting it from the tools dropdown ___ Salu2
Author
Owner

@vk2r commented on GitHub (Oct 24, 2025):

@vk2r Hola Victor, A way to do that without main code changes is with a tool. Disabling the memory feature in settings and using a tool (model callable) to do the management, and prompting the model how or when it can read/write memories. Also the tool can have specific instructions or valves...

You can try with a tool like this: Memory_Manager_Tool.py (I generate it but I haven't been able to test and debug properly; I want to finish other things first.)

Test it, let me know, and we'll improve it.

Memory_Manager_Tool

The tool provides two functions that the model can call:

  • read_memories(query, k): Searches the vector store using VECTOR_DB_CLIENT.search() with the user's collection f"user-memory-{user.id}", returning the top k relevant memories.
       """
        Retrieve relevant memories based on a query.
        Use this when you need to recall information about the user.
        :param query: The search query to find relevant memories
        :param k: Number of memories to retrieve (default: 3)
        :return: Retrieved memories as formatted text
        """
  • write_memory(content): Stores new memories using Memories.insert_new_memory() and VECTOR_DB_CLIENT.upsert(), exactly like the existing memory API endpoints.
        """
        Store a new memory for the user.
        Use this to remember important information about the user.
        :param content: The information to remember
        :return: Confirmation message
        """

When you enable this tool in a chat, the model will see these functions in its tool specifications and can decide when to call them based on the conversation context. The tool execution happens through chat_completion_tools_handler() in the middleware, giving the model explicit control over memory operations.

How to Use

  1. Create the tool: Go to Workspace → Tools → Create New Tool
  2. Paste the code above into the tool editor
  3. Save the tool - it will be registered in the tools system
  4. Disable automatic memory injection in Settings → Personalization → Memory
  5. Enable the tool in your chat by selecting it from the tools dropdown

Salu2

Thank you very much for the solution. However, I was wondering if this could be integrated as an agent option in the future.

I think it is important that an option provided by the same platform be managed by options found on the same platform and not by external tools.

PS: I got the following error when creating the function in OpenWebUI:

Image
<!-- gh-comment-id:3444701072 --> @vk2r commented on GitHub (Oct 24, 2025): > [@vk2r](https://github.com/vk2r) Hola Victor, A way to do that without main code changes is with a tool. Disabling the memory feature in settings and using a tool (model callable) to do the management, and prompting the model how or when it can read/write memories. Also the tool can have specific instructions or valves... > > You can try with a tool like this: [Memory_Manager_Tool.py](https://github.com/user-attachments/files/23133746/Memory_Manager_Tool.py) (I generate it but I haven't been able to test and debug properly; I want to finish other things first.) > > Test it, let me know, and we'll improve it. > > ### Memory_Manager_Tool > The tool provides two functions that the model can call: > > * read_memories(query, k): Searches the vector store using VECTOR_DB_CLIENT.search() with the user's collection f"user-memory-{user.id}", returning the top k relevant memories. > > ``` > """ > Retrieve relevant memories based on a query. > Use this when you need to recall information about the user. > :param query: The search query to find relevant memories > :param k: Number of memories to retrieve (default: 3) > :return: Retrieved memories as formatted text > """ > ``` > > * write_memory(content): Stores new memories using Memories.insert_new_memory() and VECTOR_DB_CLIENT.upsert(), exactly like the existing memory API endpoints. > > ``` > """ > Store a new memory for the user. > Use this to remember important information about the user. > :param content: The information to remember > :return: Confirmation message > """ > ``` > > When you enable this tool in a chat, the model will see these functions in its tool specifications and can decide when to call them based on the conversation context. The tool execution happens through chat_completion_tools_handler() in the middleware, giving the model explicit control over memory operations. > > ### How to Use > 1. Create the tool: Go to Workspace → Tools → Create New Tool > 2. Paste the code above into the tool editor > 3. Save the tool - it will be registered in the tools system > 4. Disable automatic memory injection in Settings → Personalization → Memory > 5. Enable the tool in your chat by selecting it from the tools dropdown > > Salu2 Thank you very much for the solution. However, I was wondering if this could be integrated as an agent option in the future. I think it is important that an option provided by the same platform be managed by options found on the same platform and not by external tools. PS: I got the following error when creating the function in OpenWebUI: <img width="573" height="155" alt="Image" src="https://github.com/user-attachments/assets/9b86cc41-2b7a-4820-914e-79e149488248" />
Author
Owner

@rgaricano commented on GitHub (Oct 24, 2025):

Is not a function, it's a tool (to be added in workspace tools)

Yes, when memories are enabled all memories are inyected in the context, ....

I tried similar thing as you ask (a toggle button) with an action function it seem that work ( I left in the middle of debug it, the changes of the memory states isn't refreshed/reflected in the settings)

"""
title: Memory Control Actions
author: open-webui
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.1
"""

from pydantic import BaseModel, Field
from typing import Optional, Dict, Any
import json


class Action:
    class Valves(BaseModel):
        priority: int = Field(
            default=0, description="Priority level for the action operations."
        )

    def __init__(self):
        self.valves = self.Valves()

    async def action(
        self,
        body: dict,
        __user__: Optional[dict] = None,
        __event_emitter__: Optional[Any] = None,
        __event_call__: Optional[Any] = None,
    ) -> Optional[dict]:
        """
        Action function that models can call to control memory functionality.
        """

        # Parse the action request
        action_data = body.get("action", {})
        action_type = action_data.get("type", "")

        if action_type == "toggle_memory":
            # Toggle memory state
            current_state = self._get_user_memory_state(__user__)
            new_state = not current_state

            # Update user's memory preference (this would need to be stored in user settings)
            success = await self._update_user_memory_preference(__user__, new_state)

            if success:
                status_msg = f"Memory {'enabled' if new_state else 'disabled'} for future conversations"

                if __event_emitter__:
                    await __event_emitter__(
                        {
                            "type": "status",
                            "data": {"description": status_msg, "done": True},
                        }
                    )

                return {
                    "success": True,
                    "message": status_msg,
                    "memory_enabled": new_state,
                }
            else:
                return {
                    "success": False,
                    "message": "Failed to update memory preference",
                }

        elif action_type == "check_memory_status":
            # Check current memory state
            current_state = self._get_user_memory_state(__user__)

            return {
                "success": True,
                "memory_enabled": current_state,
                "message": f"Memory is currently {'enabled' if current_state else 'disabled'}",
            }

        return {
            "success": False,
            "message": "Unknown action type. Use 'toggle_memory' or 'check_memory_status'",
        }

    def _get_user_memory_state(self, user: dict) -> bool:
        """Get current memory state for user"""
        # This would check user's stored preference
        # For now, default to True
        if user and "valves" in user:
            return getattr(user["valves"], "memory_enabled", True)
        return True

    async def _update_user_memory_preference(self, user: dict, enabled: bool) -> bool:
        """Update user's memory preference"""
        # This would update the user's stored preference
        # Implementation would depend on how user preferences are stored
        try:
            # Placeholder for actual user preference update logic
            if user and "valves" in user:
                user["valves"].memory_enabled = enabled
            return True
        except Exception:
            return False


# Define available actions for the model to call
actions = [
    {
        "id": "toggle_memory",
        "name": "Toggle Memory",
        "description": "Enable or disable memory for future conversations",
    },
    {
        "id": "check_memory_status",
        "name": "Check Memory Status",
        "description": "Check if memory is currently enabled or disabled",
    },
]
<!-- gh-comment-id:3444733180 --> @rgaricano commented on GitHub (Oct 24, 2025): Is not a function, it's a tool (to be added in workspace tools) Yes, when memories are enabled all memories are inyected in the context, .... I tried similar thing as you ask (a toggle button) with an action function it seem that work ( I left in the middle of debug it, the changes of the memory states isn't refreshed/reflected in the settings) ``` """ title: Memory Control Actions author: open-webui author_url: https://github.com/open-webui funding_url: https://github.com/open-webui version: 0.1 """ from pydantic import BaseModel, Field from typing import Optional, Dict, Any import json class Action: class Valves(BaseModel): priority: int = Field( default=0, description="Priority level for the action operations." ) def __init__(self): self.valves = self.Valves() async def action( self, body: dict, __user__: Optional[dict] = None, __event_emitter__: Optional[Any] = None, __event_call__: Optional[Any] = None, ) -> Optional[dict]: """ Action function that models can call to control memory functionality. """ # Parse the action request action_data = body.get("action", {}) action_type = action_data.get("type", "") if action_type == "toggle_memory": # Toggle memory state current_state = self._get_user_memory_state(__user__) new_state = not current_state # Update user's memory preference (this would need to be stored in user settings) success = await self._update_user_memory_preference(__user__, new_state) if success: status_msg = f"Memory {'enabled' if new_state else 'disabled'} for future conversations" if __event_emitter__: await __event_emitter__( { "type": "status", "data": {"description": status_msg, "done": True}, } ) return { "success": True, "message": status_msg, "memory_enabled": new_state, } else: return { "success": False, "message": "Failed to update memory preference", } elif action_type == "check_memory_status": # Check current memory state current_state = self._get_user_memory_state(__user__) return { "success": True, "memory_enabled": current_state, "message": f"Memory is currently {'enabled' if current_state else 'disabled'}", } return { "success": False, "message": "Unknown action type. Use 'toggle_memory' or 'check_memory_status'", } def _get_user_memory_state(self, user: dict) -> bool: """Get current memory state for user""" # This would check user's stored preference # For now, default to True if user and "valves" in user: return getattr(user["valves"], "memory_enabled", True) return True async def _update_user_memory_preference(self, user: dict, enabled: bool) -> bool: """Update user's memory preference""" # This would update the user's stored preference # Implementation would depend on how user preferences are stored try: # Placeholder for actual user preference update logic if user and "valves" in user: user["valves"].memory_enabled = enabled return True except Exception: return False # Define available actions for the model to call actions = [ { "id": "toggle_memory", "name": "Toggle Memory", "description": "Enable or disable memory for future conversations", }, { "id": "check_memory_status", "name": "Check Memory Status", "description": "Check if memory is currently enabled or disabled", }, ] ```
Author
Owner

@rgaricano commented on GitHub (Oct 24, 2025):

and this is other tool that also I have on dev, trying to implement a memory toggle (& solve the refresh state):

"""
title: Memory Settings Control Tool (Redis-Aware)
author: open-webui
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.3
"""

from pydantic import BaseModel, Field
from typing import Optional
import json
import redis

# Import the Users model and Redis utilities
try:
    from open_webui.models.users import Users
    from open_webui.utils.redis import get_redis_connection
    from open_webui.env import (
        REDIS_URL,
        REDIS_KEY_PREFIX,
        REDIS_SENTINEL_HOSTS,
        REDIS_SENTINEL_PORT,
        REDIS_CLUSTER,
    )
    from open_webui.utils.redis import get_sentinels_from_env
except ImportError:
    Users = None
    get_redis_connection = None


class Tools:
    class Valves(BaseModel):
        priority: int = Field(
            default=0, description="Priority level for the tool operations."
        )

    def __init__(self):
        self.valves = self.Valves()

    def toggle_memory_setting(
        self,
        __user__: dict,
        __event_emitter__=None,
    ) -> str:
        """
        Toggle the user's memory setting in personalization preferences with Redis cache invalidation.

        :return: Status message indicating the new memory state
        """
        if not Users or not get_redis_connection:
            return json.dumps(
                {"success": False, "message": "Required models not available"}
            )

        try:
            user_id = __user__.get("id")
            if not user_id:
                return json.dumps({"success": False, "message": "User ID not found"})

            # Get current user from database
            user = Users.get_user_by_id(user_id)
            if not user:
                return json.dumps(
                    {"success": False, "message": "User not found in database"}
                )

            # Get current settings
            current_settings = user.settings.model_dump() if user.settings else {}

            # Initialize ui settings if not present
            if "ui" not in current_settings:
                current_settings["ui"] = {}

            # Toggle memory setting
            current_memory_state = current_settings["ui"].get("memory", False)
            new_state = not current_memory_state
            current_settings["ui"]["memory"] = new_state

            # Update user settings in database
            updated_user = Users.update_user_settings_by_id(user_id, current_settings)

            if updated_user:
                # Clear Redis cache for this user's memory setting
                self._invalidate_redis_cache(user_id, "memory")

                status_msg = f"Memory setting {'enabled' if new_state else 'disabled'} in personalization preferences"
                return json.dumps(
                    {
                        "success": True,
                        "message": status_msg,
                        "memory_enabled": new_state,
                    }
                )
            else:
                return json.dumps(
                    {
                        "success": False,
                        "message": "Failed to update user settings in database",
                    }
                )

        except Exception as e:
            return json.dumps(
                {
                    "success": False,
                    "message": f"Failed to toggle memory setting: {str(e)}",
                }
            )

    def set_memory_setting(
        self,
        enabled: bool,
        __user__: dict,
    ) -> str:
        """
        Set the user's memory setting to a specific state with Redis cache invalidation.

        :param enabled: True to enable memory, False to disable
        :return: Status message confirming the change
        """
        if not Users or not get_redis_connection:
            return json.dumps(
                {"success": False, "message": "Required models not available"}
            )

        try:
            user_id = __user__.get("id")
            if not user_id:
                return json.dumps({"success": False, "message": "User ID not found"})

            # Get current user from database
            user = Users.get_user_by_id(user_id)
            if not user:
                return json.dumps(
                    {"success": False, "message": "User not found in database"}
                )

            # Get current settings
            current_settings = user.settings.model_dump() if user.settings else {}

            # Initialize ui settings if not present
            if "ui" not in current_settings:
                current_settings["ui"] = {}

            # Set memory setting
            current_settings["ui"]["memory"] = enabled

            # Update user settings in database
            updated_user = Users.update_user_settings_by_id(user_id, current_settings)

            if updated_user:
                # Clear Redis cache for this user's memory setting
                self._invalidate_redis_cache(user_id, "memory")

                status_msg = f"Memory setting {'enabled' if enabled else 'disabled'} in personalization preferences"
                return json.dumps(
                    {"success": True, "message": status_msg, "memory_enabled": enabled}
                )
            else:
                return json.dumps(
                    {
                        "success": False,
                        "message": "Failed to update user settings in database",
                    }
                )

        except Exception as e:
            return json.dumps(
                {"success": False, "message": f"Failed to set memory setting: {str(e)}"}
            )

    def _invalidate_redis_cache(self, user_id: str, setting_key: str):
        """
        Invalidate Redis cache entries for user settings to ensure changes take effect immediately.
        """
        try:
            # Get Redis connection using the same configuration as AppConfig
            redis_client = get_redis_connection(
                redis_url=REDIS_URL,
                redis_sentinels=get_sentinels_from_env(
                    REDIS_SENTINEL_HOSTS, REDIS_SENTINEL_PORT
                ),
                redis_cluster=REDIS_CLUSTER,
                decode_responses=True,
            )

            if redis_client:
                # Clear cache keys that might be related to user memory settings
                # Following the pattern from AppConfig.__setattr__ and __getattr__
                redis_key_prefix = REDIS_KEY_PREFIX or "open-webui"

                # Clear general memory config cache
                memory_key = f"{redis_key_prefix}:config:memory"
                redis_client.delete(memory_key)

                # Clear user-specific memory setting cache if it exists
                user_memory_key = f"{redis_key_prefix}:user:{user_id}:memory"
                redis_client.delete(user_memory_key)

                # Clear any broader user settings cache
                user_settings_key = f"{redis_key_prefix}:user:{user_id}:settings"
                redis_client.delete(user_settings_key)

                print(f"Cleared Redis cache for user {user_id} memory setting")

        except Exception as e:
            print(f"Warning: Failed to clear Redis cache: {e}")
            # Don't fail the operation if Redis cache clearing fails
            pass
<!-- gh-comment-id:3444756011 --> @rgaricano commented on GitHub (Oct 24, 2025): and this is other tool that also I have on dev, trying to implement a memory toggle (& solve the refresh state): ``` """ title: Memory Settings Control Tool (Redis-Aware) author: open-webui author_url: https://github.com/open-webui funding_url: https://github.com/open-webui version: 0.3 """ from pydantic import BaseModel, Field from typing import Optional import json import redis # Import the Users model and Redis utilities try: from open_webui.models.users import Users from open_webui.utils.redis import get_redis_connection from open_webui.env import ( REDIS_URL, REDIS_KEY_PREFIX, REDIS_SENTINEL_HOSTS, REDIS_SENTINEL_PORT, REDIS_CLUSTER, ) from open_webui.utils.redis import get_sentinels_from_env except ImportError: Users = None get_redis_connection = None class Tools: class Valves(BaseModel): priority: int = Field( default=0, description="Priority level for the tool operations." ) def __init__(self): self.valves = self.Valves() def toggle_memory_setting( self, __user__: dict, __event_emitter__=None, ) -> str: """ Toggle the user's memory setting in personalization preferences with Redis cache invalidation. :return: Status message indicating the new memory state """ if not Users or not get_redis_connection: return json.dumps( {"success": False, "message": "Required models not available"} ) try: user_id = __user__.get("id") if not user_id: return json.dumps({"success": False, "message": "User ID not found"}) # Get current user from database user = Users.get_user_by_id(user_id) if not user: return json.dumps( {"success": False, "message": "User not found in database"} ) # Get current settings current_settings = user.settings.model_dump() if user.settings else {} # Initialize ui settings if not present if "ui" not in current_settings: current_settings["ui"] = {} # Toggle memory setting current_memory_state = current_settings["ui"].get("memory", False) new_state = not current_memory_state current_settings["ui"]["memory"] = new_state # Update user settings in database updated_user = Users.update_user_settings_by_id(user_id, current_settings) if updated_user: # Clear Redis cache for this user's memory setting self._invalidate_redis_cache(user_id, "memory") status_msg = f"Memory setting {'enabled' if new_state else 'disabled'} in personalization preferences" return json.dumps( { "success": True, "message": status_msg, "memory_enabled": new_state, } ) else: return json.dumps( { "success": False, "message": "Failed to update user settings in database", } ) except Exception as e: return json.dumps( { "success": False, "message": f"Failed to toggle memory setting: {str(e)}", } ) def set_memory_setting( self, enabled: bool, __user__: dict, ) -> str: """ Set the user's memory setting to a specific state with Redis cache invalidation. :param enabled: True to enable memory, False to disable :return: Status message confirming the change """ if not Users or not get_redis_connection: return json.dumps( {"success": False, "message": "Required models not available"} ) try: user_id = __user__.get("id") if not user_id: return json.dumps({"success": False, "message": "User ID not found"}) # Get current user from database user = Users.get_user_by_id(user_id) if not user: return json.dumps( {"success": False, "message": "User not found in database"} ) # Get current settings current_settings = user.settings.model_dump() if user.settings else {} # Initialize ui settings if not present if "ui" not in current_settings: current_settings["ui"] = {} # Set memory setting current_settings["ui"]["memory"] = enabled # Update user settings in database updated_user = Users.update_user_settings_by_id(user_id, current_settings) if updated_user: # Clear Redis cache for this user's memory setting self._invalidate_redis_cache(user_id, "memory") status_msg = f"Memory setting {'enabled' if enabled else 'disabled'} in personalization preferences" return json.dumps( {"success": True, "message": status_msg, "memory_enabled": enabled} ) else: return json.dumps( { "success": False, "message": "Failed to update user settings in database", } ) except Exception as e: return json.dumps( {"success": False, "message": f"Failed to set memory setting: {str(e)}"} ) def _invalidate_redis_cache(self, user_id: str, setting_key: str): """ Invalidate Redis cache entries for user settings to ensure changes take effect immediately. """ try: # Get Redis connection using the same configuration as AppConfig redis_client = get_redis_connection( redis_url=REDIS_URL, redis_sentinels=get_sentinels_from_env( REDIS_SENTINEL_HOSTS, REDIS_SENTINEL_PORT ), redis_cluster=REDIS_CLUSTER, decode_responses=True, ) if redis_client: # Clear cache keys that might be related to user memory settings # Following the pattern from AppConfig.__setattr__ and __getattr__ redis_key_prefix = REDIS_KEY_PREFIX or "open-webui" # Clear general memory config cache memory_key = f"{redis_key_prefix}:config:memory" redis_client.delete(memory_key) # Clear user-specific memory setting cache if it exists user_memory_key = f"{redis_key_prefix}:user:{user_id}:memory" redis_client.delete(user_memory_key) # Clear any broader user settings cache user_settings_key = f"{redis_key_prefix}:user:{user_id}:settings" redis_client.delete(user_settings_key) print(f"Cleared Redis cache for user {user_id} memory setting") except Exception as e: print(f"Warning: Failed to clear Redis cache: {e}") # Don't fail the operation if Redis cache clearing fails pass ```
Author
Owner

@vk2r commented on GitHub (Oct 24, 2025):

PS: False alarm. My mistake. I was still testing the feature you gave me.

PS: Do you think this toggle will be implemented natively at some point?

<!-- gh-comment-id:3444895364 --> @vk2r commented on GitHub (Oct 24, 2025): PS: False alarm. My mistake. I was still testing the feature you gave me. PS: Do you think this toggle will be implemented natively at some point?
Author
Owner

@rgaricano commented on GitHub (Oct 24, 2025):

Maybe, this feature (memory) is as "experimental"

<!-- gh-comment-id:3444982819 --> @rgaricano commented on GitHub (Oct 24, 2025): Maybe, this feature (memory) is as "experimental"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#34179