本地优先的 AI 对话导出浏览器扩展
A local-first browser extension for exporting AI conversations
把 ChatGPT 等 AI 网站中的聊天记录导出为 Markdown、PDF、DOCX 和 ZIP,全部在浏览器本地完成。
Export conversations from ChatGPT and other AI websites to Markdown, PDF, DOCX, and ZIP, fully inside the browser.
AI Chat Exporter 是一个面向知识归档、内容复用和本地备份场景的开源浏览器扩展。
它的目标很直接:不把聊天内容再同步到第三方服务,而是在本地浏览器里完成提取、转换、生成和下载。如果你经常需要把 AI 对话保存为可沉淀、可检索、可再次编辑的文件,这个项目就是为这个场景设计的。
| 能力 | 说明 |
|---|---|
| 🛡️ 本地优先 | 不依赖自建后端,聊天内容默认不上传到项目服务器,所有操作在浏览器本地完成 |
| 📄 多格式导出 | 支持 Markdown、PDF(内嵌 CJK 中文字体)、DOCX(含样式定义)、ZIP(批量打包) |
| 📦 批量归档 | 支持扫描会话列表并打包批量导出为 ZIP 归档 |
| 📝 任务留痕 | 基于 IndexedDB 保存任务记录与导出历史,随时回溯 |
| 🔐 按需授权 | 站点权限、标签页权限按需申请,避免安装时过度索权 |
| 🧩 架构清晰 | Manifest V3 + Adapter + Exporter 分层,方便继续扩展更多站点 |
| 站点 | 能力 |
|---|---|
| ChatGPT | 当前会话导出、侧边栏会话扫描、批量导出、历史记录 |
以下站点使用通用 DOM 适配器,可提取基础对话内容,精度不如专用适配器。
| 站点 | 状态 |
|---|---|
| Claude | |
| Gemini | |
| Kimi | |
| DeepSeek | |
| Grok | |
| 豆包 | |
| 千问 | |
| 文心一言 |
- 想把高价值 AI 对话沉淀成 Markdown 知识库
- 想把聊天记录导出成 PDF / DOCX 用于汇报、归档或共享
- 想定期批量备份 ChatGPT 会话,避免内容散落在网页里
- 想基于本地文件继续做二次整理、翻译、笔记、RAG 或全文检索
- 从仓库构建扩展(参考下方「安装部署」)
- 打开
chrome://extensions/,开启开发者模式 - 加载
dist/目录
- 打开 chatgpt.com 或其他支持的 AI 网站
- 进入一个对话页面,确保对话内容已加载
- 点击浏览器工具栏中的 AI Chat Exporter 图标
- 在弹出的 Popup 中选择导出格式(Markdown / PDF / DOCX / ZIP)
- 点击「导出」按钮,文件将自动下载到浏览器默认下载目录
- 点击扩展图标中的「Dashboard」按钮
- 在 Dashboard 页面查看导出历史、任务状态、批量导出结果
- Node.js 20+
- npm 10+
npm installnpm testnpm run build- 打开
chrome://extensions/ - 开启开发者模式
- 点击"加载已解压的扩展程序"
- 选择仓库构建后的
dist目录
- 打开
about:debugging - 进入
This Firefox - 点击
Load Temporary Add-on - 选择
dist/manifest.json
Q: 为什么导出内容是空的? A: 请确认你正在一个 AI 对话页面,且对话内容已完全加载。可以尝试滚动页面到底部,等待内容渲染完成后再次导出。
Q: 为什么 PDF 中文字体显示异常?
A: 扩展默认使用 Noto Sans SC(思源黑体)作为中文字体。如果字体加载失败,可能会回退到 Helvetica。请确保 assets/fonts/ 目录中的字体文件存在。
Q: 为什么某些 AI 平台的导出效果不好? A: 目前只有 ChatGPT 有专用适配器,其他站点使用的是通用 DOM 适配器。通用适配器的精度不如专用适配器,我们正在为更多站点开发专用适配器。
Q: 数据安全吗?聊天内容会被上传吗? A: 完全安全。所有数据处理都在浏览器本地完成,不会上传任何聊天内容到项目服务器或第三方服务。
Q: 导出后文件下载到哪里? A: 文件会下载到浏览器的默认下载目录,你可以在浏览器设置中查看或修改默认下载位置。
| 项目 | 说明 |
|---|---|
storage |
保存语言、任务状态、导出历史 |
downloads |
下载导出的文件 |
scripting |
按需注入内容脚本 |
activeTab |
读取当前用户操作页面 |
tabs |
批量导出时用于稳定打开和处理多个会话 |
| Host Permissions | 仅在用户触发对应站点操作时按需申请 |
隐私原则:
- 不上传聊天内容到项目后端
- 默认不采集遥测
- 文件在浏览器本地生成并下载
- 权限按需申请,而不是安装时一次性索取全部站点访问能力
aichat_export_tools/
├── src/
│ ├── adapters/ # 站点适配器(ChatGPT/千问/通用 DOM)
│ ├── background/ # Service Worker、权限、下载、消息编排
│ ├── content/ # 页面桥接、DOM 观察、内容提取入口
│ ├── exporters/ # Markdown / PDF / DOCX / ZIP 导出器
│ ├── storage/ # IndexedDB / Dexie 持久化
│ ├── ui/ # Popup / Dashboard / Options 页面
│ └── core/ # 核心类型、能力声明、任务与文件名规则
├── docs/ # 架构、权限、适配器、路线图、PRD
├── public/ # Logo、图标等静态资源
└── tests/ # 单元测试
- Manifest V3 扩展基础骨架
- Popup / Dashboard / Options 页面
- ChatGPT 当前会话导出
- ChatGPT 侧边栏会话扫描
- Markdown / PDF / DOCX / ZIP 导出
- 批量导出归档
- 导出历史与任务记录
- 基础测试与文档骨架
- 继续补齐更多站点专用适配器(Claude、Gemini、Kimi 等)
- 支持 workspace-aware 扫描和导出
- 增加导出默认项和文件名模板设置
- 优化重试、预览和失败反馈流程
- 增加 Firefox 打包与发布辅助能力
- 扩大测试覆盖范围
欢迎提交 Issue 和 Pull Request,一起把这个项目补成真正可用的多站点 AI 对话导出工具。
提交代码前建议至少执行:
npm test
npm run buildAI Chat Exporter is an open-source browser extension built for local backup, knowledge archiving, and content reuse.
Its goal is straightforward: extract, transform, generate, and download AI conversations locally in the browser instead of syncing them to a third-party service. If you want AI chats saved as durable, searchable, and editable files, this project is built for that workflow.
| Capability | Description |
|---|---|
| 🛡️ Local-first | No custom backend required. Chat content stays in your browser — never uploaded to any server |
| 📄 Multiple export formats | Supports Markdown, PDF (embedded CJK fonts), DOCX (with style definitions), and ZIP (batch archiving) |
| 📦 Batch archiving | Scan conversation lists and export them as one ZIP archive |
| 📝 Export history | Job records and export history are stored in IndexedDB |
| 🔐 On-demand permissions | Site and tab permissions are requested only when needed |
| 🧩 Extensible architecture | Manifest V3 + Adapter + Exporter layering makes more sites easy to add |
| Site | Capabilities |
|---|---|
| ChatGPT | Current conversation export, sidebar scanning, batch export, export history |
The following sites use the generic DOM adapter. Basic conversation extraction works, but dedicated adapters provide better accuracy.
| Site | Status |
|---|---|
| Claude | |
| Gemini | |
| Kimi | |
| DeepSeek | |
| Grok | |
| Doubao | |
| Qianwen | |
| Yiyan |
- Building a Markdown-based knowledge base from valuable AI chats
- Exporting conversations as PDF or DOCX for reports, archives, or sharing
- Periodically backing up ChatGPT conversations in batches
- Reusing local files for translation, note-taking, RAG, or full-text search
- Build the extension from source (see "Installation" below)
- Open
chrome://extensions/, enable Developer mode - Load the
dist/directory
- Open chatgpt.com or any supported AI website
- Enter a conversation page and wait for content to fully load
- Click the AI Chat Exporter icon in your browser toolbar
- Select export format (Markdown / PDF / DOCX / ZIP)
- Click "Export" — the file downloads to your browser's default download folder
- Click the "Dashboard" button in the extension popup
- View export history, job status, and batch export results
- Node.js 20+
- npm 10+
npm installnpm testnpm run build- Open
chrome://extensions/ - Enable Developer mode
- Click
Load unpacked - Select the built
distdirectory
- Open
about:debugging - Go to
This Firefox - Click
Load Temporary Add-on - Select
dist/manifest.json
Q: Why is the exported content empty? A: Make sure you're on an AI conversation page and the content has fully loaded. Try scrolling to the bottom of the page, waiting for content to render, then try exporting again.
Q: Why is Chinese text rendering incorrectly in PDF?
A: The extension uses Noto Sans SC (思源黑体) as the default CJK font. If the font fails to load, it falls back to Helvetica. Make sure the font files in assets/fonts/ are present.
Q: Why is the export quality poor for some AI platforms? A: Only ChatGPT has a dedicated adapter. Other sites use the generic DOM adapter, which has lower accuracy. We're building dedicated adapters for more sites.
Q: Is my data safe? Will chat content be uploaded? A: Absolutely not. All processing happens locally in your browser. No chat content is uploaded to any server.
Q: Where do exported files download? A: Files download to your browser's default download folder. You can check or change the download location in your browser settings.
| Item | Description |
|---|---|
storage |
Stores language, job state, and export history |
downloads |
Downloads exported files |
scripting |
Injects content scripts on demand |
activeTab |
Reads the active user-selected tab |
tabs |
Used by batch export to open and process conversations reliably |
| Host Permissions | Requested only when the user triggers work on a supported site |
Privacy principles:
- No chat content is uploaded to a project backend
- No telemetry is collected by default
- Files are generated and downloaded locally in the browser
- Permissions are requested on demand instead of at install time
aichat_export_tools/
├── src/
│ ├── adapters/ # Site adapters (ChatGPT/Qianwen/Generic DOM)
│ ├── background/ # Service worker, permissions, downloads, runtime orchestration
│ ├── content/ # Page bridge, DOM observers, extraction entry points
│ ├── exporters/ # Markdown / PDF / DOCX / ZIP exporters
│ ├── storage/ # IndexedDB / Dexie persistence
│ ├── ui/ # Popup / Dashboard / Options pages
│ └── core/ # Shared types, capability definitions, jobs, filename rules
├── docs/ # Architecture, permissions, adapters, roadmap, PRD
├── public/ # Logo and static assets
└── tests/ # Unit tests
- Manifest V3 extension scaffold
- Popup / Dashboard / Options pages
- ChatGPT current conversation export
- ChatGPT sidebar conversation scan
- Markdown / PDF / DOCX / ZIP exporters
- Batch export archiving
- Export history and job persistence
- Base tests and documentation scaffold
- Add dedicated site adapters (Claude, Gemini, Kimi, etc.)
- Support workspace-aware scanning and export flows
- Add export defaults and filename template settings
- Improve retry, preview, and failure feedback flows
- Add Firefox packaging and release helpers
- Expand test coverage
Issues and pull requests are welcome. The long-term goal is to make this a practical multi-site AI conversation exporter.
Before submitting code, at minimum run:
npm test
npm run build