Skip to main content

Export conversations from multiple AI platforms (ChatGPT, DeepSeek, Claude) to Markdown

Project description

AI Conversation Exporter

导出多个 AI 平台(ChatGPT、DeepSeek、Claude、以及通用 JSON/JSONL)的对话为整洁的 Markdown 文件。

特性

  • ✅ 自动识别多种导出格式(包含 ChatGPT conversations.json 直读)
  • ✅ 支持 Zip(ChatGPT 官方导出)、JSON、JSONL
  • ✅ YAML frontmatter 元信息(标题、平台、导出时间、消息数)
  • ✅ 规范的角色映射(user/assistant/system/tool)
  • ✅ 命令行工具 ai-export,简单易用

安装

本项目尚未发布到 PyPI。请在源码目录内安装:

pip install ai-export

安装后将获得命令:

ai-export --help

使用示例

# 1) ChatGPT 官方导出 zip(包含 conversations.json)
ai-export chatgpt_export.zip

# 2) 直接解析 ChatGPT 的 conversations.json(无需 zip)
ai-export conversations.json

# 3) DeepSeek 导出(数组 JSON / API JSON / JSONL)
ai-export deepseek_export.json
ai-export deepseek_export.jsonl

# 4) Claude 导出 JSON
ai-export claude_chat.json

# 指定输出目录
ai-export conversations.json -o ./ai_output

支持的输入格式

  • ChatGPT

    • .zip(官方导出包,自动在包内查找 conversations.json
    • conversations.json(直接解析)
    • 消息结构同时兼容:
      • 经典结构:message.content.parts[] + message.author.role
      • 变体结构:message.fragments[]REQUEST → user,RESPONSE → assistant)
  • DeepSeek

    • 数组 JSON(含 conversation_id / messages
    • API JSON(顶层 messages
    • JSONL(每行一条 {"role","content"}
  • Claude

    • JSON(顶层 conversationmessages
  • 通用 JSON/JSONL(Unknown)

    • 自动兜底识别常见字段(mapping/messages/conversation),最大化导出成功率

输出格式

  • 每个会话导出为单独的 Markdown 文件,命名:YYYYMMDD_HHMMSS_标题.md
  • 文件内容包含:
    • YAML frontmatter(titleplatformexport_datemessage_count
    • 标题与概要信息
    • 顺序排列的消息区块(按可用的时间戳排序)

常见问题

  • 看到“无法识别格式,使用通用解析器”或“检测到 Unknown 格式”?

    • 表示当前输入未匹配 ChatGPT/DeepSeek/Claude 的特定解析器,将由通用解析器尝试解析。
    • 若导出为空,请提供文件前后数条数据样例(可打码隐私),以便完善兼容。
  • Windows 中文/空格路径

    • 已使用 UTF-8 打开文件与写入;如使用 PowerShell/终端,请确保当前路径与权限正确。

许可协议

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_conversation_exporter-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_conversation_exporter-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file ai_conversation_exporter-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ai_conversation_exporter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 90e0f14c572459c928143befd62db356d354aefd57c9d7e1a1280b1820dd178c
MD5 d107c970cb5def435ef035c2ed7f3217
BLAKE2b-256 1a919b10e53a869a3846bd5b72e7cea32db599c4be1b63492311d304b29bf7e1

See more details on using hashes here.

File details

Details for the file ai_conversation_exporter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_conversation_exporter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07e13e6eb3f2a41bae24feec274d4fa41da9dba28582c2f86aa87b9a0dff7999
MD5 3c1fb6908e47f25c7b35e26910e41f73
BLAKE2b-256 fd408b6eebbf570e2d0340fca39fb5d6a3093f19f426a6c1e693cfaa6a9f9577

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page