taichimaeda / markpilot

AI-powered inline completions and chat view for Obsidian
MIT License
5 stars 1 forks source link

🤖 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 aims to provide a similar experience to GitHub Copilot in Obsidian.

Currently the plugin supports models provided by OpenAI API, OpenRouter API and local models by Ollama. We are planning to support more providers in the future, such as Gemini Pro API.

There are plugins that provide similar features, such as Obsidian Companion and Obsidian Copilot Autocompletion 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:

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.

Markpilot's chat view UI is heavily inspired by GitHub Copilot for VSCode, and the CodeMirror extension by codemirror-copilot. Also I took inspirations from Obsidian Copilot Autocompletion to implement the few-shot prompts feature.

Demo

Inline Completions

Inline Completions Demo

Chat View

Chat View Demo

Getting Started

Markpilot currently supports OpenAI API, OpenRouter API and Ollama as providers for inline completions and chat view.

Using OpenAI API

First, you need to obtain the API key from OpenAI API.

  1. Install the plugin from the Obsidian community plugins.
  2. Navigate to the plugin settings:
    1. Under Providers > OpenAI API Key, enter your OpenAI API key.
    2. Under Inline completions > Provider, select OpenAI.
    3. Under Inline completions > Model, select the model you want to use (Recommended: gpt-3.5-turbo).
    4. Repeat the same steps for the chat view settings under Chat view.
  3. You're all set! Enjoy using Markpilot.

Using OpenRouter API

First, you need to obtain the API key from OpenRouter API.

  1. Install the plugin from the Obsidian community plugins.
  2. Navigate to the plugin settings:
    1. Under Providers > OpenRouter API Key, enter your OpenRouter API key.
    2. Under Inline completions > Provider, select OpenRouter.
    3. Under Inline completions > Model, select the model you want to use (Recommended: gpt-3.5-turbo).
    4. Repeat the same steps for the chat view settings under Chat view.
  3. You're all set! Enjoy using Markpilot.

Using Ollama (MacOS, Linux, Windows - Preview)

First, download Ollama and follow the instructions to install it.

Now you need to pull the local model of your choice from Ollama (Recommended: llama2).

$ ollama pull --model llama2

This will take some time. Once the model is downloaded, you can start the Ollama server:

$ ollama serve

If you are on MacOS, the server should start automatically when you login. If you are on Linux, you may need to configure the startup service manually: Ollama on Linux

Now you can install Markpilot and set it up to use Ollama:

  1. Install the plugin from the Obsidian community plugins.
  2. Navigate to the plugin settings:
    1. Under Providers, click Test Ollama Connection and see if the Ollama server is running correctly.
    2. Under Inline completions > Provider, select Ollama.
    3. Under Inline completions > Model, select the model you want to use (Recommended: llama2).
      • Make sure to only select the same model you pulled from Ollama.
    4. Repeat the same steps for the chat view settings under Chat view.
  3. You're all set! Enjoy using Markpilot.

Caveats

If you use the OpenAI API or OpenRouter API, this plugin will send 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

Frequently Asked Questions

I can't accept completions by hitting Tab.

Currently some extensions like Obsidian Outliner use the Tab key for their own purposes, which will conflict with Markpilot's completions.

Although I could not find documentation on this, it seems like the keybindings are loaded in the order of when the plugins got enabled, so you can try disabling the conflicting plugin and enabling it again to prioritise Markpilot's keybindings.