From a3a81fee03ba7ec0ceb4d1f456e80a8f4fc2320f Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 17 Aug 2026 01:21:58 -0700 Subject: [PATCH] refac --- backend/open_webui/routers/functions.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backend/open_webui/routers/functions.py b/backend/open_webui/routers/functions.py index 3c1cf58cd6..be3fe3edf1 100644 --- a/backend/open_webui/routers/functions.py +++ b/backend/open_webui/routers/functions.py @@ -593,6 +593,9 @@ async def get_function_user_valves_spec_by_id( ): function = await Functions.get_function_by_id(id, db=db) if function: + if not function.is_active: + return None + function_module, function_type, frontmatter = await get_function_module_from_cache(request, id) if hasattr(function_module, 'UserValves'): @@ -620,6 +623,12 @@ async def update_function_user_valves_by_id( function = await Functions.get_function_by_id(id, db=db) if function: + if not function.is_active: + raise HTTPException( + status_code=status.HTTP_400_BAD_REQUEST, + detail='Function is not active', + ) + function_module, function_type, frontmatter = await get_function_module_from_cache(request, id) if hasattr(function_module, 'UserValves'):