# PPTGenerator **Repository Path**: siYuanJun/pptgenerator ## Basic Information - **Project Name**: PPTGenerator - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-02 - **Last Updated**: 2026-07-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 风格一致PPT生成器 > 一条命令,输入JSON,输出25-30页风格统一的.pptx演示文稿 ## 快速开始 ### 1. 安装依赖 ```bash pip install -r requirements.txt ``` ### 2. 配置API Key ```bash export OPENAI_API_KEY="sk-..." ``` ### 3. 运行 ```bash # 版本A(最大美观度) python main.py --input demo/inputs/input_01_python.json --output output.pptx # 版本B(成本-速度平衡) python main.py --input demo/inputs/input_01_python.json --output output.pptx --mode tradeoff ``` ## 命令行参数 | 参数 | 说明 | 必填 | 默认值 | |------|------|------|--------| | `--input` | 输入JSON文件路径 | ✅ | - | | `--output` | 输出PPTX文件路径 | ✅ | - | | `--mode` | 生成模式:max_quality / tradeoff | ❌ | max_quality | | `--api-key` | OpenAI API Key | ❌ | 从环境变量读取 | | `--verbose` | 详细输出 | ❌ | - | | `--version` | 显示版本号 | ❌ | - | ## 输入JSON格式 ```json { "topic": "主题(字符串,必填)", "brief": "简介,≤500字(字符串,必填)", "audience": "目标受众(字符串,必填)" } ``` ## Demo输入 | # | 主题 | 受众 | |---|------|------| | 1 | Python 入门 30 分钟 | 编程零基础 | | 2 | 2025 我的年度复盘 | 朋友圈分享 | | 3 | 如何挑选一款适合自己的咖啡豆 | 咖啡新手 | | 4 | 为什么应该用 Rust 重写订单系统 | 非技术 CEO | | 5 | 周末两天玩遍京都 | 第一次去日本的游客 | ## 架构 ``` JSON输入 → Content Architect (LLM) → 演示蓝图 ↓ ← Design System (LLM) ← 设计令牌 ↓ 一致性校验 ↓ PPTX渲染器 (本地) → .pptx输出 ``` ### 三阶段设计 1. **Content Architect**:LLM根据输入生成演示蓝图(页面结构、叙事线) 2. **Design System Generator**:LLM生成设计令牌(配色、字体、网格) 3. **PPTX Renderer**:本地代码渲染,13种版式模板,零额外LLM成本 ## 双版本对比 | 特性 | 版本A (max_quality) | 版本B (tradeoff) | |------|---------------------|-------------------| | 模型 | gpt-4o | gpt-4o-mini | | 成本 | ~$0.01 | ~$0.001 | | 速度 | ~20s | ~15s | | 内容审阅 | ✅ | ❌ | | 设计微调 | ✅ | ❌ | ## 测试 ```bash pytest tests/ -v ``` ## 项目结构 ``` src/ ├── cli.py # CLI入口 ├── validators.py # 输入校验 ├── pipeline.py # 集成管道 ├── content_architect.py # 内容架构层 ├── design_system.py # 设计系统生成层 ├── design_tokens.py # 设计令牌模型 ├── design_tokens_manager.py # 设计令牌管理器 ├── renderer.py # PPTX渲染器 ├── consistency_checker.py # 一致性校验 ├── version_config.py # 双版本配置 ├── prompts/ # LLM提示词 ├── models/ # 数据模型 ├── layouts/ # 13种版式模板 demo/ ├── inputs/ # 5个Demo输入JSON tests/ # 185个测试用例 ``` ## 技术栈 - Python 3.10+ - python-pptx (PPTX生成) - OpenAI API (LLM调用) - Pydantic (数据验证) ## 许可证 MIT