{"id":13637010,"url":"https://github.com/briansunter/logseq-plugin-gpt3-openai","last_synced_at":"2025-12-29T23:35:31.897Z","repository":{"id":37257863,"uuid":"498193079","full_name":"briansunter/logseq-plugin-gpt3-openai","owner":"briansunter","description":"A plugin for GPT-3 AI assisted note taking in Logseq","archived":false,"fork":false,"pushed_at":"2024-06-29T01:39:22.000Z","size":53025,"stargazers_count":701,"open_issues_count":61,"forks_count":68,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-02T00:23:21.403Z","etag":null,"topics":["dall-e","gpt-3","gpt-4","gpt3","logseq","logseq-plugin","openai","typescript"],"latest_commit_sha":null,"homepage":"https://twitter.com/bsunter","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/briansunter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-31T05:04:30.000Z","updated_at":"2024-07-29T16:56:05.000Z","dependencies_parsed_at":"2024-04-22T04:02:27.109Z","dependency_job_id":null,"html_url":"https://github.com/briansunter/logseq-plugin-gpt3-openai","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansunter%2Flogseq-plugin-gpt3-openai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansunter%2Flogseq-plugin-gpt3-openai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansunter%2Flogseq-plugin-gpt3-openai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briansunter%2Flogseq-plugin-gpt3-openai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briansunter","download_url":"https://codeload.github.com/briansunter/logseq-plugin-gpt3-openai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223795261,"owners_count":17204136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dall-e","gpt-3","gpt-4","gpt3","logseq","logseq-plugin","openai","typescript"],"created_at":"2024-08-02T00:01:09.239Z","updated_at":"2025-12-29T23:35:31.841Z","avatar_url":"https://github.com/briansunter.png","language":"TypeScript","funding_links":[],"categories":["Plugins and Extensions","Browser-extensions","typescript","插件和扩展","TypeScript","🚀 AI Tools for Vim, Neovim, and Terminal"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"\" rel=\"noopener\"\u003e\n \u003cimg width=400px height=200px src=\"./docs/openai.webp\" alt=\"Project logo\"\u003e\u003c/a\u003e\n \u003cimg width=200px height=200px src=\"./docs/logseq.png\" alt=\"Project logo\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003elogseq-plugin-gpt3-openai\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Status](https://img.shields.io/badge/status-active-success.svg)]()\n[![GitHub Issues](https://img.shields.io/github/issues/briansunter/logseq-plugin-gpt3-openai.svg)](https://github.com/briansunter/logseq-plugin-gpt3-openai)\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/briansunter/logseq-plugin-gpt3-openai.svg)](https://github.com/briansunter/logseq-plugin-gpt3-openai)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\n\n\u003c/div\u003e\n\n---\n\n\u003cp align=\"center\"\u003e A plugin for GPT-3 AI assisted note taking in Logseq. Uses OpenAI's ChatGPT API `gpt-3.5-turbo` model by default.\n    \u003cbr\u003e\n\u003c/p\u003e\n\n## Demo\n\n![logseq gpt3 openai demo](docs/summarize.gif)\n\n [![](docs/follow.png)](https://twitter.com/bsunter) Follow me on Twitter for updates and examples of how I use this plugin: [@bsunter](https://twitter.com/bsunter)\n\n# Usage\n\n##  `gpt`\n\nTo bring up the gpt popup, use the keyboard shortcut `cmd+g`, or select `gpt` from the block or slash menu.\n\nIf you are currently in a block, the plugin will use the text in the block as input to the prompt.\n\nYou can click and drag or shift+click to select multiple blocks to use as input to the prompt.\n\nIf you are not in a block, the plugin won't add any additional input text to your prompt, and will append the results of the prompt to the bottom of the page.\n\nAfter selecting the prompt and generating a response, a preview of the response will be shown in the popup. You can click the `Insert` button or press the enter key to insert the response into the page.\n\nYou can also click the `Replace` button to replace the selected block with the response.\n\nIf you don't like the response, you can click the `Regenerate` button to generate a new response.\n### Custom prompts\nAfter you open the popup, you can write any text you want to use as the prompt.\n\nFor example you can write `create flashcards based on the following text:` and the plugin will generate flashcards for you to study:\n![](docs/custom-prompt.gif)\n### Built-in prompt templates\nThere are a number of built in prompt templates that you can use to generate text. These are useful for generating outlines, summaries, and other tasks.\n![](docs/built-in-prompt-templates.gif)\n\n#### Most important ideas\n![](docs/important-ideas.gif)\n\n#### Common Objections\n![](docs/common-objections.gif)\n#### Ask questions\n![](docs/ask-questions.gif)\n### User prompt templates\nYou can also create your own custom prompt templates.\nTo do this, you create a block with the `prompt-template::` property. The template will be added to the list of templates in the gpt popup.\n\n\nThe `prompt-template::` property is the name of the prompt template.\n\nIn a block nested underneath the template block, create a code block in triple backticks with the language set to `prompt`. The text in the code block will be used as the prompt. Make sure the code block is in its own block indented underneath the template block.\n\nFor example, you can create a template like this:\n\n\u003cpre\u003e\n- # Student Teacher Dialog\n  prompt-template:: Student Teacher Dialog\n\t- ```prompt\n\t    Rewrite text as a dialog between a teacher and a student:\n\t  ```\n\u003c/pre\u003e\n\n#### Student teacher dialog\n![](docs/user-prompt.gif)\n\n#### Australian Accent\n![](docs/australian.gif)\n### Replace\nTo replace the selected block with the generated text, click the `Replace` button.\n\n![](docs/replace.gif)\n### Regenerate\n\nIf you don't like the output of the prompt, you can click the `Regenerate` button to generate a new response. Sometimes the first response is not the best, but the second or third response can be better.\n![](docs/outline2.gif)\n\n## `gpt-block`\n\nType `/gpt-block` in a block or select `gpt-block` from the block menu.\n\n`gpt-block` will send the block to OpenAI's GPT-3 API and append the response underneath the block.\n\n![logseq gpt-block](docs/gpt-block.gif)\n#### Ask questions\n\n![](docs/demo.gif)\n### `gpt-page`\n\nType `/gpt-page` in a block or select `gpt-page` from the block menu.\n\n`gpt-page` will send the entire page to OpenAI's GPT-3 API and append the response to the bottom of the page.\n\n![logseq gpt-page](docs/gpt-page.gif)\n\n#### Whisper speech to text transcription\n\nTranscribe audio files to text using the Whisper API.\n\nType `/whisper` in a block or select `whisper` from the block menu.\n\nSupported formats are:\n```m4a, mp3, mp4, mpeg, mpga, wav, webm```\n\nNote, that the Logseq mobile app audio recorder uses `.aac` which is not supported by Whisper. I recommend using a separate audio recorder app to record audio files and then uploading them to Logseq. For example, I use the Voice Memos app on iOS and share that file to the Logseq mobile app.\n\n### `dalle`\n\nGenerate images with DALL-E\n\nType `/dalle` in a block or select `dalle` from the block menu.\n\nThis will generate an image using the DALL-E model, save the image to the `assets` folder, and insert the image into the block.\n\n![logseq dalle](docs/dalle.gif)\n\n#### Select Multiple Blocks\nYou can click and drag or shift+click to select multiple blocks to use as input to the prompt.\n\n![multi select](docs/multi-select.gif)\n### ChatGPT Guidance\nYou can adjust the `chatPrompt` setting to adjust how ChatGPT should respond to your input. By default, the setting is set to `Do not refer to yourself in your answers. Do not say as an AI language model...` to prevent the model from including unnecessary text in the response.\n\nYou can add guidance such as \"respond in chinese\" or \"respond in spanish\" to the prompt to get the model to respond in a different language.\n\nThis setting is only used when the model is set to `gpt-3.5-turbo`.\n\nFor people who uses reverse-proxy server to use OpenAI service ,you can set the `chatCompletionEndpoint` to your reverse-proxy endpoint , the default configuration for this is `http://api.openai.com/v1`.\n\n**WARNING: To use those reverse-proxy endpoints , you should always keep your data and privacy safe !!!**\n### Inject Prefix\n\nAllows you to inject a prefix into the GPT-3 output before it is inserted into the block, such as a [[gpt3]] tag or markdown formatting like `\u003e` for a blockquote. This is useful for identifying blocks that were generated by GPT-3.\nUse the `Inject Prefix` options in the setting to set the prefix. You can add a space or `\\n` newline to separate the prefix from the generated text.\n\n#### Inject Tag\n\n![inject tag](docs/inject-tag.gif)\n\n#### Inject Markdown Blockquote\n\n![inject tag](docs/inject-quote.gif)\n\n\n\n### OpenAI Examples\n\n[See here for example usages](https://beta.openai.com/examples).\n\n\n## About \u003ca name = \"about\"\u003e\u003c/a\u003e\n\n`logseq-plugin-gpt3-openai` allows users to generate human-like text using GPT-3 within the LogSeq editor.\n\nWrite a GPT-3 command in a block, then run the open `/gpt` command via the slash or block menu. The plugin will generate a GPT-3 response using the OpenAI API and insert it below. It removes leading and trailing whitespace from the prompt.\n\n## Getting Started \u003ca name = \"getting_started\"\u003e\u003c/a\u003e\n\n- You need to [get an OpenAI API Key here](https://openai.com/api/) and add the key in the plugin settings.\n- After the free welcome credit expires you will need to provide a credit card to OpenAI.\n- Note that having a paid ChatGPT account is not the same as having a paid account for OpenAI's API.\n- The default model is `gpt-3.5-turbo` but you can change it to `text-davinci-003` for GPT-3 or `gpt-4` (if you have access)in the plugin settings under `openAICompletionEngine`. See the [OpenAI docs](https://platform.openai.com/docs/) for available models.\n- Make sure you [read OpenAI's usage guidelines](https://beta.openai.com/docs/usage-guidelines) and avoid generating certain types of content.\n\n- Download the plugin in the Logseq marketplace by searching for `gpt3` or `openai`.\n\n## ⚠️ Warning ⚠️\n\nGPT-3 has limitations. It sometimes produces output that is subtly wrong or misleading. Don't rely on its output without verifying it yourself. Use it with caution.\n\n## Example Use Cases \u003ca name = \"examples\"\u003e\u003c/a\u003e\n\n## Summarizing or explaining a block of text\n\n![logseq gpt3 openai tldr](docs/tldr.gif)\n\n## Creating bullet point outlines for a given topic\n\n![logseq gpt3 openai outline](docs/outline.gif)\n\n## Creating study plan for a given topic\n\n![logseq gpt3 openai study](docs/study.gif)\n\n## Write a travel itinerary\n\n![](docs/travel.gif)\n\n## Explain how to do something\n\n![logseq gpt3 openai workout](docs/workout.gif)\n\n## Parse tabular data from plain english\n\n![logseq gpt3 openai table](docs/table.gif)\n\n### Just for fun\n\n![](docs/weirdpizza.gif)\n\n- Generate code to do a given task\n- Correct grammar\n- Translate into other languages\n\n- Classification and keyword tagging of text\n- Generate lists of given topics\n  - `List 10 top selling science fiction books`\n- Write about a given topic\n  - `Write a tagline for an ice cream shop.`\n- Answer Questions\n  - `Q: How does a telescope work?`\n\n## FAQ \u003ca name = \"faq\"\u003e\u003c/a\u003e\n\n### What is GPT-3 and OpenAI, and how does it work?\n\nSee [this article for a good overview.](https://www.vox.com/future-perfect/21355768/gpt-3-ai-openai-turing-test-language)\n\n### Errors\n\n#### OpenAI Quota Reached\n\nYour free trial is over, or you've run out of tokens. You can refill your tokens [here](https://beta.openai.com/account/billing/overview).\n\n#### `OpenAI Rate Limited`\n\nOpenAI has limits on how often you can call them. If you get this error, you'll need to wait a bit before trying again. See this [article](https://help.openai.com/en/articles/5955598-is-api-usage-subject-to-any-rate-limits) for more info on the rate limits. You can call it faster if you have a paid account.\n\n#### `Model not available`\n\nYou may have mistyped the model name, or need to generate a new API key, if you're upgrading to a paid account from a free account, or using a beta model that is not available to the public.\n#### `Refused to set unsafe header \"User Agent\"`\n\nThis error doesn't cause any issues besides the error message in the console. It's a known issue with the OpenAI API. See [this issue](https://github.com/openai/openai-node/issues/6) for more details. I'm working on a PR to their library to support browser usage. Ignore this error for now.\n\n### Debugging\n\n![openai](docs/openai-error.png)]\n\n- Open the developer tools (Menu -\u003e View -\u003e Toggle Developer tools)\n\n- Check the console logs for error messages.\n\n![](docs/debug.png)\n\n![](docs/response.png)\n\n- See if you can figure out the error on your own. Maybe you had a network issue if it says something like \"timed out.\" Sometimes the OpenAI API has issues. You also have a limited number of tokens, so you may run out and need to refill.\n\n- If you can't figure it out based on the error message and it doesn't go away. Make an issue on GitHub.\n\n### Prerequisites\n\n[An API key from OpenAI Click here to get one](https://beta.openai.com/account/api-keys)\n\n### Installing\n\n```\npnpm i\n```\n\n## Running the tests \u003ca name = \"tests\"\u003e\u003c/a\u003e\n\n- [ ] Add Tests\n\n## Build \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n```\npnpm run build\n```\n\n## 💻 Local Development\n\nThis enables the local dev server with hot reloading, via the logseq vite plugin.\n\n```\npnpm i\npnpm run dev\n```\n\n### Prod build\n\nFirst run `pnpm i` and `pnpm run build`\n\nOpen LogSeq\n\nGo to Settings \u003e Turn on Developer Mode\n\nThis will bring up the \"Plugins\" entry in three dots more menu list on the top right of the header bar. Go to Plugins page, and you will get a button with the `Load unpacked plugin label`. Select the root folder of this plugin repo.\n\nMake sure you add your [OpenAI Key](https://beta.openai.com/account/api-keys)\n\n## 🚀 Deployment \u003ca name = \"deployment\"\u003e\u003c/a\u003e\n\nCreates a build using semantic release when a commit is pushed with a smart commit message.\n\n## Built Using \u003ca name = \"built_using\"\u003e\u003c/a\u003e\n\n- [LogSeq](https://logseq.com/) - Privacy-first, open-source knowledge base that works on top of local plain-text Markdown and Org-mode files.\n- [Vite](https://vitejs.dev/) - Next Generation Frontend Tooling\n\n## Contributing \u003ca name = \"contributing\"\u003e\u003c/a\u003e\n\nDo you have a bug or idea? I would love to hear from you! [Open a GitHub issue here.](https://github.com/briansunter/logseq-plugin-gpt3-openai/issues/new)\n\nPRs welcome. [Open an issue](https://github.com/briansunter/logseq-plugin-gpt3-openai/issues/new) to discuss first if possible.\n\n## Authors \u003ca name = \"authors\"\u003e\u003c/a\u003e\n\n- [@briansunter](https://github.com/briansunter) - Author\n\n## Acknowledgements \u003ca name = \"acknowledgement\"\u003e\u003c/a\u003e\n\n- [OpenAI Examples](https://beta.openai.com/examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansunter%2Flogseq-plugin-gpt3-openai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriansunter%2Flogseq-plugin-gpt3-openai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansunter%2Flogseq-plugin-gpt3-openai/lists"}