Skip to content

GPTutor/gptutor-extension

Repository files navigation

GPTutor(🤖,🤖) - VS Code Extension

GPTutor(🤖,🤖) is a Visual Studio Code extension that uses OpenAI's GPT (Generative Pre-trained Transformer) models to provide users with code explanations and Reviews for a better understanding of their code and enabling users to get insights into code blocks and improve their coding skills. (Supported Move programming languages now)

https://marketplace.visualstudio.com/items?itemName=gptutor.gptutor

GPTutor x Move Workshop:

Come and participate in the workshop on June 28th, from 11:00 AM to 12:30 PM GMT+9, featuring Sam Blackshear, the creator of Move, and Eason Chen, the creator of GPTutor. Join us to delve into the world of GPTutor and Move development.

Register at https://lu.ma/gptutor

Donation

GPTutor is an open-source, free tool. Donations are welcome:

Sui: gptutor.sui
Ethereum: 0xCD1Ef67405DC7B2516298dcfc9De8A325d29635C
BTC: 1AoMLkWvi3MGvCpeqq5YYRERKX3cZQx8U1

Features

  • Code tutor using OpenAI's GPT models.
  • Code Review (review) using OpenAI's GPT models.
  • Code comment using OpenAI's GPT models.
  • Supports Move language for now.
  • Non-custodial API key (100% Free and we don't own your key).
  • Supported GPT-4 model (default GPT-3.5)

Getting Started

1. Install the GPTutor(🤖,🤖) in your Visual Studio Code editor from Extensions

截圖 2023-06-11 下午4 00 56

2. Activate the GPTutor by clicking 🤖 at the left side panel. You might find GPTutor in the "Additional Views" button.

image

3. Set OpenAI API key by pasting the key in the input box. You may follow the instruction to get an API key from OpenAI's Webiste

截圖 2023-06-11 下午4 03 46

4. (Optional) Set the GPT model to be used by running the GPTutor: setModel Command

> GPTutor: setModel

5. Hover over a code block to display GPTutor suggestions

截圖 2023-06-11 下午4 11 02

6. Choose the explain, Review or comment to help you

截圖 2023-06-11 下午4 13 03

7. Click on the "Settings" button located at the top left corner to access additional configuration options. From there, you can customize settings such as Prompt, Model, or Output Language.

image

Usage

GPTutor provides three main features: Explain, Comment, and Review whhen you hover on the code you selected. Moreover, you can interact with GPTutor directly on the input box.

Code Explain

  1. Hover over a code block in a supported language.
  2. Click on the Explain option to get a thoughtful explanation of the selected code.

Code Comment

  1. Hover over a code block in a supported language.
  2. Click on the Comment option to get a commented and refactored version of the selected code.

Code Review

  1. Hover over a code block in a supported language.
  2. Click on the Review option to get an Review of the selected code.

Interact by Input Box

  1. Input the instruction
  2. Selected the mode, such as Code Generate and Rewrite
  3. Execute by Ask GPTutor.

Customize Prompt

Follow the instructions in this document to customize the prompt. The default prompts is in set the package.json, you are welcome to send pull requests for your awesome prompts.

Requirements

  • Visual Studio Code
  • OpenAI API key

License

This project is licensed under the MIT License. See the License.txt file for more information.

Paper Reference

Paper 1 introduce GPTutor: https://arxiv.org/abs/2305.01863

@article{chen2023gptutor,
  title={GPTutor: a ChatGPT-powered programming tool for code explanation},
  author={Chen, Eason and Huang, Ray and Chen, Han-Shin and Tseng, Yuen-Hsien and Li, Liang-Yi},
  journal={arXiv preprint arXiv:2305.01863},
  year={2023}
}

Paper 2 that focus on customizable prompts: https://arxiv.org/abs/2310.13896

@article{chen2023gptutor,
  title={GPTutor: an open-source AI pair programming tool alternative to Copilot},
  author={Chen, Eason and Huang, Ray and Liang, Justa and Chen, Damien and Hung, Pierce},
  journal={arXiv preprint arXiv:2310.13896},
  year={2023}
}