Install
openclaw skills install @spootmu/newspaperRender structured news content into a styled HTML newspaper page with optional AI-generated images using ComfyUI integration.
openclaw skills install @spootmu/newspaperAI 报纸渲染服务 - 将结构化新闻内容渲染成仿实体报纸风格的 HTML 页面。支持 ComfyUI AI 图片生成。
服务地址: http://localhost:3000
渲染报纸 HTML。
请求格式:
POST http://localhost:3000/render
Content-Type: application/json
请求参数:
{
"title": "string (必需) - 报纸标题",
"subtitle": "string (可选) - 副标题",
"articles": [
{
"headline": "string (必需) - 文章标题",
"body": "string (必需) - 文章正文,用\\n\\n分隔段落",
"imagePrompt": "string (可选) - AI 绘画提示词,最多 1 个"
}
],
"comfyOptions": {
"enabled": "boolean (可选,默认 true)",
"timeout": "number (可选,默认 120000ms)",
"interval": "number (可选,默认 2000ms)",
"width": "number (可选,默认 1024)",
"height": "number (可选,默认 1024)"
}
}
成功响应:
{
"success": true,
"id": "生成的唯一 ID",
"url": "http://localhost:3000/output/{id}.html",
"imageStatus": {
"generated": "是否生成图片",
"prompt": "使用的提示词",
"imageUrl": "ComfyUI 图片地址",
"articleIndex": "图片所在文章索引",
"error": "错误信息(如有)"
}
}
错误响应:
{
"success": false,
"errors": ["错误列表"]
}
title: 必需,非空字符串articles: 必需,至少包含 1 篇文章headline 和 bodyimagePrompt: 最多只能有 1 个(单图限制)头条文章(articles[0]):
普通文章:
\n\n 分隔段落"A futuristic AI robot scientist in high-tech laboratory, holographic displays, blue lighting, digital art"const response = await fetch('http://localhost:3000/render', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
title: "科技日报",
subtitle: "前沿科技资讯",
articles: [
{
headline: "AI 大模型迎来重大突破",
body: "今日发布最新 AI 模型...\n\n研究团队表示...",
imagePrompt: "A futuristic AI robot scientist, digital art"
},
{
headline: "量子计算进展",
body: "科学家实现新突破..."
}
],
comfyOptions: {
enabled: true,
timeout: 120000,
interval: 2000,
width: 1024,
height: 512
}
})
});
const result = await response.json();
// result.url 为报纸页面地址
// result.imageStatus 包含图片生成状态
http://127.0.0.1:8000{COMFY_BASE_URL}/prompt{COMFY_VIEW_URL}/view# 可选:自定义 ComfyUI 地址
export COMFY_BASE_URL="http://127.0.0.1:8000"
export COMFY_VIEW_URL="http://127.0.0.1:8000"
imagePrompt 字段/history/{prompt_id} 直到完成GET http://localhost:3000/health
响应:{ "status": "ok", "timestamp": "..." }
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 缺少 title | 未提供标题 | 从内容提取或询问用户 |
| articles 为空 | 没有文章 | 确保至少 1 篇 |
| 多个 imagePrompt | 违反单图限制 | 只保留 1 个 |
| ComfyUI 超时 | 生成时间长 | 增加 comfyOptions.timeout |
| ComfyUI 不可用 | 服务未启动 | 检查 ComfyUI 或使用占位图 |