From 65ee771fd0d62d785ecbcf189e3f5b63858c11e6 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 2 Apr 2026 01:40:50 -0500 Subject: [PATCH] refac --- backend/open_webui/tools/builtin.py | 12 ++++++------ backend/open_webui/utils/middleware.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/open_webui/tools/builtin.py b/backend/open_webui/tools/builtin.py index 4fcdda48c..3c63d318c 100644 --- a/backend/open_webui/tools/builtin.py +++ b/backend/open_webui/tools/builtin.py @@ -2274,15 +2274,15 @@ async def query_knowledge_bases( async def view_skill( - name: str, + id: str, __request__: Request = None, __user__: dict = None, ) -> str: """ - Load the full instructions of a skill by its name from the available skills manifest. + Load the full instructions of a skill by its id from the available skills manifest. Use this when you need detailed instructions for a skill listed in . - :param name: The name of the skill to load (as shown in the manifest) + :param id: The id of the skill to load (as shown in the manifest) :return: The full skill instructions as markdown content """ if __request__ is None: @@ -2297,11 +2297,11 @@ async def view_skill( user_id = __user__.get('id') - # Direct DB lookup by unique name - skill = Skills.get_skill_by_name(name) + # Direct DB lookup by id (case-insensitive since IDs are stored lowercase) + skill = Skills.get_skill_by_id(id.lower()) if not skill or not skill.is_active: - return json.dumps({'error': f"Skill '{name}' not found"}) + return json.dumps({'error': f"Skill '{id}' not found"}) # Check user access user_role = __user__.get('role', 'user') diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index f3b690f2d..54df422c4 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -2417,7 +2417,7 @@ async def process_chat_payload(request, form_data, user, metadata, model): ) else: # Model-attached: name+description only - skill_descriptions += f'\n{skill.name}\n{skill.description or ""}\n\n' + skill_descriptions += f'\n{skill.id}\n{skill.name}\n{skill.description or ""}\n\n' if skill_descriptions: form_data['messages'] = add_or_update_system_message(