feat(file-summary): 实现文件处理技能链路

This commit is contained in:
2026-06-06 01:20:26 +08:00
parent 51e7c0c007
commit 18d045d487
19 changed files with 604 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
from __future__ import annotations
from .base import BaseSkill, SkillResult, WorkflowContext
class SkillRegistry:
def __init__(self):
self._skills: dict[str, BaseSkill] = {}
def register(self, skill: BaseSkill) -> None:
if not skill.name:
raise ValueError("Skill 必须声明 name。")
self._skills[skill.name] = skill
def get(self, name: str) -> BaseSkill:
try:
return self._skills[name]
except KeyError as exc:
raise KeyError(f"Skill 未注册:{name}") from exc
def execute(self, name: str, context: WorkflowContext) -> SkillResult:
return self.get(name).run(context)