Skip to content

Latest commit

 

History

History
160 lines (103 loc) · 6.72 KB

README.md

File metadata and controls

160 lines (103 loc) · 6.72 KB

Write Assist AI

The WriteAssistAI extension for VSCode utilizes the OpenAI APIs (or OpenAI compatible proxies) to offer AI-powered writing assistance for markdown, LaTeX and plain text files. It comes with some default actions to rephrase the selected text, or perform tasks like tone change, summarize, expand etc. These actions are completely configurable through the extension's settings.

🎯 Features

This AI text assistant provides a range of writing styles for you to select from. To access these styles, and other features, simply select the text you want to rewrite in a supported file. Then, click on the Code Actions 💡 tooltip and choose the desired action.

Extension Demo

Current feature list:

  • Rewrite the text using different tones. You can choose from professional, casual, formal, friendly, informative, and authoritative tones.
  • Rephrase selected text
  • Suggest headlines for selected text
  • Summarize selected text
  • Expand selected text (make it verbose)
  • Shorten selected text (make it concise)

You can modify the existing actions (including their prompt), or add new ones through the extension's settings.

✅ Requirements

To use the extension you need to provide your own OpenAI (or OpenAI-Compatible provider) API Key.

🛠️ Installation

You can install the Write Assist AI extension from the VS Code Marketplace.

VS Code Marketplace

⚙️ Extension Settings

It exposes the following settings:

  • writeAssistAi.maxTokens: Maximum number of tokens to use for each OpenAI API call. The default is 1200.
  • writeAssistAi.temperature: Temperature value to use for the API calls. The default is 0.3.
  • writeAssistAi.openAi.model: The OpenAI model to use. The default is gpt-4o.
  • writeAssistAi.openAi.customModel: To use a custom model, select custom from the writeAssistAi.openAi.model dropdown menu, and enter your model name here.
  • writeAssistAi.openAi.proxyUrl: To use a proxy for AI calls or to connect with an OpenAI-compatible AI provider (such as Groq), set this to your preferred value. If you choose a different provider, you will also need to update the API Key and specify the custom model you wish to use.
  • writeAssistAi.systemPrompt: Sets a common system prompt to be used with LLM API calls. You can also configure language specific system prompts. To do this, type @lang:<languageId> Write Assist AI e.g. @lang:markdown Write Assist AI in your VSCode settings UI, and set the required system prompt for the selected language.
  • writeAssistAI.separatorText: This option allows you to define the separator text that surrounds the output generated by the AI. By default, it is set to '*' repeated 32 times. If you prefer to remove the separators, you can do so by setting this option to an empty string.
  • writeAssistAi.quickFixes: Sets the actions that show up in the editor's tooltip menu under Quick Fix section. This is also configurable per language.
  • writeAssistAi.rewriteOptions: Sets the commands that show up in the editor's tooltip menu under Rewrite section. This is also configurable per language.

In addition, you need to set your OpenAI API Key (or the OpenAI-Compatible provider's API Key) in the Command Palette under Write Assist AI category. If not configured already, you can also set it when you use the extension for the first time. Your key will be securely stored in VSCode's secretStorage for safety.

Using Alternative OpenAI-Compatible Providers

To utilize other OpenAI-compatible providers (such as Groq, for more information see details), follow these steps:

  1. Configure the correct base URL by adjusting the writeAssistAi.openAi.proxyUrl setting.
  2. Enter the API Key for your chosen provider using the command palette.
  3. Change the writeAssistAi.openAi.model setting to "custom" and specify the desired model name in the writeAssistAi.openAi.customModel setting.

Once you've completed these steps, you'll be ready to use the alternative provider.

Creating New Actions

Both writeAssistAi.quickFixes and writeAssistAi.rewriteOptions use the same JSON Schema to define actions. You can edit or remove existing actions, or create a new one by adding an action object.

For instance, you can include a new Quick Fix action in your settings.json file to translate the selected text to French.

"writeAssistAi.quickFixes": [
  // ...
  {
    "title": "Translate into French",
    "description": "Translates the selected text into French",
    "prompt": "Translate the given text into French."
  },
  // ...
]

To specify actions for a specific language, place the actions within the corresponding language configuration block. For example, to ensure that the action "Translate into French" only applies to markdown files, you can do the following in your settings.json:

{
  "[markdown]": {
    // other settings
    "writeAssistAi.quickFixes": [
      // ...
      {
        "title": "Translate into French",
        "description": "Translates the selected text into French",
        "prompt": "Translate the given text into French."
      },
      // ...
    ]
  }
}

*Note: Default actions are activated only when no action has been specified for a supported language. If you have defined specific actions for a particular language, only those actions will be visible for that language.

🐛 Known Issues

--

🚀 Release Notes

v0.5.0

Added

  • Option to set a proxyURL (baseURL) to the OpenAI calls
  • gpt-4o-mini model to the selection dropdown
  • Option to set/remove the separator text around AI response

Fixed

  • CodeActions stopped showing if user didn't enter the API Key

v0.4.1

Added

  • gpt-4o model, and made it the default model

v0.4.0

Added

  • Language specific configuration capability for System Prompts, QuickFix Actions & RewriteOptions.

Fixed

  • OpenAI config changes take effect immediately without a reload.

v0.3.1

Fixed

  • Move the action prompt to user message prefix of the OpenAI API call.

v0.3.0

Added

  • A new command in the Command Palette to set/reset the OpenAI API Key
  • A common system prompt config for use with the LLM calls
  • Dynamically configurable Quick Fix and Rewrite actions
  • Use of v1/chat/completions endpoint of OpenAI

Fixed

Removed

  • Use of legacy v1/completions endpoint of OpenAI

📜 Changelog

To check the complete changelog click here

📋 LICENSE

This extension is licensed under the MIT License