Skip to content

An Alfred workflow that supports full-text search and metadata filtering on ChatGPT chat history, conversation preview, and opening them on ChatGPT and TypingMind

Notifications You must be signed in to change notification settings

tddschn/chatgpt-alfred-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT Alfred Workflow

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.

Demo

chatgpt-alfred-workflow-demo.mov.mp4

Setting Up

Prerequisites: Install Alfred app and buy the PowerPack.

  1. Clone this repository, edit Makefile's first target (update-workflow) so that the rsync 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
  1. 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

  2. Import the chat history to Alfred workflow by running make regen-and-update-all in the repo directory, or use the type in cgupdate 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.

Usage

Use the hotkey Cmd-Control-N or the keyword cg to see a the full list of conversations, and start typing to search.

Chat history full text search

Metadata filtering

Filtering with metadata (model, model slug, creation time etc) is also supported:

Preview of conversations & Opening on ChatGPT / TypingMind

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.

Searchable Fields

  {
    "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"
    ]
  }

How it works

  • 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. The convert_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 file linear_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 the conversations.json file from it to the workflow directory:
    handled by update_conversations_json.py.
  • generate_preview_files.py generates a Markdown file for each of your conversations from linear_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).

About

An Alfred workflow that supports full-text search and metadata filtering on ChatGPT chat history, conversation preview, and opening them on ChatGPT and TypingMind

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published