Alfred Workflow that imports ChatGPT exported conversations.json
file
and provides a List Filter
that let you do full-text search and metadata filtering on your chat history,
supports previewing conversations (by using QuickLook on Markdown files generated from conversations)
and opening them on ChatGPT or TypingMind.
chatgpt-alfred-workflow-demo.mov.mp4
Prerequisites: Install Alfred app and buy the PowerPack.
- Clone this repository, edit
Makefile
's first target (update-workflow
) so that thersync
command syncs from the repo to your Alfred workflow directory.
git clone https://github.com/tddschn/chatgpt-alfred-workflow.git
cd chatgpt-alfred-workflow
# edit Makefile
# This workflow requires Python>=3.10
python3 -m pip install -r requirements.txt
# generate_preview_files.py requires tqdm
-
Export ChatGPT chat history, make sure the downloaded zip file is saved to
~/Downloads
for automatic imports and processing.
See the official guide: https://help.openai.com/en/articles/7260999-how-do-i-export-my-chatgpt-history-and-data -
Import the chat history to Alfred workflow by running
make regen-and-update-all
in the repo directory, or use the type incgupdate
in Alfred and press Enter, as shown in below.
Please note that the path to the this repo in the cgupdate
script is hardcoded, so if you've cloned this repo to a different directory, you'll need to edit the script in Alfred Preferences.
You can also modify the hotkeys and keywords to your liking in Alfred Preferences.
Use the hotkey Cmd-Control-N or the keyword cg
to see a the full list of conversations, and start typing to search.
Filtering with metadata (model, model slug, creation time etc) is also supported:
Press Enter or click on the selected entry to open the conversation on ChatGPT,
press Command-Enter to open it on TypingMind (you'll need to import the conversations.json
first on https://TypingMind.com),
press Shift to preview the conversation in Alfred.
{
"id": "9b0891b4-19be-4275-9a34-44b9fec72f5b",
"title": "ChatGPT Alfred Workflow Demo",
"update_time": "2023-05-30T18:15:50",
"create_time": "2023-05-30T18:15:32",
"model_slug": "text-davinci-002-render-sha",
"plugin_enabled": false,
"linear_messages": [
"say 'hi' and nothing more",
"hi",
"say it again",
"hi"
]
}
- Making conversations linear
A conversation can have branches / forks if you've used the Edit feature in ChatGPT,
and from the exported JSON, you can see that a parent message contains a list of child messages. Theconvert_chatgpt_conversations_json.py
script converts the exported json by extracting the last edited messages in the forks, i.e. the messages displayed in the ChatGPT UI, and outputs them to a new json filelinear_conversations.json
. - Automatic discovery of exported ChatGPT
.zip
file (via filename regex matching and selecting the last-created one that matches) in~/Downloads
,
and extracting theconversations.json
file from it to the workflow directory:
handled byupdate_conversations_json.py
. generate_preview_files.py
generates a Markdown file for each of your conversations fromlinear_conversations.json
and saves them to./generated
, so that you can press Shift to preview the conversation in Alfred.- This function make sure that the Alfred List Filter subtitles generated contains the user query in the middle (example).