Skip to content

cpbotha/obsidian-ai-chat-as-md

Repository files navigation

Obsidian plugin: AI Chat as Markdown

AI Chat as Markdown lets GPT-4 Omni / Claude 3.5 talk directly into your Obsidian Markdown notes.

It relies on nesting of headings, and thus you can have multiple conversations and even branching conversations in the same note.

Please see the documented branching conversation example to understand how that works.

The plugin supports images, so that you can talk about the images and diagrams that are embedded in your markdown, with models that support this, such os Omni and Claude 3.5.

It can be configured via the Obsidian plugin settings to use any OpenAI-compatible API server.

Demos

Quickstart

  • Install plugin via community plugins (once approved)
  • In Obsidian settings, under AI Chat as Markdown configure API Host (e.g. https://api.openai.com/), API key (sk-xxxxx), model name (e.g. gpt-4o)
  • In your Obsidian note, add example text # My heading\nAre you there?, position cursor inside, then, in edit mode, invoke via command palette AI Chat as Markdown: Send current thread to AI. Answer should appear under new sub-heading titled ## AI.
    • You could also just select some text, and then invoke AI Chat as Markdown: Send selected text to AI and append the response.

Manually installing the plugin

  • Copy over main.js, manifest.json to your vault VaultFolder/.obsidian/plugins/your-plugin-id/.

Inspired by

Dev quickstart

  • Clone this repo.
  • Make sure your NodeJS is at least v16 (node --version).
  • corepack enable
  • yarn to install dependencies (we use Yarn PnP)
  • yarn run dev to start compilation in watch mode.

Dev Tasks

  • Send embedded images to the model
  • settings for default model, key, etc.
  • setup yarn PnP style packages
  • Add README section explaining the nesting to conversation algorithm
  • Make debug mode configurable, then feature-flag logging behind that

Maybe

  • enable per-document / yaml-header overrides of model, system prompt, etc.
  • ignore %...% comment blocks
  • Add used model as comment block (or some other mechanism) to each AI response section

Dev publish new version

See Create a new release