How to use ChatGPT to help development: experience sharing that has been viewed by 150,000 people

Original link: https://luolei.org/chatgpt-in-development/

It’s been a while since I started following this wave of AI at the beginning of the year, and I’ve incorporated AI into my workflow. Now I basically recommend it to others whenever I get the chance to introduce AI into the development process as soon as possible.

This blog is a summary of what I posted on Twitter , and it has been retweeted and favorited a lot.

In today’s article, I will share some of my current experience, tools and services related to using AI services.

The screenshot is basically the state of my desktop when I am currently working. Generally, a ChatGPT is opened in the small window on the left, and a VSCode + GitHub Copilot plug-in is opened on the right. Let’s talk about it next.

c-1.jpg

1. Threshold

In the past, due to well-known reasons, we needed to use some scientific means when accessing some overseas services. But now due to various practical reasons, reverse blocking is technically started.

Now users in China (including Hong Kong and Macau) access ChatGPT and face various problems. In general, there are three parts: registration, payment, and network.

1.1 Registration

  • Mobile phone number : ChaGPT currently restricts the registration of mobile phone numbers in China, and also restricts the processing of some overseas virtual operator numbers. It is recommended that you can purchase an overseas physical mobile phone number if conditions permit.
  • Payment : Paying to use ChatGPT Plus and API needs to be bound to a credit card. The OpenAI payment service provider accesses stripe, which not only requires a foreign bank card (VMA), but also verifies the user’s IP in the payment link, which is extremely strict risk control.
  • Network : At present, OpenAI only provides services to limited countries and regions. At the network level, not only the IP area is restricted, but also the risk control is carried out according to whether it is the IP of the computer room. Therefore, even if the proxy has been hung up, it is still blocked.

Mobile phone card, bank card, network, each is a threshold that needs to be solved, and many have been shared publicly. It is recommended that you make good use of keywords to search for solutions.

Personal experience is my suggestion. From the perspective of account security and privacy, registration and payment should be solved by yourself as much as possible. Don’t use proxy registration and payment. Use CloudFront and Warp to solve the public IP proxy problem by yourself, which can solve a lot of risk control question.

1.2 Network proxy strategy

My current plan is: no matter which proxy I use, all OpenAI-related domain name requests will be forwarded to my only US server, and the landing US server will set up a layer IP through warp to ensure the stability of the landing IP. The network is something that affects the user experience, and an unstable network has no small impact on work. My Azure API has not been approved, otherwise it should be a lot of worry.

c-2.jpg

 { 
  
    "domain": [ 
  
        "openai.com", 
  
        "ai.com", 
  
        "chat.openai.com.cdn.cloudflare.net", 
  
        "openaiapi-site.azureedge.net" 
  
    ] 
  
}

The above screenshot is a routing strategy of a certain layer of my proxy link. For these OpenAI-related domain names, I force forward them to the US server to ensure the stability of the landing IP.

c-3.jpg

Tips to check if ChatGPT proxy is successful:

Other websites using Cloudflare CDN can also test in this way. The principle is that websites using Cloudflare CDN have a debugging page of /cdn-cgi/trace, which will display the network information of your access to Cloudflare nodes.

This interface will return your user’s access IP address (proxy IP), the Cloudflare node CDN of ChatGPT accessed, and the warp network status. This method is very convenient for debugging. It can be used to judge whether you are using the expected proxy IP to access ChatGPT.

c-4.jpg

For the API layer, it is recommended not to use the official interface of http://api.openai.com directly. You can also use a forwarding solution such as Cloudflare Worker to set up a layer. The front domain name is fixed, and subsequent adjustments and loads are also convenient. I personally have also used Tencent Cloud functions, but it didn’t take long for me to switch from Tencent Cloud to OpenAI API, and I was warned by Tencent that I used an overseas proxy illegally, and I am not sure whether it is compliant.

For some technical solutions in this part, you can refer to the following articles:

2. Service

The problem of network and interface stability is solved, and the next step is to recommend some services. I did not directly use the official ChatGPT address, but chose the open source project Pandora, built a webpage by myself, cached the Access Token, 14 days free login, and replaced the configuration interface with my own forwarding API, and my wife at home can also directly use. Access is also faster, independent of the network conditions of the device I am using.

c-5.jpg

Pandora is very suitable for the initial stage of the team. Only one person needs to solve account and network problems, and others can skip the three obstacles of registration, payment and network.

Under the premise of data desensitization and company security regulations, it is strongly recommended that qualified teams can first integrate a set internally, so that the team members can use it conveniently, and solve the problem of availability first. Although our company has also developed a dialogue website based on AI API, it is not as easy to use as this one.

c-6.jpg

Except that some AI applications use their own interface services, many products provide custom API keys or third-party proxy interfaces. It should be noted that in non-open source projects, you need to be cautious when submitting the API Key. For users of client products, it is recommended to capture packets to check whether the client requests parameters related to the API Key from the third-party interface. Due to passing through a third-party server, there is theoretically a risk of leakage and embezzlement.

As for other third-party AI applications and tools, I am currently using the open source project chatbox, which is relatively more reassuring to use.

3. Auxiliary development

When I came to the development stage, I was a front-end engineer, but the things I did were complicated, from front-end business to server to operation and maintenance. In the past period of time, my development habits have been greatly changed by AI. Compared with Github Copilot, ChatGPT has a greater impact. At present, I use AI for my actual development mainly in the

  • 1. Debug
  • 2. Optimize code

I believe that like many developers, most of the current work is actually wheels.

This happens to be where AI excels. In the past I was going to write a module code, maybe steps like this

  • 1. Go to Google to search keywords
  • 2. copy paste
  • 3. Modify the specific code based on business needs and own experience
  • 4. run & debug & fix
  • 5. done & committed

Now with the blessing of AI, I changed it to

  • 1. Think about specific needs
  • 2. Think about the promotion of this specific code requirement
  • 3. Let Copilot and ChatGPT give me a sample code
  • 4. Based on your own experience, add boundary conditions such as bottom line and abnormality
  • 5.copy paste to the development environment run
  • 6. If there is an error, the log will be thrown back to AI, debug & fix

Since I began to pay attention to this wave of AI at the beginning of the year, I have added AI to my workflow for a while, and now I am basically doing Amway when I meet people. It is recommended to introduce AI into the development process as soon as possible.

c-12.jpg

c-7.jpg

There is also a high-frequency scenario, which is to optimize the existing code, copy the historical code fragment, let ChatGPT analyze and optimize the code, and give the reason for the optimization. This block is only recommended for a small range of codes. I have encountered several situations where AI has taken the initiative to remove unremarkable codes. This kind of AI gives you CodeReview.

c-8.jpg

Four. Feeling

After using ChatGPT, another change I made was to allow myself to return to a more comfortable “student” status without social pressure.

I observe many programmers and developers on a daily basis. After work, they are not good at asking other people questions. They often like to solve them by themselves. Like me, I’m still thick-skinned, but I don’t ask too many questions.

Now I especially enjoy constantly asking and exploring in-depth questions in ChatGPT. Anyway, AI will not be tired, and he will not laugh at my mentally retarded questions.

c-10.jpg

As for other writing scripts, writing plug-ins, and writing command lines, they all belong to the field that AI is good at. Recently, I used AI to assist, and it took less than 30 minutes to complete all requests from the production environment operation and maintenance logs, filter The business routing entry, the work of deleting the obsolete html files of the code base. The operation and maintenance classmate saves him trouble, and I also save trouble, and they are all happy.

c-9.jpg

I wrote this intermittently, the tiny experience and feelings of using AI in the past few months.

At present, my Workflow is far from the level of “Thai pants spicy”. In the future, I plan to sort out the prompt library I use frequently and come up with some more automated solutions.

Just a feeling, AI will not eliminate people, but people who can use AI will eliminate people.

Programmers, or those who have the ability to use the latest productivity tools, will still be the beneficiaries of this wave.

How to use ChatGPT to help development: Experience sharing that has been viewed by 150,000 people first appeared on Luo Lei’s independent blog .

This article is transferred from: https://luolei.org/chatgpt-in-development/
This site is only for collection, and the copyright belongs to the original author.