PopAI PPT Skill
Create presentations programmatically via PopAI's API. Supports optional file uploads as reference material or templates.
Setup
- 1. Get API key from https://www.popai.pro
- Store in environment: INLINECODE0
Scripts
- -
scripts/generate_ppt.py - Generate PPT via PopAI API (upload files → create channel → SSE stream → get pptx)
Usage Examples
CODEBLOCK0
Agent Steps
- 1. Get PPT topic from user
- If user provides local files, pass them via
--file (max 5, supports pptx/pdf/docx/images etc.) - Create a temp output file, then run script in background with
--output:
# Step 3a: Create temp file and launch in background
OUTFILE="/tmp/popai_ppt_$(date +%s).jsonl"
touch "$OUTFILE"
# Step 3b: Run in background (run_in_background: true, timeout: 600000)
cd /Users/Gunnar/popai-python/.claude/skills/popai-presentations && POPAI_API_KEY="$POPAI_API_KEY" python3 scripts/generate_ppt.py --query "TOPIC" [--file FILE1 FILE2 ...] --output "$OUTFILE"
Tell user: "PPT正在生成中,预计3-5分钟..."
- 4. Poll for progress — periodically read new lines from the output file using
Read tool or cat "$OUTFILE", and show progress to user:
-
task events → show task status updates
-
search events → show "正在搜索..."
-
summary event → show generation summary
-
pptx_ready event → final result (stop polling)
-
stream_end → generation complete (stop polling)
Poll every ~30 seconds until
pptx_ready or
stream_end appears.
- 5. Present final results to user:
- Show
summary text (from
NODE_END event) as the generation summary
- Show
pptx_url as the download link: "下载PPT:
"
- Show web_url as the site link: "在线查看/编辑: "
Output
Event types (stdout, one JSON per line):
CODEBLOCK3
Final result (is_end: true):
CODEBLOCK4
- -
pptx_url: .pptx文件下载链接 - INLINECODE19 : PopAI源站链接,可在线查看和编辑
- INLINECODE20 : NODE_END事件的最终总结文本,展示给用户作为生成摘要
Technical Notes
- - Streaming: SSE stream;
TOOL_CALLS-pptx event contains final .pptx download URL; last:true marks stream end - File Upload: Presigned POST to S3 via
getPresignedPost, supports any file type - Timeout: Generation takes 3-5 minutes
PopAI PPT 技能
通过 PopAI 的 API 以编程方式创建演示文稿。支持可选的文件上传作为参考资料或模板。
设置
- 1. 从 https://www.popai.pro 获取 API 密钥
- 存储在环境变量中:export POPAIAPIKEY=...
脚本
- - scripts/generate_ppt.py - 通过 PopAI API 生成 PPT(上传文件 → 创建频道 → SSE 流 → 获取 pptx)
使用示例
bash
仅从主题生成 PPT
python3 generate_ppt.py --query 人工智能发展趋势报告
使用模板 pptx 文件
python3 generate_ppt.py --query 特斯拉财报ppt --file template.pptx
使用多个参考文件(最多 5 个)
python3 generate_ppt.py --query 年度报告 --file template.pptx data.pdf chart.png
代理步骤
- 1. 从用户处获取 PPT 主题
- 如果用户提供本地文件,通过 --file 传递(最多 5 个,支持 pptx/pdf/docx/图片等)
- 创建临时输出文件,然后在后台运行脚本,使用 --output:
bash
# 步骤 3a:创建临时文件并在后台启动
OUTFILE=/tmp/popai
ppt$(date +%s).jsonl
touch $OUTFILE
bash
# 步骤 3b:在后台运行(runinbackground: true, timeout: 600000)
cd /Users/Gunnar/popai-python/.claude/skills/popai-presentations && POPAIAPIKEY=$POPAIAPIKEY python3 scripts/generate_ppt.py --query 主题 [--file 文件1 文件2 ...] --output $OUTFILE
告知用户:PPT正在生成中,预计3-5分钟...
- 4. 轮询进度 — 使用 Read 工具或 cat $OUTFILE 定期读取输出文件的新行,并向用户显示进度:
- task 事件 → 显示任务状态更新
- search 事件 → 显示正在搜索...
- summary 事件 → 显示生成摘要
- pptx_ready 事件 → 最终结果(停止轮询)
- stream_end → 生成完成(停止轮询)
每约 30 秒轮询一次,直到出现 pptx
ready 或 streamend。
- 5. 向用户展示最终结果:
- 显示 summary 文本(来自 NODE_END 事件)作为生成摘要
- 显示 pptx
url 作为下载链接:下载PPT: url>
- 显示 weburl 作为网站链接:在线查看/编辑: url>
输出
事件类型(stdout,每行一个 JSON):
json
{type: task, id: 1, content: 搜索特斯拉最新财报数据, status: progressing}
{type: search, action: Web Searching, results: [{title: ..., url: ..., snippet: ..., date: ...}]}
{type: toolresult, event: TOOLCALLS-xxx, action: ..., result: ...}
{type: summary, text: 已完成特斯拉财报PPT的创建...}
{type: stream_end}
最终结果(is_end: true):
json
{
type: pptx_ready,
is_end: true,
pptx_url: https://popai-file-boe.s3-accelerate.amazonaws.com/.../xxx.pptx,
file_name: xxx.pptx,
preview_images: [https://...0.jpeg],
preview_count: 10,
web_url: https://www.popai.pro/agentic-pptx/
}
- - pptxurl:.pptx 文件下载链接
- web
url:PopAI 源站链接,可在线查看和编辑summary:NODE_END 事件的最终总结文本,展示给用户作为生成摘要
技术说明
- - 流式传输:SSE 流;TOOL_CALLS-pptx 事件包含最终的 .pptx 下载 URL;last:true 标记流结束
- 文件上传:通过 getPresignedPost 预签名 POST 到 S3,支持任何文件类型
- 超时:生成需要 3-5 分钟