$npx -y skills add cnproduct/workbuddy-wechat-publisher --skill wechat-illustrator分析文章内容,为公众号文章生成或匹配配图。将 [配图: 描述] 占位符转换为实际图片URL。
| 1 | # wechat-illustrator - 公众号配图生成技能 |
| 2 | |
| 3 | ## 概述 |
| 4 | |
| 5 | 分析文章内容,为公众号文章生成或匹配配图。将 `[配图: 描述]` 占位符转换为实际图片URL。 |
| 6 | |
| 7 | ## 触发词 |
| 8 | |
| 9 | 配图, 生成图片, 公众号图片, 文章配图, AI配图 |
| 10 | |
| 11 | ## 功能说明 |
| 12 | |
| 13 | ### 核心能力 |
| 14 | |
| 15 | 1. **占位符识别**:解析 Markdown 文章中的所有 `[配图: 描述]` 标记 |
| 16 | 2. **Prompt生成**:为每个占位符生成详细的图片生成提示词 |
| 17 | 3. **图片生成**:调用生图API生成图片(支持 DALL-E 3、Midjourney、国内模型等) |
| 18 | 4. **图库匹配**(备选):从 Unsplash、Pexels 等免费图库搜索匹配图片 |
| 19 | |
| 20 | ### 输入要求 |
| 21 | |
| 22 | - Markdown 格式的文章内容 |
| 23 | - 包含 `[配图: 描述]` 格式的占位符 |
| 24 | |
| 25 | ### 输出格式 |
| 26 | |
| 27 | ```json |
| 28 | { |
| 29 | "images": [ |
| 30 | { |
| 31 | "index": 1, |
| 32 | "placeholder": "[配图: 科技感的办公室,程序员使用AI工具工作]", |
| 33 | "prompt": "Modern tech office, programmer working with AI tools, clean minimalist style, warm lighting, 16:9 aspect ratio, no text", |
| 34 | "url": "https://generated-image-url.com/xxx.jpg", |
| 35 | "source": "dalle3" |
| 36 | }, |
| 37 | { |
| 38 | "index": 2, |
| 39 | "placeholder": "[配图: 工具对比表格图]", |
| 40 | "prompt": "Comparison chart, software tools icons, clean data visualization, blue and white color scheme, 16:9", |
| 41 | "url": "https://generated-image-url.com/yyy.jpg", |
| 42 | "source": "dalle3" |
| 43 | } |
| 44 | ], |
| 45 | "total": 2 |
| 46 | } |
| 47 | ``` |
| 48 | |
| 49 | ## Prompt 生成要求 |
| 50 | |
| 51 | ### 风格定义 |
| 52 | |
| 53 | 根据文章基调确定图片风格: |
| 54 | - **科技感**:蓝色为主、几何元素、光效 |
| 55 | - **手绘插画**:柔和线条、扁平化、暖色调 |
| 56 | - **现代简约**:大量留白、简洁构图 |
| 57 | - **商务正式**:专业场景、西装正装 |
| 58 | |
| 59 | ### 技术要求 |
| 60 | |
| 61 | - 比例:16:9 或 1:1(适合公众号) |
| 62 | - 避免:文字、人脸、敏感内容 |
| 63 | - 主体:突出、清晰、构图平衡 |
| 64 | - 背景:干净、不过于复杂 |
| 65 | |
| 66 | ### Prompt 模板 |
| 67 | |
| 68 | ``` |
| 69 | [风格描述], [主体内容], [场景细节], [光线色彩], [技术参数] |
| 70 | ``` |
| 71 | |
| 72 | 示例: |
| 73 | ``` |
| 74 | Modern minimalist style, young professional working on laptop in bright co-working space, natural window light, blue and white color palette, 16:9 aspect ratio, high quality, no text, no watermark |
| 75 | ``` |
| 76 | |
| 77 | ## 图片生成策略 |
| 78 | |
| 79 | ### 优先级 |
| 80 | |
| 81 | 1. **首选**:调用生图API生成 |
| 82 | - DALL-E 3(OpenAI) |
| 83 | - Midjourney |
| 84 | - 通义万相 |
| 85 | - 文心一格 |
| 86 | |
| 87 | 2. **备选**:免费图库搜索 |
| 88 | - Unsplash |
| 89 | - Pexels |
| 90 | - Pixabay |
| 91 | |
| 92 | ### 生成参数 |
| 93 | |
| 94 | - 尺寸:公众号封面 900x383(2.35:1),文章配图 1080x608(16:9)或 1080x1080(1:1) |
| 95 | - 格式:JPEG/PNG |
| 96 | - 质量:高 |
| 97 | |
| 98 | ## 保存输出 |
| 99 | |
| 100 | 生成的图片保存到: |
| 101 | ``` |
| 102 | output/ |
| 103 | ├── images/ |
| 104 | │ ├── image_001.jpg |
| 105 | │ └── image_002.jpg |
| 106 | └── image_manifest.json # 图片索引文件 |
| 107 | ``` |
| 108 | |
| 109 | ## 使用示例 |
| 110 | |
| 111 | **输入文章片段**: |
| 112 | ```markdown |
| 113 | ## 为什么程序员需要AI助手? |
| 114 | |
| 115 | 当你还在为某个Bug抓耳挠腮时,AI已经能在几秒内给出解决方案... |
| 116 | |
| 117 | [配图: 程序员面对屏幕,露出惊喜表情] |
| 118 | ``` |
| 119 | |
| 120 | **处理结果**: |
| 121 | ```json |
| 122 | { |
| 123 | "index": 1, |
| 124 | "placeholder": "[配图: 程序员面对屏幕,露出惊喜表情]", |
| 125 | "prompt": "Programmer sitting in front of computer screen with amazed and delighted expression, looking at AI-generated code suggestion, modern tech office, warm lighting, blue ambient light, 16:9, high quality, no text", |
| 126 | "url": "https://example.com/images/programmer_ai.jpg", |
| 127 | "source": "dalle3" |
| 128 | } |
| 129 | ``` |
| 130 | |
| 131 | ## 错误处理 |
| 132 | |
| 133 | 1. **生图失败**:自动切换到图库搜索 |
| 134 | 2. **API限流**:排队重试,3次后使用备选方案 |
| 135 | 3. **图片不匹配**:生成多版供选择 |