From d1a737d44822c1396bc6bd7a297e37612741b0d6 Mon Sep 17 00:00:00 2001 From: eaiadmin Date: Thu, 24 Sep 2026 23:34:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E7=BB=84=E4=B8=93?= =?UTF-8?q?=E5=91=98=20spec=20=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=B8=BA=E6=8C=89=E6=AD=A5=E9=AA=A4=E5=88=86=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 扁平 config/ → 按步骤编号目录(00-global, 01-task_configuration, 02-topic_recommendation...) - 每个步骤内聚包含 meta.json、prompt.md、validator.json、fallback.json、rule.json - workflow.json 只保留编排(步骤 key + 顺序),步骤配置由各自目录提供 - 全局配置隔离在 00-global/(domains.json, policy.json) - 统一文件命名:meta.json, prompt.md, validator.json, fallback.json, rule.json, form.json - 新增 SKILL.md 作为技能描述入口 - 新增 remaining_steps.json 作为快速参考 --- .../spec/{config => 00-global}/domains.json | 4 +- .../config => api/spec/00-global}/policy.json | 2 +- .../api/spec/01-task_configuration/form.json | 17 ++ .../spec/02-topic_recommendation/meta.json | 8 + .../spec/02-topic_recommendation/prompt.md | 15 ++ .../spec/03-title_generation/fallback.json | 6 + .../api/spec/03-title_generation/meta.json | 8 + .../api/spec/03-title_generation/prompt.md | 15 ++ .../api/spec/04-outline_generation/meta.json | 8 + .../api/spec/04-outline_generation/prompt.md | 19 +++ .../spec/04-outline_generation/validator.json | 18 ++ .../api/spec/05-content_creation/meta.json | 8 + .../api/spec/05-content_creation/prompt.md | 25 +++ .../spec/05-content_creation/validator.json | 15 ++ .../spec/06-image_prompt_generation/meta.json | 8 + .../06-image_prompt_generation/prompt.md} | 2 +- .../06-image_prompt_generation/rule.json} | 23 +-- .../validator.json} | 9 +- .../api/spec/07-image_generation/prompt.md | 10 ++ .../api/spec/08-preview_export/prompt.md | 10 ++ .../api/spec/09-page_markdown/prompt.md | 10 ++ .../weixin_public_account/api/spec/README.md | 93 +++++++++++ .../api/spec/{config/skill.md => SKILL.md} | 33 ++-- .../api/spec/config/workflow.json | 157 ------------------ .../api/spec/remaining_steps.json | 5 + .../api/spec/workflow.json | 15 ++ ...ixin_public_account_image_prompt_config.go | 4 +- .../spec/{config => 00-global}/domains.json | 4 +- .../config => spec/00-global}/policy.json | 2 +- .../spec/01-task_configuration/form.json | 17 ++ .../spec/02-topic_recommendation/meta.json | 8 + .../spec/02-topic_recommendation/prompt.md | 15 ++ .../spec/03-title_generation/fallback.json | 6 + .../spec/03-title_generation/meta.json | 8 + .../spec/03-title_generation/prompt.md | 15 ++ .../spec/04-outline_generation/meta.json | 8 + .../spec/04-outline_generation/prompt.md | 19 +++ .../spec/04-outline_generation/validator.json | 18 ++ .../spec/05-content_creation/meta.json | 8 + .../spec/05-content_creation/prompt.md | 25 +++ .../spec/05-content_creation/validator.json | 15 ++ .../spec/06-image_prompt_generation/meta.json | 8 + .../06-image_prompt_generation/prompt.md} | 2 +- .../06-image_prompt_generation/rule.json} | 23 +-- .../validator.json} | 9 +- .../spec/07-image_generation/prompt.md | 10 ++ .../spec/08-preview_export/prompt.md | 10 ++ .../spec/09-page_markdown/prompt.md | 10 ++ .../weixin_public_account/spec/README.md | 95 +++++++---- .../spec/{config/skill.md => SKILL.md} | 33 ++-- .../spec/config/workflow.json | 157 ------------------ .../spec/remaining_steps.json | 5 + .../weixin_public_account/spec/workflow.json | 15 ++ 53 files changed, 647 insertions(+), 445 deletions(-) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/{config => 00-global}/domains.json (92%) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/{spec/config => api/spec/00-global}/policy.json (99%) create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/01-task_configuration/form.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/fallback.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/validator.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/validator.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/meta.json rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/{spec/config/prompts/image_prompt_generate.prompt.md => api/spec/06-image_prompt_generation/prompt.md} (91%) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/{spec/config/image_prompt.json => api/spec/06-image_prompt_generation/rule.json} (66%) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/{config/validators/image_prompt.json => 06-image_prompt_generation/validator.json} (74%) create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/07-image_generation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/08-preview_export/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/09-page_markdown/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/README.md rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/{config/skill.md => SKILL.md} (53%) delete mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/workflow.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/remaining_steps.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/workflow.json rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/{config => 00-global}/domains.json (92%) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/{api/spec/config => spec/00-global}/policy.json (99%) create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/01-task_configuration/form.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/fallback.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/validator.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/meta.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/validator.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/meta.json rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/{api/spec/config/prompts/image_prompt_generate.prompt.md => spec/06-image_prompt_generation/prompt.md} (91%) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/{api/spec/config/image_prompt.json => spec/06-image_prompt_generation/rule.json} (66%) rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/{config/validators/image_prompt.json => 06-image_prompt_generation/validator.json} (74%) create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/07-image_generation/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/08-preview_export/prompt.md create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/09-page_markdown/prompt.md rename eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/{config/skill.md => SKILL.md} (53%) delete mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/workflow.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/remaining_steps.json create mode 100644 eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/workflow.json diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/domains.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/00-global/domains.json similarity index 92% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/domains.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/00-global/domains.json index ee3fca1..db11eba 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/domains.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/00-global/domains.json @@ -1,5 +1,5 @@ { - "description": "业务域配置。每个业务域有对应的标签和默认配置。", + "description": "业务域配置。每个业务域有对应的图片标签、热点源和默认关键词。", "version": "1.0.0", "domains": { "AI": { @@ -39,4 +39,4 @@ "default_keywords": [] } } -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/policy.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/00-global/policy.json similarity index 99% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/policy.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/00-global/policy.json index 07a4675..7ed4226 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/policy.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/00-global/policy.json @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/01-task_configuration/form.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/01-task_configuration/form.json new file mode 100644 index 0000000..2220953 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/01-task_configuration/form.json @@ -0,0 +1,17 @@ +{ + "description": "步骤 0:任务配置表单定义。", + "version": "1.0.0", + "step_key": "task_configuration", + "fields": [ + { "key": "business_domain", "label": "业务域", "type": "select", "required": true, "options": ["AI", "医疗", "保险", "HR", "法务", "通用"] }, + { "key": "keyword", "label": "关键词", "type": "text", "required": true }, + { "key": "audience", "label": "目标受众", "type": "text", "default": "公众号读者", "required": false }, + { "key": "goal", "label": "写作目标", "type": "text", "required": false }, + { "key": "tone", "label": "语调风格", "type": "select", "default": "专业但好懂", "options": ["专业但好懂", "轻松有趣", "严肃权威", "故事叙述", "数据驱动"] }, + { "key": "requirements", "label": "特殊要求", "type": "textarea", "required": false }, + { "key": "outline_style", "label": "提纲风格", "type": "select", "default": "问题拆解型", "options": ["问题拆解型", "对比分析型", "案例驱动型", "步骤教程型"] }, + { "key": "outline_words", "label": "提纲字数", "type": "number", "default": 800, "min": 300, "max": 2000, "required": false }, + { "key": "content_target_words", "label": "正文目标字数", "type": "number", "default": 1400, "min": 500, "max": 5000, "required": false }, + { "key": "max_content_images", "label": "最大配图数(可选,0 表示无上限)", "type": "number", "default": 0, "min": 0, "max": 20, "required": false } + ] +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/meta.json new file mode 100644 index 0000000..978f4b2 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 1:选题推荐。", + "version": "1.0.0", + "step_key": "topic_recommendation", + "prompt_file": "prompt.md", + "has_validator": false, + "has_fallback": false +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/prompt.md new file mode 100644 index 0000000..eeaed44 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/02-topic_recommendation/prompt.md @@ -0,0 +1,15 @@ +# Role +你是 `topic_recommendation` 步骤的执行者,负责为公众号文章推荐选题。 + +# Goal +基于业务域、关键词、受众和目标,生成 3 个高传播潜力的选题建议。 + +# 输出要求 +- 每个选题包含:标题、推荐理由、热度评估(高/中/低) +- 标题要吸引点击,理由要说明为什么这个选题适合该业务域 +- 输出为 JSON 数组 + +# 约束 +- 选题必须与业务域和关键词相关 +- 避免过于技术化或过于泛泛的内容 +- 标题长度控制在 20 字以内 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/fallback.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/fallback.json new file mode 100644 index 0000000..107b970 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/fallback.json @@ -0,0 +1,6 @@ +{ + "description": "标题降级资产。当 LLM 生成失败时使用默认模板。", + "version": "1.0.0", + "step_key": "title_generation", + "fallback_template": "围绕{{keyword}},本文为你解读{style}。点击查看更多。" +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/meta.json new file mode 100644 index 0000000..cadd30e --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 2:标题生成。", + "version": "1.0.0", + "step_key": "title_generation", + "prompt_file": "prompt.md", + "has_validator": false, + "has_fallback": true +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/prompt.md new file mode 100644 index 0000000..2dfc12f --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/03-title_generation/prompt.md @@ -0,0 +1,15 @@ +# Role +你是 `title_generation` 步骤的执行者,负责为公众号文章生成标题。 + +# Goal +基于选定的选题,生成 3 个风格不同的标题建议。 + +# 输出要求 +- 偏点击型:吸引点击,适合新媒体 +- 偏稳重:专业权威,适合行业媒体 +- 偏平衡:兼顾点击与专业性 + +# 约束 +- 标题长度 15-30 字 +- 避免标题党 +- 每个标题要有独特角度 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/meta.json new file mode 100644 index 0000000..442a75b --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 3:提纲生成。", + "version": "1.0.0", + "step_key": "outline_generation", + "prompt_file": "prompt.md", + "has_validator": true, + "has_fallback": false +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/prompt.md new file mode 100644 index 0000000..6225040 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/prompt.md @@ -0,0 +1,19 @@ +# Role +你是 `outline_generation` 步骤的执行者,负责为公众号文章生成提纲。 + +# Goal +基于选定标题,生成结构清晰的 Markdown 提纲。 + +# 输出要求 +- 至少 3 个小节(## 标题) +- 每个小节至少 2 个要点 +- 提纲总字数约 {{outline_words}} 字 + +# 提纲风格 +- 风格:{{outline_style}} +- 受众:{{audience}} + +# 约束 +- 使用 Markdown 二级标题(##)标记小节 +- 避免空泛标题,每个小节要有具体内容 +- 提纲之间要有逻辑递进关系 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/validator.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/validator.json new file mode 100644 index 0000000..e26e5a6 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/04-outline_generation/validator.json @@ -0,0 +1,18 @@ +{ + "description": "提纲验证规则。", + "version": "1.0.0", + "step_key": "outline_generation", + "checks": [ + "minimum_sections", + "bullet_count_per_section", + "word_count_budget", + "no_generic_titles" + ], + "minimum_sections": 3, + "minimum_bullets_per_section": 2, + "word_budget": { + "target": 800, + "tolerance": 0.15 + }, + "generic_ban_patterns": ["^先用.+切入", "^明确本文主线", "^本文主要讲述"] +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/meta.json new file mode 100644 index 0000000..9cb5e52 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 4:正文创作。", + "version": "1.0.0", + "step_key": "content_creation", + "prompt_file": "prompt.md", + "has_validator": true, + "has_fallback": false +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/prompt.md new file mode 100644 index 0000000..b08bb59 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/prompt.md @@ -0,0 +1,25 @@ +# Role +你是 `content_creation` 步骤的执行者,负责为公众号文章生成正文。 + +# Goal +基于选定提纲,生成完整的公众号文章正文。 + +# 输入 +- 标题:{{selected_title}} +- 提纲:{{outline}} +- 业务域:{{business_domain}} +- 目标受众:{{audience}} +- 语调风格:{{tone}} +- 正文目标字数:{{content_target_words}} + +# 输出要求 +- 使用 Markdown 格式 +- 每个小节用 `##` 标题 +- 正文要有实质性内容,避免空话 +- 总字数接近 {{content_target_words}} + +# 约束 +- 内容必须与提纲一致 +- 语调要与 {{tone}} 匹配 +- 避免使用模板化语言 +- 每个小节要有具体的论据或案例支撑 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/validator.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/validator.json new file mode 100644 index 0000000..983c311 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/05-content_creation/validator.json @@ -0,0 +1,15 @@ +{ + "description": "正文验证规则。", + "version": "1.0.0", + "step_key": "content_creation", + "checks": [ + "minimum_word_count", + "section_structure", + "no_empty_sections" + ], + "minimum_word_count": 800, + "section_structure": { + "require_h2_headers": true, + "min_sections": 3 + } +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/meta.json new file mode 100644 index 0000000..d6105e2 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 5:配图提示词。", + "version": "1.0.0", + "step_key": "image_prompt_generation", + "prompt_file": "prompt.md", + "has_validator": true, + "has_rule": true +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/prompts/image_prompt_generate.prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/prompt.md similarity index 91% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/prompts/image_prompt_generate.prompt.md rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/prompt.md index 28b87ff..ddf6fa0 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/prompts/image_prompt_generate.prompt.md +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/prompt.md @@ -1,5 +1,5 @@ # Role -你是 `image_prompt_generate` 步骤的执行者,负责为公众号文章生成配图提示词。 +你是 `image_prompt_generation` 步骤的执行者,负责为公众号文章生成配图提示词。 # Goal 基于正文内容,按字数分布规则生成配图提示词,并将提示词以括号标记格式嵌入正文。 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/image_prompt.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/rule.json similarity index 66% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/image_prompt.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/rule.json index ada66d0..1649fa7 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/image_prompt.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/rule.json @@ -21,7 +21,7 @@ } }, "prompt_template": { - "description": "配图提示词模板。{index} 为序号(从 1 开始),{section_title} 为小节标题,{section_summary} 为段落摘要(截断至 120 字)。", + "description": "配图提示词模板。{index} 为序号(从 1 开始),{section_summary} 为段落摘要(截断至 120 字)。", "format": "chinese", "min_chars": 40, "max_chars": 70, @@ -31,24 +31,5 @@ "description": "配图提示词在正文中的嵌入格式。", "cover": "[TITLE_PIC: {prompt}, size: {size}]", "content": "[section_{{index:02d}}: {prompt}, size: {size}]" - }, - "validation": { - "checks": [ - "section_mapping_completeness", - "required_visual_elements", - "prompt_length", - "no_forbidden_elements" - ], - "required_elements": { - "subject": true, - "scene": true, - "lighting": true - }, - "forbidden_elements": [ - "text_overlay", - "collage_style" - ], - "retry_max": 2, - "retry_feedback_template": "配图提示词校验失败:{failed_checks}。请重新生成全部提示词并修复问题,保持段落映射不变。" } -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/validators/image_prompt.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/validator.json similarity index 74% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/validators/image_prompt.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/validator.json index 295aeaa..3c50ae7 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/validators/image_prompt.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/06-image_prompt_generation/validator.json @@ -1,7 +1,7 @@ { "description": "配图提示词验证规则。", "version": "1.0.0", - "step_id": "image_prompt_generation", + "step_key": "image_prompt_generation", "checks": [ "section_mapping_completeness", "required_visual_elements", @@ -10,7 +10,6 @@ "bracket_format_valid" ], "section_mapping": { - "description": "配图提示词与正文段落的映射必须完整。", "cover_required": true, "content_images_required": true }, @@ -24,9 +23,9 @@ "count_mode": "chinese_characters" }, "bracket_format": { - "cover_pattern": "^\\[TITLE_PIC: .* size: landscape_16_9\\]$", - "content_pattern": "^\\[section_\\d{2}: .* size: landscape_4_3\\]$" + "cover_pattern": "^\\\\[TITLE_PIC: .* size: landscape_16_9\\\\]$", + "content_pattern": "^\\\\[section_\\\\d{2}: .* size: landscape_4_3\\\\]$" }, "retry_feedback_template": "配图提示词校验失败:{failed_checks}。请重新生成全部提示词并修复问题。", "retry_max": 2 -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/07-image_generation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/07-image_generation/prompt.md new file mode 100644 index 0000000..1e8fea9 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/07-image_generation/prompt.md @@ -0,0 +1,10 @@ +# Role +你是 `image_generation` 步骤的执行者,负责为公众号文章生成配图。 + +# Goal +基于配图提示词,调用外部图片生成 API 生成配图。 + +# 输出要求 +- 封面图:16:9 横图 +- 段落配图:4:3 横图 +- 每个配图返回 URL 和元数据 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/08-preview_export/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/08-preview_export/prompt.md new file mode 100644 index 0000000..c9cba81 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/08-preview_export/prompt.md @@ -0,0 +1,10 @@ +# Role +你是 `preview_export` 步骤的执行者,负责生成预览稿。 + +# Goal +基于正文和图片,生成预览 MD、预览 HTML 和分页 MD 内容。 + +# 输出要求 +- 预览 MD:Markdown 格式 +- 预览 HTML:HTML 格式 +- 分页 MD:带图片尺寸标注的分页 Markdown diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/09-page_markdown/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/09-page_markdown/prompt.md new file mode 100644 index 0000000..6213963 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/09-page_markdown/prompt.md @@ -0,0 +1,10 @@ +# Role +你是 `page_markdown` 步骤的执行者,负责生成分页 Markdown。 + +# Goal +基于预览稿,生成适合公众号排版的分页 Markdown 文件。 + +# 输出要求 +- 每页内容以 `` 分隔 +- 分页之间用 `---` 分隔 +- 图片使用 Markdown 格式引用,包含 alt 文字 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/README.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/README.md new file mode 100644 index 0000000..f6fbf5d --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/README.md @@ -0,0 +1,93 @@ +# 公众号创作专员 - 规范定义 + +> 这是 pj0235 的第一个"配置驱动"专员样板。参考 pj0012 的 JSON 配置体系设计。 + +## 目录结构 + +``` +spec/ +├── SKILL.md # 技能描述(全局,不嵌入) +├── workflow.json # 工作流编排(步骤 key + 顺序 + 前置依赖) +├── remaining_steps.json # 快速参考(步骤 → 文件映射) +│ +├── 00-global/ # 全局配置(跨步骤共享) +│ ├── domains.json # 业务域配置 +│ └── policy.json # 重试/降级策略 +│ +├── 01-task_configuration/ # 步骤 0:任务配置 +│ └── form.json # 表单字段定义 +│ +├── 02-topic_recommendation/ # 步骤 1:选题推荐 +│ ├── meta.json # 步骤元信息 +│ └── prompt.md # 提示词模板 +│ +├── 03-title_generation/ # 步骤 2:标题生成 +│ ├── meta.json +│ ├── prompt.md +│ └── fallback.json # 降级资产 +│ +├── 04-outline_generation/ # 步骤 3:提纲生成 +│ ├── meta.json +│ ├── prompt.md +│ └── validator.json # 验证规则 +│ +├── 05-content_creation/ # 步骤 4:正文创作 +│ ├── meta.json +│ ├── prompt.md +│ └── validator.json +│ +├── 06-image_prompt_generation/ # 步骤 5:配图提示词 +│ ├── meta.json +│ ├── prompt.md +│ ├── rule.json # 配图规则(分布、模板、格式) +│ └── validator.json +│ +├── 07-image_generation/ # 步骤 6:图片生成 +│ └── prompt.md +│ +├── 08-preview_export/ # 步骤 7:预览导出 +│ └── prompt.md +│ +└── 09-page_markdown/ # 步骤 8:分页 Markdown + └── prompt.md +``` + +## 设计原则 + +1. **每个步骤一个目录**:配置完全内聚,新增/修改步骤只动一个目录 +2. **编号前缀**:文件名按数字排序即执行顺序 +3. **统一命名**:`meta.json`、`prompt.md`、`validator.json`、`fallback.json`、`rule.json` +4. **全局配置隔离**:`00-global/` 放跨步骤共享的配置 +5. **workflow.json 只保留编排**:步骤配置由各自目录提供 + +## 文件说明 + +| 文件 | 说明 | 是否必需 | +|------|------|---------| +| `meta.json` | 步骤元信息(step_key、版本号、依赖文件列表) | 是 | +| `prompt.md` | LLM 提示词模板(YAML 变量注入) | 是 | +| `validator.json` | 验证规则(检查清单、质量规则) | 否 | +| `fallback.json` | 降级资产(LLM 失败时的回退内容) | 否 | +| `rule.json` | 业务规则(仅用于配图提示词这类规则密集型步骤) | 否 | +| `form.json` | 表单字段定义(仅用于任务配置步骤) | 否 | + +## 配图规则(核心示例) + +配图提示词规则在 `06-image_prompt_generation/rule.json` 中定义,包括: + +- 分布规则:封面图 + 每 500 字 1 张 +- 提示词模板:中文模板 + 最小/最大字数 +- 括号标记格式:`[TITLE_PIC: 提示词, size: landscape_16_9]` +- 验证规则:主体/场景/光线必填,文字覆盖/拼贴禁用 + +## 使用方式 + +Go 代码通过 `embed.FS` 嵌入所有 JSON/Markdown 文件,运行时: +1. 读取 JSON 配置 → 获取业务规则 +2. 读取 prompt 模板 → 注入运行时参数 → 组装最终 prompt +3. 读取验证器 → 执行验证逻辑 +4. 读取策略 → 控制重试/降级循环 + +## 如何参考 + +完整的学习分析见:`../../../../reference/pj0012-wechat-image-spec.md` diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/skill.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/SKILL.md similarity index 53% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/skill.md rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/SKILL.md index 3965eeb..f4b3644 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/skill.md +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/SKILL.md @@ -13,19 +13,19 @@ - 关键词驱动的通用文章生成 - 多业务域(AI/医疗/保险/HR/法务/通用)适配 -## 工作流步骤 +## 工作流 -| 序号 | Step Key | 标签 | 前置条件 | 输出 | -|------|----------|------|----------|------| -| 0 | task_configuration | 任务配置 | — | 业务域、关键词、受众、语调等表单参数 | -| 1 | topic_recommendation | 选题推荐 | 配置完成 | 3 个选题建议(标题 + 理由 + 热度) | -| 2 | title_generation | 标题生成 | 有选题 | 3 个标题建议(偏点击/偏稳重/偏平衡) | -| 3 | outline_generation | 提纲生成 | 有标题 | Markdown 提纲结构 | -| 4 | content_creation | 正文创作 | 有提纲 | Markdown 正文(含 ## 小节标题) | -| 5 | image_prompt_generation | 配图提示词 | 有正文 | 配图提示词 + 带标记正文 | -| 6 | image_generation | 图片生成 | 有配图提示词 | 封面图 + 段落图 | -| 7 | preview_export | 预览导出 | 有正文 + 图片 | 预览 MD + 预览 HTML | -| 8 | page_markdown | 分页 Markdown | 有预览稿 | 分页 MD(含图片尺寸标注) | +| 编号 | Step Key | 标签 | 前置条件 | +|------|----------|------|----------| +| 0 | task_configuration | 任务配置 | — | +| 1 | topic_recommendation | 选题推荐 | 配置完成 | +| 2 | title_generation | 标题生成 | 有选题 | +| 3 | outline_generation | 提纲生成 | 有标题 | +| 4 | content_creation | 正文创作 | 有提纲 | +| 5 | image_prompt_generation | 配图提示词 | 有正文 | +| 6 | image_generation | 图片生成 | 有配图提示词 | +| 7 | preview_export | 预览导出 | 有正文 + 图片 | +| 8 | page_markdown | 分页 Markdown | 有预览稿 | ## 配图规则 @@ -34,7 +34,6 @@ 2. 从正文开头累计字数,每 500 字生成 1 张配图 3. 每张配图放在其所属小节(##)的**开始处** 4. 如果某节很长(>500 字),则该节内按 500 字间隔插入多张 -5. 如果某节不足 500 字,与下节合并累计,但不跨节重复 ### 提示词模板 ``` @@ -47,16 +46,12 @@ [section_01: 提示词, size: landscape_4_3] ``` -## 业务域 -AI、医疗、保险、HR、法务、通用 - ## 重试策略 -- 热点抓取:最多 1 次重试 - 选题推荐:最多 1 次重试 - 标题/提纲/正文/配图:最多 2 次重试 -- 预览/分页:0 次重试 +- 图片生成/预览/分页:0 次重试 ## 验证规则 - 提纲:至少 3 个小节,每小节至少 2 个要点 - 正文:至少 800 字,每个小节有实质性内容 -- 配图提示词:段落数 = 提示词数,每个提示词 40-70 字,必须包含主体/场景/光线 +- 配图提示词:段落数 = 提示词数,每个提示词 40-70 字 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/workflow.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/workflow.json deleted file mode 100644 index c26c344..0000000 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/workflow.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "description": "公众号创作工作流步骤定义。步骤按顺序执行,前一步骤完成方可进入下一步骤。", - "version": "1.0.0", - "steps": [ - { - "key": "task_configuration", - "label": "任务配置", - "type": "form", - "order": 0, - "is_entry_point": true, - "description": "配置业务域、关键词、受众、语调等参数。" - }, - { - "key": "topic_recommendation", - "label": "选题推荐", - "type": "ai", - "order": 1, - "preconditions": ["task_configuration"], - "description": "基于业务域和关键词生成 3 个选题建议。" - }, - { - "key": "title_generation", - "label": "标题生成", - "type": "ai", - "order": 2, - "preconditions": ["topic_recommendation"], - "description": "基于选定选题生成 3 个标题建议(偏点击/偏稳重/偏平衡)。" - }, - { - "key": "outline_generation", - "label": "提纲生成", - "type": "ai", - "order": 3, - "preconditions": ["title_generation"], - "description": "基于选定标题生成 Markdown 提纲结构。" - }, - { - "key": "content_creation", - "label": "正文创作", - "type": "ai", - "order": 4, - "preconditions": ["outline_generation"], - "description": "基于选定提纲和配置参数生成正文。" - }, - { - "key": "image_prompt_generation", - "label": "配图提示词", - "type": "ai", - "order": 5, - "preconditions": ["content_creation"], - "description": "基于正文按字数分布生成配图提示词,并嵌入带标记正文。" - }, - { - "key": "image_generation", - "label": "图片生成", - "type": "external", - "order": 6, - "preconditions": ["image_prompt_generation"], - "description": "基于配图提示词调用外部图片生成 API。" - }, - { - "key": "preview_export", - "label": "预览导出", - "type": "render", - "order": 7, - "preconditions": ["content_creation", "image_generation"], - "description": "生成预览 MD、预览 HTML 和分页 MD。" - }, - { - "key": "page_markdown", - "label": "分页 Markdown", - "type": "render", - "order": 8, - "preconditions": ["preview_export"], - "description": "生成带图片尺寸标注的分页 Markdown。" - } - ], - "forms": { - "task_configuration": { - "fields": [ - { - "key": "business_domain", - "label": "业务域", - "type": "select", - "required": true, - "options": ["AI", "医疗", "保险", "HR", "法务", "通用"] - }, - { - "key": "keyword", - "label": "关键词", - "type": "text", - "required": true - }, - { - "key": "audience", - "label": "目标受众", - "type": "text", - "default": "公众号读者", - "required": false - }, - { - "key": "goal", - "label": "写作目标", - "type": "text", - "required": false - }, - { - "key": "tone", - "label": "语调风格", - "type": "select", - "default": "专业但好懂", - "options": ["专业但好懂", "轻松有趣", "严肃权威", "故事叙述", "数据驱动"] - }, - { - "key": "requirements", - "label": "特殊要求", - "type": "textarea", - "required": false - }, - { - "key": "outline_style", - "label": "提纲风格", - "type": "select", - "default": "问题拆解型", - "options": ["问题拆解型", "对比分析型", "案例驱动型", "步骤教程型"] - }, - { - "key": "outline_words", - "label": "提纲字数", - "type": "number", - "default": 800, - "min": 300, - "max": 2000, - "required": false - }, - { - "key": "content_target_words", - "label": "正文目标字数", - "type": "number", - "default": 1400, - "min": 500, - "max": 5000, - "required": false - }, - { - "key": "max_content_images", - "label": "最大配图数(可选,0 表示无上限)", - "type": "number", - "default": 0, - "min": 0, - "max": 20, - "required": false - } - ] - } - } -} \ No newline at end of file diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/remaining_steps.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/remaining_steps.json new file mode 100644 index 0000000..4502058 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/remaining_steps.json @@ -0,0 +1,5 @@ +[ + {"step_key": "image_generation", "prompt_file": "prompt.md"}, + {"step_key": "preview_export", "prompt_file": "prompt.md"}, + {"step_key": "page_markdown", "prompt_file": "prompt.md"} +] diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/workflow.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/workflow.json new file mode 100644 index 0000000..f638cbd --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/workflow.json @@ -0,0 +1,15 @@ +{ + "description": "工作流编排。按编号顺序执行,每步的 prompt/validator/fallback 在各自步骤目录中。", + "version": "1.0.0", + "steps": [ + { "key": "task_configuration", "label": "任务配置", "type": "form", "order": 0, "is_entry_point": true }, + { "key": "topic_recommendation", "label": "选题推荐", "type": "ai", "order": 1, "preconditions": ["task_configuration"] }, + { "key": "title_generation", "label": "标题生成", "type": "ai", "order": 2, "preconditions": ["topic_recommendation"] }, + { "key": "outline_generation", "label": "提纲生成", "type": "ai", "order": 3, "preconditions": ["title_generation"] }, + { "key": "content_creation", "label": "正文创作", "type": "ai", "order": 4, "preconditions": ["outline_generation"] }, + { "key": "image_prompt_generation", "label": "配图提示词", "type": "ai", "order": 5, "preconditions": ["content_creation"] }, + { "key": "image_generation", "label": "图片生成", "type": "external", "order": 6, "preconditions": ["image_prompt_generation"] }, + { "key": "preview_export", "label": "预览导出", "type": "render", "order": 7, "preconditions": ["content_creation", "image_generation"] }, + { "key": "page_markdown", "label": "分页 Markdown", "type": "render", "order": 8, "preconditions": ["preview_export"] } + ] +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/weixin_public_account_image_prompt_config.go b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/weixin_public_account_image_prompt_config.go index 3922192..50b17cf 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/weixin_public_account_image_prompt_config.go +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/weixin_public_account_image_prompt_config.go @@ -7,7 +7,7 @@ import ( "strings" ) -//go:embed spec/config/*.json spec/config/validators/*.json spec/config/prompts/*.md +//go:embed spec/*.json spec/*/*.json spec/*/*.md var specConfigFS embed.FS // imagePromptConfig 从 JSON 配置文件读取的配图提示词规则。 @@ -81,7 +81,7 @@ func init() { // loadWeixinPublicAccountImagePromptConfig 从嵌入的 spec 目录加载 JSON 配置。 func loadWeixinPublicAccountImagePromptConfig() *imagePromptConfig { - data, err := specConfigFS.ReadFile("spec/config/image_prompt.json") + data, err := specConfigFS.ReadFile("spec/06-image_prompt_generation/rule.json") if err != nil { // 如果 spec 目录不存在或配置缺失,回退到内联默认配置 return defaultImagePromptConfig() diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/domains.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/00-global/domains.json similarity index 92% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/domains.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/00-global/domains.json index ee3fca1..db11eba 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/domains.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/00-global/domains.json @@ -1,5 +1,5 @@ { - "description": "业务域配置。每个业务域有对应的标签和默认配置。", + "description": "业务域配置。每个业务域有对应的图片标签、热点源和默认关键词。", "version": "1.0.0", "domains": { "AI": { @@ -39,4 +39,4 @@ "default_keywords": [] } } -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/policy.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/00-global/policy.json similarity index 99% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/policy.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/00-global/policy.json index 07a4675..7ed4226 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/policy.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/00-global/policy.json @@ -36,4 +36,4 @@ } } } -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/01-task_configuration/form.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/01-task_configuration/form.json new file mode 100644 index 0000000..2220953 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/01-task_configuration/form.json @@ -0,0 +1,17 @@ +{ + "description": "步骤 0:任务配置表单定义。", + "version": "1.0.0", + "step_key": "task_configuration", + "fields": [ + { "key": "business_domain", "label": "业务域", "type": "select", "required": true, "options": ["AI", "医疗", "保险", "HR", "法务", "通用"] }, + { "key": "keyword", "label": "关键词", "type": "text", "required": true }, + { "key": "audience", "label": "目标受众", "type": "text", "default": "公众号读者", "required": false }, + { "key": "goal", "label": "写作目标", "type": "text", "required": false }, + { "key": "tone", "label": "语调风格", "type": "select", "default": "专业但好懂", "options": ["专业但好懂", "轻松有趣", "严肃权威", "故事叙述", "数据驱动"] }, + { "key": "requirements", "label": "特殊要求", "type": "textarea", "required": false }, + { "key": "outline_style", "label": "提纲风格", "type": "select", "default": "问题拆解型", "options": ["问题拆解型", "对比分析型", "案例驱动型", "步骤教程型"] }, + { "key": "outline_words", "label": "提纲字数", "type": "number", "default": 800, "min": 300, "max": 2000, "required": false }, + { "key": "content_target_words", "label": "正文目标字数", "type": "number", "default": 1400, "min": 500, "max": 5000, "required": false }, + { "key": "max_content_images", "label": "最大配图数(可选,0 表示无上限)", "type": "number", "default": 0, "min": 0, "max": 20, "required": false } + ] +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/meta.json new file mode 100644 index 0000000..978f4b2 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 1:选题推荐。", + "version": "1.0.0", + "step_key": "topic_recommendation", + "prompt_file": "prompt.md", + "has_validator": false, + "has_fallback": false +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/prompt.md new file mode 100644 index 0000000..eeaed44 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/02-topic_recommendation/prompt.md @@ -0,0 +1,15 @@ +# Role +你是 `topic_recommendation` 步骤的执行者,负责为公众号文章推荐选题。 + +# Goal +基于业务域、关键词、受众和目标,生成 3 个高传播潜力的选题建议。 + +# 输出要求 +- 每个选题包含:标题、推荐理由、热度评估(高/中/低) +- 标题要吸引点击,理由要说明为什么这个选题适合该业务域 +- 输出为 JSON 数组 + +# 约束 +- 选题必须与业务域和关键词相关 +- 避免过于技术化或过于泛泛的内容 +- 标题长度控制在 20 字以内 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/fallback.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/fallback.json new file mode 100644 index 0000000..107b970 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/fallback.json @@ -0,0 +1,6 @@ +{ + "description": "标题降级资产。当 LLM 生成失败时使用默认模板。", + "version": "1.0.0", + "step_key": "title_generation", + "fallback_template": "围绕{{keyword}},本文为你解读{style}。点击查看更多。" +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/meta.json new file mode 100644 index 0000000..cadd30e --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 2:标题生成。", + "version": "1.0.0", + "step_key": "title_generation", + "prompt_file": "prompt.md", + "has_validator": false, + "has_fallback": true +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/prompt.md new file mode 100644 index 0000000..2dfc12f --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/03-title_generation/prompt.md @@ -0,0 +1,15 @@ +# Role +你是 `title_generation` 步骤的执行者,负责为公众号文章生成标题。 + +# Goal +基于选定的选题,生成 3 个风格不同的标题建议。 + +# 输出要求 +- 偏点击型:吸引点击,适合新媒体 +- 偏稳重:专业权威,适合行业媒体 +- 偏平衡:兼顾点击与专业性 + +# 约束 +- 标题长度 15-30 字 +- 避免标题党 +- 每个标题要有独特角度 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/meta.json new file mode 100644 index 0000000..442a75b --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 3:提纲生成。", + "version": "1.0.0", + "step_key": "outline_generation", + "prompt_file": "prompt.md", + "has_validator": true, + "has_fallback": false +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/prompt.md new file mode 100644 index 0000000..6225040 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/prompt.md @@ -0,0 +1,19 @@ +# Role +你是 `outline_generation` 步骤的执行者,负责为公众号文章生成提纲。 + +# Goal +基于选定标题,生成结构清晰的 Markdown 提纲。 + +# 输出要求 +- 至少 3 个小节(## 标题) +- 每个小节至少 2 个要点 +- 提纲总字数约 {{outline_words}} 字 + +# 提纲风格 +- 风格:{{outline_style}} +- 受众:{{audience}} + +# 约束 +- 使用 Markdown 二级标题(##)标记小节 +- 避免空泛标题,每个小节要有具体内容 +- 提纲之间要有逻辑递进关系 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/validator.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/validator.json new file mode 100644 index 0000000..e26e5a6 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/04-outline_generation/validator.json @@ -0,0 +1,18 @@ +{ + "description": "提纲验证规则。", + "version": "1.0.0", + "step_key": "outline_generation", + "checks": [ + "minimum_sections", + "bullet_count_per_section", + "word_count_budget", + "no_generic_titles" + ], + "minimum_sections": 3, + "minimum_bullets_per_section": 2, + "word_budget": { + "target": 800, + "tolerance": 0.15 + }, + "generic_ban_patterns": ["^先用.+切入", "^明确本文主线", "^本文主要讲述"] +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/meta.json new file mode 100644 index 0000000..9cb5e52 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 4:正文创作。", + "version": "1.0.0", + "step_key": "content_creation", + "prompt_file": "prompt.md", + "has_validator": true, + "has_fallback": false +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/prompt.md new file mode 100644 index 0000000..b08bb59 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/prompt.md @@ -0,0 +1,25 @@ +# Role +你是 `content_creation` 步骤的执行者,负责为公众号文章生成正文。 + +# Goal +基于选定提纲,生成完整的公众号文章正文。 + +# 输入 +- 标题:{{selected_title}} +- 提纲:{{outline}} +- 业务域:{{business_domain}} +- 目标受众:{{audience}} +- 语调风格:{{tone}} +- 正文目标字数:{{content_target_words}} + +# 输出要求 +- 使用 Markdown 格式 +- 每个小节用 `##` 标题 +- 正文要有实质性内容,避免空话 +- 总字数接近 {{content_target_words}} + +# 约束 +- 内容必须与提纲一致 +- 语调要与 {{tone}} 匹配 +- 避免使用模板化语言 +- 每个小节要有具体的论据或案例支撑 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/validator.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/validator.json new file mode 100644 index 0000000..983c311 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/05-content_creation/validator.json @@ -0,0 +1,15 @@ +{ + "description": "正文验证规则。", + "version": "1.0.0", + "step_key": "content_creation", + "checks": [ + "minimum_word_count", + "section_structure", + "no_empty_sections" + ], + "minimum_word_count": 800, + "section_structure": { + "require_h2_headers": true, + "min_sections": 3 + } +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/meta.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/meta.json new file mode 100644 index 0000000..d6105e2 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/meta.json @@ -0,0 +1,8 @@ +{ + "description": "步骤 5:配图提示词。", + "version": "1.0.0", + "step_key": "image_prompt_generation", + "prompt_file": "prompt.md", + "has_validator": true, + "has_rule": true +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/prompts/image_prompt_generate.prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/prompt.md similarity index 91% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/prompts/image_prompt_generate.prompt.md rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/prompt.md index 28b87ff..ddf6fa0 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/prompts/image_prompt_generate.prompt.md +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/prompt.md @@ -1,5 +1,5 @@ # Role -你是 `image_prompt_generate` 步骤的执行者,负责为公众号文章生成配图提示词。 +你是 `image_prompt_generation` 步骤的执行者,负责为公众号文章生成配图提示词。 # Goal 基于正文内容,按字数分布规则生成配图提示词,并将提示词以括号标记格式嵌入正文。 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/image_prompt.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/rule.json similarity index 66% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/image_prompt.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/rule.json index ada66d0..1649fa7 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/api/spec/config/image_prompt.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/rule.json @@ -21,7 +21,7 @@ } }, "prompt_template": { - "description": "配图提示词模板。{index} 为序号(从 1 开始),{section_title} 为小节标题,{section_summary} 为段落摘要(截断至 120 字)。", + "description": "配图提示词模板。{index} 为序号(从 1 开始),{section_summary} 为段落摘要(截断至 120 字)。", "format": "chinese", "min_chars": 40, "max_chars": 70, @@ -31,24 +31,5 @@ "description": "配图提示词在正文中的嵌入格式。", "cover": "[TITLE_PIC: {prompt}, size: {size}]", "content": "[section_{{index:02d}}: {prompt}, size: {size}]" - }, - "validation": { - "checks": [ - "section_mapping_completeness", - "required_visual_elements", - "prompt_length", - "no_forbidden_elements" - ], - "required_elements": { - "subject": true, - "scene": true, - "lighting": true - }, - "forbidden_elements": [ - "text_overlay", - "collage_style" - ], - "retry_max": 2, - "retry_feedback_template": "配图提示词校验失败:{failed_checks}。请重新生成全部提示词并修复问题,保持段落映射不变。" } -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/validators/image_prompt.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/validator.json similarity index 74% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/validators/image_prompt.json rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/validator.json index 295aeaa..3c50ae7 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/validators/image_prompt.json +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/06-image_prompt_generation/validator.json @@ -1,7 +1,7 @@ { "description": "配图提示词验证规则。", "version": "1.0.0", - "step_id": "image_prompt_generation", + "step_key": "image_prompt_generation", "checks": [ "section_mapping_completeness", "required_visual_elements", @@ -10,7 +10,6 @@ "bracket_format_valid" ], "section_mapping": { - "description": "配图提示词与正文段落的映射必须完整。", "cover_required": true, "content_images_required": true }, @@ -24,9 +23,9 @@ "count_mode": "chinese_characters" }, "bracket_format": { - "cover_pattern": "^\\[TITLE_PIC: .* size: landscape_16_9\\]$", - "content_pattern": "^\\[section_\\d{2}: .* size: landscape_4_3\\]$" + "cover_pattern": "^\\\\[TITLE_PIC: .* size: landscape_16_9\\\\]$", + "content_pattern": "^\\\\[section_\\\\d{2}: .* size: landscape_4_3\\\\]$" }, "retry_feedback_template": "配图提示词校验失败:{failed_checks}。请重新生成全部提示词并修复问题。", "retry_max": 2 -} \ No newline at end of file +} diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/07-image_generation/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/07-image_generation/prompt.md new file mode 100644 index 0000000..1e8fea9 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/07-image_generation/prompt.md @@ -0,0 +1,10 @@ +# Role +你是 `image_generation` 步骤的执行者,负责为公众号文章生成配图。 + +# Goal +基于配图提示词,调用外部图片生成 API 生成配图。 + +# 输出要求 +- 封面图:16:9 横图 +- 段落配图:4:3 横图 +- 每个配图返回 URL 和元数据 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/08-preview_export/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/08-preview_export/prompt.md new file mode 100644 index 0000000..c9cba81 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/08-preview_export/prompt.md @@ -0,0 +1,10 @@ +# Role +你是 `preview_export` 步骤的执行者,负责生成预览稿。 + +# Goal +基于正文和图片,生成预览 MD、预览 HTML 和分页 MD 内容。 + +# 输出要求 +- 预览 MD:Markdown 格式 +- 预览 HTML:HTML 格式 +- 分页 MD:带图片尺寸标注的分页 Markdown diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/09-page_markdown/prompt.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/09-page_markdown/prompt.md new file mode 100644 index 0000000..6213963 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/09-page_markdown/prompt.md @@ -0,0 +1,10 @@ +# Role +你是 `page_markdown` 步骤的执行者,负责生成分页 Markdown。 + +# Goal +基于预览稿,生成适合公众号排版的分页 Markdown 文件。 + +# 输出要求 +- 每页内容以 `` 分隔 +- 分页之间用 `---` 分隔 +- 图片使用 Markdown 格式引用,包含 alt 文字 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/README.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/README.md index 9a0c2cf..f6fbf5d 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/README.md +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/README.md @@ -6,55 +6,88 @@ ``` spec/ -├── config/ -│ ├── skill.md # 技能描述 + 执行策略(人可读 + LLM 可读) -│ ├── workflow.json # 工作流步骤定义(步骤 key、标签、前置条件、表单) -│ ├── image_prompt.json # 配图提示词规则(分布、模板、验证) -│ ├── domains.json # 业务域配置 -│ └── policy.json # 重试和降级策略 -├── config/prompts/ -│ └── image_prompt_generate.prompt.md # 配图提示词生成 prompt 模板 -├── config/validators/ -│ └── image_prompt.json # 配图提示词验证规则 -└── README.md +├── SKILL.md # 技能描述(全局,不嵌入) +├── workflow.json # 工作流编排(步骤 key + 顺序 + 前置依赖) +├── remaining_steps.json # 快速参考(步骤 → 文件映射) +│ +├── 00-global/ # 全局配置(跨步骤共享) +│ ├── domains.json # 业务域配置 +│ └── policy.json # 重试/降级策略 +│ +├── 01-task_configuration/ # 步骤 0:任务配置 +│ └── form.json # 表单字段定义 +│ +├── 02-topic_recommendation/ # 步骤 1:选题推荐 +│ ├── meta.json # 步骤元信息 +│ └── prompt.md # 提示词模板 +│ +├── 03-title_generation/ # 步骤 2:标题生成 +│ ├── meta.json +│ ├── prompt.md +│ └── fallback.json # 降级资产 +│ +├── 04-outline_generation/ # 步骤 3:提纲生成 +│ ├── meta.json +│ ├── prompt.md +│ └── validator.json # 验证规则 +│ +├── 05-content_creation/ # 步骤 4:正文创作 +│ ├── meta.json +│ ├── prompt.md +│ └── validator.json +│ +├── 06-image_prompt_generation/ # 步骤 5:配图提示词 +│ ├── meta.json +│ ├── prompt.md +│ ├── rule.json # 配图规则(分布、模板、格式) +│ └── validator.json +│ +├── 07-image_generation/ # 步骤 6:图片生成 +│ └── prompt.md +│ +├── 08-preview_export/ # 步骤 7:预览导出 +│ └── prompt.md +│ +└── 09-page_markdown/ # 步骤 8:分页 Markdown + └── prompt.md ``` ## 设计原则 -1. **三层分离**: - - `skill.md` — 技能描述层(人可读 + LLM 可读) - - `*.json` — 数据配置层(机器可读,热更新) - - `*.prompt.md` — 提示词模板层(YAML 变量注入) +1. **每个步骤一个目录**:配置完全内聚,新增/修改步骤只动一个目录 +2. **编号前缀**:文件名按数字排序即执行顺序 +3. **统一命名**:`meta.json`、`prompt.md`、`validator.json`、`fallback.json`、`rule.json` +4. **全局配置隔离**:`00-global/` 放跨步骤共享的配置 +5. **workflow.json 只保留编排**:步骤配置由各自目录提供 -2. **代码是运行时适配器**: - - 按路径读取 JSON/文本 - - 将运行时参数注入模板 - - 执行验证器逻辑 - - 控制重试/降级循环 - - 调用 LLM +## 文件说明 -3. **不硬编码业务内容**: - - 业务规则变更通过修改 JSON/Markdown 实现 - - 代码层只做通用适配 +| 文件 | 说明 | 是否必需 | +|------|------|---------| +| `meta.json` | 步骤元信息(step_key、版本号、依赖文件列表) | 是 | +| `prompt.md` | LLM 提示词模板(YAML 变量注入) | 是 | +| `validator.json` | 验证规则(检查清单、质量规则) | 否 | +| `fallback.json` | 降级资产(LLM 失败时的回退内容) | 否 | +| `rule.json` | 业务规则(仅用于配图提示词这类规则密集型步骤) | 否 | +| `form.json` | 表单字段定义(仅用于任务配置步骤) | 否 | ## 配图规则(核心示例) -配图提示词规则完全外置在 `image_prompt.json` 中,包括: +配图提示词规则在 `06-image_prompt_generation/rule.json` 中定义,包括: - 分布规则:封面图 + 每 500 字 1 张 - 提示词模板:中文模板 + 最小/最大字数 - 括号标记格式:`[TITLE_PIC: 提示词, size: landscape_16_9]` - 验证规则:主体/场景/光线必填,文字覆盖/拼贴禁用 -- 重试策略:最多 2 次 - -## 如何参考 - -完整的学习分析见:`../../../../reference/pj0012-wechat-image-spec.md` ## 使用方式 -Go 代码通过 `embed.FS` 嵌入这些文件,运行时: +Go 代码通过 `embed.FS` 嵌入所有 JSON/Markdown 文件,运行时: 1. 读取 JSON 配置 → 获取业务规则 2. 读取 prompt 模板 → 注入运行时参数 → 组装最终 prompt 3. 读取验证器 → 执行验证逻辑 4. 读取策略 → 控制重试/降级循环 + +## 如何参考 + +完整的学习分析见:`../../../../reference/pj0012-wechat-image-spec.md` diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/skill.md b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/SKILL.md similarity index 53% rename from eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/skill.md rename to eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/SKILL.md index 3965eeb..f4b3644 100644 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/skill.md +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/SKILL.md @@ -13,19 +13,19 @@ - 关键词驱动的通用文章生成 - 多业务域(AI/医疗/保险/HR/法务/通用)适配 -## 工作流步骤 +## 工作流 -| 序号 | Step Key | 标签 | 前置条件 | 输出 | -|------|----------|------|----------|------| -| 0 | task_configuration | 任务配置 | — | 业务域、关键词、受众、语调等表单参数 | -| 1 | topic_recommendation | 选题推荐 | 配置完成 | 3 个选题建议(标题 + 理由 + 热度) | -| 2 | title_generation | 标题生成 | 有选题 | 3 个标题建议(偏点击/偏稳重/偏平衡) | -| 3 | outline_generation | 提纲生成 | 有标题 | Markdown 提纲结构 | -| 4 | content_creation | 正文创作 | 有提纲 | Markdown 正文(含 ## 小节标题) | -| 5 | image_prompt_generation | 配图提示词 | 有正文 | 配图提示词 + 带标记正文 | -| 6 | image_generation | 图片生成 | 有配图提示词 | 封面图 + 段落图 | -| 7 | preview_export | 预览导出 | 有正文 + 图片 | 预览 MD + 预览 HTML | -| 8 | page_markdown | 分页 Markdown | 有预览稿 | 分页 MD(含图片尺寸标注) | +| 编号 | Step Key | 标签 | 前置条件 | +|------|----------|------|----------| +| 0 | task_configuration | 任务配置 | — | +| 1 | topic_recommendation | 选题推荐 | 配置完成 | +| 2 | title_generation | 标题生成 | 有选题 | +| 3 | outline_generation | 提纲生成 | 有标题 | +| 4 | content_creation | 正文创作 | 有提纲 | +| 5 | image_prompt_generation | 配图提示词 | 有正文 | +| 6 | image_generation | 图片生成 | 有配图提示词 | +| 7 | preview_export | 预览导出 | 有正文 + 图片 | +| 8 | page_markdown | 分页 Markdown | 有预览稿 | ## 配图规则 @@ -34,7 +34,6 @@ 2. 从正文开头累计字数,每 500 字生成 1 张配图 3. 每张配图放在其所属小节(##)的**开始处** 4. 如果某节很长(>500 字),则该节内按 500 字间隔插入多张 -5. 如果某节不足 500 字,与下节合并累计,但不跨节重复 ### 提示词模板 ``` @@ -47,16 +46,12 @@ [section_01: 提示词, size: landscape_4_3] ``` -## 业务域 -AI、医疗、保险、HR、法务、通用 - ## 重试策略 -- 热点抓取:最多 1 次重试 - 选题推荐:最多 1 次重试 - 标题/提纲/正文/配图:最多 2 次重试 -- 预览/分页:0 次重试 +- 图片生成/预览/分页:0 次重试 ## 验证规则 - 提纲:至少 3 个小节,每小节至少 2 个要点 - 正文:至少 800 字,每个小节有实质性内容 -- 配图提示词:段落数 = 提示词数,每个提示词 40-70 字,必须包含主体/场景/光线 +- 配图提示词:段落数 = 提示词数,每个提示词 40-70 字 diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/workflow.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/workflow.json deleted file mode 100644 index c26c344..0000000 --- a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/config/workflow.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "description": "公众号创作工作流步骤定义。步骤按顺序执行,前一步骤完成方可进入下一步骤。", - "version": "1.0.0", - "steps": [ - { - "key": "task_configuration", - "label": "任务配置", - "type": "form", - "order": 0, - "is_entry_point": true, - "description": "配置业务域、关键词、受众、语调等参数。" - }, - { - "key": "topic_recommendation", - "label": "选题推荐", - "type": "ai", - "order": 1, - "preconditions": ["task_configuration"], - "description": "基于业务域和关键词生成 3 个选题建议。" - }, - { - "key": "title_generation", - "label": "标题生成", - "type": "ai", - "order": 2, - "preconditions": ["topic_recommendation"], - "description": "基于选定选题生成 3 个标题建议(偏点击/偏稳重/偏平衡)。" - }, - { - "key": "outline_generation", - "label": "提纲生成", - "type": "ai", - "order": 3, - "preconditions": ["title_generation"], - "description": "基于选定标题生成 Markdown 提纲结构。" - }, - { - "key": "content_creation", - "label": "正文创作", - "type": "ai", - "order": 4, - "preconditions": ["outline_generation"], - "description": "基于选定提纲和配置参数生成正文。" - }, - { - "key": "image_prompt_generation", - "label": "配图提示词", - "type": "ai", - "order": 5, - "preconditions": ["content_creation"], - "description": "基于正文按字数分布生成配图提示词,并嵌入带标记正文。" - }, - { - "key": "image_generation", - "label": "图片生成", - "type": "external", - "order": 6, - "preconditions": ["image_prompt_generation"], - "description": "基于配图提示词调用外部图片生成 API。" - }, - { - "key": "preview_export", - "label": "预览导出", - "type": "render", - "order": 7, - "preconditions": ["content_creation", "image_generation"], - "description": "生成预览 MD、预览 HTML 和分页 MD。" - }, - { - "key": "page_markdown", - "label": "分页 Markdown", - "type": "render", - "order": 8, - "preconditions": ["preview_export"], - "description": "生成带图片尺寸标注的分页 Markdown。" - } - ], - "forms": { - "task_configuration": { - "fields": [ - { - "key": "business_domain", - "label": "业务域", - "type": "select", - "required": true, - "options": ["AI", "医疗", "保险", "HR", "法务", "通用"] - }, - { - "key": "keyword", - "label": "关键词", - "type": "text", - "required": true - }, - { - "key": "audience", - "label": "目标受众", - "type": "text", - "default": "公众号读者", - "required": false - }, - { - "key": "goal", - "label": "写作目标", - "type": "text", - "required": false - }, - { - "key": "tone", - "label": "语调风格", - "type": "select", - "default": "专业但好懂", - "options": ["专业但好懂", "轻松有趣", "严肃权威", "故事叙述", "数据驱动"] - }, - { - "key": "requirements", - "label": "特殊要求", - "type": "textarea", - "required": false - }, - { - "key": "outline_style", - "label": "提纲风格", - "type": "select", - "default": "问题拆解型", - "options": ["问题拆解型", "对比分析型", "案例驱动型", "步骤教程型"] - }, - { - "key": "outline_words", - "label": "提纲字数", - "type": "number", - "default": 800, - "min": 300, - "max": 2000, - "required": false - }, - { - "key": "content_target_words", - "label": "正文目标字数", - "type": "number", - "default": 1400, - "min": 500, - "max": 5000, - "required": false - }, - { - "key": "max_content_images", - "label": "最大配图数(可选,0 表示无上限)", - "type": "number", - "default": 0, - "min": 0, - "max": 20, - "required": false - } - ] - } - } -} \ No newline at end of file diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/remaining_steps.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/remaining_steps.json new file mode 100644 index 0000000..4502058 --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/remaining_steps.json @@ -0,0 +1,5 @@ +[ + {"step_key": "image_generation", "prompt_file": "prompt.md"}, + {"step_key": "preview_export", "prompt_file": "prompt.md"}, + {"step_key": "page_markdown", "prompt_file": "prompt.md"} +] diff --git a/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/workflow.json b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/workflow.json new file mode 100644 index 0000000..f638cbd --- /dev/null +++ b/eai_agentplatform/backend-go/internal/specialists/packages/weixin_public_account/spec/workflow.json @@ -0,0 +1,15 @@ +{ + "description": "工作流编排。按编号顺序执行,每步的 prompt/validator/fallback 在各自步骤目录中。", + "version": "1.0.0", + "steps": [ + { "key": "task_configuration", "label": "任务配置", "type": "form", "order": 0, "is_entry_point": true }, + { "key": "topic_recommendation", "label": "选题推荐", "type": "ai", "order": 1, "preconditions": ["task_configuration"] }, + { "key": "title_generation", "label": "标题生成", "type": "ai", "order": 2, "preconditions": ["topic_recommendation"] }, + { "key": "outline_generation", "label": "提纲生成", "type": "ai", "order": 3, "preconditions": ["title_generation"] }, + { "key": "content_creation", "label": "正文创作", "type": "ai", "order": 4, "preconditions": ["outline_generation"] }, + { "key": "image_prompt_generation", "label": "配图提示词", "type": "ai", "order": 5, "preconditions": ["content_creation"] }, + { "key": "image_generation", "label": "图片生成", "type": "external", "order": 6, "preconditions": ["image_prompt_generation"] }, + { "key": "preview_export", "label": "预览导出", "type": "render", "order": 7, "preconditions": ["content_creation", "image_generation"] }, + { "key": "page_markdown", "label": "分页 Markdown", "type": "render", "order": 8, "preconditions": ["preview_export"] } + ] +}