1. Install Extension ChatGPT
First, go to vscode and find an extension called “ChatGPT” to install it:
Everyone, please pay attention to choose the right name and publisher (because there are many other similar extensions, but it’s not very good if I try to use it).
Next, we need to login to our ChatGPT account to proceed with use. There will be 2 authentication methods including:
- Login directly with your gmail account through the browser
- Login with API Secret Key
Here I will guide you how to login with API Key:
- You access the homepage of OpenAI Api: https://openai.com/api/ then log in to your account using ChatGPT
- Go to ” Personal “, select ” View Api keys “
- At the Account API Keys screen, select “Create new secret key”, then copy the key shown
- Go back to VSCode, go to the Extension Setting of the ChatGPT extension just installed, scroll down to find the ” OpenAI Organization ID ” section and paste the key snippet just now. It is done. You can start coding with chatGPT right next to you
2. Outstanding Features
- To use the extension, you highlight a piece of code, then right-click, there will be some options to choose from such as: Find bugs, Explain code, Optimize code, ..vv.vvv These are the features I especially like this extension.
As in the example above, I code crap like that, to see how this integrated Bot will handle it. First I will let it explain the code, now a small chat window will appear on the left, here we can interact with ChatGPT like the web version:
Pretty convenient, isn’t it, now let’s try to let it find bugs in the code and refactor it:
- Found the bug:
- Show how to refactor the code:
It’s pretty cool
3. Summary
- This extension also has other great features, but within the framework of this article, I cannot fully introduce it, so please continue to study it.
- The chatbot content in this integrator has been filtered by topics of technology and coding, so many questions about other marginal areas will not be answered like the web version.
- Perhaps it is also because of such a topic limit, so its reply speed is faster and smoother than many current web versions
- 1 Again, I emphasize that the current version of ChatGPT is still in the process of being completed, so the information it answers is not always 100% accurate, so you should use it only for reference. okay, don’t trust too much