refac
This commit is contained in:
1 parent
0c5399ca53
commit
65ee771fd0
2 files changed
+7
-7
No files matched your search
@@ -2274,15 +2274,15 @@ async def query_knowledge_bases(
|
|||||||
|
|
||||||
|
|
||||||
async def view_skill(
|
async def view_skill(
|
||||||
name: str,
|
id: str,
|
||||||
__request__: Request = None,
|
__request__: Request = None,
|
||||||
__user__: dict = None,
|
__user__: dict = None,
|
||||||
) -> str:
|
) -> 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 <available_skills>.
|
Use this when you need detailed instructions for a skill listed in <available_skills>.
|
||||||
|
|
||||||
: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
|
:return: The full skill instructions as markdown content
|
||||||
"""
|
"""
|
||||||
if __request__ is None:
|
if __request__ is None:
|
||||||
@@ -2297,11 +2297,11 @@ async def view_skill(
|
|||||||
|
|
||||||
user_id = __user__.get('id')
|
user_id = __user__.get('id')
|
||||||
|
|
||||||
# Direct DB lookup by unique name
|
# Direct DB lookup by id (case-insensitive since IDs are stored lowercase)
|
||||||
skill = Skills.get_skill_by_name(name)
|
skill = Skills.get_skill_by_id(id.lower())
|
||||||
|
|
||||||
if not skill or not skill.is_active:
|
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
|
# Check user access
|
||||||
user_role = __user__.get('role', 'user')
|
user_role = __user__.get('role', 'user')
|
||||||
|
|||||||
@@ -2417,7 +2417,7 @@ async def process_chat_payload(request, form_data, user, metadata, model):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# Model-attached: name+description only
|
# Model-attached: name+description only
|
||||||
skill_descriptions += f'<skill>\n<name>{skill.name}</name>\n<description>{skill.description or ""}</description>\n</skill>\n'
|
skill_descriptions += f'<skill>\n<id>{skill.id}</id>\n<name>{skill.name}</name>\n<description>{skill.description or ""}</description>\n</skill>\n'
|
||||||
|
|
||||||
if skill_descriptions:
|
if skill_descriptions:
|
||||||
form_data['messages'] = add_or_update_system_message(
|
form_data['messages'] = add_or_update_system_message(
|
||||||
|
|||||||
Reference in new issue
Block a user