Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
liuhuanshuo committed Dec 9, 2022
1 parent 6d2c1ad commit 1150365
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 12 deletions.
20 changes: 12 additions & 8 deletions Docs/cn_doc.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## ChatGPT_PyBot
# 使用说明

ChatGPT_PyBot 是一个基于 Python 开发的命令行机器人。


## 使用说明

若要使用`ChatGPT_PyBot`,你需要拥有一个openai账号,且在一台可以正常登录到`ChatGPT`网页版的机器上进行。
若要使用`ChatGPT_PyBot`**你需要拥有一个openai账号,且在一台可以正常登录到`ChatGPT`网页版的机器上进行**

## 安装

Expand Down Expand Up @@ -41,15 +39,15 @@ pip install git+https://github.com/liuhuanshuo/ChatGPT_PyBot

注意:如果你在`openai`所不支持的地区使用账号密码,需要配置终端走代理流量,否则会无法验证。

你可以使用如下代码检查你的终端ip地址
你可以使用如下代码检查你的终端ip地址已确保终端的ip属于可用区域

```shell
curl cip.cc
```

### 使用Cookie

如果你在`openai`所不支持的地区使用账号密码方式,即使使用代理终端,可以依旧会无法验证,这时可以使用第二种方式
如果上面的配置方案没有作用,这时可以使用第二种方式,别担心,一点也不困难

首先需要登录ChatGPT,并按下F12或者 右键 - 检查

Expand Down Expand Up @@ -91,4 +89,10 @@ $ chatgpt
$ chatgpt your question
```

![](https://pic.liuzaoqi.com/picgo/202212091119492.png)
![](https://pic.liuzaoqi.com/picgo/202212091119492.png)



## 致谢

本项目从[ChatGPT - 一个OpenAI 的逆向工程]( https://github.com/acheong08/ChatGPT)中得到灵感。
79 changes: 75 additions & 4 deletions readme.md
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

![](https://pic.liuzaoqi.com/picgo/202212091104801.png)

click `Application`

![](https://pic.liuzaoqi.com/picgo/202212091105819.png)

Copy the `Cookie Value` as instructed below

![](https://pic.liuzaoqi.com/picgo/202212091107424.png)

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

![](https://pic.liuzaoqi.com/picgo/202212091115468.png)

If you only need a single question, you can add your question directly after chatgpt

```shell
$ chatgpt your question
```

![](https://pic.liuzaoqi.com/picgo/202212091119492.png)

## Acknowledgments

This project is inspired by [ChatGPT - A reverse engineering of OpenAI]( https://github.com/acheong08/ChatGPT)

0 comments on commit 1150365

Please sign in to comment.