Skip to content

Commit

Permalink
Merge branch 'master' of github.com:xiangsx/gpt4free-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangsx committed Sep 10, 2023
2 parents 4628db7 + ffc23f4 commit 404da10
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 5 deletions.
148 changes: 148 additions & 0 deletions HowToUse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
## 1. 项目接口介绍

- /supports 查询项目支持哪些站点和哪些model
- /ask 简化后的请求和返回参数格式,后面会说明参数格式,等整个对话完成再返回
- /ask/stream 简化后的请求和返回参数格式,流式返回
- /:site/v1/chat/completions 和openai一致的请求和返回格式,需要把`:site`更换成`/supports`查询出来的`site``model`

## 2. 环境变量以及配置文件详细解释

### 2.1 环境变量
`.env`,运行之前需要删掉所有注释,不然会有问题,这里为了方便直接写在字段后面了,注意如果使用`docker-compose` 请直接把环境变量写到`docker-compose.yaml`
```
http_proxy=http://127.0.0.1:7890 #这里改为你的代理地址
RETRY=1 # 请求失败自动重试1次
rapid_api_key=${rapid_api_key} # 临时邮箱需要的key
EMAIL_TYPE=tempmail-lol # 使用的临时邮箱类型
COPILOT_POOL_SIZE=0 # copilot 账号数目
POE_POOL_SIZE=0 # 同上
# 多个用|分割
POE_PB=xxxxx|xxxxxx # poe的登录pb
#是否使用免费账号 1:不会校验账号是否是会员直接使用
POE_ALLOW_FREE=1
#是否忽略剩余数直接使用,1: 不论剩余多少都会尝试发送消息 0:剩余0之后就不发送了
POE_USE_IGNORE_LEFT=1
OEPNPROMPT_POOL_SIZE=0
#perplexity 需要的配置是下面3个
CHROME_PATH=google-chrome # 如果在容器中运行固定配置这个,不用修改
PERPLEXITY_POOL_SIZE=0
# 多个用|分割
PERPLEXITY_TOKEN=xxxxxx|xxxxxxx
# sincode站点相关变量,注意email和password要一一对应,多个用|分割
SINCODE_EMAIL=xxx|xxx|xxx
SINCODE_PASSWORD=xxx|xxx|xxx
SINCODE_POOL_SIZE=4
```

### 2.2 配置文件解释
run/config.json 负载均衡配置文件,需要把docker文件映射出来, 映射示例 `./run:/usr/src/app/run`**此文件可以在运行时修改,修改会实时生效**
配置好之后,接口site的值传auto
配置文件示例:
```
{
"site_map": {
"gpt-4": [
{
"site": "poe",
"priority": 20
},
{
"site": "perplexity",
"priority": 20
}
],
"gpt-3.5-turbo": [
{
"site": "bai",
"priority": 50
},
{
"site": "copilot",
"priority": 0
},
{
"site": "pweb",
"priority": 0
},
{
"site": "chur",
"priority": 10
},
{
"site": "poe",
"priority": 20
},
{
"site": "chatbase",
"priority": 30
}
],
"gpt-3.5-turbo-16k": [
{
"site": "chur",
"priority": 20
},
{
"site": "openprompt",
"priority": 30
},
{
"site": "poe",
"priority": 30
}
]
}
}
```




## 3. 部署教程

### 3.1 Docker
### 3.2 Docker Compose(推荐)

安装docker-compose 自行寻找教程安装

私人镜像需要运行命令
```shell
docker login
# 输入用户名密码
```
以使用poe为例,首先创建`docker-compose.yaml`文件
```
version: "3.9"
services:
gpt4free:
image: gpt4freets/gpt4free-ts:v0.0.46-private
ports:
- "3000:3000"
restart: always
volumes:
- ./run:/usr/src/app/run
environment:
- http_proxy=http://127.0.0.1:7890
- POE_PB=xxxxxxx|xxxxxxxxxxxxx
- POE_POOL_SIZE=1
```
`docker-compose.yaml`同级目录下,使用命令
```
docker-compose up -d
```
成功运行!访问 `服务地址:3000/poe/v1/chat/completions` 即可使用api

### 3.3 Sealos
### 3.4 Windows 版本docker

## 4. 接口参数说明

## 5. 接入其他平台教程

### 5.1 接入one api平台
### 5.2 接入沉浸式翻译

10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">

# GPT4Free TypeScript Version 🆓
###### Providing a free OpenAI GPT-4 API!
English | [中文](README_zh.md) | [日本語](README_ja.md)
Expand Down Expand Up @@ -79,6 +79,10 @@ deploy
docker-compose up --build -d
```

### Clash+one-api+gpt4free-ts Start with one command 😮

[gpt4free-ts-deploy](https://github.com/xiangsx/gpt4free-ts-deploy)

## 🚀 Let's Use GPT4

> Find supports model and site http://127.0.0.1:3000/supports [GET]
Expand Down Expand Up @@ -231,8 +235,8 @@ data: {"content":"done"}

## 👥 Wechat Group

<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/213d34c6-0640-4f49-b65f-e6178720d8af" width=240 />
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/5c79b921-f744-4b26-872d-e05436316215" width=240 />
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/4e14d056-a22e-43f7-972f-daaf2b36077e" width=240 />
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/da4a08c5-8340-4da1-9f6b-03780d56f5b3" width=240 />

## 🌟 Star History

Expand Down
10 changes: 8 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ docker run -p 3000:3000 --env-file .env xiangsx/gpt4free-ts:latest
docker-compose up --build -d
```

### 一站式整合clash+one-api+gpt4free-ts 无脑一键启动 😮

该项目整合了onapi(开箱即用的api售卖平台) + clash(项目运行所需代理) + upma(项目监控) + gpt4free-ts(项目本体)

[gpt4free-ts-deploy](https://github.com/xiangsx/gpt4free-ts-deploy)

### 使用Sealos详细部署教程 🌐

[详细教程](https://icloudnative.io/posts/completely-free-to-use-gpt4/)
Expand Down Expand Up @@ -424,8 +430,8 @@ data: {"content":"done"}
```
## 👥 加群细聊

<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/213d34c6-0640-4f49-b65f-e6178720d8af" width=240 />
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/5c79b921-f744-4b26-872d-e05436316215" width=240 />
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/4e14d056-a22e-43f7-972f-daaf2b36077e" width=240 />
<image src="https://github.com/xiangsx/gpt4free-ts/assets/29322721/da4a08c5-8340-4da1-9f6b-03780d56f5b3" width=240 />

## 🌟 Star History

Expand Down

0 comments on commit 404da10

Please sign in to comment.