Git Product home page Git Product logo

vscode-chatgpt's Introduction


An Unofficial VS Code - Chat GPT extension

The most loved* ChatGPT extension in VS Code open-sourced

The project is built as a hobby project - With no affiliation to any organization

The functionality fully relies on OpenAI services without any affiliation to them

*Downloaded by ~500,000 developers with more than 100 5 star ratings within 3 months of release

Try out this extension on marketplace: ChatGPT - Genie AI

The extension is stripped out of Browser capabilities and published as an integration point for community to continue utilizing GPT models in Sidebar conversations or responses in editor, favorites, personalization and more.

Forks and continuation of the original project

Feel free to contribute here.

  1. Continued by ChatGPT - Genie AI
  2. Forked by @Christopher-Hayes: ChatGPT Reborn

Features

  • βž• Use GPT-4, GPT-3.5, GPT3 or Codex models using your OpenAI API Key
  • πŸ“ƒ Get streaming answers to your prompts in sidebar conversation window
  • πŸ”₯ Stop the responses to save your tokens.
  • πŸ“ Create files or fix your code with one click or with keyboard shortcuts.
  • ➑️ Export all your conversation history at once in Markdown format.
  • Automatic partial code response detection. Continues and combines automatically, when response is cut off.
  • Ad-hoc prompt prefixes for you to customize what you are asking ChatGPT
  • Edit and resend a previous prompt
  • Copy, insert or create new file from the code, ChatGPT is suggesting right into your editor.

License

If you are developing completely another extension and release it to the public, make sure you follow this.

This project is released under ISC License - See root License for details. Copyright notice and the respective permission notices must appear in all copies.

How to build and run

  • Clone the repository to your local machine
  • On the root directory, run yarn command to install the dependencies listed in package.json
  • Within VS Code - run the project by simply hitting F5

How to install locally

  • Install vsce if you don't have it on your machine (The Visual Studio Code Extension Manager)
    • npm install --global vsce
  • Run vsce package
  • Follow the instructions and install manually.

vscode-chatgpt's People

Contributors

finders-pe avatar gencay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-chatgpt's Issues

Suggestions - automatic continuation of long code

So there is an issue with ChatGPT which is due to character cap it often stops the code in the middle, sometimes in the middle of the line. In which case we have to ask it to continue and repeat the missing lines.
Would make life a lot easier if this would be possible to implement and we could copy/paste just one big code section instead of trying to merge and rewrite code parts from 2+ consecutive responses.
Thanks!

Suggestion: include highlighted text in 'Ask anything' context

Awesome job on this extension, especially solving the authentication issues πŸŽ‰

My workflow for ChatGPT is to highlight a block of code and then ask it something usually very specific, either to make a change or to explain one very specific thing. So I only rarely use the default prompts.

Currently in this extension I have to paste the context into the 'Ask anything'. Ideally it would include highlighted code.

a proxy setting for plugin

Since some region is blocked by openai, maybe add a proxy config to let all the traffic using a proxy?

Feature request: Save chat to .md file

Great extension!

I have one feature request as I keep copying and pasting the content of the chat to markdown file - it would be great to be able to save entire content of the chat to a markdown file.

Suggestion: Do not auto-fill that captcha click

The captcha is already in the human mouse pointer movement. If you auto-fill it by machine, it triggers another harder graphical captcha (since mouse-captcha failed), and also need to click "Next".

It's faster (and less disrupting) to just do 2 clicks :)

  • I am human
  • Next

Error 429 happens more often than in the WebUI

I realized the ChatGPTAPI error 429 happens quite often from within extension - usually after previous timed out request. It rarely happens from the Web UI.
Usually the fix is reloading window (VS Code) - so it doesn't seem that it really is error 429 - does it cache the error?

Feature Request: [Chat GPT: Add Comments] prompt

In addition to:

  • Add Tests
  • Find bugs
  • Optimize
  • Explain

I'd like to be able to select a block of code, and ask ChatGPT to add comments to the code, via the right-click context menu.

Or better yet, in the extension options, allow for the user to add their own prompts.

I know the workaround is just to edit one of the defaults to send a different prompt, but it would be nicer to have the option to customize all the prompts.

--no-sandbox explanation

I noticed that when the browser launches to log in I get the warning: "You are using an unsupported command-line flag: --no-sandbox. Stability and security will suffer".

I've always understood this to be a very bad thing for security. I imagine this is necessary for the authentication functionality to work? I'd appreciate it if someone could expound on why that is.

Might it make sense to put a warning about this in the README/docs? Maybe its fine if you just use that browser instance for ChatGPT only, but it might be helpful to inform users to make sure they don't do anything else in that window unless they're feeling very lucky. =)

Thanks folks!

VSCODE Dev Container

When opening a browser in a dev container, the error Unable to login. Make sure to login and keep your browser open. This error may also be due to OpenAI servers down or that it's throttling the requests. Error: Error Failed to launch the browser process !spawn /opt/yandex/browser/yandex-browser ENOENT TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md . If you install it in the "Chrome" container, then it swears on the X server. Maybe somehow you can make it so that when the browser leaves the dev container, the browser is in the system, and not in the container?

Feature Request: One Session over multiple VS Code Windows

Can we store the session information globally so that all VS Code windows have access to the same session?

EDIT: I looked into the code and it looks like it already uses the global state but for me if i open another window it still opens chrome again perhaps there is another issue somewhere?

Impossible optimize code

Capture5

How can I solve this problem ?
I have restarted several times as requested but the problem persists.

Need to login after every question

Hi!

After every question I need to redo the login process due to 429 error - when starting chrome it doesn't open up my default login so I need to redo my whole google login process again.

Is there any way to fix this? I've tried to remove all users from chrome in order to make my gmail account default but it still just opens up as a new login

Support for auto login on Linux

I think currently only Mac and Windows are supported. Can you add support for Linux as well? For example, a browser can be run on Linux like this: /usr/bin/firefox. Thank you in advance.

Im getting error 403 Fobidden

Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state.

An error occurred. If the issue persists try 'ChatGPT: Clear session.'

I get the above error codes. I've refreshed and cleared many times.

Auto scroll in the conversation window

Each time a response is received, the conversation window should scroll to the bottom

Unrelated to this issue: I know I am spamming issues right now, but I think it's wise to have them as separate issues instead of a big one. I am definitely willing to look at some of these and contribute, but would like to know your opinions first.

Dialogue not working

Hi,

The dialogue feature of chatGPT is not working with the extension for me, as illustrated below.

Screenshot 2023-01-12 at 15 18 00

I am using "GPT3 OpenAI API Key" for the setting "ChatGPT: Method". I did not change any other settings. Great extension otherwise!

Conversation window textarea should be submittable with keyboard

Right now, you have to press "Ask" using the mouse. Would be nice if you can press enter to send the message, and use shift+enter to add new lines, just like the message box on chat.openai.com works.

Another suggestion is to keep the current behavior but send the message using shift+enter.

Doesn't work with VSCode under WSL2

Set my Chromium path to /mnt/c/Program Files/Google/Chrome/Application/chrome.exe, and after hitting login button I get:
image

I believe in such case tmp path should be on mounted C drive, maybe make it configurable?

I do realize it might be an exotic way to use VS Code for you, but it's the only way I use it and your extension seems to be the only way to use ChatGPT from inside VS Code at all :P

Cannot login

When I click login, it shows:
ChatGPT is at capacity right now
[Get notified when we're back]

package.json and ./src still running on v.1.6.2?

Hi,

I tried building the extension from source but I saw the version in package.json was still on v1.6.2 instead of the v2.5.1 like on the VSCode marketplace. When building with the old package.json I got a Node <= 18 error, so I had to manually extract it from the gencay.vscode-chatgpt-2.5.1.vsix to run it properly.

Nevertheless, the login button does not appear for me.

Screenshot from 2023-01-02 16-04-39

My guess is that ./src/chatgpt-view-provider.ts and ./src/extension.ts are outdated too, or am I missing something here? Can we get the latest source files that correspond with v2.5.1?

ps. Similar issue pertains for v2.0.0 in Releases for me.
pps. Wonderful code btw!

error using OpenAI API key method

I keep getting "An error occured. If this issue persists please clear your session token with ChatGPT: Reset session command. As a last resort try restarting your VS-Code and retry logging in. Error:Error Request failed with status code 400"

Done reset session, retry, exit vscode, changing keys, no avail.

Publish plugin to Open VSX Registry

We’re using Gitpod for development, and it uses VS Code Browser.
You can’t install directly Plugins from the Microsoft VSCode marketplace. Instead, you need to install the Plugins from the Open VSX Registry. For that to work, the Plugin creator, need to publish their Plugin to this Open source registry.

The publishing seems quite easy - the only thing is, you need to create an account there to publish: Publishing Extensions Β· eclipse/openvsx Wiki Β· GitHub
Github Action: GitHub - HaaLeo/publish-vscode-extension: GitHub action to publish your VS Code Extension to the Open VSX Registry or Visual Studio Marketplace.

Feature: Use API key not session token

Allow us to use the API key which is consistent and how we are supposed to use the ChatGPT API.

Example of curl using the api

curl https://api.openai.com/v1/completions \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer [api-key]" \
  -d '{
  "model": "text-davinci-003",
  "prompt": "$query",
  "max_tokens": 4000,
  "temperature": 0.9 

REFERENCE: https://beta.openai.com/docs/api-reference/authentication

Use the official OpenAI API to generate code or natural language responses from OpenAI's GPT3/GPT3.5 to your questions, right within the editor

Suggestion: When execution fails, use error message & traceback to debug

When code execution fails, it could automatically take the error message & traceback and ask GPT to suggest a fix. Could be a setting to toggle this to run automatically or have it manually triggered on demand.

Would be a great alternative to just asking what's wrong with a piece of code.

Doesn't work in remote workspace (Remote - SSH)

Hey. Thank you very much for this really good made extension.
Unfortunately I don't know, how to make it work with remote workspace with a extension "Remote - SSH". Is there any chance to fix this? Maybe it would be enough to set your extension to run only from the local machine in order to have access to the local browser when connected to the remote workspace. At the moment it forces me to install and activate your extension on my remote server (via Remote - SSH) without the ability to use it only from the local machine.
I hope this is somehow possible, because it's the only thing that makes it impossible for me to use it at the moment...

Thank you. ;)

Google Auth constantly got reset

I use Google Chrome and my Google account to authenticate. However, with each new session, my auth got reset. Google Chrome launched as a brand new browser. Is there any fix for this?

Formatting issue in v1.2.0

There seems to be an issue with code formatting:
image
The first code section is handled well, the second it misses and then it starts handling it from the middle.

API Key doesn't appear to be working

I entered the API Key in the settings and chose it as the method and even after restarting the session and reopening the application itself I am getting the following error:

An error occurred. If this issue persists please clear your session token with ChatGPT: Reset session command and/or restart your Visual Studio Code. If you still experience issues, it may be due to outage on https://openai.com/ services.

Suggestions and formatting

Thanks for an amazing extension ❀️

I have several suggestions:

  1. Can we get a setting for customizing font
  2. The code formatting is odd for now. I'd like to have something like in pic below. It becomes much clear where is the code parts are. [We should handle dark/light theme]

Screenshot 2022-12-09 at 23 09 27

3. A clear conversation button would be nice as well! 4. A little say npm package would make a great addition as it would allow to convert text into Speech

Interact in main pane?

Another question, @gencay: Interacting with the extension in the left side pane feels awfully crammed. Can I have the extension interact in the main pane?

None of the code related features work

I am able to log in, and send "regular" messages and get responses, but when I try to run stuff such as optimizing code, explaining code or make unit tests, I always get the same error :
"An error occured. If this issue persists please clear your session token with ChatGPT: Reset session command. As a last resort try restarting your VS-Code and retry logging in. Error: SyntaxError: Unexpected non-whitespace character after JSON at position 4"

When I go onto the created window, I actually can see that the conversation was created and ChatGPT did answer.
I tried restarting, re logging many, many times and at different times, but I always get this error.

Need to add isGoogleLogin to settings

With the auto-login settings, can you add the isGoogleLogin option, from the chatgpt-api?

From chatgpt-api readme:

Alternatively, if your OpenAI account uses Google Auth, you shouldn't encounter any of the more complicated Recaptchas β€” and can avoid using these third-party providers. To use Google auth, make sure your OpenAI account is using Google and then set isGoogleLogin to true whenever you're passing your email and password. For example:

const api = new ChatGPTAPIBrowser({
  email: process.env.OPENAI_EMAIL,
  password: process.env.OPENAI_PASSWORD,
  isGoogleLogin: true
})

sets how line-breaks are rendered in the markdown preview

I would like to know how to set how line breaks are rendered in markdown preview.

Because the original rendering made the chatGPT responses seem a bit crowded:

image

image

I've tried modifying the markdown settings that come with vscode:

image

But it doesn't seem to solve the problem.

Keep conversation state between questions

It seems like the extension is resetting the conversation between every question. Is it possible to have the same behavior as the web based chat has, where you can ask follow up questions?

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.