Typing Mind Extensions (RFC)


Typing Mind Extensions allows users to embed custom JavaScript code to Typing Mind. The JavaScript code will have access to all internal data and application state of Typing Mind, which will allow the users to do add custom logic and application behavior to fit their workflow.

How it works

In general, Typing Mind Extensions works like a typical browser extension. The only different is that you can install the extensions on the macOS app and mobile apps (PWA).
The user β€œinstall” the extension by providing a script URL (JavaScript), then Typing Mind will load and execute it when the app is loaded.
This is similar to the β€œCustom Code” feature in Typing Mind Custom.
The user install a new extension by go to Settings β†’ Extensions β†’ Install New Extension, then enter the URL to the JS file. The URL must be hosted at a publicly accessible endpoint.
  • Extensions are installed locally on the user’s browser.
  • Extensions are not synced across multiple devices.

Typing Mind SDK

Within the extension code, the JavaScript code can access Typing Mind internal application state by using the following methods.
// All methods below returns a promise. TypingMindSDK.getAllChats() // return all chats on the current device TypingMindSDK.getChatByID(chatID) // return one specific chat TypingMindSDK.setChatByID(chatID, data) // replace the current chat with the provided chat data TypingMindSDK.setAllChats(chats) // replace all current chats on the device with the provided chats TypingMindSDK.getAllData() // return all data, include chats, prompts, AI characters, preferences, etc., similar to the data structure you'll get from the Export feature.
Alternatively, the script can access the Local Storage and IndexedDB directly to get the data. However, this method may cause internal data corrupt and is not recommended unless you are an experienced developer and you know what you’re doing.

Use cases

The first use case for Typing Mind Extensions is to allow the users to add additional backup & sync sources. This is done by using the extension to read Typing Mind’s data, then upload/download the data to the user’s private server without using the default cloud storage at cloud.typingmind.com.
Other use cases:
  • Embed a widget to Typing Mind (e.g., live chat widget)
  • Adding custom keyboard shortcuts
  • Customize message rendering

Powered by Notaku