跳转到主要内容

一款有趣且易于使用的命令行应用程序,可以将GPT聊天会话转换为漂亮的Markdown文件。

项目描述

ChatterMark 💬📝✨

Chattermark是一款CLI工具,可以将GPT聊天会话转换为Markdown格式,使您更容易阅读、分享或存档聊天会话。它解析从GPT聊天会话中提取的JSON数据,并生成整洁且格式良好的Markdown文件。

安装

pip install chattermark

用法

chattermark input.json output.md

输入

您的输入应该是一个包含GPT模型聊天会话的JSON文件。JSON结构应与代码中的GPTChatSession Pydantic模型匹配。

输出

Chattermark将生成一个Markdown文件,以时间顺序和易于阅读的方式表示聊天会话。输出将显示用户和助手的消息,以及时间戳。

示例

假设您在名为input.json的文件中有以下JSON数据

{
    "title": "dev(python/chattermark): convert chat GPT sessions to markdown",
    "create_time": 1681444192.748429,
    "update_time": 1681446704.0,
    "mapping": {
        ...
    }
}

运行Chattermark

chattermark input.json output.md

生成的output.md将如下所示

**2023-04-13 15:30:52 - User:**

Please define a pydantic model for a json representation of a chat GPT session as extracted from a Chrome browser session using the developer tools.

_**2023-04-13 15:31:53 - Assistant:**_

> To create a Pydantic model for a JSON representation of a chat GPT session extracted from a Chrome browser session using the developer tools, you'll first need to identify the data structure and fields in the JSON. ...

---

...

将Markdown转换为其他格式

Chattermark生成Markdown输出,这是一种灵活且广泛支持的格式。但是,您可能希望将Markdown输出转换为其他格式,如Word文档、HTML或PDF。为此,您可以使用名为Pandoc的工具。

  1. 按照官方安装指南安装Pandoc。

  2. 使用Pandoc将Markdown文件转换为所需的格式。例如

    • 将Markdown文件转换为HTML文件

      pandoc output.md -o output.html
      
    • 将Markdown文件转换为Word文档

      pandoc output.md -o output.docx
      
    • 将Markdown文件转换为PDF文件

      pandoc output.md -o output.pdf
      

有关可用的输出格式和选项的更多信息,请参阅Pandoc用户指南

许可协议

ChatterMark遵循MIT许可证发布。

致谢

ChatterMark由一个充满热情的AI和开发人员团队创建,我们相信乐趣和生产力可以相辅相成!我们希望您使用ChatterMark的乐趣与我们创建它的乐趣一样。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

chattermark-0.1.0.tar.gz (3.8 kB 查看哈希值)

上传时间 源代码

构建分发

chattermark-0.1.0-py3-none-any.whl (4.9 kB 查看哈希值)

上传时间 Python 3

由以下机构支持