refactor: to_prompt_block剥离frontmatter冗余(目录层已展示name/description)
This commit is contained in:
parent
99256f040c
commit
d9c100ce76
@ -102,10 +102,16 @@ class Skill:
|
||||
|
||||
def to_prompt_block(self) -> str:
|
||||
scope_tag = SCOPE_TAG.get(self.scope, self.scope)
|
||||
body = self.content
|
||||
# 剥离 frontmatter(--- 之间),只保留正文,避免 name/description 与目录层重复
|
||||
if body.startswith("---"):
|
||||
end = body.find("---", 3)
|
||||
if end != -1:
|
||||
body = body[end + 3:].strip()
|
||||
return f"""## [{scope_tag}] {self.name}
|
||||
{self.description}
|
||||
|
||||
{self.content}
|
||||
{body}
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user