Skip to content

Commit 8815b01

Browse files
committed
fix: delete skill name and description when registering skill
1 parent ff6121f commit 8815b01

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

veadk/skills/utils.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ def load_skills_from_cloud(skill_space_ids: str) -> list[Skill]:
8989
secret_key = cred.secret_access_key
9090
session_token = cred.session_token
9191

92+
request_body = {
93+
"SkillSpaceId": skill_space_id,
94+
"InnerTags": {"source": "sandbox"},
95+
}
96+
logger.debug(f"ListSkillsBySpaceId request body: {request_body}")
97+
9298
response = ve_request(
93-
request_body={
94-
"SkillSpaceId": skill_space_id,
95-
"InnerTags": {"source": "sandbox"},
96-
},
99+
request_body=request_body,
97100
action="ListSkillsBySpaceId",
98101
ak=access_key,
99102
sk=secret_key,

veadk/tools/skills_tools/register_skills_tool.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import json
1818
import os
1919
import zipfile
20+
import frontmatter
2021
from pathlib import Path
2122
from datetime import datetime
2223

@@ -31,16 +32,12 @@
3132

3233

3334
def register_skills_tool(
34-
skill_name: str,
35-
skill_description: str,
3635
skill_local_path: str,
3736
tool_context: ToolContext,
3837
) -> str:
3938
"""Register a skill to the remote skill space by uploading its zip package to TOS and calling the CreateSkill API.
4039
4140
Args:
42-
skill_name (str): The name of the skill.
43-
skill_description (str): The description of the skill.
4441
skill_local_path (str): The local path of the skill directory.
4542
- The format of the skill directory is as follows:
4643
skill_local_path/
@@ -68,6 +65,16 @@ def register_skills_tool(
6865
logger.error(f"Skill path '{skill_path}' has no SKILL.md file.")
6966
return f"Skill path '{skill_path}' has no SKILL.md file."
7067

68+
try:
69+
skill = frontmatter.load(str(skill_readme))
70+
skill_name = skill.get("name", "")
71+
# skill_description = skill.get("description", "")
72+
except Exception as e:
73+
logger.error(
74+
f"Failed to get skill name and description from {skill_readme}: {e}"
75+
)
76+
return f"Failed to get skill name and description from {skill_readme}: {e}"
77+
7178
zip_file_path = working_dir / "outputs" / f"{skill_name}.zip"
7279

7380
with zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED) as zipf:
@@ -138,13 +145,14 @@ def register_skills_tool(
138145
x.strip() for x in skill_space_ids.split(",") if x.strip()
139146
]
140147

148+
request_body = {
149+
"TosUrl": tos_url,
150+
"SkillSpaces": skill_space_ids_list,
151+
}
152+
logger.debug(f"CreateSkill request body: {request_body}")
153+
141154
response = ve_request(
142-
request_body={
143-
"Name": skill_name,
144-
"Description": skill_description,
145-
"TosUrl": tos_url,
146-
"SkillSpaces": skill_space_ids_list,
147-
},
155+
request_body=request_body,
148156
action="CreateSkill",
149157
ak=access_key,
150158
sk=secret_key,

0 commit comments

Comments
 (0)