Skip to content

Commit 65ee771

Browse files
committed
refac
1 parent 0c5399c commit 65ee771

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

backend/open_webui/tools/builtin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,15 +2274,15 @@ async def query_knowledge_bases(
22742274

22752275

22762276
async def view_skill(
2277-
name: str,
2277+
id: str,
22782278
__request__: Request = None,
22792279
__user__: dict = None,
22802280
) -> str:
22812281
"""
2282-
Load the full instructions of a skill by its name from the available skills manifest.
2282+
Load the full instructions of a skill by its id from the available skills manifest.
22832283
Use this when you need detailed instructions for a skill listed in <available_skills>.
22842284
2285-
:param name: The name of the skill to load (as shown in the manifest)
2285+
:param id: The id of the skill to load (as shown in the manifest)
22862286
:return: The full skill instructions as markdown content
22872287
"""
22882288
if __request__ is None:
@@ -2297,11 +2297,11 @@ async def view_skill(
22972297

22982298
user_id = __user__.get('id')
22992299

2300-
# Direct DB lookup by unique name
2301-
skill = Skills.get_skill_by_name(name)
2300+
# Direct DB lookup by id (case-insensitive since IDs are stored lowercase)
2301+
skill = Skills.get_skill_by_id(id.lower())
23022302

23032303
if not skill or not skill.is_active:
2304-
return json.dumps({'error': f"Skill '{name}' not found"})
2304+
return json.dumps({'error': f"Skill '{id}' not found"})
23052305

23062306
# Check user access
23072307
user_role = __user__.get('role', 'user')

backend/open_webui/utils/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2417,7 +2417,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
24172417
)
24182418
else:
24192419
# Model-attached: name+description only
2420-
skill_descriptions += f'<skill>\n<name>{skill.name}</name>\n<description>{skill.description or ""}</description>\n</skill>\n'
2420+
skill_descriptions += f'<skill>\n<id>{skill.id}</id>\n<name>{skill.name}</name>\n<description>{skill.description or ""}</description>\n</skill>\n'
24212421

24222422
if skill_descriptions:
24232423
form_data['messages'] = add_or_update_system_message(

0 commit comments

Comments
 (0)