diff --git a/backend/open_webui/routers/functions.py b/backend/open_webui/routers/functions.py index be3fe3edf1..212a419500 100644 --- a/backend/open_webui/routers/functions.py +++ b/backend/open_webui/routers/functions.py @@ -23,6 +23,7 @@ from open_webui.models.functions import ( ) from open_webui.utils.auth import get_admin_user, get_verified_user from open_webui.utils.plugin import ( + get_function_contents_cache, get_functions_cache, get_function_module_from_cache, load_function_module_by_id, @@ -440,6 +441,8 @@ async def delete_function_by_id( if result: FUNCTIONS = get_functions_cache(request) FUNCTIONS.pop(id, None) + FUNCTION_CONTENTS = get_function_contents_cache(request) + FUNCTION_CONTENTS.pop(id, None) await publish_event( request, EVENTS.FUNCTION_DELETED, diff --git a/backend/open_webui/routers/tools.py b/backend/open_webui/routers/tools.py index 86860237aa..a814eb30f3 100644 --- a/backend/open_webui/routers/tools.py +++ b/backend/open_webui/routers/tools.py @@ -32,6 +32,7 @@ from open_webui.utils.access_control import ( ) from open_webui.utils.auth import get_admin_user, get_verified_user from open_webui.utils.plugin import ( + get_tool_contents_cache, get_tools_cache, get_tool_module_from_cache, load_tool_module_by_id, @@ -681,6 +682,8 @@ async def delete_tools_by_id( if result: TOOLS = get_tools_cache(request) TOOLS.pop(id, None) + TOOL_CONTENTS = get_tool_contents_cache(request) + TOOL_CONTENTS.pop(id, None) await publish_event( request, EVENTS.TOOL_DELETED,