GithubHelp home page GithubHelp logo

chivalry02 / vscode-chatgpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gencay/vscode-chatgpt

0.0 0.0 0.0 17.41 MB

A Visual Studio Code extension to support ChatGPT. The extension is pair-programmed with ChatGPT.

Home Page: https://marketplace.visualstudio.com/items?itemName=gencay.vscode-chatgpt

License: ISC License

JavaScript 47.68% TypeScript 41.49% CSS 10.83%

vscode-chatgpt's Introduction


Ask ChatGPT

ChatGPT, GPT-3 and Codex conversations in Visual Studio Code

๐Ÿ“ข New feature - Use pre-release ChatGPT model via API Key Method

  • You can now use Pre-Release model to enable ChatGPT with API Key method

  • We made the API Key method as the default integration. Please note that the model name may change without a prior notice, which may break the ChatGPT interface. Extension will be updated once OpenAI enables the ChatGPT in production with the latest model name. If the name changes before an extension update, you could update your vs-code settings.json with another model name: chatgpt.gpt3.model

ChatGPT as your copilot to level up your developer experience

  • โž• ChatGPT Plus support.
  • ๐Ÿ”ฅ Streaming conversation support for both browser and API Key method. ChatGPT will type as they think.
  • ๐Ÿ“ Create files/projects or fix your code with one click.
  • ๐Ÿค– Zero-Config setup. Simply login to OpenAI as usual. Or use OpenAI's official GPT3 APIs.
  • โžก๏ธ Export all your conversation history at once in Markdown format.

Zero Configuration with Browser or API Key setup Methods

  1. [Default] Use OpenAI's official ChatGPT APIs - Use your personal/organizational API Keys. This method provides many parameters to customize your prompt. Check out the GPT3 settings. For more details: GPT3 OpenAI API Key
  2. Autologin - Uses browser to ask questions to ChatGPT. Zero-Config Autologin lets the extension grab the required tokens automatically using puppeteer. The extension will use the browser behind the scenes, so you are not expected to receive 4xx errors while asking ChatGPT via extension unless there is OpenAI outages. Autologin Setup (Default)

API Key Setup

Get your API Key ready from here: OpenAI

  1. Click Login in your extension or ask any coding question by selecting a code fragment.
  2. Once asked provide your API Key to the extension
    • [Optional] You could also store your API Key in your settings.json. However, it's highly discouraged due to security reasons.

Browser Setup

๐Ÿš€ All you need to do is click Login or ask a question to get started!

  1. Click on the ChatGPT extension icon on your sidebar and hit Login button.

  2. A new browser window (Default is Chrome but you may override it with any Chromium-based browser) will open up redirected to https://chat.openai.com/. Wait till you see login page, and click on Login on your browser.

    • If you see a ChatGPT is at capacity right now message, the extension will refresh the page every 2 seconds until it's passed. If OpenAI systems are experiencing issues and the extension fails to see Login page after 10 retries, the browser will be automatically closed.
  3. Solve captchas if you are prompted and continue.

  4. After successfully logging in, the browser will be minimized.

๐Ÿ”‘ Use Google, Microsoft or standard OpenAI credentials to login. The email/password will be used to autofill the login form depending on the authentication type you choose. NOTE: We don't recommend storing your password in your settings.json since the file is plain text. However, you can opt-in to use it to reduce the friction during logins.

โ„น๏ธ You will need to have a browser open and be logged in at all times. If you close the browser or your VS-Code instance, you will be asked to login again in your next session.

๐Ÿ“ You can have the extension auto-fill the email address and/or password during logins. Update the extension settings with those information for quicker login. NOTE: We never store any of this information locally or remotely.

๐Ÿค– Below is a sample autologin flow. Simply login & keep your browser minimized for dialogues with ChatGPT:


Override settings with any Chromium-based browser

  1. To use Edge, go to this URL: edge://version and copy the executable path used by your Edge browser.
  2. Override the chromium path by going to vs-code settings and search for chatgpt:chromiumPath. Paste the executable path. i.e. C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe
  3. [Maybe required] Run ChatGPT: Reset session command to clear your previous browser selection. This is required only if you have previously authenticated using a different browser.

Run on Linux or remote - SSH workspace

There are community members who are able to run the extension in WSL, Linux, remote-SSH workspaces. Please check these issues for instructions.

Credits to @EzyDark

Features

The extension comes with context menu commands, copy/move suggested code into editor with one-click, conversation window and customization options for OpenAI's ChatGPT prompts.

ChatGPT conversation window in vs-code

๐Ÿ†• Export all your conversation history withs one click


Ad-hoc prompt prefixes for you to customize what you are asking ChatGPT

Customize what you are asking with the selected code. The extension will remember your prompt for subsequent questions.


Automatic partial code response detection

The extension will detect if ChatGPT didn't complete code in their answer and it will suggest automatic continuation and combination of answers


๐Ÿป Optimized for dialogue


Edit and resend a previous prompt


Copy or insert the code ChatGPT is suggesting right into your editor.


Ask free-form text questions that will be listed in the conversation window. The conversation is kept in cache until vs-code instance is closed.

Use defaults or customize your code prompts

  • ChatGPT: Ad-hoc prompt: Ad-hoc custom prompt prefix for the selected code. Right click on a selected block of code, run command.
    • You will be asked to fill in your preferred custom prefix and the extension will remember that string for your subsequent ad-hoc queries.
  • ChatGPT: Add tests: Write tests for you. Right click on a selected block of code, run command.
    • "default": "Implement tests for the following code",
    • "description": "The prompt prefix used for adding tests for the selected code"
  • ChatGPT: Find bugs: Analyze and find bugs in your code. Right click on a selected block of code, run command.
    • "default": "Find problems with the following code",
    • "description": "The prompt prefix used for finding problems for the selected code"
  • ChatGPT: Optimize: Add suggestions to your code to improve. Right click on a selected block of code, run command.
    • "default": "Optimize the following code",
    • "description": "The prompt prefix used for optimizing the selected code"
  • ChatGPT: Explain: Explain the selected code. Right click on a selected block of code, run command.
    • "default": "Explain the following code",
    • "description": "The prompt prefix used for explaining the selected code"
  • ChatGPT: Add comments: Add comments for the selected code. Right click on a selected block of code, run command.
    • "default": "Add comments for the following code",
    • "description": "The prompt prefix used for adding comments for the selected code"

Other available commands

  • ChatGPT: Ask anything: Free-form text questions within conversation window.
  • ChatGPT: Reset session: Clears the current session and resets your connection with ChatGPT
  • ChatGPT: Clear conversation: Clears the conversation window and resets the thread to start a new conversation with ChatGPT.
  • ChatGPT: Export conversation: Exports the whole conversation in Markdown for you to easily store and find the Q&A list.

Customization settings

  • Use proxy with autologin puppeteer setup
  • Opt-in to use automation to authenticate OpenAI.
  • You can configure the commands to use any prompts for the selected code!
  • Opt-in to receive notification when ChatGPT sends you a message!

Using Proxy

The autologin supports setting a proxy server. This is useful if you're running into rate limiting issues or if you want to use a proxy to hide your IP address. Right now this setting only supports http proxies. Don't provide a protocol in the setting.

To use a proxy, update the settings with your proxy server details. For more information on the format, see here.

Format examples:

Troubleshooting

  • It's possible that OpenAI systems may experience issues responding to your queries due to high-traffic from time to time.
  • If you get 400 BadRequest error with API Key based method, it means that your conversation's length is more than GPT/Codex models can handle. Clear your conversation history with ChatGPT: Clear conversation command and retry sending your prompt.
  • If you get ChatGPT is at capacity right now during autologin, the extension will refresh the page every 2 seconds until you see the login page. Refreshing may help in some cases, when there is a queue. This is unfortunately out of this extension's control. If, even after refresh, OpenAI shows capacity error, the browser will close automatically.
  • If you get ChatGPTAPI error 429, it means that you are making Too Many Requests. Please wait and try again in a few moments. If it persists, restart your vs-code.
    • This could also be due to multiple browser/requests being active on OpenAI. Make sure that none of your API Keys are being actively used at the moment.
    • You could also try re-generating a new API Key here
  • If you see ChatGPTAPI error terminated, your requests are being throttled. Please try again later.
  • If you encounter persistent issues with your queries
    • Try ChatGPT: Reset session command
    • As a last resort try restarting your VS-Code and retry logging in.
  • If you are using Remote Development and cant login to ChatGPT
    • In settings.json add
    • "remote.extensionKind": {"gencay.vscode-chatgpt": ["ui"]}

Disclaimer and Credits

  • There is no guarantee that the extension will continue to work as-is without any issues or side-effects. Please use it at your own risk. It may stop working without a notice e.g. OpenAI may decide to change all or some of its functionality, which will affect this extension.
  • This extension never uses/stores your personally identifiable information. There are some optional settings that you may opt-in to use i.e. OpenAI API Key. Please be careful of what you are storing in your settings.json file, since vs-code may sync them across their instances and it's outside of this extension's boundary. We recommend not storing any personally identifiable information in your settings.json.
  • This extension collects metadata to improve its features. No personally identifiable information is collected. You can opt-out from telemetry either by setting the global 'telemetry.telemetryLevel' or 'chatgpt.telemetry.disable'. The extension will respect both of these settings and will collect metadata only if both allow telemetry. We use the official telemetry package provided by the vscode team here to understand this extension's usage patterns better to plan new feature releases i.e. popularity of Browser-based autologin vs. API Key method setting.
  • We assume no responsibility of any issues that you may face using this extension. Your use of OpenAI services is subject to OpenAI's Privacy Policy and Terms of Use.
  • ๐Ÿ’ป Open AI ChatGPT: https://chat.openai.com/
  • ๐Ÿ–ผ๏ธ Open AI Dall-E-2: https://openai.com/dall-e-2/
  • ๐Ÿงช Uses unofficial nodejs OpenAI API wrapper for conversational fetch calls to api.openai.com.

vscode-chatgpt's People

Contributors

gencay avatar checkm3out avatar

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.