702 lines
34 KiB
Markdown
702 lines
34 KiB
Markdown
<!-- WEHUB_ZH_README -->
|
||
> [!NOTE]
|
||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||
> [English](./README.en.md) · [原始项目](https://github.com/presenton/presenton) · [上游 README](https://github.com/presenton/presenton/blob/HEAD/README.md)
|
||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||
|
||
<p align="center">
|
||
<img src="./readme_assets/images/logo.png" alt="Presenton" />
|
||
</p>
|
||
|
||
<p align="center">
|
||
<a href="https://presenton.ai/download"><strong>快速入门</strong></a> ·
|
||
<a href="https://docs.presenton.ai/"><strong>文档</strong></a> ·
|
||
<a href="https://www.youtube.com/@presentonai"><strong>Youtube</strong></a> ·
|
||
<a href="https://discord.gg/9ZsKKxudNE"><strong>Discord</strong></a>
|
||
</p>
|
||
|
||
<p align="center">
|
||
<a href="https://github.com/presenton/presenton/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue?style=flat" alt="Apache2.0" /></a>
|
||
<a href="https://github.com/presenton/presenton"><img src="https://img.shields.io/github/stars/presenton/presenton?style=flat" alt="Stars" /></a>
|
||
<a href="https://presenton.ai/"><img src="https://img.shields.io/badge/Platform-Docker%20%7C%20Windows%20%7C%20macOS%20%7C%20Linux-lightgrey?style=flat" alt="Platform" /></a>
|
||
</p>
|
||
|
||
<p align="center">
|
||
<a href="https://trendshift.io/repositories/18582?utm_source=repository-badge&utm_medium=badge&utm_campaign=badge-repository-18582" target="_blank" rel="noopener noreferrer"><img src="https://trendshift.io/api/badge/repositories/18582" alt="presenton%2Fpresenton | Trendshift" width="250" height="55" /></a>
|
||
</p>
|
||
|
||
# 开源 AI 演示文稿生成器与 API(Gamma、Canva、Beautiful AI、Decktopus、Presentations AI 的替代方案)
|
||
|
||
从 AI 驱动的演示文稿生成,到编辑、导出和灵活的模型提供商,探索 Presenton 能做什么。
|
||
|
||
[▶ 观看 Presenton 实操演示](https://github.com/user-attachments/assets/93e541dc-8487-4dcf-a9a0-95ad5ca94453)
|
||
|
||
### ✨ 为什么选择 Presenton
|
||
|
||
无 SaaS 锁定 · 无强制订阅 · 对模型与数据拥有完全控制权
|
||
|
||
Presenton 有何不同?
|
||
|
||
- 通过 [Docker Package](https://docs.presenton.ai/v3/get-started/quickstart) 在 Web 端实现完全**自托管(self-hosted)**
|
||
- 或下载 [Desktop App](https://presenton.ai/download)(Mac、Windows 与 Linux)
|
||
- 兼容 Ollama、LM Studio、OpenAI、Gemini、Vertex AI、Azure OpenAI、Amazon Bedrock、Fireworks、Together AI、Anthropic,或任何其他 OpenAI 兼容提供商
|
||
- 内置 AI 演示文稿生成 API
|
||
- 完全开源(Apache 2.0)
|
||
- 支持使用你自己的设计/模板
|
||
- **可完全编辑的 PPTX 导出**
|
||
|
||
> [!TIP]
|
||
> **给我们点个 Star!** 一颗 ⭐ 代表你的支持,也会激励我们持续构建!😇
|
||
|
||
<p align="center">
|
||
<img src="./readme_assets/images/banner_bg.gif" alt="Presenton" />
|
||
</p>
|
||
|
||
#
|
||
|
||
### 🎛 功能特性
|
||
|
||
<p align="center">
|
||
<img src="./readme_assets/images/features.png" alt="Presenton 功能特性" />
|
||
</p>
|
||
|
||
<p align="center">
|
||
<img src="./readme_assets/images/chatgpt-2-1.png" alt="使用现有 ChatGPT 订阅创建精美演示文稿 — 安全私密、即时访问、无需 API 密钥" />
|
||
</p>
|
||
|
||
#
|
||
|
||
### 💻 Presenton Desktop
|
||
|
||
使用你自己的模型提供商(BYOK,Bring Your Own Key)创建 AI 驱动的演示文稿,或在本地机器上完整运行一切,以获得完全控制与数据隐私。
|
||
|
||
<p align="center">
|
||
<a href="https://presenton.ai/download">
|
||
<img src="./readme_assets/images/banner.png" alt="云端部署" />
|
||
</a>
|
||
</p>
|
||
|
||
**支持平台**
|
||
|
||
<table>
|
||
<tr>
|
||
<th align="left">平台</th>
|
||
<th align="left">架构</th>
|
||
<th align="left">安装包</th>
|
||
<th align="left">下载</th>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><b>macOS</b></td>
|
||
<td>Apple Silicon / Intel</td>
|
||
<td><code>.dmg</code></td>
|
||
<td><a href="https://presenton.ai/download">下载 ↗</a></td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><b>Windows</b></td>
|
||
<td>x64</td>
|
||
<td><code>.exe</code></td>
|
||
<td><a href="https://presenton.ai/download">下载 ↗</a></td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><b>Linux</b></td>
|
||
<td>x64</td>
|
||
<td> <code>.deb</code></td>
|
||
<td><a href="https://presenton.ai/download">下载 ↗</a></td>
|
||
</tr>
|
||
|
||
</table>
|
||
|
||
|
||
**部署到云服务商**
|
||
|
||
<div style="display:flex; gap:12px; align-items:center;">
|
||
<a href="https://railway.com/deploy/presenton-ai-presentations">
|
||
<img
|
||
src="https://railway.com/button.svg"
|
||
alt="Deploy on Railway"
|
||
style="height:38px;"
|
||
/>
|
||
</a>
|
||
<a href="https://cloud.digitalocean.com/apps/new?repo=https://github.com/presenton/presenton/tree/main">
|
||
<img
|
||
src="https://www.deploytodo.com/do-btn-blue.svg"
|
||
alt="Deploy to DigitalOcean"
|
||
style="height:36px;"
|
||
/>
|
||
</a>
|
||
</div>
|
||
|
||
#
|
||
|
||
Presenton 让你对 AI 演示文稿工作流拥有完全控制权。选择你的模型、自定义体验,并保持数据私密。
|
||
|
||
- 自定义模板与主题 — 使用 HTML 和 Tailwind CSS 创建无限种演示文稿设计
|
||
- AI 模板生成 — 从现有 Powerpoint 文档创建演示文稿模板
|
||
- 灵活生成 — 通过提示词或上传文档构建演示文稿
|
||
- 随时导出 — 以专业格式保存为 PowerPoint(PPTX)和 PDF
|
||
- 内置 MCP Server — 通过 Model Context Protocol 生成演示文稿
|
||
- Bring Your Own Key — 使用你自己的 API 密钥连接 OpenAI、Google Gemini、Vertex AI、Azure OpenAI、Anthropic Claude 或任何兼容提供商。只为实际使用付费,无隐藏费用或订阅
|
||
- Ollama 集成 — 在本地运行开源模型,享有完全隐私
|
||
- OpenAI API 兼容 — 使用你自己的模型连接任何 OpenAI 兼容端点
|
||
- 多提供商支持 — 自由组合文本与图像生成提供商
|
||
- 多样化图像生成 — 可选 DALL-E 3、Gemini Flash、Pexels 或 Pixabay
|
||
- 丰富媒体支持 — 图标、图表和自定义图形,打造专业演示文稿
|
||
- 本地运行 — 所有处理都在你的设备上完成,无云端依赖
|
||
- API 部署 — 作为团队自有的 API 服务托管
|
||
- 完全开源 — Apache 2.0 许可,可审查、修改与贡献
|
||
- Docker 就绪 — 一条命令即可部署,支持 GPU 以运行本地模型
|
||
- Electron 桌面应用 — 在 Windows、macOS 和 Linux 上以原生桌面应用运行 Presenton(无需浏览器)
|
||
- 使用 ChatGPT 登录 — 使用免费或付费 ChatGPT 账户登录,即刻开始创建演示文稿 — 无需单独的 API 密钥
|
||
|
||
#
|
||
|
||
### ☁️ Presenton Cloud
|
||
|
||
直接在浏览器中运行 Presenton — 无需安装、无需配置。随时随地即刻开始创建演示文稿。
|
||
|
||
<p align="center">
|
||
<a href="https://presenton.ai">
|
||
<img src="./readme_assets/images/cloud-banner.png" alt="Presenton Cloud" />
|
||
</a>
|
||
</p>
|
||
|
||
#
|
||
|
||
### ⚡ 运行 Presenton
|
||
|
||
<p>
|
||
你可以通过两种方式运行 Presenton:
|
||
使用 <strong>Docker</strong> 一条命令完成搭建,无需安装本地开发
|
||
环境栈;或使用 <strong>Electron 桌面应用</strong> 获得原生应用
|
||
体验(适合开发或离线使用)。
|
||
</p>
|
||
|
||
**选项 1:Electron(桌面应用)**
|
||
|
||
<p>
|
||
以原生桌面应用运行 Presenton。可在应用中配置 LLM 与图像提供商
|
||
(API 密钥等)。运行捆绑后端时,适用与 Docker 相同的环境变量。
|
||
</p>
|
||
|
||
<p>
|
||
<strong>前置要求:</strong>Node.js(LTS)、npm、Python 3.11,以及
|
||
<a href="https://docs.astral.sh/uv/">uv</a>
|
||
(用于 <code>servers/fastapi</code> 中的共享 FastAPI 后端)。
|
||
</p>
|
||
|
||
- 初始化设置(首次)
|
||
<pre><code class="language-bash">cd electron
|
||
npm run setup:env</code></pre>
|
||
|
||
这将安装 Node 依赖,在 FastAPI
|
||
服务器中运行 <code>uv sync</code>,并安装 Next.js 依赖。
|
||
|
||
- 开发模式运行
|
||
<pre><code class="language-bash">npm run dev</code></pre>
|
||
<p>
|
||
这将编译 TypeScript 并启动 Electron。后端与 UI 在桌面窗口内本地运行。
|
||
</p>
|
||
|
||
- 构建可分发版本(可选)
|
||
为 Windows、macOS 或 Linux 创建安装包:
|
||
<pre><code class="language-bash">npm run build:all
|
||
npm run dist</code></pre>
|
||
<p>
|
||
输出文件写入 <code>electron/dist</code>
|
||
(或按你的 <code>electron-builder</code> 配置)。
|
||
</p>
|
||
<p>
|
||
若要在 Mac App Store 之外分发公开 macOS DMG,请在 <code>electron/</code> 目录下,完成 <code>docs/macos/dev/direct-distribution.md</code> 中的一次性 Developer ID 与公证(notarization)
|
||
设置后,运行
|
||
<code>APPLE_KEYCHAIN_PROFILE="presenton-notary" npm run build:all:mac:signed</code>。
|
||
</p>
|
||
|
||
**选项 2:Docker**
|
||
|
||
- 启动 Presenton
|
||
Linux/MacOS(Bash/Zsh Shell):
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
Windows(PowerShell):
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -v "${PWD}\app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 打开 Presenton
|
||
<p>
|
||
在任意浏览器中打开 <a href="http://localhost:5001">http://localhost:5001</a> 即可使用 Presenton。
|
||
</p>
|
||
|
||
<blockquote>
|
||
<p>
|
||
<strong>注意:</strong> 可将 <code>5001</code> 替换为任意其他端口号,以在不同端口上运行 Presenton。若使用
|
||
Docker Compose,请设置 <code>PRESENTON_HTTP_HOST_PORT</code>,例如
|
||
<code>PRESENTON_HTTP_HOST_PORT=8080 docker compose up production</code>。
|
||
</p>
|
||
</blockquote>
|
||
|
||
#
|
||
|
||
### ⚙️ 部署配置
|
||
|
||
下列列表与本仓库 **`docker-compose.yml`**(`production`、`production-gpu`、`development` 和 `development-gpu`)中转发的环境变量一致。请将取值写入与 compose 文件同目录的 `.env` 文件,或在执行 `docker compose up` 之前导出它们。在 Docker 外运行时,Electron 应用后端也可读取相同名称的变量。
|
||
|
||
代码中还存在其他可选变量(例如高级 Mem0 路径、LiteParse 运行器,或当 Next.js 与 FastAPI 非同源时的 `FAST_API_INTERNAL_URL`);它们**未**接入 `docker-compose.yml`。受支持的名称可从 `servers/fastapi/utils/get_env.py` 以及 `servers/nextjs/` 下的 Next.js 服务端工具中发现。
|
||
|
||
#### LLM 与 API 密钥
|
||
|
||
- **CAN_CHANGE_KEYS**=[true/false]:若希望隐藏 API 密钥并禁止修改,请设为 **false**。
|
||
- **LLM**=[openai/deepseek/google/vertex/azure/bedrock/openrouter/fireworks/together/cerebras/anthropic/litellm/lmstudio/ollama/custom/codex]:选择文本 **LLM**。
|
||
- **OPENAI_API_KEY**:当 **LLM** 为 **openai** 时必填。
|
||
- **OPENAI_MODEL**:当 **LLM** 为 **openai** 时必填(默认:`gpt-4.1`)。
|
||
- **DEEPSEEK_API_KEY**:当 **LLM** 为 **deepseek** 时必填。
|
||
- **DEEPSEEK_MODEL**:当 **LLM** 为 **deepseek** 时必填(默认:`deepseek-chat`)。
|
||
- **DEEPSEEK_BASE_URL**:当 **LLM** 为 **deepseek** 时可选(默认:`https://api.deepseek.com`)。
|
||
- **GOOGLE_API_KEY**:当 **LLM** 为 **google** 时必填。
|
||
- **GOOGLE_MODEL**:当 **LLM** 为 **google** 时必填(默认:`models/gemini-2.0-flash`)。
|
||
- **VERTEX_MODEL**:当 **LLM** 为 **vertex** 时必填(默认:`gemini-2.5-flash`)。
|
||
- **VERTEX_API_KEY**:当 **LLM=vertex** 时的可选认证方式(Vertex Express)。
|
||
- **VERTEX_PROJECT** / **VERTEX_LOCATION**:使用 GCP 项目凭据且 **LLM=vertex** 时的可选认证方式(勿与 `VERTEX_API_KEY` 同时使用)。
|
||
- **VERTEX_BASE_URL**:可选的 Vertex 网关/基础 URL 覆盖。
|
||
- **AZURE_OPENAI_MODEL**:当 **LLM** 为 **azure** 时必填(部署/模型名称)。
|
||
- **AZURE_OPENAI_API_KEY**:当 **LLM** 为 **azure** 时必填。
|
||
- **AZURE_OPENAI_API_VERSION**:当 **LLM** 为 **azure** 时必填(例如 `2024-10-21`)。
|
||
- **AZURE_OPENAI_ENDPOINT** / **AZURE_OPENAI_BASE_URL**:当 **LLM** 为 **azure** 时至少需设置其一。
|
||
- **AZURE_OPENAI_DEPLOYMENT**:当 **LLM** 为 **azure** 时的可选部署覆盖。
|
||
- **BEDROCK_REGION**:当 **LLM** 为 **bedrock** 时可选(默认:`us-east-1`)。
|
||
- **BEDROCK_MODEL**:当 **LLM** 为 **bedrock** 时必填。使用标准模型 ID(示例:`us.anthropic.claude-3-5-haiku-20241022-v1:0`)或较新模型的完整 **inference profile ARN**(示例:Claude Sonnet 4.6)。会作为 `modelId` 传递给 Bedrock Converse。请参阅 **[Amazon Bedrock 指南](docs/amazon-bedrock.md)**。
|
||
- **BEDROCK_API_KEY**:当 **LLM** 为 **bedrock** 时可选(API 密钥认证;AWS 密钥的替代方案)。
|
||
- **BEDROCK_AWS_ACCESS_KEY_ID** / **BEDROCK_AWS_SECRET_ACCESS_KEY**:当 **LLM** 为 **bedrock** 且未设置 `BEDROCK_API_KEY` 时,需同时设置。
|
||
- **BEDROCK_AWS_SESSION_TOKEN**:当 **LLM** 为 **bedrock** 时的可选会话令牌。
|
||
- **BEDROCK_PROFILE_NAME**:当 **LLM** 为 **bedrock** 时的可选 AWS 配置文件名称。
|
||
- **OPENROUTER_API_KEY**:当 **LLM** 为 **openrouter** 时必填。
|
||
- **OPENROUTER_MODEL**:当 **LLM** 为 **openrouter** 时必填(默认:`openai/gpt-4o`)。
|
||
- **OPENROUTER_BASE_URL**:当 **LLM** 为 **openrouter** 时可选(默认:`https://openrouter.ai/api/v1`)。
|
||
- **FIREWORKS_API_KEY**:当 **LLM** 为 **fireworks** 时必填。
|
||
- **FIREWORKS_MODEL**:当 **LLM** 为 **fireworks** 时必填(示例:`accounts/fireworks/models/llama-v3p1-8b-instruct`)。
|
||
- **FIREWORKS_BASE_URL**:当 **LLM** 为 **fireworks** 时可选(默认:`https://api.fireworks.ai/inference/v1`)。
|
||
- **TOGETHER_API_KEY**:当 **LLM** 为 **together** 时必填。
|
||
- **TOGETHER_MODEL**:当 **LLM** 为 **together** 时必填(示例:`openai/gpt-oss-20b`)。
|
||
- **TOGETHER_BASE_URL**:当 **LLM** 为 **together** 时可选(默认:`https://api.together.ai/v1`)。
|
||
- **CEREBRAS_API_KEY**:当 **LLM** 为 **cerebras** 时必填。
|
||
- **CEREBRAS_MODEL**:当 **LLM** 为 **cerebras** 时必填(默认:`llama-3.3-70b`)。
|
||
- **CEREBRAS_BASE_URL**:当 **LLM** 为 **cerebras** 时可选(默认:`https://api.cerebras.ai/v1`)。
|
||
- **ANTHROPIC_API_KEY**:当 **LLM** 为 **anthropic** 时必填。
|
||
- **ANTHROPIC_MODEL**:当 **LLM** 为 **anthropic** 时必填(默认:`claude-3-5-sonnet-20241022`)。
|
||
- **CODEX_MODEL**:当 **LLM** 为 **codex** 时必填(Codex OAuth 流程;compose 将主机端口 **1455** 映射用于回调)。
|
||
- **CUSTOM_LLM_URL**:当 **LLM** 为 **custom** 时的 OpenAI 兼容基础 URL。
|
||
- **CUSTOM_LLM_API_KEY**:当 **LLM** 为 **custom** 时的 API 密钥。
|
||
- **CUSTOM_MODEL**:当 **LLM** 为 **custom** 时的模型 ID。
|
||
- **LITELLM_BASE_URL**:当 **LLM** 为 **litellm** 时的 LiteLLM 代理或网关基础 URL。
|
||
- **LITELLM_API_KEY**:当 **LLM** 为 **litellm** 时的可选 API 密钥。
|
||
- **LITELLM_MODEL**:当 **LLM** 为 **litellm** 时必填(默认:`gpt-4.1`)。
|
||
- **LMSTUDIO_BASE_URL**:当 **LLM** 为 **lmstudio** 时的可选 LM Studio 基础 URL(默认:`http://localhost:1234/v1`;省略时会自动追加 `/v1`)。
|
||
- **LMSTUDIO_API_KEY**:当 **LLM** 为 **lmstudio** 时的可选 API 密钥。
|
||
- **LMSTUDIO_MODEL**:当 **LLM** 为 **lmstudio** 时必填(示例:`openai/gpt-oss-20b`)。
|
||
- **DISABLE_THINKING**=[true/false]:若为 **true**,则对支持该功能的提供商(包括 DeepSeek)禁用“思考”(thinking)。
|
||
- **WEB_GROUNDING**=[true/false]:若为 **true**,则默认启用网页搜索。
|
||
- **WEB_SEARCH_PROVIDER**=[auto/native/searxng/tavily/exa]:选择网页搜索模式。`auto` 对 OpenAI、Google 和 Anthropic 使用原生搜索,否则除非你选择外部提供商,否则网页搜索保持关闭。
|
||
<!-- Brave and Serper search providers are hidden until they are tested. -->
|
||
<!-- - **WEB_SEARCH_PROVIDER** also supports `brave` and `serper`. -->
|
||
- **WEB_SEARCH_MAX_RESULTS**:添加到模型上下文的外部搜索结果数量上限(默认 `5`,最大 `10`)。
|
||
- **SEARXNG_BASE_URL**:自托管 SearXNG 实例的基础 URL。
|
||
- **TAVILY_API_KEY**、**EXA_API_KEY**:可选托管搜索 API 的凭据。
|
||
<!-- - **BRAVE_SEARCH_API_KEY**, **SERPER_API_KEY**: Credentials for hidden, untested hosted search APIs. -->
|
||
- **EXTENDED_REASONING**=[true/false]:在已配置技术栈支持的情况下启用扩展推理(extended reasoning)。
|
||
|
||
#### Ollama
|
||
|
||
当 **LLM** 为 **ollama** 时使用:
|
||
|
||
- **OLLAMA_URL**:Ollama HTTP API 的基础 URL(例如 Docker 中的 `http://host.docker.internal:11434`)。
|
||
- **OLLAMA_MODEL**:Ollama 中的模型名称(例如 `llama3.2:3b`)。
|
||
- **START_OLLAMA**=[true/false]:容器入口点(`start.js`):可选安装 + `ollama serve`。默认 **false**(`development` / `production` compose)。
|
||
|
||
#### 演示文稿记忆(Mem0 OSS)
|
||
|
||
Mem0 使用本地 Qdrant + SQLite(OSS);记忆按演示文稿(presentation)作用域划分。
|
||
|
||
默认情况下,Docker 运行时会将 Mem0 指向本地 Ollama 兼容的 LLM 端点,因此初始化时不再需要 OpenAI 密钥。若希望改用 OpenAI,请将 `MEM0_LLM_BASE_URL`/`MEM0_LLM_API_KEY` 设置为你的 OpenAI 兼容端点与密钥。
|
||
Docker 镜像在构建期间会安装默认 spaCy 模型(`en_core_web_sm`),以便 Mem0 在每次运行时无需额外配置即可启动。
|
||
|
||
| 变量 | 用途 |
|
||
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||
| **MEM0_ENABLED** | **true**/false(compose 默认值 **true**)。 |
|
||
| **MEM0_LLM_MODEL** | Mem0 LLM 模型名称(compose 默认值 **`llama3.1:latest`** 或 `OLLAMA_MODEL`)。 |
|
||
| **MEM0_LLM_API_KEY** | 面向 OpenAI 兼容客户端的 Mem0 LLM API 密钥占位符(compose 默认值 **`ollama`**)。 |
|
||
| **MEM0_LLM_BASE_URL** | Mem0 LLM 基础 URL(compose 默认值 **`OLLAMA_URL`** 或 `http://host.docker.internal:11434`)。 |
|
||
| **MEM0_DIR** | 根目录(compose 默认值 **`/app_data/mem0`**)。 |
|
||
| **MEM0_EMBEDDER_PROVIDER** | 嵌入器(Embedder)后端(compose 默认值 **`fastembed`**)。 |
|
||
| **MEM0_EMBEDDER_MODEL** | 模型 ID(compose 默认值 **`BAAI/bge-small-en-v1.5`**)。 |
|
||
| **MEM0_EMBEDDING_DIMS** | 向量维度(compose 默认值 **384**)。 |
|
||
| **MEM0_SPACY_MODEL** | 可选的 spaCy 模型覆盖(默认值 **`en_core_web_sm`**)。 |
|
||
| **MEM0_REQUIRE_SPACY_MODEL** | 保持为 **true**(默认值)。仅当你有意让 Mem0 在不使用 spaCy 词形还原的情况下运行时,才设置为 false。 |
|
||
|
||
#### 文档解析(LiteParse)
|
||
|
||
| 变量 | 用途 |
|
||
| ------------------------- | ----------------------------------------- |
|
||
| **LITEPARSE_DPI** | OCR 渲染 DPI(compose 默认值 **120**)。 |
|
||
| **LITEPARSE_NUM_WORKERS** | 工作进程数量(compose 默认值 **1**)。 |
|
||
|
||
#### 数据库
|
||
|
||
- **DATABASE_URL**:SQLAlchemy URL;若未设置,应用会回退到应用数据目录下的 SQLite。
|
||
- **MIGRATE_DATABASE_ON_STARTUP**:Compose 为所有服务设置 **`true`**,以便在启动时运行迁移。
|
||
|
||
#### 图像生成
|
||
|
||
这些变量与 `docker-compose.yml` 对应。**`IMAGE_PROVIDER`** 用于选择后端(`pexels`、`pixabay`、`gemini_flash`、`nanobanana_pro`、`dall-e-3`、`gpt-image-1.5`、`comfyui`、`open_webui`)。OpenAI 图像模式使用 **OPENAI_API_KEY**,Gemini 图像模式使用 **GOOGLE_API_KEY**(与 LLM 部分使用相同的密钥)。
|
||
|
||
- **DISABLE_IMAGE_GENERATION**=[true/false]:禁用幻灯片图像生成。
|
||
- **IMAGE_PROVIDER**:提供商 ID(见上文枚举)。
|
||
- **PEXELS_API_KEY**:Pexels 图库图片。
|
||
- **PIXABAY_API_KEY**:Pixabay 图库图片。
|
||
- **DALL_E_3_QUALITY**=[standard/hd]:**dall-e-3** 的可选配置(默认值 `standard`)。
|
||
- **GPT_IMAGE_1_5_QUALITY**=[low/medium/high]:**gpt-image-1.5** 的可选配置(默认值 `medium`)。
|
||
- **COMFYUI_URL** / **COMFYUI_WORKFLOW**:自托管 ComfyUI 工作流 JSON。
|
||
- **OPEN_WEBUI_IMAGE_URL** / **OPEN_WEBUI_IMAGE_API_KEY**:兼容 Open WebUI 的图像端点。
|
||
- **OPENAI_COMPAT_IMAGE_BASE_URL** / **OPENAI_COMPAT_IMAGE_API_KEY** / **OPENAI_COMPAT_IMAGE_MODEL**:若使用 **openai_compatible** 将图像请求发送到任意 OpenAI 兼容的 `/v1/images/*` 端点(LiteLLM、Azure、vLLM Gateways 等),则为必填项。
|
||
|
||
#### 遥测
|
||
|
||
- **DISABLE_ANONYMOUS_TRACKING**=[true/false]:设置为 **true** 以禁用匿名遥测。
|
||
|
||
#### 身份验证(Web 登录)
|
||
|
||
Presenton 每个实例使用**单一管理员账户**。凭据存储在 `app_data`(已哈希;参见 `userConfig.json`)。可通过 `-e` 传入,或在 compose 中通过 `.env` 传入:
|
||
|
||
- **AUTH_USERNAME** / **AUTH_PASSWORD** — 在首次启动时预置管理员登录(密码至少 6 个字符)。若用户已存在则忽略,除非设置了 **AUTH_OVERRIDE_FROM_ENV**。
|
||
- **AUTH_OVERRIDE_FROM_ENV**=[true/false] — 若为 **true**,则在每次 FastAPI 启动时从环境变量替换已存储的凭据,并轮换会话签名密钥(会使现有会话失效)。一次性轮换完成后请移除该设置。
|
||
- **RESET_AUTH**=[true/false] — 若为 **true**,则在启动时清除已存储的凭据。用于**单次**启动以恢复访问权限,之后请取消设置。
|
||
|
||
**示例**
|
||
|
||
```bash
|
||
docker run -it --name presenton -p 5001:80 -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest
|
||
```
|
||
|
||
```bash
|
||
docker run -it --name presenton -p 5001:80 -e AUTH_USERNAME=admin -e AUTH_PASSWORD=changeme123 -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest
|
||
```
|
||
|
||
```bash
|
||
docker run -it --name presenton -p 5001:80 -e AUTH_USERNAME=admin -e AUTH_PASSWORD=changeme123 -v "${PWD}\app_data:/app_data" ghcr.io/presenton/presenton:latest
|
||
```
|
||
|
||
```bash
|
||
docker stop presenton && docker rm presenton && docker run -it --name presenton -p 5001:80 -e AUTH_USERNAME=admin -e AUTH_PASSWORD=newcred456 -e AUTH_OVERRIDE_FROM_ENV=true -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest
|
||
```
|
||
|
||
```bash
|
||
docker stop presenton && docker rm presenton && docker run -it --name presenton -p 5001:80 -e RESET_AUTH=true -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest
|
||
```
|
||
|
||
```bash
|
||
docker stop presenton && docker rm presenton && docker run -it --name presenton -p 5001:80 -e AUTH_USERNAME=admin -e AUTH_PASSWORD=changeme123 -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest
|
||
```
|
||
|
||
**手动重置:**停止容器,编辑 `./app_data/userConfig.json`,删除 `AUTH_USERNAME`、`AUTH_PASSWORD_HASH` 和 `AUTH_SECRET_KEY`,保存后重新启动。
|
||
|
||
在应用中退出登录:**Settings → Other → Sign out**。
|
||
|
||
#### MCP 身份验证
|
||
|
||
当已配置身份验证(`AUTH_USERNAME` / `AUTH_PASSWORD`)时,位于 `/mcp` 的 MCP 端点现在也需要身份验证。
|
||
|
||
1. 登录一次以获取 bearer token:
|
||
|
||
```bash
|
||
curl -s -X POST http://localhost:5001/api/v1/auth/login \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"username":"admin","password":"changeme123"}'
|
||
```
|
||
|
||
响应包含:
|
||
|
||
- `access_token`(会话 token)
|
||
- `token_type`(`bearer`)
|
||
|
||
2. 配置你的 MCP 客户端,在每次请求中发送该 token:
|
||
|
||
```json
|
||
{
|
||
"mcpServers": {
|
||
"presenton": {
|
||
"url": "http://localhost:5001/mcp",
|
||
"headers": {
|
||
"Authorization": "Bearer <access_token>"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
```
|
||
|
||
说明:
|
||
|
||
- 若你通过 `AUTH_OVERRIDE_FROM_ENV=true` 轮换凭据,此前签发的会话 token 将失效。
|
||
- MCP 在 Electron 桌面应用中不可用(`PRESENTON_ELECTRON=true`)。Electron 默认以 `DISABLE_AUTH=true` 运行,且为避免身份验证冲突,MCP 服务器在该环境中被禁用。
|
||
|
||
> 注意:当在 `.env` 中设置时,上述 LLM 和图像变量会从 **`docker-compose.yml`** 转发。
|
||
|
||
<br>
|
||
<br>
|
||
|
||
**按提供商分类的 Docker Run 示例**
|
||
|
||
变量与 compose 相同;直接运行 `docker run` 时,使用 `-e` 而非 `.env`。
|
||
|
||
- 使用 OpenAI
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="openai" -e OPENAI_API_KEY="******" -e IMAGE_PROVIDER="dall-e-3" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Google
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="google" -e GOOGLE_API_KEY="******" -e IMAGE_PROVIDER="gemini_flash" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Vertex AI(API key 模式)
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="vertex" -e VERTEX_API_KEY="******" -e VERTEX_MODEL="gemini-2.5-flash" -e IMAGE_PROVIDER="gemini_flash" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Azure OpenAI
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="azure" -e AZURE_OPENAI_API_KEY="******" -e AZURE_OPENAI_MODEL="gpt-4.1" -e AZURE_OPENAI_API_VERSION="2024-10-21" -e AZURE_OPENAI_ENDPOINT="https://YOUR-RESOURCE.openai.azure.com" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Amazon Bedrock(按需模型 ID)— 有关推理配置文件(inference profiles)、IAM 与故障排查,请参阅 **[docs/amazon-bedrock.md](docs/amazon-bedrock.md)**。
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="bedrock" -e BEDROCK_REGION="us-east-1" -e BEDROCK_AWS_ACCESS_KEY_ID="******" -e BEDROCK_AWS_SECRET_ACCESS_KEY="******" -e BEDROCK_MODEL="us.anthropic.claude-3-5-haiku-20241022-v1:0" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Amazon Bedrock(推理配置文件 ARN,例如 Claude Sonnet 4.6)
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="bedrock" -e BEDROCK_REGION="us-east-1" -e BEDROCK_AWS_ACCESS_KEY_ID="******" -e BEDROCK_AWS_SECRET_ACCESS_KEY="******" -e BEDROCK_MODEL="arn:aws:bedrock:us-east-1:YOUR_ACCOUNT_ID:inference-profile/us.anthropic.claude-sonnet-4-6" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Fireworks
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="fireworks" -e FIREWORKS_API_KEY="******" -e FIREWORKS_MODEL="accounts/fireworks/models/llama-v3p1-8b-instruct" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Together AI
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="together" -e TOGETHER_API_KEY="******" -e TOGETHER_MODEL="openai/gpt-oss-20b" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Ollama
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="ollama" -e OLLAMA_MODEL="llama3.2:3b" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="*******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 Anthropic
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="anthropic" -e ANTHROPIC_API_KEY="******" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 LM Studio(本地)
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e LLM="lmstudio" -e LMSTUDIO_BASE_URL="http://host.docker.internal:1234" -e LMSTUDIO_MODEL="openai/gpt-oss-20b" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 OpenAI 兼容 LLM API
|
||
<pre><code class="language-bash">docker run -it -p 5001:80 -e CAN_CHANGE_KEYS="false" -e LLM="custom" -e CUSTOM_LLM_URL="http://*****" -e CUSTOM_LLM_API_KEY="*****" -e CUSTOM_MODEL="llama3.2:3b" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="********" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 在 GPU 支持下运行 Presenton
|
||
若要对 Ollama 模型使用 GPU 加速,需要安装并配置 NVIDIA Container Toolkit,以便 Docker 容器访问 NVIDIA GPU。
|
||
安装并配置好 NVIDIA Container Toolkit 后,可通过添加 `--gpus=all` 标志以 GPU 支持运行 Presenton:
|
||
<pre><code class="language-bash">docker run -it --name presenton --gpus=all -p 5001:80 -e LLM="ollama" -e OLLAMA_MODEL="llama3.2:3b" -e IMAGE_PROVIDER="pexels" -e PEXELS_API_KEY="*******" -e CAN_CHANGE_KEYS="false" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
- 使用 OpenAI 兼容图像提供商
|
||
|
||
这会将所有幻灯片图像请求路由到你的 OpenAI 兼容网关(LiteLLM、Azure、vLLM 等),同时保持文本 LLM 配置独立:
|
||
<pre><code class="language-bash">docker run -it --name presenton -p 5001:80 -e IMAGE_PROVIDER="openai_compatible" -e OPENAI_COMPAT_IMAGE_BASE_URL="https://proxy.example.com/v1" -e OPENAI_COMPAT_IMAGE_API_KEY="******" -e OPENAI_COMPAT_IMAGE_MODEL="gpt-image-1" -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest</code></pre>
|
||
|
||
#
|
||
|
||
### ✨ 通过 API 生成演示文稿
|
||
|
||
**生成演示文稿**
|
||
|
||
<p>
|
||
<strong>端点:</strong> <code>/api/v1/ppt/presentation/generate</code><br>
|
||
<strong>方法:</strong> <code>POST</code><br>
|
||
<strong>Content-Type:</strong> <code>application/json</code>
|
||
</p>
|
||
|
||
<p>
|
||
<strong>身份验证(HTTP Basic):</strong><br>
|
||
除 <code>/api/v1/auth/*</code> 外,所有 <code>/api/v1/</code> 路由均需身份验证。请发送你的 Presenton 管理员用户名和密码(与 Web UI 相同,或在 Docker 预置时使用 <strong>AUTH_USERNAME</strong> / <strong>AUTH_PASSWORD</strong>)。使用 <code>curl</code> 时,在 <code>-u</code> 之后直接写 <code>-u USERNAME:PASSWORD</code> — 即 HTTP Basic 身份验证,会自动设置 <code>Authorization: Basic …</code>。请将下方示例中的 <code>username:password</code> 替换为你的真实凭据。
|
||
</p>
|
||
|
||
**请求体**
|
||
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>参数</th>
|
||
<th>类型</th>
|
||
<th>必填</th>
|
||
<th>说明</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
|
||
<tr>
|
||
<td><code>content</code></td>
|
||
<td>string</td>
|
||
<td>是</td>
|
||
<td>用于生成演示文稿的主要内容。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>slides_markdown</code></td>
|
||
<td>string[] | null</td>
|
||
<td>否</td>
|
||
<td>提供自定义幻灯片 Markdown,而非自动生成。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>instructions</code></td>
|
||
<td>string | null</td>
|
||
<td>否</td>
|
||
<td>额外的生成说明。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>tone</code></td>
|
||
<td>string</td>
|
||
<td>否</td>
|
||
<td>
|
||
文本语气(默认:<code>"default"</code>)。
|
||
可选值:<code>default</code>、<code>casual</code>、<code>professional</code>、
|
||
<code>funny</code>、<code>educational</code>、<code>sales_pitch</code>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>verbosity</code></td>
|
||
<td>string</td>
|
||
<td>否</td>
|
||
<td>
|
||
内容密度(默认:<code>"standard"</code>)。
|
||
可选值:<code>concise</code>、<code>standard</code>、<code>text-heavy</code>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>web_search</code></td>
|
||
<td>boolean</td>
|
||
<td>否</td>
|
||
<td>启用网络搜索 grounding(默认:<code>false</code>)。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>n_slides</code></td>
|
||
<td>integer</td>
|
||
<td>否</td>
|
||
<td>要生成的幻灯片数量(默认:<code>8</code>)。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>language</code></td>
|
||
<td>string</td>
|
||
<td>否</td>
|
||
<td>演示文稿语言(默认:<code>"English"</code>)。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>template</code></td>
|
||
<td>string</td>
|
||
<td>否</td>
|
||
<td>模板名称(默认:<code>"general"</code>)。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>include_table_of_contents</code></td>
|
||
<td>boolean</td>
|
||
<td>否</td>
|
||
<td>包含目录页(默认:<code>false</code>)。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>include_title_slide</code></td>
|
||
<td>boolean</td>
|
||
<td>否</td>
|
||
<td>包含标题页(默认:<code>true</code>)。</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>files</code></td>
|
||
<td>string[] | null</td>
|
||
<td>否</td>
|
||
<td>
|
||
生成时使用的文件。
|
||
请先通过 <code>/api/v1/ppt/files/upload</code> 上传。
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><code>export_as</code></td>
|
||
<td>string</td>
|
||
<td>否</td>
|
||
<td>
|
||
导出格式(默认:<code>"pptx"</code>)。
|
||
可选值:<code>pptx</code>、<code>pdf</code>
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
</table>
|
||
|
||
**响应**
|
||
|
||
<pre><code class="language-json">{
|
||
"presentation_id": "string",
|
||
"path": "string",
|
||
"edit_path": "string"
|
||
}</code></pre>
|
||
|
||
**示例(curl + 使用 <code>-u</code> 的 HTTP Basic 身份验证)**
|
||
|
||
<pre><code class="language-bash">curl -u username:password \
|
||
-X POST http://localhost:5001/api/v1/ppt/presentation/generate \
|
||
-H "Content-Type: application/json" \
|
||
-d '{
|
||
"content": "Introduction to Machine Learning",
|
||
"n_slides": 5,
|
||
"language": "English",
|
||
"template": "general",
|
||
"export_as": "pptx"
|
||
}'</code></pre>
|
||
|
||
**示例响应**
|
||
|
||
<pre><code class="language-json">{
|
||
"presentation_id": "d3000f96-096c-4768-b67b-e99aed029b57",
|
||
"path": "/app_data/d3000f96-096c-4768-b67b-e99aed029b57/Introduction_to_Machine_Learning.pptx",
|
||
"edit_path": "/presentation?id=d3000f96-096c-4768-b67b-e99aed029b57"
|
||
}</code></pre>
|
||
|
||
<blockquote>
|
||
<strong>注意:</strong>
|
||
在 <code>path</code> 和 <code>edit_path</code> 前加上服务器根 URL,即可构成有效链接。
|
||
</blockquote>
|
||
|
||
**文档与教程**
|
||
|
||
<ul>
|
||
<li>
|
||
<a href="https://docs.presenton.ai/v3/get-started/quickstart">
|
||
部署 Presenton
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.presenton.ai/v3/get-started/api-introduction">
|
||
完整 API 文档
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.presenton.ai/v3/guide/using-presenton-api">
|
||
5 分钟通过 API 生成演示文稿
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.presenton.ai/tutorial/generate-presentation-from-csv">
|
||
使用 AI 从 CSV 创建演示文稿
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.presenton.ai/tutorial/create-data-reports-using-ai">
|
||
使用 AI 创建数据报告
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
|
||
#
|
||
|
||
### 🚀 路线图
|
||
|
||
在 GitHub Projects 上跟踪公开路线图:[https://github.com/orgs/presenton/projects/2](https://github.com/orgs/presenton/projects/2)
|