From 6b295fc8cad723a47996ec61e252ebe3a480eb10 Mon Sep 17 00:00:00 2001 From: ymq Date: Sat, 8 Aug 2026 11:51:48 +0800 Subject: [PATCH] agent: inject skills from params into prompt; skills_dir fixed --- pipeline_service/agent_loop.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pipeline_service/agent_loop.py b/pipeline_service/agent_loop.py index 143c6a8..29b7921 100644 --- a/pipeline_service/agent_loop.py +++ b/pipeline_service/agent_loop.py @@ -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: