Created
April 2, 2023 02:16
-
-
Save tubaman/794441bcd7d65da2e1d5d134c477bb32 to your computer and use it in GitHub Desktop.
Print out all the chatgpt responses in a conversation Use the devtools in your browser to download the json file from: https://chat.openai.com/backend-api/conversation/nnnnnnnnnnnnnn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Print out all the chatgpt responses in a conversation | |
Use the devtools in your browser to download the json file from: | |
https://chat.openai.com/backend-api/conversation/nnnnnnnnnnnnnn | |
""" | |
import sys | |
import json | |
conversation_json_file_path = sys.argv[1] | |
conversation = json.load(open(conversation_json_file_path)) | |
for mapping_id, mapping_data in conversation['mapping'].items(): | |
try: | |
message = mapping_data['message'] | |
except KeyError: | |
continue | |
if message['author']['role'] != 'assistant': | |
continue | |
content = message['content'] | |
assert content['content_type'] == 'text' | |
for part in content['parts']: | |
print(part) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment