sync update from LAN repo (source dhk-1 @ 3e87be55)
This commit is contained in:
1 parent
ab6068a7c1
commit
42f2a26fa8
1482 files changed
+227759
-9584
No files matched your search
@@ -371,6 +371,34 @@ class SkillNodeExecutor(_AgentInvocation):
|
||||
skill_names = [str(s) for s in (node.config.get("skillNames") or node.config.get("skill_names") or [])]
|
||||
if not skill_names:
|
||||
raise WorkflowError("WORKFLOW_SKILL_FAILED", "技能节点需要同时指定智能体与技能", node_id=node.id)
|
||||
|
||||
# Publishing validates the immutable graph against the then-current
|
||||
# catalog. Recheck immediately before execution so a skill taken
|
||||
# offline after publish (or after the run was queued) fails closed.
|
||||
resolve_enabled_skills = ctx.deps.resolve_enabled_skills
|
||||
if resolve_enabled_skills is not None:
|
||||
try:
|
||||
enabled_skills = await resolve_enabled_skills()
|
||||
except WorkflowError as exc:
|
||||
exc.node_id = exc.node_id or node.id
|
||||
raise
|
||||
except Exception as exc: # noqa: BLE001 - catalog failures fail closed
|
||||
logger.warning("workflow skill availability check failed for node %s", node.id, exc_info=True)
|
||||
raise WorkflowError(
|
||||
"WORKFLOW_RESOURCE_MISSING",
|
||||
"技能可用性校验失败",
|
||||
node_id=node.id,
|
||||
details={"reason": type(exc).__name__},
|
||||
) from exc
|
||||
unavailable = [name for name in skill_names if name not in enabled_skills]
|
||||
if unavailable:
|
||||
raise WorkflowError(
|
||||
"WORKFLOW_RESOURCE_MISSING",
|
||||
f"技能不存在或已下线:{'、'.join(unavailable)}",
|
||||
node_id=node.id,
|
||||
details={"skillNames": unavailable},
|
||||
)
|
||||
|
||||
template = str(node.config.get("promptTemplate") or node.config.get("prompt_template") or "")
|
||||
state = ctx.state()
|
||||
prompt = render_template(template, state).strip() or f"请使用技能 {skill_names[0]} 完成任务。"
|
||||
|
||||
Reference in new issue
Block a user