abi / codeGPT

A VSCode extension that allows you to use ChatGPT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeGPT (CURRENTLY NOT WORKING)

Update (Dec 14): OpenAI made the unofficial API for ChatGPT harder to access and there aren't any good workarounds at the moment so the extension is not functional for the time being. - Abi

This is very much an alpha. The error handling needs to be significantly improved.

An extension that allows you to use ChatGPT right within VSCode.

The goal is to make interaction with the AI seamless via deep integration with VS Code.

Install via the VS Code Marketplace.

Demo

Here, we code the popular game, Wordle, in 2 minutes.

final2.mp4

Setup

The first time you try to ask ChatGPT a question, you'll be asked for your session token.

Here's how you get the session token:

  1. Go to ChatGPT and log in or sign up.
  2. Open Dev Tools (Cmd + Opt + C on Mac/Chrome).
  3. Go to Application > Cookies
  4. Copy the value for __Secure-next-auth.session-token

Periodically, the token might expire and you will be prompted for a new session token.

You can also modify this session token at any time by editing chatgpt.token in settings.

Features

  • Streaming, fast responses from ChatGPT
  • Send generated code directly to text or terminal buffers
  • Comes with useful prompt presets:
    • Explain code
    • Diagnose error message
  • Feed your current selection or active tab into the prompt

Planned (please submit PRs)

  • Support for large responses that span multiple messages (using the "continue" prompt trick)
  • Workspace detection (tell GPT that you use Yarn, Tailwind, etc. so it generates the most relevant code snippets)
  • Full history
  • Refactor code and see diff

How it works

Forked from chatgpt-vscode.

We use the unofficial API endpoints that power the ChatGPT website. Thanks to Travis Fischer for the ChatGPT package.

While this approach is more robust than earlier UI automation approaches, the endpoints are subject to change as well as rate limits. They might break at any point.

License

MIT

About

A VSCode extension that allows you to use ChatGPT

License:MIT License


Languages

Language:TypeScript 45.9%Language:JavaScript 31.4%Language:HTML 22.6%