ChatGPT Save Conversation

Save the conversation as a .txt file

As of 2025-06-02. See the latest version.

Author
人民的勤务员
Ratings
0 0 0
Version
2025.6.2.1
Created
2025-05-29
Updated
2025-06-02
Size
26.8 KB
Compatibility
Compatible with Firefox Compatible with Chrome Compatible with Opera Compatible with Safari Compatible with Edge
License
MIT
Applies to

简体中文 | English | 한국어 | Tiếng Việt | 繁體中文
👆️access GitHub Readme file on for a better experience。

Recommended use:
Support
Support
Support
💡 Tip: The script manager and browser listed above do not represent all
The script runs normally in the following environment
Passed

ChatGPT Save conversation

「 Save the conversation as a .txt file 」

Views

Download:Github | ⭐Greasy Fork

Introduction to the chat content save button script

Automatically add a fixed position“Save the conversation”Button,After clicking the button, the chat conversation content in the current page will be extracted and saved as a plain text file.,Convenient to users export and backup chat history。


Main functions

  • Extract chat messages
    From all included in the page data-message-id Elements of attributes extract conversation content,And according to data-message-author-role Attribute judgment role(User / Assistant wait)。

  • Format text
    according to Character name: Line break,Write the corresponding text content,每条消息之间用Separation符 --- 分隔。

  • Generate file name
    Priority to using web titles40characters as file name,If there is no title, start with the dialogue5Lowercase splicing of words as file names,The default file name is conversation.txt

  • Download text file
    use Blob Object creation download link,Simulate click to download the conversation content text file。

  • Interface interaction
    A small button is displayed in the upper left corner of the page,Click to save the current conversation。


Code structure description

  • capitalizeRole(role):Format the initial letter of the role based on the role string。
  • generateFileName(messages):Generate file name based on page title or first message。
  • saveConversation():Core Functions,Collect message content、format、Generate file and trigger download。
  • createDownloadButton():Create and add a fixed one“Save the conversation”Button to page。
  • waitForBody Timer:Wait for the page body and chat messages to complete the loading of buttons。

How to use

  1. Add this script to the browser user script manager(like Tampermonkey)。
  2. Open a web page with chat conversations(Support with data-message-id and data-message-author-role The structure of attributes)。
  3. The upper left corner of the page appears“Save the conversation”Button,After clicking, you can export the current chat content as .txt document。

Applicable scenarios

  • Export and backup web chat history。
  • View conversation content offline。
  • Convenient to share or archive chat text。

Things to note

  • Depend on page structure,Require message node to have data-message-id and data-message-author-role property。
  • Extract only with .whitespace-pre-wrap or .markdown Text content of class。
  • Simple and fixed button style,The location can be customized as needed。

This script is suitable for users who need to quickly save web chat history。

💖 The script referenced or used the following script:

🧑‍💻 @Taylor-eOS ⇒ 📜 Save Conversation

Help

Recommended browser and script manager:

  • Greasemonkey + Waterfox
  • Tampermonkey/Violentmonkey + Firefox
  • Tampermonkey/Violentmonkey + Chrome
  • Userscripts + ios Safari
  • Violentmonkey/KiWiBrowser + Android

If you need to learn more about how to install user scripts,Click meView the teaching of pictures and texts!

View all publish scripts