No description
Find a file
2024-04-12 15:17:39 +09:00
.github Fix pipeline typo 2024-04-03 16:09:33 +09:00
src Fixed bug where completions are not fetched when cache is disabled 2024-04-12 15:17:13 +09:00
.eslintrc.json Re-implement API logic using OpenAI API 2024-04-02 16:29:12 +09:00
.gitignore Re-implement API logic using OpenAI API 2024-04-02 16:29:12 +09:00
.prettierrc.json Fix format 2024-04-03 15:35:15 +09:00
esbuild.config.mjs Re-implement API logic using OpenAI API 2024-04-02 16:29:12 +09:00
LICENSE Add missing info to LICENSE 2024-04-04 15:09:28 +09:00
manifest.json Update version 2024-04-12 15:17:39 +09:00
package.json Update version 2024-04-12 15:17:39 +09:00
README.md Fix typos in README.md and settings 2024-04-04 15:55:03 +09:00
styles.css Move css-in-js to styles.css 2024-04-12 00:15:48 +09:00
tsconfig.json Move css-in-js to styles.css 2024-04-12 00:15:48 +09:00
version-bump.mjs Re-implement API logic using OpenAI API 2024-04-02 16:29:12 +09:00
versions.json Update version 2024-04-12 15:17:39 +09:00
yarn.lock Remove redundant dependencies 2024-04-12 15:16:32 +09:00

🤖 Markpilot: AI-powered inline completions and chat view for Obsidian

workflow semver

Markpilot is an Obsidian plugin that offers inline completions features and chat view in the sidebar. It is powered by the OpenAI API and aims to provide a similar experience to GitHub Copilot in Obsidian.

There are well-known plugins that provide similar features, such as Obsidian Companion for AI-powered auto-completions, and Obsidian Copilot for chat UI. However, Markpilot is designed to be a GitHub Copilot-flavored alternative that provides both features in one plugin, with more sophisticated UI/UX, including:

  • Context-aware completions
    • Detects the language of a Markdown code block.
    • Feeds only the content within a code block to generate relevant completions.
  • Better handling of inline completions
    • Force completions before waiting time by hitting Tab twice.
    • Reject completions by hitting Esc key.
  • Fast in-memory caching to save costs.

Markpilot also comes with a bar chart visualization of usage similar to OpenAI API Platform, and the fact that Markpilot offers both features in one plugin makes it a more convenient choice for users who want to manage their API usage in one place.

As mentioned, Markpilot's chat view UI is heavily inspired by GitHub Copilot for VSCode. Also, I took some inspirations from codemirror-copilot for the implementation of the CodeMirror extension used for Markpilot's inline completions.

Demo

Inline Completions

Inline Completions Demo

Chat View

Chat View Demo

Getting Started

Markpilot requires an OpenAI API key to work, which you can obtain from OpenAI API.

  1. Install the plugin from the Obsidian community plugins.
  2. Under the plugin settings, go to Community Plugins > Markpilot > OpenAI > OpenAI API Key and enter your OpenAI API key.
  3. Optionally customize the plugin settings to your preference, and enable caching if you want to save usage costs.
  4. You're all set - enjoy using Markpilot!

Caveats

This plugin sends your content to the OpenAI API to generate completions.

You should be cautious about sending sensitive information to the API, and be aware of the costs associated with using the API. The plugin provides a usage limit feature to help you manage your costs, but it is your responsibility to monitor your usage and costs.

Features

  • Inline completions
    • Context-aware completions as you type.
    • Force completions before waiting time by hitting Tab twice.
    • Reject completions by hitting Esc key.
    • Enable/disable completions from the command palette.
  • Chat view
    • Open chat view from the sidebar.
    • Send message by hitting Enter, add a new line by hitting Shift + Enter.
    • Clear chat history from the command palette.
  • Caching
    • In-memory cache to save costs
    • Completions are lost after reloading the plugin or Obsidian.
  • Usage
    • Set a monthly usage limit to automatically disable features when the limit is reached.
    • Monitor costs in a graph from the settings tab.
    • These costs are estimated based on the number of tokens used for completions.

Customization

You can customize most of the plugin settings from the settings tab.

Some of the settings you will likely want to customize:

  • Model
    • Changing the model to GPT-4 may give you better completions, but this will cost more.
    • You can select any of the models provided by OpenAI's Node API, but some of the less common models may not work as expected or give you incorrect cost estimates.
  • Temperature
    • The higher the temperature, the more creative completions you get.
    • The lower the temperature, the more conservative completions you get.
  • Window size
    • The window size determines the number of characters fed into the model to generate inline completions.
    • The longer the window size, the more context-aware completions you get, but it will take longer to generate completions and result in hitting the cache less often.
  • Wait time
    • The time in milliseconds to wait before sending the content to the model to generate completions.