npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-agent-ppt

v0.1.0

Published

AI-driven PPT generation CLI — LLM content + PureLayout CSS engine + native .pptx output

Downloads

26

Readme

ai-agent-ppt

AI 驱动的 PPT 生成命令行工具 — 输入主题或截图,秒出专业演示文稿

ai-agent-ppt 是一个基于 LLM(大语言模型)的命令行 PPT 生成工具。它通过 AI 自动完成大纲构思、内容撰写、排版设计,最终输出原生 .pptx 文件。

✨ 亮点功能

🚀 截图即 PPT

这是本项目最大的亮点。只需提供一张 PPT 截图或设计稿图片,工具会自动识别图片中的文字和布局结构,还原为可编辑的 PPTX 文件。

# 单张截图 → PPT
ai-agent-ppt create --images screenshot.png -o output.pptx

# 多张截图 → 多页 PPT
ai-agent-ppt create --images ./slides/ -o presentation.pptx

ai-agent-ppt

🎨 主题描述 → PPT

输入一句话的主题描述,AI 自动生成完整的大纲和内容:

ai-agent-ppt create --topic "2025 年 AI 技术趋势" -o ai-trends.pptx

📄 文档 → PPT

从 Markdown 文件或项目文档自动提取内容生成演示文稿:

ai-agent-ppt create --input README.md -o project-intro.pptx
ai-agent-ppt create --input ./docs/ -o docs-summary.pptx

🧪 HTML → PPT(开发者工具)

提供 HTML+CSS 字符串直接渲染为 PPTX,用于测试和自定义布局:

ai-agent-ppt create --html '<div style="font-size:36px; color:blue">Hello PPT</div>'

📦 安装

npm install -g ai-agent-ppt

要求 Node.js >= 18.0.0。

🔧 快速开始

1. 初始化配置

ai-agent-ppt init -p deepseek -k sk-your-api-key

支持以下 LLM 供应商:

  • deepseek — DeepSeek Chat
  • glm — 智谱 GLM-4V(支持图片识别)
  • claude, openai, kimi — 预留支持

2. 生成 PPT

# 从主题生成
ai-agent-ppt create --topic "人工智能发展史" -o ai-history.pptx

# 从截图生成(需要 glm provider)
ai-agent-ppt init -p glm -k your-glm-key
ai-agent-ppt create --images slide.png -o slide.pptx

3. 选择模板

# 查看可用模板
ai-agent-ppt template

# 使用指定模板
ai-agent-ppt create --topic "产品发布会" --template pitch -o launch.pptx

🎯 命令参考

ai-agent-ppt init

初始化 LLM 配置,保存至 ~/.ai-agent-ppt/config.json

| 选项 | 说明 | 必填 | |------|------|------| | -p, --provider | LLM 供应商: deepseek, claude, openai, kimi, glm | 是 | | -k, --api-key | API 密钥 | 是 | | -m, --model | 模型名称 | 否 | | -t, --template | 默认模板 | 否 | | -l, --lang | 默认语言 zh/en | 否 |

ai-agent-ppt create

创建 PPT(四种输入源任选其一)。

| 选项 | 说明 | |------|------| | --topic <text> | 演示主题(字符串) | | -i, --input <path> | 输入文件(.md)或目录 | | --html <html> | HTML 字符串(绕过 LLM) | | --images <path> | 图片文件或目录(需 vision LLM) | | -t, --template | 模板名称 | | -o, --output | 输出 .pptx 路径(默认 output.pptx)| | -l, --lang | 内容语言 | | --dry-run | 仅生成大纲预览 |

ai-agent-ppt template

模板管理。

| 选项 | 说明 | |------|------| | (无选项) | 列出所有模板 | | -s, --show <name> | 查看模板详情 |

🎨 模板系统

内置 5 个专业模板:

| 模板 | 风格 | 适用场景 | |------|------|----------| | tech | 科技暗色 | 技术分享、开发者大会 | | business | 商务蓝色 | 商业报告、项目汇报 | | education | 教育清晰 | 教学课件、培训材料 | | pitch | 融资路演 | 产品发布会、BP | | report | 数据驱动 | 数据分析、研究报告 |

📐 布局系统

内置 8 种页面布局,LLM 会根据内容自动选择:

| 布局 | 用途 | 内容槽 | |------|------|--------| | title | 封面/标题页 | title, subtitle | | bullet | 要点列表 | title, bulletPoints | | code | 代码展示 | title, code, bulletPoints | | chart | 数据展示 | title, bulletPoints | | comparison | 双栏对比 | title, bulletPoints | | timeline | 时间线 | title, bulletPoints | | image | 全幅背景图+文字 | title, subtitle | | image-text | 左图右文 | image, title, bulletPoints |

🏗️ 架构

三条生成管道:

管道 A: --topic / --input(标准 LLM 管道)
  主题/文档 → LLM 大纲生成 → LLM 内容填充
    → 布局加载 → Slot 注入 → PPTXBuilder → .pptx

管道 B: --html(直通渲染)
  HTML 字符串 → PureLayout 解析 → 坐标计算
    → PPTAdapter → .pptx

管道 C: --images(视觉 LLM 管道,亮点✨)
  截图 → vision LLM 识别 → HTML+CSS 生成
    → PureLayout 解析 → PPTAdapter → .pptx

核心组件:

  • PureLayout — 纯函数 CSS 布局引擎,解析 HTML+内联 CSS,计算 1280×720 视口中的精确像素坐标
  • PPTAdapter — 声明式渲染适配器,将布局坐标映射为 pptxgenjs API 调用
  • CSS Inliner — 智能处理 LLM 返回的 <style> 块,自动内联到元素 style 属性
  • Provider 插件体系 — 基于 PROVIDER_MAP 声明式注册表,一行代码添加新 LLM 供应商

🧪 开发

# 构建
npm run build

# 测试(106 项测试,覆盖率门槛 80%)
npm test

# 单元测试
npm run test:unit

# 运行
node bin/ai-agent-ppt.js create --topic "测试"

📄 开源协议

MIT © peterfei