GithubHelp home page GithubHelp logo

chatgpt-vscode's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgpt-vscode's Issues

Can't locate Session_token

Hi, I followed your instruction but i wasn't able to find SESSION_TOKEN in chatgpt section under settings in vscode. I downloaded the chatgpt extension from the marketplace

Prompt from action palette doesn't work before manually opening the extension tab

When opening a fresh instance of VS-code, prompting doesn't work until you manually open the conversation window pane.

The video shows:

  1. Doing an ad-hoc prompt. Nothing happens
  2. Pressing the "ChatGpt" pane, then going back. Doing an ad-hoc prompt works as expected.
shot-IfKst1yC.mp4

How to reproduce:

  • Use VS Code
  • From the command palette: Run "Developer: Reload window"
  • From the command palette: Run "ChatGPT: Ad-hoc prompt", type a prompt and press enter
  • Nothing happens

Expected:

  • The ChatGPT pane should automatically open

Requesting HTML content often renders the requested html in the chat window instead of giving me the HTML code that I can copy

I'm able to work around by asking for the contents of the body tag, but if chatGPT renders a full HTML file it will occasionally render in place instead.

I reproduced by selecting all of my HTML in a file (below) and asking it to add fields.

<html>
  <head>
    <meta charset="UTF-8">
    <title>ChatGPT Prompt</title>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <h1>ChatGPT Prompt</h1>
    <div style="display: flex;">
      <div style="flex: 1; margin-right: 20px;">
        <h3>Column 1</h3>
        <form>
          <label for="prompt1">Enter your prompt:</label><br>
          <textarea id="prompt1" name="prompt1" rows="4" cols="50"></textarea><br><br>
          <button type="button" onclick="generateResponse(1)">Submit</button><br><br>
          <label for="response1">ChatGPT Response:</label><br>
          <textarea id="response1" name="response1" rows="8" cols="50" style="height: 300px;"></textarea>
        </form>
      </div>
      <div style="flex: 1; margin-right: 20px;">
        <h3>Column 2</h3>
        <form>
          <label for="prompt2">Enter your prompt:</label><br>
          <textarea id="prompt2" name="prompt2" rows=\"4" cols="50"></textarea><br><br>
          <button type="button" onclick="generateResponse(2)">Submit</button><br><br>
          <label for="response2">ChatGPT Response:</label><br>
          <textarea id="response2" name="response2" rows="8" cols="50" style="height: 300px;"></textarea>
        </form>
      </div>
      <div style="flex: 1;">
        <h3>Column 3</h3>
        <form>
          <label for="prompt3">Enter your prompt:</label><br>
          <textarea id="prompt3" name="prompt3" rows="4" cols="50"></textarea><br><br>
          <button type="button" onclick="generateResponse(3)">Submit</button><br><br>
          <label for="response3">ChatGPT Response:</label><br>
          <textarea id="response3" name="response3" rows="8" cols="50" style="height: 300px;"></textarea>
        </form>
      </div>
    </div>
    <script>
      async function generateResponse(column) {
        const input = document.getElementById(`prompt${column}`).value;
        const response = await fetch(`/prompt?prompt=${encodeURI(input)}`);
        const result = await response.text();
        document.getElementById(`response${column}`).value = result;
      }
    </script>
  </body>
</html>```

"This browser or app may not be secure" when logging in [with potential fix]

When trying to log in with Google, I got a warning "This browser or app may not be secure". Therefore I couldn't sign in. The source of this issue is not in this repo, but in the chatgpt-api repo.

They avoid the problem in v1.0.0 of the chatgpt-api, which uses a session token from https://chat.openai.com to authenticate. I tried upgrading this code to use the new version (session cookie is passed to the extension from vscode settings) and it now works.

Checkout https://github.com/timkmecl/chatgpt-vscode (to just install the extension without compiling see Releases)

Command 'Ask ChatGPT' resulted in an error (command 'chatgpt.ask' not found)

Installing on Mac. After running vsce package to create the vsix file, I install the plugin locally. The icon is added to the sidebar, but when I click the icon, there is no output or prompt.

When running cmd+shift+p and then selecting Ask ChatGPT, I receive Command 'Ask ChatGPT' resulted in an error (command 'chatgpt.ask' not found)

Is there a different path to installing and using the plugin that should be used?

; node bin location = nvm/versions/node/v16.14.2/bin/node
; node version = v16.14.2
; npm version = 8.19.2

Issues about TimeoutError

Hi and thank you for developing this amazing extension! It is so useful and efficient!
However, there is a small problem that i have met using this extension:
If the answer of ChatGPT is too long, e.g., I am asking it to write the structure of a rather long program, its answer will first be printed out and then be shut down by the extension for the following error:
[ERROR] TimeoutError: ChatGPT timed out waiting for response
I understand that keep generating long code can get freshman rely too much on ChatGPT LOL, but can you add a feature in the setting to determine the time for timeout error?
Looking forward to hearing from you soon!

Ask to (re)connect at each VSC session

image

I can't use "try without account" as I created an account and it asks me everytime to connect so I prefer not to lose 30sec to type my long email and to retrieve what password did I use.

Also, I'm looking forward for the "use codebase" to work again and I'll be happy to pay for a subscription when it works rather than having to explain to chatGPT (in browser) every time what i'm doing.

Thanks

Feature request: Asking ChatGPT to explain code in Chinese or more languages

Hi! I am amazed at the idea to put ChatGPT into VSCode to let it explain code more efficiently!
However, because i am not native speaker of English, reading ChatGPT's answer in native language may help people like me work more efficiently.
Moreover, through my interaction with ChatGPT, I found that its ability to deal with code wont change with language
So, I would like to add a feature to let user set the snippets of asking ChatGPT to explain code, etc, so that ChatGPT can respond in the users' native language

[Suggestion] "ChatGPT: Check comments"

It would be great to have an ability to select the comment section and ask ChatGPT to check the grammar, or to make more sense in the comments. For example, I write comments in English language, but it isn't my native language and I make mistakes or I use incorrect words to describe the context. Or, may be, ask it to even write some template first.

Help error 403:

[ERROR] Error: ChatGPTAPI error 403
I double checked my user agent, session id and the other things and this error still presists

error after setting token

i get [ERROR] "Session Token, Clearance Token or User Agent not set, please go to extension settings to set them (read README.md for more info)" even though i copied the token exactly as it is and i checked that it is set on the settings too "chatgpt.sessionToken": "eyJ......"

[ERROR] 404 when I set model to gpt-4

When I set the model to gpt-4 I have the following error:

[ERROR] Error: ChatGPT error 404: {
"error": {
"message": "The model: 
gpt-4
 does not exist",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
}

image

keep getting HTTP 429 Too Many Requests error

does free account work or not?

windows vscode. try to login with openai api key . free account

Too many requests try again later. (HTTP 429 Too Many Requests) Potential reasons:

You exceeded your current quota, please check your plan and billing details
You are sending requests too quickly
The engine is currently overloaded, please try again later.
See https://platform.openai.com/docs/guides/error-codes for more details. ChatGPT error 429: {
"error": {
"message": "You exceeded your current quota, please check your plan and billing details.",
"type": "insufficient_quota",
"param": null,
"code": null
}
}

Wrote a script to automate the install of the plugin and the authentication

I wrote a script to install the plugin.

Unfortunately it has a permissions issue:

Anyway here is the script (at the risk of getting yelled at or being called a novice).

If anyone can add it to this project, and perhaps figure out what's wrong with the permissions issue.

I think it might be helpful. If not, just let me know:

#!/usr/bin/env python3
import subprocess
import os
import random
import webbrowser
import subprocess
import venv
import logging

logging.basicConfig(level=logging.DEBUG)

class SetupChatGPT:
# Added init method
def init(self):
pass

 # Added check_python_venv_pip method

 def check_python_venv_pip(self):
     # Check if python is installed
     try:
         subprocess.run(["python", "--version"], check=True)

     except subprocess.CalledProcessError:
         # python is not installed, so install it
         subprocess.run(["apt-get", "install", "python"], check=True)

         # Check if virtual environments are installed
         if venv is not None:
              # virtual environments are installed
              pass
         else:
              # virtual environments are not installed, so install them
              subprocess.run(
                  ["apt-get", "install", "python3-venv"], check=True)

              # Check if pip is installed
         try:
              subprocess.run(["pip", "--version"], check=True)
         except subprocess.CalledProcessError:
              # pip is not installed, so install it
              subprocess.run(["apt-get", "install", "pip"], check=True)

 # Added create_venv method

 def create_venv(self):
     # Create a virtual environment with a random name
     venv_name = f"setup-chatGPT-{random.randint(1, 1000000)}"

     # Use try/except block for error handling
     try:
         # Create the virtual environment
         os.system(f"python -m venv {venv_name}")

         # Check if the requirements.txt file exists
         if os.path.exists("requirements.txt"):
             # If it exists, install the required packages in the virtual
             # environment
             os.system(
                 f"source {venv_name}/bin/activate && pip install -r requirements.txt")
         else:
             # If it does not exist, print a warning message
             print(
                 "Warning: requirements.txt file not found. Skipping package installation.")

     except:
         print("An error occurred while creating the virtual environment.")
         # Handle the error here (e.g. log it, raise an exception, etc.)
         raise
     else:
         # If no error occurred, activate the virtual environment
         subprocess.run(["source", f"{venv_name}/bin/activate"], check=True)
         print(
             f"Successfully created and activated virtual environment: {venv_name}")
         return venv_name

  def start_venv(self, venv_name):
      # This function starts the virtual environment with the given name.

      # Check if the virtual environment is already activated
      if "VIRTUAL_ENV" in os.environ:
           # If it is already activated, prompt the user to restart it
           response = input(
           "Virtual environment is already activated. Do you want to restart it? (y/n) "
           )
           if response == "y":
                # Restart the virtual environment
                os.system("deactivate")
                os.system(f"source {venv_name}/bin/activate")
           elif response != "y":
                # If the user does not want to restart it, do nothing
                pass
           else:
                # If the virtual environment is not already activated, activate it
                os.system(f"source {venv_name}/bin/activate")

                # Check if the chatgpt package is installed in the virtual environment
      try:
           subprocess.run(["python", "-c", "import chatgpt"], check=True)

      except subprocess.CalledProcessError:
          # If the chatgpt package is not installed, install it
          os.system("pip install chatgpt")

          # Print a success message
          print("Successfully started virtual environment and installed chatgpt package.")
     
  def check_vscode(self):
     """
     This function checks to see if Visual Studio Code is installed.
     If it is not installed, it suggests a URL where someone can download it.
          
     In the above code, the check_vscode function uses the try/except block to
     check if the code command is available. If the code command is not available,
     it means that Visual Studio Code is not installed, and the function suggests
     a URL where the user can download it. Then, the function exits the program.
     This way, if the install_chatgpt_plugin function calls the check_vscode
     function and Visual Studio Code is not installed, the program will exit,
     and the user will not be able to install the ChatGPT VSCode plugin.

     """
     # Use try/except block to check if the "code" command is available
     try:
         # Run the "code" command to see if Visual Studio Code is installed
         os.system("code")
     except:
         # If the "code" command is not available, Visual Studio Code is not installed
         print(
             "Visual Studio Code is not installed. You can download it from: https://code.visualstudio.com/"
         )
         # Exit the program
         sys.exit()
     else:
         print("Visual Studio Code is installed.")

  def install_chatgpt_plugin(self):
     """
     In the above code, the install_chatgpt_plugin function calls the check_vscode function
     to check if Visual Studio Code is installed. If it is not installed, the check_vscode
     function suggests a URL where the user can download it. Then, the
     install_chatgpt_plugin function installs the ChatGPT VSCode plugin from the Visual Studio repository.
     """
     # Check if Visual Studio Code is installed
     self.check_vscode()

     # Use try/except block for error handling
     try:
         # Install the ChatGPT VSCode plugin from the Visual Studio repository
         os.system("code --install-extension Harshal-Mehta.chat-gpt")
     except:
         print(
             "An error occurred while installing the ChatGPT VSCode plugin."
         )
         # Handle the error here (e.g. log it, raise an exception, etc.)
         raise
     else:
         print("Successfully installed the ChatGPT VSCode plugin.")

  def start_login(self):
     """
     This function opens the ChatGPT website and starts the login process.
     """
     # Use try/except block for error handling
     try:
         # Open the ChatGPT website in the default web browser
         webbrowser.open("https://www.chatgpt.com/login")
     except:
         print("An error occurred while opening the ChatGPT website.")
         # Handle the error here (e.g. log it, raise an exception, etc.)
         raise
     else:
         print("Successfully opened the ChatGPT website.")


  if __name__ == "__main__":
       setup_chatgpt = SetupChatGPT()
       setup_chatgpt.check_python_venv_pip()

       # Call the create_venv() method and store the return value in a variable named venv_name
       venv_name = setup_chatgpt.create_venv()

       # Pass the venv_name variable as an argument to the start_venv() method
       setup_chatgpt.start_venv(venv_name)
       setup_chatgpt.check_vscode()
       setup_chatgpt.install_chatgpt_plugin()
       setup_chatgpt.start_login()
       setup_chatgpt.install_chatgpt()

[Suggestion] "ChatGTP: Translate this"

Add an option in settings that we could define a language, and in the context menu "ChatGTP: Translate this"

Note: make translation to ignore the code and translate only the "content"

Unable to find chatpgt in extension

I have installed this ChatGPT VSCode extension.
I go to Code -> Preference -> Settings and enter ChatGPT in the search bar but not found.
I restarted VSCode and tried again but still not found.
I uninstalled and install again this ChatGPT VSCode extension, tried to search again still not found.
However, I right click on the selected code and the ChatGPT menu are in the list like:
ChatGPT: Why it is broken?
ChatGPT: Expliain Code
ChatGPT: Refactor
ChatGPT: Add tests

I am using VSCode Version: 1.79.2 (Universal) on my Macbook Pro macOS Monterey 12.6.

[Feature Request]: Smart code formatting based on context

It would be super nice if there was a smart AI code formatting option where the AI looks at your codebase and understands your formatting style and then formats the current file based on the style of the rest of the code base. I do not like to use formatters like prettier since they are too opinionated but if the AI could analyze my style and apply the same formatting that would be so 🔥 😍

Need to Log in with Google every time I close VSCode

As the title says, everytime I relaunch VSCode I need to log in and enter email and password for my Google Account. Is this a limit of the API? Haven't tried using OpenAI Authentication, so maybe it is a problem with Google?

Love the extension btw.

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.

Make it sessionToken based again.

Make it sessionToken based again.
Because through API, it's only 18$ of free use, when sessionToken is from ChatGPT which is free...

Feature request: keeping the chat history in the ChatGPT tab

Hello and thank you for this amazing extension!

I would like to request a new feature: a chat history in the ChatGPT tab.
Very often I find myself thinking "I wish I could read what me and ChatGPT were discussing a few messages back".

I don't know how complex would that be, but I think it would be extremely useful.

Licence

Hi, what is the license for this repo? Could I use code from here in my opensource repo?

Module not found: Error: Default condition should be last one

Hey Marcel,

first of all, thanks a lot for this repo and your idea. This is really awesome.

I cloned your repository and tried to set it up locally but somehow webpack is not able to resolve the chatgpt module, albeit it has been installed and can be found by vscode and within the node_modules.

Steps to reproduce:

  1. Clone the repository
  2. cd to folder
  3. yarn install
  4. Start vscode from that folder
  5. Press f5 for a debugging session

I see the extension in the tab in the Extension Development Ide, but when i click i get the error in the logs:

Module not found: Error: Default condition should be last one

i get the same error when i try to compile with yarn compile

Versions:
macos: 12.5.1
vscode: Version: 1.73.1, Commit: 6261075646f055b99068d3688932416f2346dd3b
yarn: 1.22.11
node: v16.13.2

thanks a lot in advance!

Contribution to your project

Hi,

I want to contribute to your project. I can make translation, code, 2D graphics - icons, logos. Will you be interested?

Thank you in advance.

Valeriia Zhuravska

Auth Error: ChatGPT error 401

Following the README guide, I get this error message when trying to use the token:

[ERROR] Error: ChatGPT error 401: {
"error": {
"message": "Could not parse your authentication token. Please try signing in again.",
"type": "invalid_request_error",
"param": null,
"code": "invalid_jwt"
}
}

I also tried generating an official API token but got the same error.

Suggestion: scan application output for errors

"Bug Buster" functionality that can scan application log for errors and stack traces, and then send these log entries to ChatGPT. By doing so, the model could generate an explanation of the bug and suggest potential fixes.

Feature: Read application as a whole vs just selected code

Can we integrate the ability for ChatGPT to understand the entire code base vs just selected text.

For example... one can ask ChatGPT to create backend api service to do "something" ChatGPT will start writing the code for you in one file and then you can ask it to organize the code for you. It'll outlay the directory structure, explain whats in each file, and will be able to modify the right files to adjust what you want it to do.

If it can provide the above....could it also take a current code base as a starting point and provide outputs?

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.