diff --git a/README.md b/README.md index 75fb596..5d2023c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [English](README.md) | [中文](README_zh.md) -Recreate NotebookLM's AI PPT feature and extend it into a controllable, editable, model-configurable PPT workbench that converts papers, documents, and other materials into beautiful PPT images. +Build a controllable, editable, model-configurable AI PPT workbench inspired by NotebookLM. AIPPT converts papers, documents, and other materials into presentation decks, then exports them as PDF, raster PPTX, or editable PPTX with editable text, native lines/table borders, and separated image assets. ![AIPPT workbench demo](docs/assets/aippt-demo.gif) @@ -10,27 +10,35 @@ Recreate NotebookLM's AI PPT feature and extend it into a controllable, editable The demo covers uploading `doc/L9.md`, entering custom requirements, generating and editing the design outline, confirming page designs, generating a 6-slide deck, editing one slide, confirming the replacement, and exporting PDF/PPTX. Model waiting time is fast-forwarded. +## Latest Update: Editable PPTX Export + +Editable PPTX export is now supported. Generated slide images can be reconstructed into PowerPoint-editable pages: OCR text becomes editable text boxes, simple lines and table borders are rebuilt as native shapes, and backgrounds, icons, illustrations, and visual components are separated into movable image assets instead of remaining one full-page bitmap. + +| Generated PPT image | After conversion to editable PPTX | +| :--------------------------------------------------------: | :------------------------------------------------------------------------------------: | +| ![Generated PPT image](docs/assets/gen_ppt_pic.png) | ![Converted editable PPTX with separated elements](docs/assets/gen_ppt_edit.png) | + ## More Than A Clone NotebookLM's PPT feature is closer to a one-click result generator, with limited visibility into the design process and limited per-slide control. This project turns the workflow into an understandable, editable workbench: -- **Visible process**: Review the deck outline and page-by-page design notes before image generation +- **Visible process**: Review the deck outline and page-by-page design notes before slide generation - **Per-slide control**: Edit any slide independently, generate new versions, revert history, and confirm replacements -- **Model control**: Configure separate OpenAI-compatible models for text planning, image generation, and image editing +- **Model control**: Configure separate OpenAI-compatible models for text planning, visual understanding, OCR, image generation, and image editing - **Local-first config**: Manage model connections through local `config.yaml` or WebUI local API configuration; saved projects and exported files do not include API keys -- **Export-ready output**: Export generated decks to PDF/PPTX for presentation or further editing -- **Experimental high-fidelity editable PPTX export**: Rebuild slide images into editable PowerPoint text boxes, conservative native shapes, and positioned bitmap assets through a provider-gated generative editable export path +- **Export-ready output**: Export generated decks to PDF, raster PPTX, or editable PPTX for presentation and downstream editing +- **Editable PPTX reconstruction**: Rebuild slide images into editable PowerPoint text boxes, native line/table-border shapes, and positioned bitmap assets through a provider-gated reconstruction path ## ✨ Features -- 🎨 **Per-slide image generation**: Create an editable outline and page designs before converting them into PPT page images -- 🌐 **PPT Workbench**: Upload sources, configure model roles, preview slides, edit pages, track history, and export +- 🎨 **Per-slide generation**: Create an editable outline and page designs before generating polished PPT pages +- 🌐 **PPT Workbench**: Upload sources, configure model roles, preview slides, edit pages, track history, and export PDF/PPTX - 📝 **Multi-format parsing**: Supports `.md/.txt/.pdf/.docx/.pptx` input and converts content to Markdown - ✏️ **Full-page image editing**: Edit each generated slide independently, revert history, and confirm replacements -- 🔀 **Three model roles**: Configure `prompt_model`, `image_model`, and `edit_model` separately +- 🔀 **Multi-model roles**: Configure `text_model`/`prompt_model`, `vlm_model`, `ocr_model`, `image_model`, and `edit_model` separately as needed - 🖼️ **Image result compatibility**: Accepts URLs, Markdown image links, data URLs, `b64_json`, and raw base64 -- 💾 **Local multi-project persistence**: Save multiple PPT projects in the browser, including source content, outline, page designs, generated images, and per-slide edit history -- 📤 **Editable PPTX reconstruction**: Export a separate experimental high-fidelity editable PPTX mode after provider verification; see [Generative Editable PPTX Export](docs/generative-editable-pptx.md) +- 💾 **Local multi-project persistence**: Save multiple PPT projects in the browser, including source content, outline, page designs, generated slides, and per-slide edit history +- 📤 **Editable PPTX reconstruction**: Export editable PPTX with editable text, separated image assets, and native simple shapes after provider verification; see [Generative Editable PPTX Export](docs/generative-editable-pptx.md) ## 🚀 Quick Start @@ -87,7 +95,7 @@ python main.py --from-prompt prompts.json ### Local Project Persistence -AIPPT stores project content and image assets in the current browser profile's IndexedDB, and uses localStorage for the active project id, UI preferences, and local API configuration. Saved project data includes uploaded sources, content settings, design outlines, page designs, generated images, edited versions, and image data needed for export. +AIPPT stores project content and image assets in the current browser profile's IndexedDB, and uses localStorage for the active project id, UI preferences, and local API configuration. Saved project data includes uploaded sources, content settings, design outlines, page designs, generated pages, edited versions, and image assets needed for export. Notes: - Clearing browser site data removes local projects. @@ -97,14 +105,14 @@ Notes: ### 3. WebUI Usage Flow 1. **Upload Document**: Drag and drop or click to upload a source file in the left panel -2. **Configure Models**: Configure text, image generation, and image editing model roles +2. **Configure Models**: Configure text, visual understanding/OCR, image generation, and image editing model roles as needed 3. **Set Parameters & Requirements**: Choose page count, resolution, aspect ratio, language, style, audience, and custom requirements 4. **Confirm Design**: Generate an editable outline, confirm it, then review the generated page designs -5. **Generate PPT**: Generate slide images after page-design confirmation and watch real-time progress +5. **Generate PPT**: Generate slide pages after page-design confirmation and watch real-time progress 6. **Preview & Edit**: Preview generated slides in the right panel and edit a single page when needed -7. **Export**: Export to PDF or PPTX +7. **Export**: Export to PDF, raster PPTX, or editable PPTX -The export menu keeps the existing raster PPTX option and adds a separate experimental high-fidelity editable PPTX option. The editable mode uses OCR plus image editing/image generation providers and is quality-gated by default; it fails rather than silently returning a low-fidelity deck unless an explicit fallback policy is requested. Strict live provider verification is still pending for the currently tested provider set. See [Generative Editable PPTX Export](docs/generative-editable-pptx.md). +The export menu keeps the existing raster PPTX option and adds a separate editable PPTX option. Editable mode uses VLM/OCR plus image editing/image generation providers to reconstruct slides into editable text boxes, native simple shapes, and separated bitmap assets. It is quality-gated by default and fails rather than silently returning a low-fidelity deck unless an explicit fallback policy is requested. See [Generative Editable PPTX Export](docs/generative-editable-pptx.md). The built-in demo source is `doc/L9.md`. This is a repository-relative path, so a fresh clone can use it directly in the WebUI or CLI examples. @@ -126,8 +134,8 @@ OpenNotebookLM-AIPPT/ ## ⚙️ Configuration All configurations are managed in `config.yaml`, including: -- API configuration (`prompt_model`, `image_model`, `edit_model`) -- Generative editable PPTX provider roles and quality gates (`ocr_model`, cleanup, asset generation, repair, validation) +- API configuration (`text_model`/`prompt_model`, `vlm_model`, `ocr_model`, `image_model`, `edit_model`) +- Generative editable PPTX provider roles and quality gates (visual analysis, OCR, cleanup, asset generation, repair, validation) - PPT default settings (language, style, page count) - Timeout and retry settings @@ -142,10 +150,18 @@ return an image URL, data URL, or base64 payload. ```yaml api: models: - prompt_model: + text_model: + model: "gpt-4o" + base_url: "https://api.openai.com/v1" + api_key: "sk-xxx" + vlm_model: model: "gpt-4o" base_url: "https://api.openai.com/v1" api_key: "sk-xxx" + ocr_model: + model: "ocr-model" + base_url: "https://api.example.com/v1" + api_key: "sk-xxx" image_model: model: "gpt-image-2" base_url: "https://api.example.com/v1" @@ -164,7 +180,8 @@ output/ppt_20241201_123456/ ├── prompts.json # Generated prompts ├── result.json # Generation result ├── presentation.pdf # Exported PDF -└── images/ # Slide images +├── presentation.pptx # Exported raster or editable PPTX +└── images/ # Generated slide images and assets ``` ## 🧪 Development Checks @@ -196,15 +213,15 @@ GitHub Actions runs the same default checks on `main` and `dev` pull requests an ## 📋 TODO -- [ ] Upgrade generated PPT images into structured, editable PPT content - [ ] Support region selection for partial slide editing -- [ ] Add more provider profile templates +- [ ] Improve editable PPTX element grouping, layer ordering, and native-shape coverage for complex slides +- [ ] Add more VLM, OCR, image generation, and image editing provider presets -## 🙏 Acknowledgements +## Acknowledgements The editable PPTX reconstruction design references ideas from: -- [LRriver/slide-alchemy](https://github.com/LRriver/slide-alchemy) -- [ningzimu/image-to-editable-ppt-skill](https://github.com/ningzimu/image-to-editable-ppt-skill) +- [slide-alchemy](https://github.com/CodingFeng101/slide-alchemy) +- [image-to-editable-ppt-skill](https://github.com/ningzimu/image-to-editable-ppt-skill) ## 📄 License diff --git a/README_zh.md b/README_zh.md index 993f29e..43c1f39 100644 --- a/README_zh.md +++ b/README_zh.md @@ -2,7 +2,7 @@ [English](README.md) | [中文](README_zh.md) -复刻 NotebookLM 的 AI PPT 功能,并进一步增强为可控、可编辑、可自定义模型的 PPT 生成工作台,支持将论文、文档等资料自动转换为精美的 PPT 图片。 +构建一个受 NotebookLM 启发的可控、可编辑、可自定义模型 AI PPT 工作台。AIPPT 支持将论文、文档等资料转换为演示文稿,并导出 PDF、栅格 PPTX 或可编辑 PPTX;可编辑 PPTX 中的文字可直接修改,线条/表格边框可作为原生形状编辑,背景、图标和图片元素也会拆分为可移动的独立资产。 ![AIPPT 工作台演示](docs/assets/aippt-demo.gif) @@ -10,27 +10,35 @@ 演示视频覆盖上传 `doc/L9.md`、填写用户要求、生成并编辑设计大纲、确认逐页设计、生成 6 页 PPT、单页编辑、确认替换、导出 PDF/PPTX;模型等待阶段已做快进剪辑。 +## 最新更新:可编辑 PPTX 导出 + +现已支持可编辑 PPTX 导出。生成的幻灯片图片可以进一步重建为 PowerPoint/WPS 可编辑页面:OCR 文本会变成可编辑文本框,简单线条和表格边框会尽量转为 PPT 原生形状,背景、图标、插图和视觉组件会拆分为可移动、可缩放、可隐藏的独立图片资产,而不是整页保留为一张大图。 + +| 生成的 PPT 图片 | 转为可编辑 PPTX 后 | +| :---: | :---: | +| ![生成的 PPT 图片](docs/assets/gen_ppt_pic.png) | ![转为可编辑 PPTX 后的拆分元素效果](docs/assets/gen_ppt_edit.png) | + ## 为什么不只是复刻 NotebookLM 的 PPT 能力更像“一键生成结果”,中间设计过程和单页调整空间相对有限。本项目把生成链路拆成用户可理解、可干预的工作台流程: -- **过程可见**:先展示 PPT 大纲和逐页设计说明,用户确认后再生成图片 +- **过程可见**:先展示 PPT 大纲和逐页设计说明,用户确认后再生成页面 - **逐页可改**:每一页都能单独编辑、生成新版本、回退历史并确认替换 -- **模型可控**:文本规划、生图、图片编辑可分别配置不同 OpenAI-compatible 模型 +- **模型可控**:文本规划、多模态理解、OCR、生图、图片编辑可分别配置不同 OpenAI-compatible 模型 - **本地可跑**:可使用本地 `config.yaml` 或 WebUI 本地 API 配置管理模型连接,项目记录和导出文件不包含 API Key -- **结果可导出**:生成后可直接导出 PDF/PPTX,适合继续汇报或二次编辑 -- **实验性高保真可编辑 PPTX 导出**:通过 provider 门禁的生成式可编辑导出链路,把幻灯片图片重建为 PowerPoint 可编辑文本框、保守原生形状和可移动图片资产 +- **结果可导出**:生成后可直接导出 PDF、栅格 PPTX 或可编辑 PPTX,适合继续汇报或二次编辑 +- **可编辑 PPTX 重建**:通过 provider 门禁的重建链路,把幻灯片图片重建为 PowerPoint 可编辑文本框、原生线条/表格边框和可移动图片资产 ## ✨ 功能特性 -- 🎨 **逐页图片生成**:先生成可编辑设计大纲和逐页设计,再使用 AI 模型转换为 PPT 页面图片 -- 🌐 **PPT 工作台**:支持资料上传、模型配置、当前页大预览、缩略图列表、编辑历史和导出 +- 🎨 **逐页生成**:先生成可编辑设计大纲和逐页设计,再使用 AI 模型生成精美 PPT 页面 +- 🌐 **PPT 工作台**:支持资料上传、模型配置、当前页大预览、缩略图列表、编辑历史和 PDF/PPTX 导出 - 📝 **多格式解析**:支持 `.md/.txt/.pdf/.docx/.pptx` 输入,统一转 Markdown 后生成 - ✏️ **整页图像编辑**:支持对每页幻灯片单独二次编辑、历史回退和确认替换 -- 🔀 **三模型角色**:支持 `prompt_model`、`image_model`、`edit_model` 分别配置 +- 🔀 **多模型角色**:按需分别配置 `text_model`/`prompt_model`、`vlm_model`、`ocr_model`、`image_model`、`edit_model` - 🖼️ **图像结果兼容**:兼容 URL、Markdown 图片链接、data URL、`b64_json` 和纯 base64 -- 💾 **多项目本地留存**:支持在浏览器本地保存多个 PPT 项目,恢复资料、设计大纲、逐页设计、生成图片和单页编辑历史 -- 📤 **可编辑 PPTX 重建**:新增独立的实验性高保真可编辑 PPTX 导出模式,需要通过 provider 验证后使用,详见 [Generative Editable PPTX Export](docs/generative-editable-pptx.md) +- 💾 **多项目本地留存**:支持在浏览器本地保存多个 PPT 项目,恢复资料、设计大纲、逐页设计、生成页面和单页编辑历史 +- 📤 **可编辑 PPTX 重建**:通过 provider 验证后导出文字可编辑、图片资产可移动、简单形状可原生编辑的 PPTX,详见 [Generative Editable PPTX Export](docs/generative-editable-pptx.md) ## 🚀 快速开始 @@ -87,7 +95,7 @@ python main.py --from-prompt prompts.json ### 本地项目保存 -AIPPT 会把项目内容和图片资源保存在当前浏览器 Profile 的 IndexedDB 中,并用 localStorage 保存当前打开的项目 ID、界面偏好和本地 API 配置。项目保存内容包括上传资料、PPT 内容设置、设计大纲、逐页设计、生成图片、编辑后的版本和导出所需图片数据。 +AIPPT 会把项目内容和图片资源保存在当前浏览器 Profile 的 IndexedDB 中,并用 localStorage 保存当前打开的项目 ID、界面偏好和本地 API 配置。项目保存内容包括上传资料、PPT 内容设置、设计大纲、逐页设计、生成页面、编辑后的版本和导出所需图片资产。 注意: - 清理浏览器站点数据会删除本地项目。 @@ -97,14 +105,14 @@ AIPPT 会把项目内容和图片资源保存在当前浏览器 Profile 的 Inde ### 3. WebUI 使用流程 1. **上传文档**:在左侧面板拖拽或点击上传资料文件 -2. **配置模型**:在中间面板配置文本、生图和编辑模型 +2. **配置模型**:在中间面板按需配置文本、多模态理解/OCR、生图和编辑模型 3. **设置参数与要求**:选择页数、清晰度、比例、语言、风格、受众,并填写用户定制要求 4. **确认设计**:先生成设计大纲,用户可编辑后确认,再生成逐页设计预览 -5. **生成 PPT**:确认逐页设计后生成 PPT 图片,实时查看进度 +5. **生成 PPT**:确认逐页设计后生成 PPT 页面,实时查看进度 6. **预览编辑**:在右侧面板预览生成的幻灯片,点击可进行单页编辑 -7. **导出文件**:选择 PDF 或 PPTX 格式导出 +7. **导出文件**:选择 PDF、栅格 PPTX 或可编辑 PPTX 格式导出 -导出菜单会保留原有栅格 PPTX 选项,并新增独立的实验性高保真可编辑 PPTX 选项。可编辑模式依赖 OCR、图像编辑和图像生成 provider,默认优先保证质量:验证失败时返回错误,不会悄悄降级为低保真 PPTX,除非请求显式允许 fallback。当前测试过的 provider 组合仍未通过严格 live 验证。详见 [Generative Editable PPTX Export](docs/generative-editable-pptx.md)。 +导出菜单会保留原有栅格 PPTX 选项,并新增独立的可编辑 PPTX 选项。可编辑模式依赖 VLM/OCR、图像编辑和图像生成 provider,将幻灯片重建为可编辑文本框、PPT 原生简单形状和拆分后的图片资产。该模式默认优先保证质量:验证失败时返回错误,不会悄悄降级为低保真 PPTX,除非请求显式允许 fallback。详见 [Generative Editable PPTX Export](docs/generative-editable-pptx.md)。 仓库内置演示资料为 `doc/L9.md`。该路径是仓库相对路径,clone 后可直接用于 WebUI 上传或命令行示例。 @@ -126,8 +134,8 @@ OpenNotebookLM-AIPPT/ ## ⚙️ 配置说明 所有配置统一在 `config.yaml` 中管理,包括: -- API 配置(文本 prompt、生图、编辑三角色模型) -- 生成式可编辑 PPTX provider 角色和质量门禁(OCR、清理、资产生成、修复、验证) +- API 配置(`text_model`/`prompt_model`、`vlm_model`、`ocr_model`、`image_model`、`edit_model`) +- 生成式可编辑 PPTX provider 角色和质量门禁(视觉分析、OCR、清理、资产生成、修复、验证) - PPT 默认配置(语言、风格、页数) - 超时和重试配置 @@ -142,10 +150,18 @@ completion,图像/编辑模型走多模态 chat completion,响应需返回 ```yaml api: models: - prompt_model: + text_model: + model: "gpt-4o" + base_url: "https://api.openai.com/v1" + api_key: "sk-xxx" + vlm_model: model: "gpt-4o" base_url: "https://api.openai.com/v1" api_key: "sk-xxx" + ocr_model: + model: "ocr-model" + base_url: "https://api.example.com/v1" + api_key: "sk-xxx" image_model: model: "gpt-image-2" base_url: "https://api.example.com/v1" @@ -164,7 +180,8 @@ output/ppt_20241201_123456/ ├── prompts.json # 生成的 Prompt ├── result.json # 生成结果 ├── presentation.pdf # 导出的 PDF -└── images/ # 幻灯片图片 +├── presentation.pptx # 导出的栅格或可编辑 PPTX +└── images/ # 生成页面图片和拆分资产 ``` ## 🧪 开发检查 @@ -192,13 +209,19 @@ npm run test npm run build ``` -GitHub Actions 会在 `main` 和 `dev` 的 Pull Request 与 push 上运行这些默认检查。真实模型 API 调用需要私有 Key,且容易受外部服务波动影响,因此不放入默认 CI。 +GitHub Actions 会在 `main` 和 `dev` 的 Pull Request 与 push 上运行这些默认检查。真实模型 API 调用和桌面 PowerPoint/WPS 渲染需要私有 Key 或 GitHub runner 中不存在的宿主应用,因此不放入默认 CI。CI 仍会验证包级 PPTX 结构、对象 manifest、渲染器 contract 和 fake-provider 重建路径。 ## 📋 TODO -- [ ] 将生成的 PPT 图片增强为结构化、可编辑的 PPT 内容 - [ ] 支持框选局部区域编辑 -- [ ] 增加更多 provider profile 模板 +- [ ] 持续优化复杂页面的可编辑 PPTX 元素分组、层级顺序和原生形状覆盖率 +- [ ] 增加更多 VLM、OCR、生图和图片编辑 provider 预设 + +## 致谢 + +可编辑 PPTX 重建设计参考了以下项目的思路: +- [slide-alchemy](https://github.com/CodingFeng101/slide-alchemy) +- [image-to-editable-ppt-skill](https://github.com/ningzimu/image-to-editable-ppt-skill) ## 📄 许可证 diff --git a/docs/assets/gen_ppt_edit.png b/docs/assets/gen_ppt_edit.png new file mode 100644 index 0000000..f06dc00 Binary files /dev/null and b/docs/assets/gen_ppt_edit.png differ diff --git a/docs/assets/gen_ppt_pic.png b/docs/assets/gen_ppt_pic.png new file mode 100644 index 0000000..f94a81a Binary files /dev/null and b/docs/assets/gen_ppt_pic.png differ