Skip to content

Commit 0a60a87

Browse files
committed
Merge branch 'main' into reset
# Conflicts: # app/components/settings.tsx
2 parents 506cdbc + a64c438 commit 0a60a87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2644
-1122
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"extends": "next/core-web-vitals"
2+
"extends": "next/core-web-vitals",
3+
"plugins": ["prettier"]
34
}

.github/workflows/docker.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Publish Docker image
22

33
on:
4+
workflow_dispatch:
45
release:
56
types: [published]
67

@@ -9,25 +10,43 @@ jobs:
910
name: Push Docker image to Docker Hub
1011
runs-on: ubuntu-latest
1112
steps:
12-
- name: Check out the repo
13+
-
14+
name: Check out the repo
1315
uses: actions/checkout@v3
14-
15-
- name: Log in to Docker Hub
16-
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
16+
-
17+
name: Log in to Docker Hub
18+
uses: docker/login-action@v2
1719
with:
1820
username: ${{ secrets.DOCKER_USERNAME }}
1921
password: ${{ secrets.DOCKER_PASSWORD }}
2022

21-
- name: Extract metadata (tags, labels) for Docker
23+
-
24+
name: Extract metadata (tags, labels) for Docker
2225
id: meta
23-
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
26+
uses: docker/metadata-action@v4
2427
with:
2528
images: yidadaa/chatgpt-next-web
29+
tags: |
30+
type=raw,value=latest
31+
type=ref,event=tag
32+
33+
-
34+
name: Set up QEMU
35+
uses: docker/setup-qemu-action@v2
36+
37+
-
38+
name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v2
2640

27-
- name: Build and push Docker image
28-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
41+
-
42+
name: Build and push Docker image
43+
uses: docker/build-push-action@v4
2944
with:
3045
context: .
46+
platforms: linux/amd64
3147
push: true
3248
tags: ${{ steps.meta.outputs.tags }}
3349
labels: ${{ steps.meta.outputs.labels }}
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+

.github/workflows/sync.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Upstream Sync
2+
3+
on:
4+
schedule:
5+
- cron: '0 */12 * * *' # every 12 hours
6+
workflow_dispatch: # on button click
7+
8+
jobs:
9+
sync_latest_from_upstream:
10+
name: Sync latest commits from upstream repo
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
# Step 1: run a standard checkout action, provided by github
15+
- name: Checkout target repo
16+
uses: actions/checkout@v3
17+
18+
# Step 2: run the sync action
19+
- name: Sync upstream changes
20+
id: sync
21+
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
22+
with:
23+
upstream_sync_repo: Yidadaa/ChatGPT-Next-Web
24+
upstream_sync_branch: main
25+
target_sync_branch: main
26+
target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
27+
28+
# Set test_mode true to run tests instead of the true action!!
29+
test_mode: false

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ yarn-error.log*
3434
# typescript
3535
*.tsbuildinfo
3636
next-env.d.ts
37-
dev
37+
dev
38+
39+
public/prompts.json

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.lintstagedrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"./app/**/*.{js,ts,jsx,tsx,json,html,css,md}": [
3+
"eslint --fix",
4+
"prettier --write"
5+
]
6+
}

.prettierrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
printWidth: 80,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: true,
6+
singleQuote: false,
7+
trailingComma: 'all',
8+
bracketSpacing: true,
9+
arrowParens: 'always',
10+
};

Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ RUN apk add --no-cache libc6-compat
66

77
WORKDIR /app
88

9-
COPY package.json yarn.lock* package-lock.json* ./
9+
COPY package.json yarn.lock ./
1010

11-
RUN \
12-
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
13-
elif [ -f package-lock.json ]; then npm ci; \
14-
else echo "Lockfile not found." && exit 1; \
15-
fi
11+
RUN yarn install
1612

1713
FROM base AS builder
1814

README.md

Lines changed: 63 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
One-Click to deploy your own ChatGPT web UI.
99

10-
[演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [加入 Discord](https://discord.gg/zrhvHCr79N) / [微信群](https://user-images.githubusercontent.com/16968934/227772522-b3ba3713-9206-4c8d-a81f-22300b7c313a.jpg) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg)
10+
[演示 Demo](https://chat-gpt-next-web.vercel.app/) / [反馈 Issues](https://github.com/Yidadaa/ChatGPT-Next-Web/issues) / [加入 Discord](https://discord.gg/zrhvHCr79N) / [QQ 群](https://user-images.githubusercontent.com/16968934/228190818-7dd00845-e9b9-4363-97e5-44c507ac76da.jpeg) / [打赏开发者](https://user-images.githubusercontent.com/16968934/227772541-5bcd52d8-61b7-488c-a203-0330d8006e2b.jpg) / [Donate](#捐赠-donate-usdt)
1111

12-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web)
12+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web)
1313

1414
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Yidadaa/ChatGPT-Next-Web)
1515

@@ -22,6 +22,7 @@ One-Click to deploy your own ChatGPT web UI.
2222
- 在 1 分钟内使用 Vercel **免费一键部署**
2323
- 精心设计的 UI,响应式设计,支持深色模式
2424
- 极快的首屏加载速度(~85kb)
25+
- 海量的内置 prompt 列表,来自[中文](https://github.com/PlexPt/awesome-chatgpt-prompts-zh)[英文](https://github.com/f/awesome-chatgpt-prompts)
2526
- 自动压缩上下文聊天记录,在节省 Token 的同时支持超长对话
2627
- 一键导出聊天记录,完整的 Markdown 支持
2728
- 拥有自己的域名?好上加好,绑定后即可在任何地方**无障碍**快速访问
@@ -31,22 +32,33 @@ One-Click to deploy your own ChatGPT web UI.
3132
- **Deploy for free with one-click** on Vercel in under 1 minute
3233
- Responsive design, and dark mode
3334
- Fast first screen loading speed (~85kb)
35+
- Awesome prompts powered by [awesome-chatgpt-prompts-zh](https://github.com/PlexPt/awesome-chatgpt-prompts-zh) and [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts)
3436
- Automatically compresses chat history to support long conversations while also saving your tokens
3537
- One-click export all chat history with full Markdown support
3638

37-
## 使用
39+
## 开发计划 Roadmap
40+
- System Prompt: pin a user defined prompt as system prompt 为每个对话设置系统 Prompt [#138](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/138)
41+
- User Prompt: user can edit and save custom prompts to prompt list 允许用户自行编辑内置 Prompt 列表
42+
- Self-host Model: support llama, alpaca, ChatGLM, BELLE etc. 支持自部署的大语言模型
43+
- Plugins: support network search, caculator, any other apis etc. 插件机制,支持联网搜索、计算器、调用其他平台 api [#165](https://github.com/Yidadaa/ChatGPT-Next-Web/issues/165)
44+
45+
### 不会开发的功能 Not in Plan
46+
- User login, accounts, cloud sync 用户登陆、账号管理、消息云同步
47+
- UI text customize 界面文字自定义
48+
49+
## 开始使用
3850

3951
1. 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys);
4052
2. 点击右侧按钮开始部署:
41-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登陆即可,记得在环境变量页填入 API Key;
53+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web),直接使用 Github 账号登陆即可,记得在环境变量页填入 API Key;
4254
3. 部署完毕后,即可开始使用;
4355
4. (可选)[绑定自定义域名](https://vercel.com/docs/concepts/projects/domains/add-a-domain):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。
4456

4557
## Get Started
4658

4759
1. Get [OpenAI API Key](https://platform.openai.com/account/api-keys);
4860
2. Click
49-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web);
61+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FYidadaa%2FChatGPT-Next-Web&env=OPENAI_API_KEY&env=CODE&project-name=chatgpt-next-web&repository-name=ChatGPT-Next-Web);
5062
3. Enjoy :)
5163

5264
## 保持更新 Keep Updated
@@ -76,24 +88,56 @@ This project will be continuously maintained. If you want to keep the code repos
7688

7789
You can star or watch this project or follow author to get release notifictions in time.
7890

79-
## 访问控制 Access Control
91+
## 配置密码 Password
8092

81-
本项目提供有限的权限控制功能,请在环境变量页增加名为 `CODE` 的环境变量,值为用英文逗号分隔的自定义控制码
93+
本项目提供有限的权限控制功能,请在 Vercel 项目控制面板的环境变量页增加名为 `CODE` 的环境变量,值为用英文逗号分隔的自定义密码
8294

8395
```
8496
code1,code2,code3
8597
```
8698

8799
增加或修改该环境变量后,请**重新部署**项目使改动生效。
88100

89-
This project provides limited access control. Please add an environment variable named `CODE` on the environment variables page. The value should be a custom control code separated by comma like this:
101+
This project provides limited access control. Please add an environment variable named `CODE` on the vercel environment variables page. The value should be passwords separated by comma like this:
90102

91103
```
92104
code1,code2,code3
93105
```
94106

95107
After adding or modifying this environment variable, please redeploy the project for the changes to take effect.
96108

109+
## 环境变量 Environment Variables
110+
111+
### `OPENAI_API_KEY` (required)
112+
113+
OpanAI 密钥。
114+
115+
Your openai api key.
116+
117+
### `CODE` (optional)
118+
119+
访问密码,可选,可以使用逗号隔开多个密码。
120+
121+
Access passsword, separated by comma.
122+
123+
### `BASE_URL` (optional)
124+
125+
> Default: `api.openai.com`
126+
127+
OpenAI 接口代理 URL。
128+
129+
Override openai api request base url.
130+
131+
### `PROTOCOL` (optional)
132+
133+
> Default: `https`
134+
135+
> Values: `http` | `https`
136+
137+
OpenAI 接口协议。
138+
139+
Override openai api request protocol.
140+
97141
## 开发 Development
98142

99143
点击下方按钮,开始二次开发:
@@ -117,16 +161,8 @@ OPENAI_API_KEY=<your api key here>
117161

118162
### 本地部署 Local Deployment
119163

120-
请直接询问 ChatGPT,使用下列 Prompt:
121-
122-
```
123-
如何使用 pm2 和 yarn 部署 nextjs 项目到 ubuntu 服务器上,项目编译命令为 yarn build,启动命令为 yarn start,启动时需要设置环境变量为 OPENAI_API_KEY,端口为 3000,使用 ngnix 做反向代理
124-
```
125-
126-
Please ask ChatGPT with prompt:
127-
128-
```
129-
how to deploy nextjs project with pm2 and yarn on my ubuntu server, the build command is `yarn build`, the start command is `yarn start`, the project must start with env var named `OPENAI_API_KEY`, the port is 3000, use ngnix
164+
```shell
165+
bash <(curl -s https://raw.githubusercontent.com/Yidadaa/ChatGPT-Next-Web/main/scripts/setup.sh)
130166
```
131167

132168
### 容器部署 Docker Deployment
@@ -143,29 +179,26 @@ docker run -d -p 3000:3000 -e OPENAI_API_KEY="" -e CODE="" yidadaa/chatgpt-next-
143179

144180
![更多展示 More](./static/more.png)
145181

146-
## 说明 Attention
147-
148-
本项目的演示地址所用的 OpenAI 账户的免费额度将于 2023-04-01 过期,届时将无法通过演示地址在线体验。
149-
150-
如果你想贡献出自己的 API Key,可以通过作者主页的邮箱发送给作者,并标注过期时间。
151182

152-
The free trial of the OpenAI account used by the demo will expire on April 1, 2023, and the demo will not be available at that time.
153-
154-
If you would like to contribute your API key, you can email it to the author and indicate the expiration date of the API key.
183+
## 捐赠 Donate USDT
184+
> BNB Smart Chain (BEP 20)
185+
```
186+
0x67cD02c7EB62641De576a1fA3EdB32eA0c3ffD89
187+
```
155188

156189
## 鸣谢 Special Thanks
157190

158191
### 捐赠者 Sponsor
159192

160193
[@mushan0x0](https://github.com/mushan0x0)
161194
[@ClarenceDan](https://github.com/ClarenceDan)
195+
[@zhangjia](https://github.com/zhangjia)
196+
[@hoochanlon](https://github.com/hoochanlon)
162197

163198
### 贡献者 Contributor
164199

165-
[@AprilNEA](https://github.com/AprilNEA)
166-
[@iSource](https://github.com/iSource)
167-
[@iFwu](https://github.com/iFwu)
200+
[Contributors](https://github.com/Yidadaa/ChatGPT-Next-Web/graphs/contributors)
168201

169202
## LICENSE
170203

171-
- [Anti 996 License](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN)
204+
[Anti 996 License](https://github.com/kattgu7/Anti-996-License/blob/master/LICENSE_CN_EN)

app/api/access.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ export function getAccessCodes(): Set<string> {
1414
}
1515

1616
export const ACCESS_CODES = getAccessCodes();
17+
export const IS_IN_DOCKER = process.env.DOCKER;

0 commit comments

Comments
 (0)