agent: inject skills from params into prompt; skills_dir fixed

This commit is contained in:
ymq 2026-08-08 11:51:48 +08:00
parent 4db1405be7
commit 6b295fc8ca

View File

@ -176,6 +176,9 @@ __QNA__
## 产出要求
__ROLE_SPECIFIC__
## 开发规范(必须严格遵循!)
__SKILLS__
## 输出格式严格JSON不要markdown包裹
{
"status": "done",
@ -414,13 +417,23 @@ async def role_agent_run(project_id, role, agent_id=None, model_name=None):
role_specific = ROLE_SPECIFICS.get(role, ROLE_SPECIFICS.get('develop', ''))
qna_section = await _build_qna_section(sor, task_id)
# 从 params 中提取 skills 文本
skills_text = "无特定规范要求,请按行业最佳实践执行。"
try:
params_obj = json.loads(params_str) if isinstance(params_str, str) else params_str
if isinstance(params_obj, dict) and params_obj.get('skills'):
skills_text = str(params_obj['skills']).strip()
except (json.JSONDecodeError, TypeError, ValueError):
pass
prompt = (ROLE_PROMPT
.replace('__ROLE__', role)
.replace('__TITLE__', title)
.replace('__PARAMS__', params_str)
.replace('__QNA__', qna_section)
.replace('__WORKSPACE__', workspace_dir)
.replace('__ROLE_SPECIFIC__', role_specific))
.replace('__ROLE_SPECIFIC__', role_specific)
.replace('__SKILLS__', skills_text))
from .llm_bridge import llm_call
try: