-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d2c1ad
commit 1150365
Showing
2 changed files
with
87 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,95 @@ | ||
# ChatGPT-PyBot | ||
|
||
`ChatGPT-PyBot` is an open-source tool unofficial API that lets you interact with ChatGPT in Python and as a CLI. | ||
<p align="center"><a href="https://github.com/liuhuanshuo/ChatGPT_PyBot">En</a>|<a href="https://github.com/liuhuanshuo/ChatGPT_PyBot/blob/main/Docs/cn_doc.md">Cn</a></p> | ||
|
||
## Usage | ||
|
||
ChatGPT_PyBot is a command-line robot developed in Python. | ||
|
||
## Usage | ||
To use ChatGPT_PyBot, you need to have an openai account and use it on a machine that can log into the ChatGPT web version. | ||
|
||
## Install | ||
|
||
`ChatGPT_PyBot` has been uploaded to `Pypi`, you can execute the following code in the terminal to install | ||
|
||
```shell | ||
pip install ChatGPT_PyBot --upgrade | ||
``` | ||
|
||
Or you can install it via GitHub | ||
|
||
### install | ||
```shell | ||
pip install git+https://github.com/liuhuanshuo/ChatGPT_PyBot | ||
``` | ||
|
||
## Configuration (very important❗️) | ||
|
||
After the installation is complete, you need to configure the login file. ChatGPT_PyBot provides two ways to verify login. | ||
|
||
### Use account password | ||
|
||
Create a `config.json` file in the current directory with the following contents: | ||
|
||
```json | ||
{ | ||
"email":"<EMAIL>", | ||
"password": "<PASSWORD>" | ||
} | ||
``` | ||
|
||
Just fill in your account password. | ||
|
||
## Acknowledgments | ||
**Note:** If you use an account password in an area not supported by `openai`, you need to configure the terminal to go through proxy traffic, otherwise it will not be verified. | ||
|
||
You can use the following code to check your terminal ip address to ensure that the terminal ip address belongs to the available region | ||
|
||
```shell | ||
curl cip.cc | ||
``` | ||
|
||
### Use Cookie | ||
|
||
If the above configuration scheme does not work, then you can use the second method, don't worry, it is not difficult at all. | ||
|
||
First you need to log in to ChatGPT and press F12 or right-click - Check | ||
|
||
 | ||
|
||
click `Application` | ||
|
||
 | ||
|
||
Copy the `Cookie Value` as instructed below | ||
|
||
 | ||
|
||
Similarly, create a `config.json` file in the current directory with the following contents: | ||
|
||
```json | ||
{ | ||
"session_token":"Your Cookie Value" | ||
} | ||
``` | ||
|
||
## CLI Usage | ||
|
||
Open the terminal (command line), ensure that the current directory has the configured `config.json` file, execute `chatgpt` to enter the interactive dialog box | ||
|
||
```shell | ||
$ chatgpt | ||
``` | ||
|
||
 | ||
|
||
If you only need a single question, you can add your question directly after chatgpt | ||
|
||
```shell | ||
$ chatgpt your question | ||
``` | ||
|
||
 | ||
|
||
## Acknowledgments | ||
|
||
This project is inspired by [ChatGPT - A reverse engineering of OpenAI]( https://github.com/acheong08/ChatGPT) | ||
|