Skip to content

Commit 3dd55c8

Browse files
author
Kerwin
committed
Merge remote-tracking branch 'github/main'
# Conflicts: # docker-compose/docker-compose.yml # pnpm-lock.yaml # service/pnpm-lock.yaml # service/src/chatgpt/index.ts
2 parents e33e5ad + 9bd88ea commit 3dd55c8

File tree

25 files changed

+2100
-1880
lines changed

25 files changed

+2100
-1880
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker-compose
2+
kubernetes

.github/workflows/issues_close.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Close inactive issues
2+
on:
3+
schedule:
4+
- cron: '30 1 * * *'
5+
6+
jobs:
7+
close-issues:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
steps:
13+
- uses: actions/stale@v5
14+
with:
15+
days-before-issue-stale: 10
16+
days-before-issue-close: 5
17+
stale-issue-label: stale
18+
stale-issue-message: This issue is stale because it has been open for 10 days with no activity.
19+
close-issue-message: This issue was closed because it has been inactive for 5 days since being marked as stale.
20+
days-before-pr-stale: -1
21+
days-before-pr-close: -1
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}

README.en.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ pnpm dev
183183
- `TIMEOUT_MS` timeout, in milliseconds, optional
184184
- `SOCKS_PROXY_HOST` optional, effective with SOCKS_PROXY_PORT
185185
- `SOCKS_PROXY_PORT` optional, effective with SOCKS_PROXY_HOST
186+
- `SOCKS_PROXY_USERNAME` optional, effective with SOCKS_PROXY_HOST and SOCKS_PROXY_PORT
187+
- `SOCKS_PROXY_PASSWORD` optional, effective with SOCKS_PROXY_HOST and SOCKS_PROXY_PORT
186188
- `HTTPS_PROXY` optional, support http,https, socks5
187189
- `ALL_PROXY` optional, support http,https, socks5
188190

@@ -237,6 +239,10 @@ services:
237239
SOCKS_PROXY_HOST: xxxx
238240
# socks proxy port, optional, effective with SOCKS_PROXY_HOST
239241
SOCKS_PROXY_PORT: xxxx
242+
# socks proxy, optional, effective with SOCKS_PROXY_HOST and SOCKS_PROXY_PORT
243+
SOCKS_PROXY_USERNAME: xxxx
244+
# socks proxy port, optional, effective with SOCKS_PROXY_HOST and SOCKS_PROXY_PORT
245+
SOCKS_PROXY_PASSWORD: xxxx
240246
# HTTPS Proxy,optional, support http, https, socks5
241247
HTTPS_PROXY: http://xxx:7890
242248
# Title for site
@@ -291,20 +297,22 @@ The `OPENAI_API_MODEL` is optional and only used when setting the `OPENAI_API_KE
291297

292298
#### Railway Environment Variables
293299

294-
| Environment Variable | Required | Description |
295-
| -------------------- | -------- | ------------------------------------------------------------------------------------------------- |
296-
| `PORT` | Required | Default: `3002` |
297-
| `AUTH_SECRET_KEY` | Optional | access password |
298-
| `TIMEOUT_MS` | Optional | Timeout in milliseconds |
299-
| `OPENAI_API_KEY` | Optional | Required for `OpenAI API`. `apiKey` can be obtained from [here](https://platform.openai.com/overview). |
300-
| `OPENAI_ACCESS_TOKEN`| Optional | Required for `Web API`. `accessToken` can be obtained from [here](https://chat.openai.com/api/auth/session).|
301-
| `OPENAI_API_BASE_URL` | Optional, only for `OpenAI API` | API endpoint. |
302-
| `OPENAI_API_MODEL` | Optional, only for `OpenAI API` | API model. |
303-
| `API_REVERSE_PROXY` | Optional, only for `Web API` | Reverse proxy address for `Web API`. [Details](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) |
304-
| `SOCKS_PROXY_HOST` | Optional, effective with `SOCKS_PROXY_PORT` | Socks proxy. |
305-
| `SOCKS_PROXY_PORT` | Optional, effective with `SOCKS_PROXY_HOST` | Socks proxy port. |
306-
| `HTTPS_PROXY` | Optional | HTTPS Proxy. |
307-
| `ALL_PROXY` | Optional | ALL Proxy. |
300+
| Environment Variable | Required | Description |
301+
|------------------------|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
302+
| `PORT` | Required | Default: `3002` |
303+
| `AUTH_SECRET_KEY` | Optional | access password |
304+
| `TIMEOUT_MS` | Optional | Timeout in milliseconds |
305+
| `OPENAI_API_KEY` | Optional | Required for `OpenAI API`. `apiKey` can be obtained from [here](https://platform.openai.com/overview). |
306+
| `OPENAI_ACCESS_TOKEN` | Optional | Required for `Web API`. `accessToken` can be obtained from [here](https://chat.openai.com/api/auth/session). |
307+
| `OPENAI_API_BASE_URL` | Optional, only for `OpenAI API` | API endpoint. |
308+
| `OPENAI_API_MODEL` | Optional, only for `OpenAI API` | API model. |
309+
| `API_REVERSE_PROXY` | Optional, only for `Web API` | Reverse proxy address for `Web API`. [Details](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) |
310+
| `SOCKS_PROXY_HOST` | Optional, effective with `SOCKS_PROXY_PORT` | Socks proxy. |
311+
| `SOCKS_PROXY_PORT` | Optional, effective with `SOCKS_PROXY_HOST` | Socks proxy port. |
312+
| `SOCKS_PROXY_USERNAME` | Optional, effective with `SOCKS_PROXY_HOST` & `SOCKS_PROXY_PORT` | Socks proxy username. |
313+
| `SOCKS_PROXY_PASSWORD` | Optional, effective with `SOCKS_PROXY_HOST` & `SOCKS_PROXY_PORT` | Socks proxy password. |
314+
| `HTTPS_PROXY` | Optional | HTTPS Proxy. |
315+
| `ALL_PROXY` | Optional | ALL Proxy. |
308316

309317
> Note: Changing environment variables in Railway will cause re-deployment.
310318

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ pnpm dev
170170
- `OPENAI_API_KEY``OPENAI_ACCESS_TOKEN` 二选一
171171
- `OPENAI_API_MODEL` 设置模型,可选,默认:`gpt-3.5-turbo`
172172
- `OPENAI_API_BASE_URL` 设置接口地址,可选,默认:`https://api.openai.com`
173+
- `OPENAI_API_DISABLE_DEBUG` 设置接口关闭 debug 日志,可选,默认:empty 不关闭
173174

174175
`ACCESS_TOKEN` 可用:
175176

@@ -312,6 +313,8 @@ volumes:
312313
| `API_REVERSE_PROXY` | 可选,`Web API` 时可用 | `Web API` 反向代理地址 [详情](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) |
313314
| `SOCKS_PROXY_HOST` | 可选,和 `SOCKS_PROXY_PORT` 一起时生效 | Socks代理 |
314315
| `SOCKS_PROXY_PORT` | 可选,和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理端口 |
316+
| `SOCKS_PROXY_USERNAME` | 可选,和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理用户名 |
317+
| `SOCKS_PROXY_PASSWORD` | 可选,和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理密码 |
315318
| `HTTPS_PROXY` | 可选 | HTTPS 代理,支持 http,https, socks5 |
316319
| `ALL_PROXY` | 可选 | 所有代理 代理,支持 http,https, socks5 |
317320

docker-compose/docker-compose.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ services:
1212
environment:
1313
TZ: Asia/Shanghai
1414
# 二选一
15-
OPENAI_API_KEY: sk-xxx
15+
OPENAI_API_KEY:
1616
# 二选一
17-
OPENAI_ACCESS_TOKEN: xxx
17+
OPENAI_ACCESS_TOKEN:
1818
# API接口地址,可选,设置 OPENAI_API_KEY 时可用
19-
OPENAI_API_BASE_URL: xxx
19+
OPENAI_API_BASE_URL:
2020
# API模型,可选,设置 OPENAI_API_KEY 时可用
21-
OPENAI_API_MODEL: xxx
21+
OPENAI_API_MODEL:
2222
# 反向代理,可选
23-
API_REVERSE_PROXY: xxx
23+
API_REVERSE_PROXY:
2424
# 访问jwt加密参数,可选 不为空则允许登录 同时需要设置 MONGODB_URL
25-
AUTH_SECRET_KEY: xxx
25+
AUTH_SECRET_KEY:
2626
# 每小时最大请求次数,可选,默认无限
2727
MAX_REQUEST_PER_HOUR: 0
2828
# 超时,单位毫秒,可选
2929
TIMEOUT_MS: 60000
3030
# Socks代理,可选,和 SOCKS_PROXY_PORT 一起时生效
31-
SOCKS_PROXY_HOST: xxx
31+
SOCKS_PROXY_HOST:
3232
# Socks代理端口,可选,和 SOCKS_PROXY_HOST 一起时生效
33-
SOCKS_PROXY_PORT: xxx
33+
SOCKS_PROXY_PORT:
34+
# Socks代理用户名,可选,和 SOCKS_PROXY_HOST & SOCKS_PROXY_PORT 一起时生效
35+
SOCKS_PROXY_USERNAME:
36+
# Socks代理密码,可选,和 SOCKS_PROXY_HOST & SOCKS_PROXY_PORT 一起时生效
37+
SOCKS_PROXY_PASSWORD:
3438
# HTTPS_PROXY 代理,可选
3539
HTTPS_PROXY: http://xxxx:7890
3640
# 网站名称

kubernetes/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 增加一个Kubernetes的部署方式
2+
```
3+
kubectl apply -f deploy.yaml
4+
```
5+
6+
### 如果需要Ingress域名接入
7+
```
8+
kubectl apply -f ingress.yaml
9+
```

kubernetes/deploy.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: chatgpt-web
5+
labels:
6+
app: chatgpt-web
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: chatgpt-web
12+
strategy:
13+
type: RollingUpdate
14+
template:
15+
metadata:
16+
labels:
17+
app: chatgpt-web
18+
spec:
19+
containers:
20+
- image: chenzhaoyu94/chatgpt-web
21+
name: chatgpt-web
22+
imagePullPolicy: Always
23+
ports:
24+
- containerPort: 3002
25+
env:
26+
- name: OPENAI_API_KEY
27+
value: sk-xxx
28+
- name: OPENAI_API_BASE_URL
29+
value: 'https://api.openai.com'
30+
- name: OPENAI_API_MODEL
31+
value: gpt-3.5-turbo
32+
- name: API_REVERSE_PROXY
33+
value: https://bypass.duti.tech/api/conversation
34+
- name: AUTH_SECRET_KEY
35+
value: '123456'
36+
- name: TIMEOUT_MS
37+
value: '60000'
38+
- name: SOCKS_PROXY_HOST
39+
value: ''
40+
- name: SOCKS_PROXY_PORT
41+
value: ''
42+
- name: HTTPS_PROXY
43+
value: ''
44+
resources:
45+
limits:
46+
cpu: 500m
47+
memory: 500Mi
48+
requests:
49+
cpu: 300m
50+
memory: 300Mi
51+
---
52+
apiVersion: v1
53+
kind: Service
54+
metadata:
55+
labels:
56+
app: chatgpt-web
57+
name: chatgpt-web
58+
spec:
59+
ports:
60+
- name: chatgpt-web
61+
port: 3002
62+
protocol: TCP
63+
targetPort: 3002
64+
selector:
65+
app: chatgpt-web
66+
type: ClusterIP

kubernetes/ingress.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: networking.k8s.io/v1
2+
kind: Ingress
3+
metadata:
4+
annotations:
5+
kubernetes.io/ingress.class: nginx
6+
nginx.ingress.kubernetes.io/proxy-connect-timeout: '5'
7+
name: chatgpt-web
8+
spec:
9+
rules:
10+
- host: chatgpt.example.com
11+
http:
12+
paths:
13+
- backend:
14+
service:
15+
name: chatgpt-web
16+
port:
17+
number: 3002
18+
path: /
19+
pathType: ImplementationSpecific
20+
tls:
21+
- secretName: chatgpt-web-tls

0 commit comments

Comments
 (0)