content-generation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Content Generation

内容生成

Overview

概述

Generate professional content including images, diagrams, documents, and summaries using AI-powered tools.
使用基于AI的工具生成专业内容,包括图片、示意图、文档和摘要。

Quick Decision Tree

快速决策树

What do you need?
├── Generate images
│   └── references/images.md
│   └── Script: scripts/generate_images.py
├── Create flowchart/diagram
│   └── references/flowchart.md
│   └── Script: scripts/generate_flowchart.py
├── Create Google Doc
│   └── references/document.md
│   └── Script: scripts/generate_document.py
├── Generate client proposal
│   └── references/proposal.md
│   └── Script: scripts/generate_proposal.py
├── Convert Markdown to PDF
│   └── references/pdf.md
│   └── Script: scripts/md_to_pdf.py
└── Summarize content
    └── references/summarize.md
    └── Script: scripts/summarize_content.py
What do you need?
├── Generate images
│   └── references/images.md
│   └── Script: scripts/generate_images.py
├── Create flowchart/diagram
│   └── references/flowchart.md
│   └── Script: scripts/generate_flowchart.py
├── Create Google Doc
│   └── references/document.md
│   └── Script: scripts/generate_document.py
├── Generate client proposal
│   └── references/proposal.md
│   └── Script: scripts/generate_proposal.py
├── Convert Markdown to PDF
│   └── references/pdf.md
│   └── Script: scripts/md_to_pdf.py
└── Summarize content
    └── references/summarize.md
    └── Script: scripts/summarize_content.py

Environment Setup

环境配置

bash
undefined
bash
undefined

Required in .env

Required in .env

FAL_API_KEY=fal_xxxx # For image generation OPENROUTER_API_KEY=sk-or-v1-xxx # For AI text generation

Get API keys:
- fal.ai: https://fal.ai/dashboard/keys
- OpenRouter: https://openrouter.ai/keys
FAL_API_KEY=fal_xxxx # For image generation OPENROUTER_API_KEY=sk-or-v1-xxx # For AI text generation

获取API密钥:
- fal.ai: https://fal.ai/dashboard/keys
- OpenRouter: https://openrouter.ai/keys

Common Usage

常见用法

Generate Images

生成图片

bash
undefined
bash
undefined

Nano Banana Pro (best quality)

Nano Banana Pro (最佳画质)

python scripts/generate_images.py "Professional product photo of smartwatch" --model nano-banana-pro
python scripts/generate_images.py "Professional product photo of smartwatch" --model nano-banana-pro

FLUX-2 (fast, cheap)

FLUX-2 (快速、低成本)

python scripts/generate_images.py "Vibrant lifestyle photo" --model flux-2 --size landscape_4_3
undefined
python scripts/generate_images.py "Vibrant lifestyle photo" --model flux-2 --size landscape_4_3
undefined

Create Flowchart

创建流程图

bash
python scripts/generate_flowchart.py "User login: enter email, validate, check password, if correct go to dashboard"
bash
python scripts/generate_flowchart.py "User login: enter email, validate, check password, if correct go to dashboard"

Generate Document

生成文档

bash
python scripts/generate_document.py --input content.json --title "Q4 Report"
bash
python scripts/generate_document.py --input content.json --title "Q4 Report"

Generate Proposal

生成提案

bash
python scripts/generate_proposal.py --transcript-file meeting.txt --client "Acme Corp"
bash
python scripts/generate_proposal.py --transcript-file meeting.txt --client "Acme Corp"

Cost Estimates

成本估算

ToolCost
Nano Banana Pro 1K$0.15/image
Nano Banana Pro 4K$0.30/image
FLUX-2$0.012/megapixel
Flowchart~$0.005/diagram
Proposal~$0.10/doc
工具成本
Nano Banana Pro 1K$0.15/张图片
Nano Banana Pro 4K$0.30/张图片
FLUX-2$0.012/百万像素
流程图~$0.005/张示意图
提案~$0.10/份文档

Security Notes

安全说明

Credential Handling

凭证处理

  • Store
    FAL_API_KEY
    in
    .env
    file (never commit to git)
  • Store
    OPENROUTER_API_KEY
    in
    .env
    file (never commit to git)
  • Regenerate keys from respective dashboards if compromised
  • Never log or print API keys in script output
  • FAL_API_KEY
    存储在
    .env
    文件中(绝不要提交到git)
  • OPENROUTER_API_KEY
    存储在
    .env
    文件中(绝不要提交到git)
  • 若凭证泄露,从对应控制面板重新生成密钥
  • 绝不要在脚本输出中记录或打印API密钥

Data Privacy

数据隐私

  • Text prompts sent to fal.ai and OpenRouter servers
  • Generated images stored locally in
    .tmp/
    directory
  • AI services may log prompts for service improvement
  • Avoid including sensitive/confidential data in prompts
  • Generated documents may be uploaded to Google Drive
  • 文本提示会发送到fal.ai和OpenRouter服务器
  • 生成的图片存储在本地
    .tmp/
    目录
  • AI服务可能会记录提示信息以优化服务
  • 避免在提示中包含敏感/机密数据
  • 生成的文档可能会上传到Google Drive

Access Scopes

访问权限

  • FAL_API_KEY
    - Full access to image generation models
  • OPENROUTER_API_KEY
    - Access to configured AI models
  • Google OAuth - Required for Google Docs creation (see google-workspace skill)
  • FAL_API_KEY
    - 拥有图片生成模型的完整访问权限
  • OPENROUTER_API_KEY
    - 可访问已配置的AI模型
  • Google OAuth - 创建Google Docs时需要(请查看google-workspace技能)

Compliance Considerations

合规注意事项

  • AI Disclosure: Consider disclosing AI-generated content where required
  • Image Rights: Generated images subject to fal.ai terms of use
  • Copyright: AI-generated content copyright varies by jurisdiction
  • Brand Consistency: Review AI outputs against brand guidelines
  • Sensitive Content: AI image generators have content policies
  • Client Proposals: Verify accuracy before sending to clients
  • Attribution: Some contexts require AI generation disclosure
  • AI披露:在要求的场景下,需披露内容由AI生成
  • 图片版权:生成的图片受fal.ai服务条款约束
  • 著作权:AI生成内容的著作权因司法管辖区而异
  • 品牌一致性:对照品牌指南审核AI输出内容
  • 敏感内容:AI图片生成器有内容政策限制
  • 客户提案:发送给客户前需验证内容准确性
  • 署名要求:部分场景需要披露AI生成信息

Troubleshooting

故障排除

Common Issues

常见问题

Issue: Image generation failed

问题:图片生成失败

Symptoms: fal.ai returns error or no image generated Cause: Invalid prompt, model unavailable, or API issue Solution:
  • Check prompt for policy violations (explicit content, etc.)
  • Verify model ID is correct and available
  • Try a simpler prompt to test API connectivity
  • Check fal.ai status page for outages
症状:fal.ai返回错误或未生成图片 原因:提示无效、模型不可用或API问题 解决方案
  • 检查提示是否违反政策(如露骨内容等)
  • 验证模型ID是否正确且可用
  • 使用更简单的测试提示检查API连接性
  • 查看fal.ai状态页面确认是否有服务中断

Issue: Content policy violation

问题:违反内容政策

Symptoms: "Content policy violation" or similar safety error Cause: Prompt contains flagged terms or concepts Solution:
  • Remove explicit, violent, or harmful content from prompt
  • Rephrase ambiguous terms that might trigger filters
  • Review fal.ai content policy guidelines
  • Use more general/professional language
症状:返回“Content policy violation”或类似安全错误 原因:提示包含被标记的术语或概念 解决方案
  • 从提示中移除露骨、暴力或有害内容
  • 改写可能触发过滤器的模糊术语
  • 查看fal.ai内容政策指南
  • 使用更通用/专业的语言

Issue: Google Doc not created

问题:Google Doc未创建

Symptoms: Script completes but no document appears in Drive Cause: OAuth issue, folder permissions, or API error Solution:
  • Verify Google OAuth is working (see google-workspace skill)
  • Check target folder exists and is accessible
  • Delete
    mycreds.txt
    and re-authenticate
  • Look for error messages in script output
症状:脚本执行完成但Drive中无文档 原因:OAuth问题、文件夹权限或API错误 解决方案
  • 验证Google OAuth是否正常工作(请查看google-workspace技能)
  • 检查目标文件夹是否存在且可访问
  • 删除
    mycreds.txt
    并重新认证
  • 查看脚本输出中的错误信息

Issue: Flowchart syntax error

问题:流程图语法错误

Symptoms: Mermaid diagram fails to render Cause: Invalid Mermaid syntax in generated diagram Solution:
  • Review generated Mermaid code for syntax errors
  • Simplify complex flows into smaller diagrams
  • Test diagram at https://mermaid.live/
  • Ensure special characters are properly escaped
症状:Mermaid示意图无法渲染 原因:生成的示意图中存在无效Mermaid语法 解决方案

Issue: PDF conversion fails

问题:PDF转换失败

Symptoms: Error during markdown to PDF conversion Cause: Missing dependencies or invalid markdown Solution:
  • Ensure required PDF tools are installed (weasyprint, etc.)
  • Check markdown syntax is valid
  • Verify font files exist if custom fonts specified
  • Try with simpler markdown to isolate issue
症状:Markdown转PDF过程中出错 原因:缺少依赖或无效Markdown 解决方案
  • 确保已安装所需PDF工具(如weasyprint等)
  • 检查Markdown语法是否有效
  • 若使用自定义字体,验证字体文件是否存在
  • 使用更简单的Markdown测试以定位问题

Issue: OpenRouter API error

问题:OpenRouter API错误

Symptoms: Text generation fails with API error Cause: Invalid API key, model unavailable, or rate limit Solution:
  • Verify
    OPENROUTER_API_KEY
    is set correctly
  • Check model availability at OpenRouter dashboard
  • Try a different model if current one is unavailable
  • Review rate limit status and add delays if needed
症状:文本生成因API错误失败 原因:API密钥无效、模型不可用或触发速率限制 解决方案
  • 验证
    OPENROUTER_API_KEY
    是否设置正确
  • 在OpenRouter控制面板检查模型可用性
  • 若当前模型不可用,尝试其他模型
  • 查看速率限制状态,必要时添加延迟

Resources

资源

  • references/images.md - fal.ai image generation
  • references/flowchart.md - Mermaid diagram generation
  • references/document.md - Google Docs creation
  • references/proposal.md - Client proposal generation
  • references/pdf.md - Markdown to PDF conversion
  • references/summarize.md - Content summarization
  • references/images.md - fal.ai图片生成
  • references/flowchart.md - Mermaid示意图生成
  • references/document.md - Google Docs创建
  • references/proposal.md - 客户提案生成
  • references/pdf.md - Markdown转PDF转换
  • references/summarize.md - 内容摘要

Integration Patterns

集成模式

Generate and Save

生成并保存

Skills: content-generation → google-workspace Use case: Create documents and store in Drive Flow:
  1. Generate content (proposal, report, summary)
  2. Format as Google Doc or PDF
  3. Upload to appropriate Drive folder via google-workspace
技能:content-generation → google-workspace 使用场景:创建文档并存储到Drive 流程
  1. 生成内容(提案、报告、摘要)
  2. 格式化为Google Doc或PDF
  3. 通过google-workspace上传到对应Drive文件夹

Proposal to CRM

提案同步到CRM

Skills: content-generation → attio-crm Use case: Link generated proposals to deal records Flow:
  1. Generate client proposal from meeting transcript
  2. Upload proposal to Google Drive
  3. Add note to Attio CRM company record with proposal link
技能:content-generation → attio-crm 使用场景:将生成的提案关联到交易记录 流程
  1. 从会议记录生成客户提案
  2. 将提案上传到Google Drive
  3. 在Attio CRM公司记录中添加包含提案链接的备注

Images to Video

图片转视频

Skills: content-generation → video-production Use case: Create title slides for video courses Flow:
  1. Generate branded title slide images for each lesson
  2. Export images to video-compatible format
  3. Use video-production to stitch with lesson videos
技能:content-generation → video-production 使用场景:为视频课程创建标题幻灯片 流程
  1. 为每节课生成品牌化标题幻灯片图片
  2. 将图片导出为视频兼容格式
  3. 使用video-production将图片与课程视频拼接