用 GPT-4、kie.ai 和 Gmail 生成研究型信息图
表单输入 → AI 联网研究并优化提示词 → kie.ai 生成图片 → 轮询检测 → 邮件交付
- 给谁
- 需要快速制作数据驱动视觉内容的营销人员、内容创作者、教育工作者
- 你会得到
- 提交表单后自动收到研究支撑的信息图邮件附件;失败时收到详细错误说明
硬约束
前置条件:可访问的 n8n 实例(自托管或云版)。需要三种凭证:OpenAI API key(用于 Researcher 节点的 AI 研究代理)、kie.ai API key(以 Header Auth 形式配置,用于 Generate Infographic 和 Check Job Status 节点)、Gmail OAuth2(用于发送邮件)。两个 Gmail 节点的收件人地址需从默认的 [email protected] 替换为实际地址。预计配置时间约 5 分钟。费用取决于 OpenAI、kie.ai 及邮件发送量;来源未提供具体定价。
他们做了什么
模板作者 georgedanp 在 n8n 中构建了一个自动化工作流:用户通过内置表单提交信息图需求(标题、数据主题、风格、布局、配色、分辨率等),AI Agent 调用 GPT-4.1-mini 进行联网研究并生成优化后的图像提示词,随后通过 kie.ai 的 nano-banana-pro 模型生成信息图,工作流每 15 秒轮询一次任务状态(最多 20 次),完成后将图片作为邮件附件发送,失败或超时则发送详细的错误说明邮件。
效果如何
来源报告的预期行为:表单提交后约 5 分钟内完成全流程,成功时收件人收到带附件的信息图邮件,失败时收到包含错误详情、任务 ID 和原始请求参数的排查邮件。(author_report)
值得知道
1. 轮询上限为 20 次(约 5 分钟),超过即视为超时。2. kie.ai 的 nano-banana-pro 模型可用性和定价需自行确认。3. 两个 Gmail 节点的默认收件人为 [email protected],必须替换。4. 图片下载 URL 来自 kie.ai 返回的 resultJson,若格式变化可能导致解析失败。5. 本站未实际运行该模板(reproduction=not_tested),配置前建议在隔离环境测试。6. 节点提示词中的变量名(如 $json['Main Headline'])为 n8n 表达式语法,不可直接用于其他平台。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Generate Infographic 节点:绑定HTTP Header Auth 凭证。
- Email Image to User 节点:绑定Gmail OAuth2 凭证。
- Researcher 节点:绑定OpenAI API 凭证。
- Check Job Status 节点:绑定HTTP Header Auth 凭证。
- Send Error Email 节点:绑定Gmail OAuth2 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #14000(约 19 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
配置凭证与收件人
在 n8n 中打开该模板后,依次完成以下凭证配置:1) 在 Researcher 节点(OpenAI Chat Model)添加 OpenAI API key;2) 新建 Header Auth 凭证,填入 kie.ai 的 Bearer token,并将其关联到 Generate Infographic 和 Check Job Status 两个 HTTP Request 节点;3) 在 Email Image to User 和 Send Error Email 两个 Gmail 节点连接 Gmail OAuth2 账户;4) 将两个 Gmail 节点的 sendTo 字段从 '[email protected]' 改为实际收件人地址。
填写表单触发工作流
激活工作流后,打开 On form submission 节点提供的表单 URL。表单字段包括:Main Headline(主标题,5-7 词)、Key Data Points(关键数据点/主题)、Target Audience(目标受众,下拉选择)、Tone of Voice(语气,下拉选择)、Visualization Options(可视化偏好,下拉选择)、Art Style(艺术风格,下拉选择)、Color Palette(配色,文本输入)、Layout Structure(布局结构,下拉选择)、Font Family(字体,下拉选择)、Information Density(信息密度,单选)、Aspect Ratio(宽高比,下拉选择)、Resolution(分辨率,单选:1K/2K/4K)、Output Format(输出格式,单选:png/jpg)。全部必填。提交后工作流自动运行。
AI Agent 研究主题并构建图片提示词
表单数据进入 Build Image Prompt 节点(AI Agent)。该节点调用 Researcher(GPT-4.1-mini,带联网搜索)收集所需数据点,然后按系统指令将用户需求转化为面向扩散模型的高度优化提示词。提示词强调可读性、构图、留白、矢量风格,并将标题转为大写引号包裹的 text "HEADLINE" 形式。
运行提示词 · 来源原文。Build Image Prompt 节点的 text 参数(AI Agent 系统指令)
=### ROLE You are a world-class Art Director and Prompt Engineer specializing in generative AI for information design. Your goal is to take user requirements and convert them into a highly optimized image generation prompt for a diffusion model. ### YOUR GOAL Create a prompt that results in a clean, legible, and professional infographic. You must prioritize "readability" and "composition" over artistic flair. ### INPUT DATA - Headline: {{ $json['Main Headline'] }} - Data Points: {{ $json['Key Data Points'] }} - Layout: {{ $json['Layout Structure'] }} - Visualization Types: {{ $json['Visualization Options'] }} - Tone of Voice: {{ $json['Tone of Voice'] }} - Style: {{ $json['Art Style'] }} - Information Density: {{ $json['Information Density'] }} - Font Family: {{ $json['Font Family'] }} - Colors: {{ $json['Color Palette'] }} ### TOOLS Use the "Researcher" model, which has access to the Internet, to gather the "Data Points" that are needed for the infographic. ### PROMPT STRUCTURE RULES 1. **Subject & Layout:** Start by defining the image type strictly (e.g., "A vertical infographic vector illustration..."). 2. **Text Handling:** Modern AI models (like Flux or SD3) can render text if it is capitalized and wrapped in quotes. You MUST extract the "Headline" and place it in the prompt as: text "HEADLINE HERE". Do not try to fit all data points as literal text; summarize them as visual icons or short labels. 3. **Style Descriptors:** Use keywords that enforce cleanliness: "white space," "margins," "grid layout," "vector graphics," "adobe illustrator style," "high resolution." 4. **Negative Weighting (Implicit):** phrasing matters. Avoid "cluttered," "messy," "illegible." ### OUTPUT FORMAT Return ONLY the raw prompt string to be sent to the image generator. Do not add conversational filler or the URLs of the sources for "Data Points". ### DYNAMIC PROMPT TEMPLATE (Use this logic) "[Style] infographic featuring text ' [Headline] ' at the top. The layout is [Layout]. Preferred visualization types: [Visualization Types]. Tone of voice: [Tone of Voice]. Art style: [Style]. Information density: [Information Density]. Preferred font family [Font Family]. The design uses a [Colors] color scheme. Key visual elements include: [Convert 'Data Points' into visual metaphors, e.g., if data is 'costs down', describe a downward arrow or coin stack]. High quality, professional graphic design, flat vector art, precise lines, extra white space for readability, typography focused."提交生成任务到 kie.ai 并开始轮询
Build Image Prompt 节点输出的提示词进入 Generate Infographic 节点(HTTP Request),以 POST 方式提交到 https://api.kie.ai/api/v1/jobs/createTask,模型固定为 nano-banana-pro,同时传入用户在表单中选择的 aspect_ratio、resolution 和 output_format。成功后,工作流进入 Polling Delay (15s) 等待 15 秒,然后 Check Job Status 节点查询 https://api.kie.ai/api/v1/jobs/recordInfo。Route by Job Status 节点根据 state 字段分流:success → 下载图片;waiting/generating → Increment Retry 计数并回到轮询;fail → 错误处理。Check Timeout 节点在 retryCount > 20 时触发超时错误处理。
下载图片并邮件发送,或发送错误邮件
成功路径:Download Generated Image 节点从 resultJson 解析 resultUrls[0] 下载图片,Email Image to User 节点将其作为附件发送到配置的收件人。错误路径分三种:1) 生成失败(state='fail'):Prepare Error Email 提取 errorMessage 和 taskId,Send Error Email 发送详情;2) 轮询超时(>20 次):邮件说明超时并附原始请求信息;3) API 错误:邮件附带完整错误 JSON。所有错误邮件均包含原始表单请求的关键字段以便排查。
运行提示词 · 来源原文。Prepare Error Email 节点的 jsCode 参数
const input = $input.first().json; const formData = $('On form submission').item.json; let subject, body; if (input.data?.state === 'fail') { subject = 'Infographic generation failed'; body = `Hi,\n\nThe infographic generation failed.\n\n**Error Details:**\n${input.data.errorMessage || 'Unknown error'}\n\n**Task ID:** ${input.data.taskId || input.taskId || 'unknown'}\n\n**Original Request:**\n- Headline: ${formData['Main Headline']}\n- Data Points: ${formData['Key Data Points']}\n- Style: ${formData['Art Style']}\n- Layout: ${formData['Layout Structure']}\n- Aspect Ratio: ${formData['Aspect Ratio']}\n- Resolution: ${formData['Resolution']}`; } else if (input.retryCount !== undefined) { subject = 'Infographic generation timed out'; body = `Hi,\n\nThe infographic generation timed out after 20 polling attempts.\n\n**Task ID:** ${input.taskId || 'unknown'}\n\n**Original Request:**\n- Headline: ${formData['Main Headline']}\n- Data Points: ${formData['Key Data Points']}\n- Style: ${formData['Art Style']}\n- Layout: ${formData['Layout Structure']}\n- Aspect Ratio: ${formData['Aspect Ratio']}\n- Resolution: ${formData['Resolution']}\n\nPlease check the kie.ai dashboard for more details.`; } else { subject = 'Infographic API Error'; body = `Hi,\n\nAn API error occurred during infographic generation.\n\n**Error Details:**\n${JSON.stringify(input, null, 2)}\n\n**Original Request:**\n- Headline: ${formData['Main Headline']}\n- Data Points: ${formData['Key Data Points']}\n- Style: ${formData['Art Style']}\n- Layout: ${formData['Layout Structure']}`; } return [{ json: { subject, body } }];
可复制提示词
搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限,再按步骤配置节点
这一段是提示词,页面不会在这里插入广告。
你正在复现一个 n8n 模板:用 GPT-4 联网研究主题,通过 kie.ai 生成信息图,并以 Gmail 发送结果。请先确认你拥有 n8n 实例、OpenAI API key、kie.ai API key(Header Auth)和 Gmail OAuth2 凭证,然后按步骤配置节点并替换收件人地址。主提示词(Build Image Prompt)已作为节点系统指令提供,无需修改即可使用。
先检查凭证是否齐全,再激活工作流测试表单提交。首次运行建议用简短主题验证端到端流程。
来源
Generate research-backed infographics with GPT-4, kie.ai, and Gmail · georgedanp · n8n.io · 2026-03-11
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。