介绍
# SlideSpeak Presentation Skill
此技能使您能够使用 SlideSpeak API 创建和编辑 PowerPoint 演示文稿。
## 重要:计时行为
**演示文稿生成需要 30-60 秒。**
### 选项 1:等待完成(默认) 运行命令并等待。脚本会在内部进行轮询,直到完成: ```bash node scripts/slidespeak.mjs generate --text "Topic" ``` - 阻塞直到任务完成(通常为 30-60 秒) - 返回包含下载 URL 的完整结果
### 选项 2:使用 `--no-wait` 立即返回 如果您无法等待命令完成,请使用 `--no-wait`: ```bash node scripts/slidespeak.mjs generate --text "Topic" --no-wait ``` 立即返回: ```json { "success": true, "data": { "task_id": "abc123...", "message": "Task started. Check status with: node scripts/slidespeak.mjs status abc123..." } } ```
然后轮询状态直到完成: ```bash node scripts/slidespeak.mjs status <task_id> ``` 当 `task_status` 为 `SUCCESS` 时,使用 `request_id` 进行下载。
### 超时行为 如果脚本在等待时超时,它将返回 task_id 以便您可以继续轮询: ```json { "success": true, "data": { "complete": false, "task_id": "abc123...", "task_status": "STARTED", "message": "Task still processing. Check status with: node scripts/slidespeak.mjs status abc123..." } } ```
## 设置
必须设置 `SLIDESPEAK_API_KEY` 环境变量。请从 https://app.slidespeak.co/settings/developer 获取您的 API 密钥
## 快速参考
所有命令都使用位于 `scripts/slidespeak.mjs` 的辅助脚本。该脚本处理 API 身份验证并自动等待异步任务完成(无需手动轮询)。
### 根据文本生成演示文稿
```bash node scripts/slidespeak.mjs generate --text "Your topic or content" --length 6 ```
选项: - `--text`(必需):演示文稿的主题或内容 - `--length`:幻灯片数量(默认:10) - `--template`:模板名称或 ID(默认:"default") - `--language`:输出语言(默认:"ORIGINAL") - `--tone`:casual、professional、funny、educational、sales_pitch - `--verbosity`:concise、standard、text-heavy - `--no-images`:禁用库存图片获取 - `--no-cover`:排除封面幻灯片 - `--no-toc`:排除目录
### 根据上传的文档生成
首先上传文档,然后生成:
```bash # Upload a document (PDF, DOCX, PPTX, etc.) node scripts/slidespeak.mjs upload /path/to/document.pdf
# Use the returned document_uuid to generate node scripts/slidespeak.mjs generate --document <document_uuid> --length 10 ```
支持的格式:`.pdf`、`.docx`、`.doc`、`.pptx`、`.ppt`、`.xlsx`、`.txt`、`.md`
### 列出可用模板
```bash # Default templates node scripts/slidespeak.mjs templates
# Branded templates (if configured) node scripts/slidespeak.mjs templates --branded ```
### 下载演示文稿
生成完成后,使用 `request_id` 下载:
```bash node scripts/slidespeak.mjs download <request_id> ```
返回一个包含短期有效下载 URL 的 JSON 对象。
### 编辑现有演示文稿
编辑现有演示文稿中的幻灯片:
```bash # Insert a new slide at position 2 node scripts/slidespeak.mjs edit-slide \ --presentation-id <id> \ --type INSERT \ --position 2 \ --prompt "Content about market analysis"
# Regenerate slide at position 3 node scripts/slidespeak.mjs edit-slide \ --presentation-id <id> \ --type REGENERATE \ --position 3 \ --prompt "Updated content for this slide"
# Remove slide at position 4 node scripts/slidespeak.mjs edit-slide \ --presentation-id <id> \ --type REMOVE \ --position 4 ```
编辑类型: - `INSERT`:在指定位置添加新幻灯片 - `REGENERATE`:替换现有幻灯片内容 - `REMOVE`:删除幻灯片(无需提示)
### 检查任务状态
用于调试或手动轮询:
```bash node scripts/slidespeak.mjs status <task_id> ```
### 获取账户信息
```bash node scripts/slidespeak.mjs me ```
## 逐页生成
如需对每张幻灯片进行精确控制,请使用逐页端点。完整架构请参阅 `references/API.md`。
```bash node scripts/slidespeak.mjs generate-slides --config slides.json ```
其中 `slides.json` 包含: ```json { "slides": [ {"title": "Introduction", "layout": "title", "content": "Welcome message"}, {"title": "Key Points", "layout": "bullets", "item_amount": 4, "content": "Main discussion points"} ], "template": "default" } ```
## Webhooks
订阅以在任务完成时接收通知:
```bash # Subscribe node scripts/slidespeak.mjs webhook-subscribe --url "https://your-webhook.com/endpoint"
# Unsubscribe node scripts/slidespeak.mjs webhook-unsubscribe --url "https://your-webhook.com/endpoint" ```
## 错误处理
脚本输出以下 JSON 之一: - 成功:`{"success": true, "data": {...}}` - 错误:`{"success": false, "error": "message"}`
## 常见工作流
### 创建关于某个主题的演示文稿 ```bash node scripts/slidespeak.mjs generate --text "Introduction to Machine Learning" --length 8 --tone educational ```
### 根据 PDF 报告创建演示文稿 ```bash # Upload the PDF RESULT=$(node scripts/slidespeak.mjs upload report.pdf) DOC_ID=$(echo $RESULT | jq -r '.data.document_uuid')
# Generate presentation node scripts/slidespeak.mjs generate --document "$DOC_ID" --length 12 ```
### 编辑演示文稿以添加新幻灯片 ```bash node scripts/slidespeak.mjs edit-slide \ --presentation-id "abc123" \ --type INSERT \ --position 5 \ --prompt "Add a slide about quarterly revenue growth with charts" ```
## 其他资源
有关包含所有参数、布局类型和约束的详细 API 文档,请阅读 `references/API.md`。