Home >Technology peripherals >AI >ChatGPT and related open source project experience
At the beginning of this month, ChatGPT came out at an alarming rate, causing widespread discussion in the technology circle. Recently, a number of ChatGPT-related open source projects have been born on GitHub. The number is staggering. ChatGPT even dominates most of GitHub Trending. So, what kind of charm does it have that makes many developers so excited? Let’s explore it together.
Currently, ChatGPT cannot be registered directly in China. Access needs to be through an agent, and you need to use a mobile phone number in other countries to register. For the specific registration method, you can read this article [1 ]
ChatGPT can realize tasks such as intelligent chatting, poetry, writing, programming, bug correction, writing weekly reports, Zhihu Q&A, etc.
For example, I can use it to write
Use React hooks to write an echarts component
The above code implements basic components, but no sample code is given. We can continue to ask
give an example of options for a line chart
Optimize last week’s weekly report to make it richer
In the weekly report, not only did they help me optimize the content, but they also helped me arrange my work for next week. , what do you think of the organization of ChatGPT?
The author believes that although it is not perfect, the answers given within the given keywords are already very unexpected.
For more experience, you can explore it by yourself. Let’s take a look at the ChatGPT project on GitHub.
Front-end engineers are familiar with Nodejs, and the official website has a nodejs interface
First install openai through npm
npm install openai
Then you can use the following code in any interface
const { Configuration, OpenAIApi } = require("openai"); const configuration = new Configuration({ apiKey: process.env.OPENAI_API_KEY, }); const openai = new OpenAIApi(configuration); const response = await openai.createCompletion({ model: "text-davinci-003", prompt: "你好", max_tokens: 255, temperature: 0.5, }); // 打印 API 返回的结果 console.log(response.data.choices[0].text);
The other is a personal development project, which re-encapsulates the API of ChatGPT, making customized development easy. More convenient.
Install chatgpt via npm.
npm install chatgpt
import { ChatGPTAPI } from 'chatgpt' async function example() { // sessionToken is required; see below for details const api = new ChatGPTAPI({ sessionToken: process.env.SESSION_TOKEN }) // ensure the API is properly authenticated await api.ensureAuth() // send a message and wait for the response const response = await api.sendMessage( 'Write a python version of bubble sort.' ) // response is a markdown-formatted string console.log(response) }
SESSION_TOKEN value needs to be copied through the chome console after logging in to the account.
GitHub: https://github.com/transitive-bullshit/chatgpt-api
This project is based on wechaty, allowing you to quickly initiate a conversation with ChatGPT through the WeChat chat window.
Before using it, you need to configure OpenAI’s Session Token information and the corresponding “keyword” trigger.
Function and Features
Access to the public account
GitHub: https://github. com/fuergaosi233/wechat-chatgpt
A WeChat bot based on chatgpt wechaty, which can be used to help you automatically reply to WeChat messages, or manage WeChat groups/friends. It is simple, easy to use, and can be played in 2 minutes.
Execute npm install after git cloning the project, modify the env related configuration,
Then modify the relevant logical files according to your needs
Modify the configuration
You can scan the QR code to log in
Scan the QR code to log in
This is the actual effect:
WeChat access demonstration
GitHub: https://github.com/wangrongding/wechat-bot
This plug-in supports Chrome / Edge / Firefox and other browsers.
After installation, in addition to the normal display of Google search content in the browser, ChatGPT feedback results will also be displayed on the right side, which can further improve search efficiency.
Search Demo
GitHub: https://github.com/wong2/chat-gpt-google-extension
This is a ChatGPT plug-in specially developed for Chrome users.
After installation, right-click in the text box on any page to pop up the "Ask ChatGPT" option.
ChatGPT will search based on the content in the current text box. This extension also includes a plugin system that provides greater control over the behavior of ChatGPT and the ability to interact with third-party APIs.
Plugin Demo
GitHub: https://github.com/gragland/chatgpt-chrome-extension
Will Baoge from Taiwan can turn ChatGPT into your voice assistant, realizing voice input and automatic reading functions. Let us say goodbye to typing mode through the Web Speech API that comes with the browser.
He has a video explanation at Station B [2], you can watch it, it is very interesting.
GitHub: https://github.com/doggy8088/TampermonkeyUserscripts
Any project that makes engineers full of curiosity , cannot escape reversal, and ChatGPT is no exception in this regard.
Antonio Cheong, a developer from Malaysia on GitHub, reversed ChatGPT not long after its release and successfully extracted the API.
With these APIs, we can develop a fun chatbot, AI intelligent assistant, code assistance tool and other applications by ourselves.
GitHub: https://github.com/acheong08/ChatGPT
is customized for Mac users A small tool: ChatGPT for desktop, supports M1 and Mac Intel. After installation, you can quickly launch ChatGPT in the system menu bar through the Cmd Shift G shortcut key.
GitHub: https://github.com/vincelwt/chatgpt-mac
For front-end engineers, we You can use the API to integrate ChatGPT into your own application, so it is necessary to understand nodejs and docker related knowledge.
Its advantage is that its language organization ability is very strong and it can be combined with context. But the answers it gives are not necessarily correct, and sometimes they are even wrong
As the official website says, it cannot be searched through the Internet.
Limited knowledge of world and events after 2021
There is limited knowledge about what will be gained after 2021. We can use it to strengthen our search capabilities. It is up to us to decide whether to adopt the answer.
The above is the entire content of this article. If it is helpful to you, you can give it a like. This is really important to me. I hope this article will be helpful to everyone. You can also refer to my previous articles. Or share your thoughts and experiences in the comment area. Welcome to explore the front end together.
[1]OpenAI launches the super powerful ChatGPT registration guide: https://juejin.cn/post/7173447848292253704
[2]ChatGPT Voice Monkey Script: https://www .bilibili.com/video/BV12P411K7gc/?vd_source=93efb77f3c9b0f1580f0a8d631b74ce2
The above is the detailed content of ChatGPT and related open source project experience. For more information, please follow other related articles on the PHP Chinese website!