bugfix
This commit is contained in:
parent
4099c30156
commit
e5e3bd6c02
@ -10,6 +10,8 @@ This module provides a general-purpose Agent framework that integrates with Skil
|
|||||||
- Parameter schema validation and multi-turn resume
|
- Parameter schema validation and multi-turn resume
|
||||||
- Unified Skillkit invocation interface
|
- Unified Skillkit invocation interface
|
||||||
|
|
||||||
|
## loadable skills
|
||||||
|
[Anthropic's implementation of skills](https://github.com/anthropics/skills/tree/main/skills)
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|||||||
@ -1,7 +1,31 @@
|
|||||||
|
from skillkit import SkillManager
|
||||||
|
|
||||||
class SkillkitWrapper:
|
class SkillkitWrapper:
|
||||||
def __init__(self, skillkit_client):
|
def __init__(self, user_skillsroot, sys_skillsroot):
|
||||||
self.client = skillkit_client
|
|
||||||
|
self.client = SkillManager(project_skill_dir=skillroot,
|
||||||
|
anthropic_config_dir=sys_skillsroot)
|
||||||
|
self.client.discover()
|
||||||
|
|
||||||
|
def list_skills(self):
|
||||||
|
return self.client.list_skills()
|
||||||
|
|
||||||
def invoke_skill(self, skill: str, script: str, params: dict):
|
def invoke_skill(self, skill: str, script: str, params: dict):
|
||||||
print(f"Invoking skill={skill}, script={script}, params={params}")
|
print(f"Invoking skill={skill}, script={script}, params={params}")
|
||||||
return self.client.invoke_skill(skill, params)
|
return self.client.invoke_skill(skill, params)
|
||||||
|
|
||||||
|
def parse_skill_md(self, skill_name: str) -> List[Dict]:
|
||||||
|
md_path = os.path.join(self.skillspath, skill_name, "skill.md")
|
||||||
|
if not os.path.exists(md_path):
|
||||||
|
return []
|
||||||
|
scripts = []
|
||||||
|
md_text = open(md_path, encoding="utf-8").read()
|
||||||
|
script_blocks = re.findall(r"### (.+?)\n- 功能: (.+?)\n- 参数: (.+)", md_text)
|
||||||
|
for name, desc, params in script_blocks:
|
||||||
|
scripts.append({
|
||||||
|
"name": name.strip(),
|
||||||
|
"description": desc.strip(),
|
||||||
|
"params": [p.strip() for p in params.split(",")]
|
||||||
|
})
|
||||||
|
return scripts
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user