fix(skill): 角色技能目录 30→60 + 描述精简 + 优先级顺序同步
This commit is contained in:
parent
8a2d462382
commit
3ecb4f755c
@ -997,12 +997,12 @@ async def _build_role_skills_block(sor, project_id, role, org_id=""):
|
||||
角色专属技能(scope=role,即 pipelines/{pid}/roles/{role}/)全量注入正文——
|
||||
角色 agent 无 load_skill 工具,且角色技能数量少、是角色必须遵守的领域规范。
|
||||
其余 scope(项目/产线/机构/通用)注入目录层(名字+描述),按优先级降序排列,
|
||||
优先级(同名覆盖,高→低):项目 > 角色 > 产线 > 机构 > 通用(SCOPE_PRIORITY 已定义)。
|
||||
优先级(同名覆盖,高→低):角色 > 项目 > 产线 > 机构 > 通用(SCOPE_PRIORITY 已定义)。
|
||||
返回注入 system prompt 的文本,无技能或失败时返回空串。
|
||||
"""
|
||||
try:
|
||||
pid = await _resolve_pipeline_id(project_id)
|
||||
from pipeline_core.skill_loader import get_skill_loader, SCOPE_PRIORITY
|
||||
from pipeline_core.skill_loader import get_skill_loader, SCOPE_PRIORITY, SCOPE_TAG
|
||||
from pipeline_core.skill_pack import ensure_org_skills
|
||||
from .workspace import get_workspace_base
|
||||
ws_base = await get_workspace_base(sor)
|
||||
@ -1019,9 +1019,10 @@ async def _build_role_skills_block(sor, project_id, role, org_id=""):
|
||||
others = sorted([s for s in merged.values() if getattr(s, 'scope', '') != 'role'],
|
||||
key=lambda s: -SCOPE_PRIORITY.get(getattr(s, 'scope', ''), 0))
|
||||
if others:
|
||||
lines = ["## 可用技能(目录,优先级 项目>机构>通用)"]
|
||||
for s in others[:30]:
|
||||
lines.append(f"- [{getattr(s, 'scope', '')}] {s.name}: {(s.description or '')[:100]}")
|
||||
lines = ["## 可用技能(目录,优先级 角色>项目>产线>组织>通用)"]
|
||||
for s in others[:60]:
|
||||
tag = SCOPE_TAG.get(getattr(s, 'scope', ''), getattr(s, 'scope', ''))
|
||||
lines.append(f"- [{tag}] {s.name}: {(s.description or '')[:60]}")
|
||||
blocks.append("\n".join(lines))
|
||||
return "\n\n".join(blocks)
|
||||
except Exception as e:
|
||||
@ -1066,7 +1067,7 @@ async def role_agent_run(project_id, role, agent_id=None, model_name=None):
|
||||
qna_section = await _build_qna_section(sor, task_id, role, agent_id)
|
||||
tools_text = json.dumps(AGENT_TOOLS, ensure_ascii=False)
|
||||
|
||||
# 注入角色技能(角色专属技能全量 + 其余 scope 目录层,优先级 项目>机构>通用)
|
||||
# 注入角色技能(角色专属技能全量 + 其余 scope 目录层,优先级 角色>项目>产线>组织>通用)
|
||||
role_skills = await _build_role_skills_block(sor, project_id, role, org_id)
|
||||
|
||||
system = (AGENT_SYSTEM_PROMPT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user