Giter Site home page Giter Site logo

chatgpt-md's Introduction

ChatGPT-MD

A (nearly) seamless integration of ChatGPT into Obsidian.

Demo

Screen.Recording.2023-03-05.at.9.16.31.PM.mov

(youtube mirror - for mobile users ⬇️)

video thumbnail

Features

  • Chat from any MD note
  • Create Chat Templates for sharing and running similar scenarios. Check out the companion repo chatgpt-md-templates for some templates!
  • As minimal boilerplate as possible, only two required in fact! <hr class="__chatgpt_plugin"> and role::system|assistant|user
  • Use frontmatter to change variables for the ChatGPT API
  • Stream characters to Obsidian, creating a realtime feel
  • Uses regular Markdown. Meaning everything from lists to code blocks from ChatGPT will render!
  • Create chats from highlighted text.
  • Infer title from messages. Can be set to run automatically after >4 messages.
  • Stream at cursor position or at end of file. Can be set in settings.
  • (NEW!) Choose heading level for role h1-h6. Can be set in settings.
  • (NEW!) Custom endpoints can be specified using the url parameter in your front matter. See FAQ for an example.
  • (NEW!) Stop a running stream with a command. See commands section below.

Commands

Chat

The main command! Parses the file and calls ChatGPT. Recommended to add to a hotkey for easy usage.

Create New Chat with Highlighted Text

Take currently highlighted text and default frontmatter and create a new chat file in Chat Folder

Create New Chat From Template

Create a new chat file from a template specified in Chat Template Folder. Remember to check out chatgpt-md-templates for some templates!

Infer Title

Infer the title of the chat from the messages. Requires at least 2 messages. Can be set in settings to run automatically after >4 messages.

Stop Streaming (Does not work on mobile)

Stops the stream. Useful if you want to stop the stream if you don't like where ChatGPT is heading/going too long.

Add Divider

Add a ChatGPT MD Horizontal Rule and role::user.

!! Note: both role::system|assistant|user AND <hr class="__chatgpt_plugin"> are REQUIRED for the plugin to work!!

Installation

Community Plugins

Go to Community Plugins and search ChatGPT MD

Local

  1. Clone this repo into your plugins directory in your vault
  2. Run npm i and npm run build

Both

  1. Insert your OpenAI API Key into the settings
  2. Set Chat Folder and Chat Template Folder
  3. Add a hotkey for Chat (Im using alt-[)

FAQ

Q: The chat seems to be getting cut off halfway through

To address this, first try to increase your max_tokens (default is set to 300). You may also want to update it more permanently in the default frontmatter settings. See pics below:

Screenshot 2023-03-12 16-14-35 Screenshot 2023-03-12 16-15-01

Q: Code Blocks cut off halfway through and leave ```

The Obsidian editor renders backticks in automatically (see issue) and fires extra logic that causes the stream to add extra backticks. To address this, you can:

  1. at the end of the code block add ``` (three backticks) to close the code block BEFORE the <hr> and delete the three extra Obsidian added automatically.
  2. in role::user write "keep going"

See pics below:

Screenshot 2023-03-15 18-47-40 Screenshot 2023-03-15 18-48-30

Q: How do I use GPT-4?

If you are off the waitlist, simply replace model: gpt-3.5-turbo with model: gpt-4 in the frontmatter. (note: gpt-4 is slower than turbo!)

Q: How do I use a custom endpoint?

---
system_commands: ['I create small self contained app ideas that could fit in a CodePen or a Replit']
url: https://localhost
---

The custom API must conform to the OpenAI API spec. eg you could use Azure's OpenAI hosted endpoints here. Refer to your provider for API key handling.

About the Developer

This repository was written by Bram Adams, a writer and programmer based out of NYC.

Bram publishes a Zettelkasten with a twice/weekly newsletter, is a community developer ambassador for OpenAI, and does freeleance contracts (for hire!) related to AI/web dev/AR+VR.

Bram is also the creator of Stenography, an API and VSC Extension that automatically documents code on save. He also is the author of Bramses' Highly Opinionated Vault, an extremely detailed philosophy + vault template used by hundreds of Obsidian users, new and old.

You can learn more about him and his work on his website.

The best way to support his work is to sign up for his newsletter here.

chatgpt-md's People

Contributors

bramses avatar nintorac avatar adamjgrant avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.