imseldrith commited on
Commit
3d83f0d
·
1 Parent(s): 98ee521

Upload with huggingface_hub (#1)

Browse files

- Upload with huggingface_hub (b90481c92f7e3e998d6819a52942afe6a382b7f4)

This view is limited to 50 files because it contains too many changes.   See raw diff
.commitlintrc.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "extends": ["@commitlint/config-conventional"]
3
+ }
.dockerignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ **/node_modules
2
+ */node_modules
3
+ node_modules
4
+ Dockerfile
5
+ .*
6
+ */.*
.editorconfig ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Editor configuration, see http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ indent_style = tab
8
+ indent_size = 2
9
+ end_of_line = lf
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
.env ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Glob API URL
2
+ VITE_GLOB_API_URL=/api
3
+
4
+ VITE_APP_API_BASE_URL=https://app-imseldrith.cloud.okteto.net:3002/
5
+
6
+ # Whether long replies are supported, which may result in higher API fees
7
+ VITE_GLOB_OPEN_LONG_REPLY=false
.eslintrc.cjs ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['@antfu'],
4
+ }
.gitattributes CHANGED
@@ -1,34 +1,17 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tflite filter=lfs diff=lfs merge=lfs -text
29
- *.tgz filter=lfs diff=lfs merge=lfs -text
30
- *.wasm filter=lfs diff=lfs merge=lfs -text
31
- *.xz filter=lfs diff=lfs merge=lfs -text
32
- *.zip filter=lfs diff=lfs merge=lfs -text
33
- *.zst filter=lfs diff=lfs merge=lfs -text
34
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ "*.vue" eol=lf
2
+ "*.js" eol=lf
3
+ "*.ts" eol=lf
4
+ "*.jsx" eol=lf
5
+ "*.tsx" eol=lf
6
+ "*.cjs" eol=lf
7
+ "*.cts" eol=lf
8
+ "*.mjs" eol=lf
9
+ "*.mts" eol=lf
10
+ "*.json" eol=lf
11
+ "*.html" eol=lf
12
+ "*.css" eol=lf
13
+ "*.less" eol=lf
14
+ "*.scss" eol=lf
15
+ "*.sass" eol=lf
16
+ "*.styl" eol=lf
17
+ "*.md" eol=lf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/build_docker.yml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: build_docker
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ release:
7
+ types: [created] # 表示在创建新的 Release 时触发
8
+
9
+ jobs:
10
+ build_docker:
11
+ name: Build docker
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v3
16
+
17
+ - run: |
18
+ echo "本次构建的版本为:${GITHUB_REF_NAME} (但是这个变量目前上下文中无法获取到)"
19
+ echo 本次构建的版本为:${{ github.ref_name }}
20
+ env
21
+
22
+ - name: Set up QEMU
23
+ uses: docker/setup-qemu-action@v2
24
+ - name: Set up Docker Buildx
25
+ uses: docker/setup-buildx-action@v2
26
+ - name: Login to DockerHub
27
+ uses: docker/login-action@v2
28
+ with:
29
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
30
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
31
+ - name: Build and push
32
+ id: docker_build
33
+ uses: docker/build-push-action@v4
34
+ with:
35
+ context: .
36
+ push: true
37
+ labels: ${{ steps.meta.outputs.labels }}
38
+ platforms: linux/amd64,linux/arm64
39
+ tags: |
40
+ ${{ secrets.DOCKERHUB_USERNAME }}/chatgpt-web:${{ github.ref_name }}
41
+ ${{ secrets.DOCKERHUB_USERNAME }}/chatgpt-web:latest
.github/workflows/ci.yml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ pull_request:
9
+ branches:
10
+ - main
11
+
12
+ jobs:
13
+ lint:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - name: Set node
18
+ uses: actions/setup-node@v3
19
+ with:
20
+ node-version: 18.x
21
+
22
+ - name: Setup
23
+ run: npm i -g @antfu/ni
24
+
25
+ - name: Install
26
+ run: nci
27
+
28
+ - name: Lint
29
+ run: nr lint:fix
30
+
31
+ typecheck:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v3
35
+ - name: Set node
36
+ uses: actions/setup-node@v3
37
+ with:
38
+ node-version: 18.x
39
+
40
+ - name: Setup
41
+ run: npm i -g @antfu/ni
42
+
43
+ - name: Install
44
+ run: nci
45
+
46
+ - name: Typecheck
47
+ run: nr type-check
.gitignore ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ .DS_Store
12
+ dist
13
+ dist-ssr
14
+ coverage
15
+ *.local
16
+
17
+ /cypress/videos/
18
+ /cypress/screenshots/
19
+
20
+ # Editor directories and files
21
+ .vscode/*
22
+ !.vscode/settings.json
23
+ !.vscode/extensions.json
24
+ .idea
25
+ *.suo
26
+ *.ntvs*
27
+ *.njsproj
28
+ *.sln
29
+ *.sw?
30
+
31
+ # Environment variables files
32
+ /service/.env
.husky/commit-msg ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx --no -- commitlint --edit
.husky/pre-commit ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
.npmrc ADDED
@@ -0,0 +1 @@
 
 
1
+ strict-peer-dependencies=false
.vscode/extensions.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "recommendations": ["Vue.volar", "dbaeumer.vscode-eslint"]
3
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "prettier.enable": false,
3
+ "editor.formatOnSave": false,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": true
6
+ },
7
+ "eslint.validate": [
8
+ "javascript",
9
+ "javascriptreact",
10
+ "typescript",
11
+ "typescriptreact",
12
+ "vue",
13
+ "html",
14
+ "json",
15
+ "jsonc",
16
+ "json5",
17
+ "yaml",
18
+ "yml",
19
+ "markdown"
20
+ ],
21
+ "cSpell.words": [
22
+ "antfu",
23
+ "axios",
24
+ "bumpp",
25
+ "chatgpt",
26
+ "chenzhaoyu",
27
+ "commitlint",
28
+ "davinci",
29
+ "dockerhub",
30
+ "esno",
31
+ "GPTAPI",
32
+ "highlightjs",
33
+ "hljs",
34
+ "iconify",
35
+ "katex",
36
+ "katexmath",
37
+ "linkify",
38
+ "logprobs",
39
+ "mdhljs",
40
+ "nodata",
41
+ "OPENAI",
42
+ "pinia",
43
+ "Popconfirm",
44
+ "rushstack",
45
+ "Sider",
46
+ "tailwindcss",
47
+ "traptitech",
48
+ "tsup",
49
+ "Typecheck",
50
+ "unplugin",
51
+ "VITE",
52
+ "vueuse",
53
+ "Zhao"
54
+ ],
55
+ "i18n-ally.enabledParsers": [
56
+ "ts"
57
+ ],
58
+ "i18n-ally.sortKeys": true,
59
+ "i18n-ally.keepFulfilled": true,
60
+ "i18n-ally.localesPaths": [
61
+ "src/locales"
62
+ ],
63
+ "i18n-ally.keystyle": "nested"
64
+ }
CHANGELOG.md ADDED
@@ -0,0 +1,479 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## v2.10.5
2
+
3
+ `2023-03-13`
4
+
5
+ 更新依赖,`access_token` 默认代理为 [acheong08](https://github.com/acheong08) 的 `https://bypass.duti.tech/api/conversation`
6
+
7
+ ## Feature
8
+ - `Prompt` 商店在线导入可以导入两种 `recommend.json`里提到的模板 [simonwu53](https://github.com/Chanzhaoyu/chatgpt-web/pull/521)
9
+ - 支持 `HTTPS_PROXY` [whatwewant](https://github.com/Chanzhaoyu/chatgpt-web/pull/308)
10
+ - `Prompt` 添加查询筛选
11
+
12
+ ## Enhancement
13
+ - 调整输入框最大行数 [yi-ge](https://github.com/Chanzhaoyu/chatgpt-web/pull/502)
14
+ - 优化 `docker` 打包 [whatwewant](https://github.com/Chanzhaoyu/chatgpt-web/pull/520)
15
+ - `Prompt` 添加翻译和优化布局
16
+ - 「繁体中文」补全和审阅 [PeterDaveHello](https://github.com/Chanzhaoyu/chatgpt-web/pull/542)
17
+ - 语言选择调整为下路框形式
18
+ - 权限输入框类型调整为密码形式
19
+
20
+ ## BugFix
21
+ - `JSON` 导入检查 [Nothing1024](https://github.com/Chanzhaoyu/chatgpt-web/pull/523)
22
+ - 修复 `AUTH_SECRET_KEY` 模式下跨域异常并添加对 `node.js 19` 版本的支持 [yi-ge](https://github.com/Chanzhaoyu/chatgpt-web/pull/499)
23
+ - 确定清空上下文时不应该重置会话标题
24
+
25
+ ## Other
26
+ - 调整文档
27
+ - 更新依赖
28
+
29
+ ## v2.10.4
30
+
31
+ `2023-03-11`
32
+
33
+ ## Feature
34
+ - 感谢 [Nothing1024](https://github.com/Chanzhaoyu/chatgpt-web/pull/268) 添加 `Prompt` 模板和 `Prompt` 商店支持
35
+
36
+ ## Enhancement
37
+ - 设置添加关闭按钮[#495]
38
+
39
+ ## Demo
40
+
41
+ ![Prompt](https://camo.githubusercontent.com/6a51af751eb29238cb7ef4f8fbd89f63db837562f97f33273095424e62dc9194/68747470733a2f2f73312e6c6f63696d672e636f6d2f323032332f30332f30342f333036326665633163613562632e676966)
42
+
43
+ ## v2.10.3
44
+
45
+ `2023-03-10`
46
+
47
+ > 声明:除 `ChatGPTUnofficialProxyAPI` 使用的非官方代理外,本项目代码包括上游引用包均开源在 `GitHub`,如果你觉得本项目有监控后门或有问题导致你的账号、API被封,那我很抱歉。我可能`BUG`写的多,但我不缺德。此次主要为前端界面调整,周末愉快。
48
+
49
+ ## Feature
50
+ - 支持长回复 [[yi-ge](https://github.com/Chanzhaoyu/chatgpt-web/pull/450)][[详情](https://github.com/Chanzhaoyu/chatgpt-web/pull/450)]
51
+ - 支持 `PWA` [[chenxch](https://github.com/Chanzhaoyu/chatgpt-web/pull/452)]
52
+
53
+ ## Enhancement
54
+ - 调整移动端按钮和优化布局
55
+ - 调整 `iOS` 上安全距离
56
+ - 简化 `docker-compose` 部署 [[cloudGrin](https://github.com/Chanzhaoyu/chatgpt-web/pull/466)]
57
+
58
+ ## BugFix
59
+ - 修复清空会话侧边栏标题不会重置的问题 [[RyanXinOne](https://github.com/Chanzhaoyu/chatgpt-web/pull/453)]
60
+ - 修复设置文字过长时导致的设置按钮消失的问题
61
+
62
+ ## Other
63
+ - 更新依赖
64
+
65
+ ## v2.10.2
66
+
67
+ `2023-03-09`
68
+
69
+ 衔接 `2.10.1` 版本[详情](https://github.com/Chanzhaoyu/chatgpt-web/releases/tag/v2.10.1)
70
+
71
+ ## Enhancement
72
+ - 移动端下输入框获得焦点时左侧按钮隐藏
73
+
74
+ ## BugFix
75
+ - 修复 `2.10.1` 中添加 `OPENAI_API_MODEL` 变量的判断错误,会导致默认模型指定失效,抱歉
76
+ - 回退 `2.10.1` 中前端变量影响 `Docker` 打包
77
+
78
+ ## v2.10.1
79
+
80
+ `2023-03-09`
81
+
82
+ 注意:删除了 `.env` 文件改用 `.env.example` 代替,如果是手动部署的同学现在需要手动创建 `.env` 文件并从 `.env.example` 中复制需要的变量,并且 `.env` 文件现在会在 `Git` 提交中被忽略,原因如下:
83
+
84
+ - 在项目中添加 `.env` 从一开始就是个错误的示范
85
+ - 如果是 `Fork` 项目进行修改测试总是会被 `Git` 修改提示给打扰
86
+ - 感谢 [yi-ge](https://github.com/Chanzhaoyu/chatgpt-web/pull/395) 的提醒和修改
87
+
88
+
89
+ 这两天开始,官方已经开始对第三方代理进行了拉闸, `accessToken` 即将或已经开始可能会不可使用。异常 `API` 使用也开始封号,封号缘由不明,如果出现使用 `API` 提示错误,请查看后端控制台信息,或留意邮箱。
90
+
91
+ ## Feature
92
+ - 感谢 [CornerSkyless](https://github.com/Chanzhaoyu/chatgpt-web/pull/393) 添加是否发送上下文开关功能
93
+
94
+ ## Enhancement
95
+ - 感谢 [nagaame](https://github.com/Chanzhaoyu/chatgpt-web/pull/415) 优化`docker`打包镜像文件过大的问题
96
+ - 感谢 [xieccc](https://github.com/Chanzhaoyu/chatgpt-web/pull/404) 新增 `API` 模型配置变量 `OPENAI_API_MODEL`
97
+ - 感谢 [acongee](https://github.com/Chanzhaoyu/chatgpt-web/pull/394) 优化输出时滚动条问题
98
+
99
+ ## BugFix
100
+ - 感谢 [CornerSkyless](https://github.com/Chanzhaoyu/chatgpt-web/pull/392) 修复导出图片会丢失头像的问题
101
+ - 修复深色模式导出图片的样式问题
102
+
103
+
104
+ ## v2.10.0
105
+
106
+ `2023-03-07`
107
+
108
+ - 老规矩,手动部署的同学需要删除 `node_modules` 安装包重新安装降低出错概率,其他部署不受影响,但是可能会有缓存问题。
109
+ - 虽然说了更新放缓,但是 `issues` 不看, `PR` 不改我睡不着,我的邮箱从每天早上`8`点到凌晨`12`永远在滴滴滴,所以求求各位,超时的`issues`自己关闭下哈,我真的需要缓冲一下。
110
+ - 演示图片请看最后
111
+
112
+ ## Feature
113
+ - 添加权限功能,用法��`service/.env` 中的 `AUTH_SECRET_KEY` 变量添加密码
114
+ - 感谢 [PeterDaveHello](https://github.com/Chanzhaoyu/chatgpt-web/pull/348) 添加「繁体中文」翻译
115
+ - 感谢 [GermMC](https://github.com/Chanzhaoyu/chatgpt-web/pull/369) 添加聊天记录导入、导出、清空的功能
116
+ - 感谢 [CornerSkyless](https://github.com/Chanzhaoyu/chatgpt-web/pull/374) 添加会话保存为本地图片的功能
117
+
118
+
119
+ ## Enhancement
120
+ - 感谢 [CornerSkyless](https://github.com/Chanzhaoyu/chatgpt-web/pull/363) 添加 `ctrl+enter` 发送消息
121
+ - 现在新消息只有在结束了之后才滚动到底部,而不是之前的强制性
122
+ - 优化部分代码
123
+
124
+ ## BugFix
125
+ - 转义状态码前端显示,防止直接暴露 `key`(我可能需要更多的状态码补充)
126
+
127
+ ## Other
128
+ - 更新依赖到最新
129
+
130
+ ## 演示
131
+ > 不是界面最新效果,有美化改动
132
+
133
+ 权限
134
+
135
+ ![权限](https://user-images.githubusercontent.com/24789441/223438518-80d58d42-e344-4e39-b87c-251ff73925ed.png)
136
+
137
+ 聊天记录导出
138
+
139
+ ![聊天记录导出](https://user-images.githubusercontent.com/57023771/223372153-6d8e9ec1-d82c-42af-b4bd-232e50504a25.gif)
140
+
141
+ 保存图片到本地
142
+
143
+ ![保存图片到本地](https://user-images.githubusercontent.com/13901424/223423555-b69b95ef-8bcf-4951-a7c9-98aff2677e18.gif)
144
+
145
+ ## v2.9.3
146
+
147
+ `2023-03-06`
148
+
149
+ ## Enhancement
150
+ - 感谢 [ChandlerVer5](https://github.com/Chanzhaoyu/chatgpt-web/pull/305) 使用 `markdown-it` 替换 `marked`,解决代码块闪烁的问题
151
+ - 感谢 [shansing](https://github.com/Chanzhaoyu/chatgpt-web/pull/277) 改善文档
152
+ - 感谢 [nalf3in](https://github.com/Chanzhaoyu/chatgpt-web/pull/293) 添加英文翻译
153
+
154
+ ## BugFix
155
+ - 感谢[sepcnt ](https://github.com/Chanzhaoyu/chatgpt-web/pull/279) 修复切换记录时编辑状态未关闭的问题
156
+ - 修复复制代码的兼容性报错问题
157
+ - 修复部分优化小问题
158
+
159
+ ## v2.9.2
160
+
161
+ `2023-03-04`
162
+
163
+ 手动部署的同学,务必删除根目录和`service`中的`node_modules`重新安装依赖,降低出现问题的概率,自动部署的不需要做改动。
164
+
165
+ ### Feature
166
+ - 感谢 [hyln9](https://github.com/Chanzhaoyu/chatgpt-web/pull/247) 添加对渲染 `LaTex` 数学公式的支持
167
+ - 感谢 [ottocsb](https://github.com/Chanzhaoyu/chatgpt-web/pull/227) 添加支持 `webAPP` (苹果添加到主页书签访问)支持
168
+ - 添加 `OPENAI_API_BASE_URL` 可选环境变量[#249]
169
+ ## Enhancement
170
+ - 优化在高分屏上主题内容的最大宽度[#257]
171
+ - 现在文字按单词截断[#215][#225]
172
+ ### BugFix
173
+ - 修复动态生成时代码块不能被复制的问题[#251][#260]
174
+ - 修复 `iOS` 移动端输入框不会被键盘顶起的问题[#256]
175
+ - 修复控制台渲染警告
176
+ ## Other
177
+ - 更新依赖至最新
178
+ - 修改 `README` 内容
179
+
180
+ ## v2.9.1
181
+
182
+ `2023-03-02`
183
+
184
+ ### Feature
185
+ - 代码块添加当前代码语言显示和复制功能[#197][#196]
186
+ - 完善多语言,现在可以切换中英文显示
187
+
188
+ ## Enhancement
189
+ - 由[Zo3i](https://github.com/Chanzhaoyu/chatgpt-web/pull/187) 完善 `docker-compose` 部署文档
190
+
191
+ ### BugFix
192
+ - 由 [ottocsb](https://github.com/Chanzhaoyu/chatgpt-web/pull/200) 修复头像修改不同步的问题
193
+ ## Other
194
+ - 更新依赖至最新
195
+ - 修改 `README` 内容
196
+ ## v2.9.0
197
+
198
+ `2023-03-02`
199
+
200
+ ### Feature
201
+ - 现在能复制带格式的消息文本
202
+ - 新设计的设定页面,可以自定义姓名、描述、头像(链接方式)
203
+ - 新增`403`和`404`页面以便扩展
204
+
205
+ ## Enhancement
206
+ - 更新 `chatgpt` 使 `ChatGPTAPI` 支持 `gpt-3.5-turbo-0301`(默认)
207
+ - 取消了前端超时限制设定
208
+
209
+ ## v2.8.3
210
+
211
+ `2023-03-01`
212
+
213
+ ### Feature
214
+ - 消息已输出内容不会因为中断而消失[#167]
215
+ - 添加复制消息按钮[#133]
216
+
217
+ ### Other
218
+ - `README` 添加声明内容
219
+
220
+ ## v2.8.2
221
+
222
+ `2023-02-28`
223
+ ### Enhancement
224
+ - 代码主题调整为 `One Dark - light|dark` 适配深色模式
225
+ ### BugFix
226
+ - 修复普通文本代码渲染和深色模式下的问题[#139][#154]
227
+
228
+ ## v2.8.1
229
+
230
+ `2023-02-27`
231
+
232
+ ### BugFix
233
+ - 修复 `API` 版本不是 `Markdown` 时,普通 `HTML` 代码会被渲染的问题 [#146]
234
+
235
+ ## v2.8.0
236
+
237
+ `2023-02-27`
238
+
239
+ - 感谢 [puppywang](https://github.com/Chanzhaoyu/chatgpt-web/commit/628187f5c3348bda0d0518f90699a86525d19018) 修复了 `2.7.0` 版本中关于流输出数据的问题(使用 `nginx` 需要自行配置 `octet-stream` 相关内容)
240
+
241
+ - 关于为什么使用 `octet-stream` 而不是 `sse`,是因为更好的兼容之前的模式。
242
+
243
+ - 建议更新到此版本获得比较完整的体验
244
+
245
+ ### Enhancement
246
+ - 优化了部份代码和类型提示
247
+ - 输入框添加换行提示
248
+ - 移动端输入框现在回车为换行,而不是直接提交
249
+ - 移动端双击标题返回顶部,箭头返回底部
250
+
251
+ ### BugFix
252
+ - 流输出数据下的问题[#122]
253
+ - 修复了 `API Key` 下部份代码不换行的问题
254
+ - 修复移动端深色模式部份样式问题[#123][#126]
255
+ - 修复主题模式图标不一致的问题[#126]
256
+
257
+ ## v2.7.3
258
+
259
+ `2023-02-25`
260
+
261
+ ### Feature
262
+ - 适配系统深色模式 [#118](https://github.com/Chanzhaoyu/chatgpt-web/issues/103)
263
+ ### BugFix
264
+ - 修���用户消息能被渲染为 `HTML` 问题 [#117](https://github.com/Chanzhaoyu/chatgpt-web/issues/117)
265
+
266
+ ## v2.7.2
267
+
268
+ `2023-02-24`
269
+ ### Enhancement
270
+ - 消息使用 [github-markdown-css](https://www.npmjs.com/package/github-markdown-css) 进行美化,现在支持全语法
271
+ - 移除测试无用函数
272
+
273
+ ## v2.7.1
274
+
275
+ `2023-02-23`
276
+
277
+ 因为消息流在 `accessToken` 中存在解析失败和消息不完整等一系列的问题,调整回正常消息形式
278
+
279
+ ### Feature
280
+ - 现在可以中断请求过长没有答复的消息
281
+ - 现在可以删除单条消息
282
+ - 设置中显示当前版本信息
283
+
284
+ ### BugFix
285
+ - 回退 `2.7.0` 的消息不稳定的问题
286
+
287
+ ## v2.7.0
288
+
289
+ `2023-02-23`
290
+
291
+ ### Feature
292
+ - 使用消息流返回信息,反应更迅速
293
+
294
+ ### Enhancement
295
+ - 样式的一点小改动
296
+
297
+ ## v2.6.2
298
+
299
+ `2023-02-22`
300
+ ### BugFix
301
+ - 还原修改代理导致的异常问题
302
+
303
+ ## v2.6.1
304
+
305
+ `2023-02-22`
306
+
307
+ ### Feature
308
+ - 新增 `Railway` 部署模版
309
+
310
+ ### BugFix
311
+ - 手动打包 `Proxy` 问题
312
+
313
+ ## v2.6.0
314
+
315
+ `2023-02-21`
316
+ ### Feature
317
+ - 新增对 `网页 accessToken` 调用 `ChatGPT`,更智能不过不太稳定 [#51](https://github.com/Chanzhaoyu/chatgpt-web/issues/51)
318
+ - 前端页面设置按钮显示查看当前后端服务配置
319
+
320
+ ### Enhancement
321
+ - 新增 `TIMEOUT_MS` 环境变量设定后端超时时常(单位:毫秒)[#62](https://github.com/Chanzhaoyu/chatgpt-web/issues/62)
322
+
323
+ ## v2.5.2
324
+
325
+ `2023-02-21`
326
+ ### Feature
327
+ - 增加对 `markdown` 格式的支持 [Demo](https://github.com/Chanzhaoyu/chatgpt-web/pull/77)
328
+ ### BugFix
329
+ - 重载会话时滚动条保持
330
+
331
+ ## v2.5.1
332
+
333
+ `2023-02-21`
334
+
335
+ ### Enhancement
336
+ - 调整路由模式为 `hash`
337
+ - 调整新增会话添加到
338
+ - 调整移动端样式
339
+
340
+
341
+ ## v2.5.0
342
+
343
+ `2023-02-20`
344
+
345
+ ### Feature
346
+ - 会话 `loading` 现在显示为光标动画
347
+ - 会话现在可以再次生成回复
348
+ - 会话异常可以再次进行请求
349
+ - 所有删除选项添加确认操作
350
+
351
+ ### Enhancement
352
+ - 调整 `chat` 为路由页面而不是组件形式
353
+ - 更新依赖至最新
354
+ - 调整移动端体验
355
+
356
+ ### BugFix
357
+ - 修复移动端左侧菜单显示不完整的问题
358
+
359
+ ## v2.4.1
360
+
361
+ `2023-02-18`
362
+
363
+ ### Enhancement
364
+ - 调整部份移动端上的样式
365
+ - 输入框支持换行
366
+
367
+ ## v2.4.0
368
+
369
+ `2023-02-17`
370
+
371
+ ### Feature
372
+ - 响应式支持移动端
373
+ ### Enhancement
374
+ - 修改部份描述错误
375
+
376
+ ## v2.3.3
377
+
378
+ `2023-02-16`
379
+
380
+ ### Feature
381
+ - 添加 `README` 部份说明和贡献列表
382
+ - 添加 `docker` 镜像
383
+ - 添加 `GitHub Action` 自动化构建
384
+
385
+ ### BugFix
386
+ - 回退依赖更新导致的 [Eslint 报错](https://github.com/eslint/eslint/issues/16896)
387
+
388
+ ## v2.3.2
389
+
390
+ `2023-02-16`
391
+
392
+ ### Enhancement
393
+ - 更新依赖至最新
394
+ - 优化部份内容
395
+
396
+ ## v2.3.1
397
+
398
+ `2023-02-15`
399
+
400
+ ### BugFix
401
+ - 修复多会话状态下一些意想不到的问题
402
+
403
+ ## v2.3.0
404
+
405
+ `2023-02-15`
406
+ ### Feature
407
+ - 代码类型信息高亮显示
408
+ - 支持 `node ^16` 版本
409
+ - 移动端响应式初步支持
410
+ - `vite` 中 `proxy` 代理
411
+
412
+ ### Enhancement
413
+ - 调整超时处理范围
414
+
415
+ ### BugFix
416
+ - 修复取消请求错误提示会添加到信息中
417
+ - 修复部份情况下提交请求不可用
418
+ - 修复侧边栏宽度变化闪烁的问题
419
+
420
+ ## v2.2.0
421
+
422
+ `2023-02-14`
423
+ ### Feature
424
+ - 会话和上下文本地储存
425
+ - 侧边栏本地储存
426
+
427
+ ## v2.1.0
428
+
429
+ `2023-02-14`
430
+ ### Enhancement
431
+ - 更新依赖至最新
432
+ - 联想功能移动至前端提交,后端只做转发
433
+
434
+ ### BugFix
435
+ - 修复部份项目检测有关 `Bug`
436
+ - 修复清除上下文按钮失效
437
+
438
+ ## v2.0.0
439
+
440
+ `2023-02-13`
441
+ ### Refactor
442
+ 重构并优化大部分内容
443
+
444
+ ## v1.0.5
445
+
446
+ `2023-02-12`
447
+
448
+ ### Enhancement
449
+ - 输入框焦点,连续提交
450
+
451
+ ### BugFix
452
+ - 修复信息框样式问题
453
+ - 修复中文输入法提交问题
454
+
455
+ ## v1.0.4
456
+
457
+ `2023-02-11`
458
+
459
+ ### Feature
460
+ - 支持上下文联想
461
+
462
+ ## v1.0.3
463
+
464
+ `2023-02-11`
465
+
466
+ ### Enhancement
467
+ - 拆分 `service` 文件以便扩展
468
+ - 调整 `Eslint` 相关验证
469
+
470
+ ### BugFix
471
+ - 修复部份控制台报错
472
+
473
+ ## v1.0.2
474
+
475
+ `2023-02-10`
476
+
477
+ ### BugFix
478
+ - 修复新增信息容器不会自动滚动到问题
479
+ - 修复文本过长不换行到问题 [#1](https://github.com/Chanzhaoyu/chatgpt-web/issues/1)
CONTRIBUTING.en.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contribution Guide
2
+ Thank you for your valuable time. Your contributions will make this project better! Before submitting a contribution, please take some time to read the getting started guide below.
3
+
4
+ ## Semantic Versioning
5
+ This project follows semantic versioning. We release patch versions for important bug fixes, minor versions for new features or non-important changes, and major versions for significant and incompatible changes.
6
+
7
+ Each major change will be recorded in the `changelog`.
8
+
9
+ ## Submitting Pull Request
10
+ 1. Fork [this repository](https://github.com/Chanzhaoyu/chatgpt-web) and create a branch from `main`. For new feature implementations, submit a pull request to the `feature` branch. For other changes, submit to the `main` branch.
11
+ 2. Install the `pnpm` tool using `npm install pnpm -g`.
12
+ 3. Install the `Eslint` plugin for `VSCode`, or enable `eslint` functionality for other editors such as `WebStorm`.
13
+ 4. Execute `pnpm bootstrap` in the root directory.
14
+ 5. Execute `pnpm install` in the `/service/` directory.
15
+ 6. Make changes to the codebase. If applicable, ensure that appropriate testing has been done.
16
+ 7. Execute `pnpm lint:fix` in the root directory to perform a code formatting check.
17
+ 8. Execute `pnpm type-check` in the root directory to perform a type check.
18
+ 9. Submit a git commit, following the [Commit Guidelines](#commit-guidelines).
19
+ 10. Submit a `pull request`. If there is a corresponding `issue`, please link it using the [linking-a-pull-request-to-an-issue keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).
20
+
21
+ ## Commit Guidelines
22
+
23
+ Commit messages should follow the [conventional-changelog standard](https://www.conventionalcommits.org/en/v1.0.0/):
24
+
25
+ ```bash
26
+ <type>[optional scope]: <description>
27
+
28
+ [optional body]
29
+
30
+ [optional footer]
31
+ ```
32
+
33
+ ### Commit Types
34
+
35
+ The following is a list of commit types:
36
+
37
+ - feat: New feature or functionality
38
+ - fix: Bug fix
39
+ - docs: Documentation update
40
+ - style: Code style or component style update
41
+ - refactor: Code refactoring, no new features or bug fixes introduced
42
+ - perf: Performance optimization
43
+ - test: Unit test
44
+ - chore: Other commits that do not modify src or test files
45
+
46
+
47
+ ## License
48
+
49
+ [MIT](./license)
CONTRIBUTING.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 贡献指南
2
+ 感谢你的宝贵时间。你的贡献将使这个项目变得更好!在提交贡献之前,请务必花点时间阅读下面的入门指南。
3
+
4
+ ## 语义化版本
5
+ 该项目遵循语义化版本。我们对重要的漏洞修复发布修订号,对新特性或不重要的变更发布次版本号,对重大且不兼容的变更发布主版本号。
6
+
7
+ 每个重大更改都将记录在 `changelog` 中。
8
+
9
+ ## 提交 Pull Request
10
+ 1. Fork [此仓库](https://github.com/Chanzhaoyu/chatgpt-web),从 `main` 创建分支。新功能实现请发 pull request 到 `feature` 分支。其他更改发到 `main` 分支。
11
+ 2. 使用 `npm install pnpm -g` 安装 `pnpm` 工具。
12
+ 3. `vscode` 安装了 `Eslint` 插件,其它编辑器如 `webStorm` 打开了 `eslint` 功能。
13
+ 4. 根目录下执行 `pnpm bootstrap`。
14
+ 5. `/service/` 目录下执行 `pnpm install`。
15
+ 6. 对代码库进行更改。如果适用的话,请确保进行了相应的测试。
16
+ 7. 请在根目录下执行 `pnpm lint:fix` 进行代码格式检查。
17
+ 8. 请在根目录下执行 `pnpm type-check` 进行类型检查。
18
+ 9. 提交 git commit, 请同时遵守 [Commit 规范](#commit-指南)
19
+ 10. 提交 `pull request`, 如果有对应的 `issue`,请进行[关联](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)。
20
+
21
+ ## Commit 指南
22
+
23
+ Commit messages 请遵循[conventional-changelog 标准](https://www.conventionalcommits.org/en/v1.0.0/):
24
+
25
+ ```bash
26
+ <类型>[可选 范围]: <描述>
27
+
28
+ [可选 正文]
29
+
30
+ [可选 脚注]
31
+ ```
32
+
33
+ ### Commit 类型
34
+
35
+ 以下是 commit 类型列表:
36
+
37
+ - feat: 新特性或功能
38
+ - fix: 缺陷修复
39
+ - docs: 文档更新
40
+ - style: 代码风格或者组件样式更新
41
+ - refactor: 代码重构,不引入新功能和缺陷修复
42
+ - perf: 性能优化
43
+ - test: 单元测试
44
+ - chore: 其他不修改 src 或测试文件的提交
45
+
46
+
47
+ ## License
48
+
49
+ [MIT](./license)
Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # build front-end
2
+ FROM node:lts-alpine AS frontend
3
+
4
+ RUN npm install pnpm -g
5
+
6
+ WORKDIR /app
7
+
8
+ COPY ./package.json /app
9
+
10
+ COPY ./pnpm-lock.yaml /app
11
+
12
+ RUN pnpm install
13
+
14
+ COPY . /app
15
+
16
+ RUN pnpm run build
17
+
18
+ # build backend
19
+ FROM node:lts-alpine as backend
20
+
21
+ RUN npm install pnpm -g
22
+
23
+ WORKDIR /app
24
+
25
+ COPY /service/package.json /app
26
+
27
+ COPY /service/pnpm-lock.yaml /app
28
+
29
+ RUN pnpm install
30
+
31
+ COPY /service /app
32
+
33
+ RUN pnpm build
34
+
35
+ # service
36
+ FROM node:lts-alpine
37
+
38
+ RUN npm install pnpm -g
39
+
40
+ WORKDIR /app
41
+
42
+ COPY /service/package.json /app
43
+
44
+ COPY /service/pnpm-lock.yaml /app
45
+
46
+ RUN pnpm install --production && rm -rf /root/.npm /root/.pnpm-store /usr/local/share/.cache /tmp/*
47
+
48
+ COPY /service /app
49
+
50
+ COPY --from=frontend /app/dist /app/public
51
+
52
+ COPY --from=backend /app/build /app/build
53
+
54
+ EXPOSE 3002
55
+
56
+ CMD ["pnpm", "run", "prod"]
README.ch.md ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ChatGPT Web
2
+
3
+ <div style="font-size: 1.5rem;">
4
+ <a href="./README.ch.md">中文</a> |
5
+ <a href="./README.md">English</a>
6
+ </div>
7
+ </br>
8
+
9
+ > 声明:此项目只发布于 Github,基于 MIT 协议,免费且作为开源学习使用。并且不会有任何形式的卖号、付费服务、讨论群、讨论组等行为。谨防受骗。
10
+
11
+ ![cover](./docs/c1.png)
12
+ ![cover2](./docs/c2.png)
13
+
14
+ - [ChatGPT Web](#chatgpt-web)
15
+ - [介绍](#介绍)
16
+ - [待实现路线](#待实现路线)
17
+ - [前置要求](#前置要求)
18
+ - [Node](#node)
19
+ - [PNPM](#pnpm)
20
+ - [填写密钥](#填写密钥)
21
+ - [安装依赖](#安装依赖)
22
+ - [后端](#后端)
23
+ - [前端](#前端)
24
+ - [测试环境运行](#测试环境运行)
25
+ - [后端服务](#后端服务)
26
+ - [前端网页](#前端网页)
27
+ - [环境变量](#环境变量)
28
+ - [打包](#打包)
29
+ - [使用 Docker](#使用-docker)
30
+ - [Docker 参数示例](#docker-参数示例)
31
+ - [Docker build \& Run](#docker-build--run)
32
+ - [Docker compose](#docker-compose)
33
+ - [使用 Railway 部署](#使用-railway-部署)
34
+ - [Railway 环境变量](#railway-环境变量)
35
+ - [手动打包](#手动打包)
36
+ - [后端服务](#后端服务-1)
37
+ - [前端网页](#前端网页-1)
38
+ - [常见问题](#常见问题)
39
+ - [参与贡献](#参与贡献)
40
+ - [赞助](#赞助)
41
+ - [License](#license)
42
+ ## 介绍
43
+
44
+ 支持双模型,提供了两种非官方 `ChatGPT API` 方法
45
+
46
+ | 方式 | 免费? | 可靠性 | 质量 |
47
+ | --------------------------------------------- | ------ | ---------- | ---- |
48
+ | `ChatGPTAPI(gpt-3.5-turbo-0301)` | 否 | 可靠 | 相对较笨 |
49
+ | `ChatGPTUnofficialProxyAPI(网页 accessToken)` | 是 | 相对不可靠 | 聪明 |
50
+
51
+ 对比:
52
+ 1. `ChatGPTAPI` 使用 `gpt-3.5-turbo-0301` 通过官方`OpenAI`补全`API`模拟`ChatGPT`(最稳健的方法,但它不是免费的,并且没有使用针对聊天进行微调的模型)
53
+ 2. `ChatGPTUnofficialProxyAPI` 使用非官方代理服务器访问 `ChatGPT` 的后端`API`,绕过`Cloudflare`(使用真实的的`ChatGPT`,非常轻量级,但依赖于第三方服务器,并且有速率限制)
54
+
55
+ 警告:
56
+ 1. 你应该首先使用 `API` 方式
57
+ 2. 使用 `API` 时,如果网络不通,那是国内被墙了,你需要自建代理,绝对不要使用别人的公开代理,那是危险的。
58
+ 3. 使用 `accessToken` 方式时反向代理将向第三方暴露您的访问令牌,这样做应该不会产生任何不良影响,但在使用这种方法之前请考虑风险。
59
+ 4. 使用 `accessToken` 时,不管你是国内还是国外的机器,都会使用代理。默认代理为 [acheong08](https://github.com/acheong08) 大佬的 `https://bypass.duti.tech/api/conversation`,这不是后门也不是监听,除非你有能力自己翻过 `CF` 验证,用前请知悉。[社区代理](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy)(注意:只有这两个是推荐,其他第三方来源,请自行甄别)
60
+ 5. 把项目发布到公共网络时,你应该设置 `AUTH_SECRET_KEY` 变量添加你的密码访问权限,你也应该修改 `index.html` 中的 `title`,防止被关键词搜索到。
61
+
62
+ 切换方式:
63
+ 1. 进入 `service/.env.example` 文件,复制内容到 `service/.env` 文件
64
+ 2. 使用 `OpenAI API Key` 请填写 `OPENAI_API_KEY` 字段 [(获取 apiKey)](https://platform.openai.com/overview)
65
+ 3. 使用 `Web API` 请填写 `OPENAI_ACCESS_TOKEN` 字段 [(获取 accessToken)](https://chat.openai.com/api/auth/session)
66
+ 4. 同时存在时以 `OpenAI API Key` 优先
67
+
68
+ 环境变量:
69
+
70
+ 全部参数变量请查看或[这里](#环境变量)
71
+
72
+ ```
73
+ /service/.env.example
74
+ ```
75
+
76
+ ## 待实现路线
77
+ [✓] 双模型
78
+
79
+ [✓] 多会话储存和上下文逻辑
80
+
81
+ [✓] 对代码等消息类型的格式化美化处理
82
+
83
+ [✓] 访问权限控制
84
+
85
+ [✓] 数据导入、导出
86
+
87
+ [✓] 保存消息到本地图片
88
+
89
+ [✓] 界面多语言
90
+
91
+ [✓] 界面主题
92
+
93
+ [✗] More...
94
+
95
+ ## 前置要求
96
+
97
+ ### Node
98
+
99
+ `node` 需要 `^16 || ^18 || ^19` 版本(`node >= 14` 需要安装 [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill)),使用 [nvm](https://github.com/nvm-sh/nvm) 可管理本地多个 `node` 版本
100
+
101
+ ```shell
102
+ node -v
103
+ ```
104
+
105
+ ### PNPM
106
+ 如果你没有安装过 `pnpm`
107
+ ```shell
108
+ npm install pnpm -g
109
+ ```
110
+
111
+ ### 填写密钥
112
+ 获取 `Openai Api Key` 或 `accessToken` 并填写本地环境变量 [跳转](#介绍)
113
+
114
+ ```
115
+ # service/.env 文件
116
+
117
+ # OpenAI API Key - https://platform.openai.com/overview
118
+ OPENAI_API_KEY=
119
+
120
+ # change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
121
+ OPENAI_ACCESS_TOKEN=
122
+ ```
123
+
124
+ ## 安装依赖
125
+
126
+ > 为了简便 `后端开发人员` 的了解负担,所以并没有采用前端 `workspace` 模式,而是分文件夹存放。如果只需要前端页面做二次开发,删除 `service` 文件夹即可。
127
+
128
+ ### 后端
129
+
130
+ 进入文件夹 `/service` 运行以下命令
131
+
132
+ ```shell
133
+ pnpm install
134
+ ```
135
+
136
+ ### 前端
137
+ 根目录下运行以下命令
138
+ ```shell
139
+ pnpm bootstrap
140
+ ```
141
+
142
+ ## 测试环境运行
143
+ ### 后端服务
144
+
145
+ 进入文件夹 `/service` 运行以下命令
146
+
147
+ ```shell
148
+ pnpm start
149
+ ```
150
+
151
+ ### 前端网页
152
+ 根目录下运行以下命令
153
+ ```shell
154
+ pnpm dev
155
+ ```
156
+
157
+ ## 环境变量
158
+
159
+ `API` 可用:
160
+
161
+ - `OPENAI_API_KEY` 和 `OPENAI_ACCESS_TOKEN` 二选一
162
+ - `OPENAI_API_MODEL` 设置模型,可选,默认:`gpt-3.5-turbo`
163
+ - `OPENAI_API_BASE_URL` 设置接口地址,可选,默认:`https://api.openai.com`
164
+
165
+ `ACCESS_TOKEN` 可用:
166
+
167
+ - `OPENAI_ACCESS_TOKEN` 和 `OPENAI_API_KEY` 二选一,同时存在时,`OPENAI_API_KEY` 优先
168
+ - `API_REVERSE_PROXY` 设置反向代理,可选,默认:`https://bypass.duti.tech/api/conversation`,[社区](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy)(注意:只有这两个是推荐,其他第三方来源,请自行甄别)
169
+
170
+ 通用:
171
+
172
+ - `AUTH_SECRET_KEY` 访问权限密钥,可选
173
+ - `TIMEOUT_MS` 超时,单位毫秒,可选
174
+ - `SOCKS_PROXY_HOST` 和 `SOCKS_PROXY_PORT` 一起时生效,可选
175
+ - `SOCKS_PROXY_PORT` 和 `SOCKS_PROXY_HOST` 一起时生效,可选
176
+ - `HTTPS_PROXY` 支持 `http`,`https`, `socks5`,可选
177
+ - `ALL_PROXY` 支持 `http`,`https`, `socks5`,可选
178
+
179
+ ## 打包
180
+
181
+ ### 使用 Docker
182
+
183
+ #### Docker 参数示例
184
+
185
+ ![docker](./docs/docker.png)
186
+
187
+ #### Docker build & Run
188
+
189
+ ```bash
190
+ docker build -t chatgpt-web .
191
+
192
+ # 前台运行
193
+ docker run --name chatgpt-web --rm -it -p 3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
194
+
195
+ # 后台运行
196
+ docker run --name chatgpt-web -d -p 3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
197
+
198
+ # 运行地址
199
+ http://localhost:3002/
200
+ ```
201
+
202
+ #### Docker compose
203
+
204
+ [Hub 地址](https://hub.docker.com/repository/docker/chenzhaoyu94/chatgpt-web/general)
205
+
206
+ ```yml
207
+ version: '3'
208
+
209
+ services:
210
+ app:
211
+ image: chenzhaoyu94/chatgpt-web # 总是使用 latest ,更新时重新 pull 该 tag 镜像即可
212
+ ports:
213
+ - 3002:3002
214
+ environment:
215
+ # 二选一
216
+ OPENAI_API_KEY: xxxxxx
217
+ # 二选一
218
+ OPENAI_ACCESS_TOKEN: xxxxxx
219
+ # API接口地址,可选,设置 OPENAI_API_KEY 时可用
220
+ OPENAI_API_BASE_URL: xxxx
221
+ # API模型,可选,设置 OPENAI_API_KEY 时可用
222
+ OPENAI_API_MODEL: xxxx
223
+ # 反向代理,可选
224
+ API_REVERSE_PROXY: xxx
225
+ # 访问权限密钥,可选
226
+ AUTH_SECRET_KEY: xxx
227
+ # 超时,单位毫秒,可选
228
+ TIMEOUT_MS: 60000
229
+ # Socks代理,可选,和 SOCKS_PROXY_PORT 一起时生效
230
+ SOCKS_PROXY_HOST: xxxx
231
+ # Socks代理端口,可选,和 SOCKS_PROXY_HOST 一起时生效
232
+ SOCKS_PROXY_PORT: xxxx
233
+ # HTTPS 代理,可选,支持 http,https,socks5
234
+ HTTPS_PROXY: http://xxxx:7890
235
+ ```
236
+ - `OPENAI_API_BASE_URL` 可选,设置 `OPENAI_API_KEY` 时可用
237
+ - `OPENAI_API_MODEL` 可选,设置 `OPENAI_API_KEY` 时可用
238
+ ### 使用 Railway 部署
239
+
240
+ [![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/yytmgc)
241
+
242
+ #### Railway 环境变量
243
+
244
+ | 环境变量名称 | 必填 | 备注 |
245
+ | --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------- |
246
+ | `PORT` | 必填 | 默认 `3002`
247
+ | `AUTH_SECRET_KEY` | 可选 | 访问权限密钥 |
248
+ | `TIMEOUT_MS` | 可选 | 超时时间,单位毫秒 |
249
+ | `OPENAI_API_KEY` | `OpenAI API` 二选一 | 使用 `OpenAI API` 所需的 `apiKey` [(获取 apiKey)](https://platform.openai.com/overview) |
250
+ | `OPENAI_ACCESS_TOKEN` | `Web API` 二选一 | 使用 `Web API` 所需的 `accessToken` [(获取 accessToken)](https://chat.openai.com/api/auth/session) |
251
+ | `OPENAI_API_BASE_URL` | 可选,`OpenAI API` 时可用 | `API`接口地址 |
252
+ | `OPENAI_API_MODEL` | 可选,`OpenAI API` 时可用 | `API`模型 |
253
+ | `API_REVERSE_PROXY` | 可选,`Web API` 时可用 | `Web API` 反向代理地址 [详情](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) |
254
+ | `SOCKS_PROXY_HOST` | 可选,和 `SOCKS_PROXY_PORT` 一起时生效 | Socks代理 |
255
+ | `SOCKS_PROXY_PORT` | 可选,和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理端口 |
256
+ | `HTTPS_PROXY` | 可选 | HTTPS 代理,支持 http,https, socks5 |
257
+ | `ALL_PROXY` | 可选 | 所有代理 代理,支持 http,https, socks5 |
258
+
259
+ > 注意: `Railway` 修改环境变量会重新 `Deploy`
260
+
261
+ ### 手动打包
262
+ #### 后端服务
263
+ > 如果你不需要本项目的 `node` 接口,可以省略如下操作
264
+
265
+ 复制 `service` 文件夹到你有 `node` 服务环境的服务器上。
266
+
267
+ ```shell
268
+ # 安装
269
+ pnpm install
270
+
271
+ # 打包
272
+ pnpm build
273
+
274
+ # 运行
275
+ pnpm prod
276
+ ```
277
+
278
+ PS: 不进行打包,直接在服务器上运行 `pnpm start` 也可
279
+
280
+ #### 前端网页
281
+
282
+ 1、修改根目录下 `.env` 文件中的 `VITE_APP_API_BASE_URL` 为你的实际后端接口地址
283
+
284
+ 2、根目录下运行以下命令,然后将 `dist` 文件夹内的文件复制到你网站服务的根目录下
285
+
286
+ [参考信息](https://cn.vitejs.dev/guide/static-deploy.html#building-the-app)
287
+
288
+ ```shell
289
+ pnpm build
290
+ ```
291
+
292
+ ## 常见问题
293
+ Q: 为什么 `Git` 提交总是报错?
294
+
295
+ A: 因为有提交信息验证,请遵循 [Commit 指南](./CONTRIBUTING.md)
296
+
297
+ Q: 如果只使用前端页面,在哪里改请求接口?
298
+
299
+ A: 根目录下 `.env` 文件中的 `VITE_GLOB_API_URL` 字段。
300
+
301
+ Q: 文件保存时全部爆红?
302
+
303
+ A: `vscode` 请安装项目推荐插件,或手动安装 `Eslint` 插件。
304
+
305
+ Q: 前端没有打字机效果?
306
+
307
+ A: 一种可能原因是经过 Nginx 反向代理,开启了 buffer,则 Nginx 会尝试从后端缓冲一定大小的数据再发送给浏览器。请尝试在反代参数后添加 `proxy_buffering off;`,然后重载 Nginx。其他 web server 配置同理。
308
+
309
+ ## 参与贡献
310
+
311
+ 贡献之前请先阅读 [贡献指南](./CONTRIBUTING.md)
312
+
313
+ 感谢所有做过贡献的人!
314
+
315
+ <a href="https://github.com/Chanzhaoyu/chatgpt-web/graphs/contributors">
316
+ <img src="https://contrib.rocks/image?repo=Chanzhaoyu/chatgpt-web" />
317
+ </a>
318
+
319
+ ## 赞助
320
+
321
+ 如果你觉得这个项目对你有帮助,并且情况允许的话,可以给我一点点支持,总之非常感谢支持~
322
+
323
+ <div style="display: flex; gap: 20px;">
324
+ <div style="text-align: center">
325
+ <img style="max-width: 100%" src="./docs/wechat.png" alt="微信" />
326
+ <p>WeChat Pay</p>
327
+ </div>
328
+ <div style="text-align: center">
329
+ <img style="max-width: 100%" src="./docs/alipay.png" alt="支付宝" />
330
+ <p>Alipay</p>
331
+ </div>
332
+ </div>
333
+
334
+ ## License
335
+ MIT © [ChenZhaoYu](./license)
README.md CHANGED
@@ -1,11 +1,333 @@
1
- ---
2
- title: Chatgpt Web
3
- emoji: 👁
4
- colorFrom: indigo
5
- colorTo: pink
6
- sdk: docker
7
- pinned: false
8
- license: creativeml-openrail-m
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ChatGPT Web
2
+
3
+ <div style="font-size: 1.5rem;">
4
+ <a href="./README.ch.md">中文</a> |
5
+ <a href="./README.md">English</a>
6
+ </div>
7
+ </br>
8
+
9
+ > Disclaimer: This project is only released on GitHub, under the MIT License, free and for open-source learning purposes. There will be no account selling, paid services, discussion groups, or forums. Beware of fraud.
10
+
11
+ ![cover](./docs/c1.png)
12
+ ![cover2](./docs/c2.png)
13
+
14
+ - [ChatGPT Web](#chatgpt-web)
15
+ - [Introduction](#introduction)
16
+ - [Roadmap](#roadmap)
17
+ - [Prerequisites](#prerequisites)
18
+ - [Node](#node)
19
+ - [PNPM](#pnpm)
20
+ - [Fill in the Keys](#fill-in-the-keys)
21
+ - [Install Dependencies](#install-dependencies)
22
+ - [Backend](#backend)
23
+ - [Frontend](#frontend)
24
+ - [Run in Test Environment](#run-in-test-environment)
25
+ - [Backend Service](#backend-service)
26
+ - [Frontend Webpage](#frontend-webpage)
27
+ - [Packaging](#packaging)
28
+ - [Using Docker](#using-docker)
29
+ - [Docker Parameter Example](#docker-parameter-example)
30
+ - [Docker Build \& Run](#docker-build--run)
31
+ - [Docker Compose](#docker-compose)
32
+ - [Deployment with Railway](#deployment-with-railway)
33
+ - [Railway Environment Variables](#railway-environment-variables)
34
+ - [Manual packaging](#manual-packaging)
35
+ - [Backend service](#backend-service-1)
36
+ - [Frontend webpage](#frontend-webpage-1)
37
+ - [Frequently Asked Questions](#frequently-asked-questions)
38
+ - [Contributing](#contributing)
39
+ - [Sponsorship](#sponsorship)
40
+ - [License](#license)
41
+
42
+ ## Introduction
43
+
44
+ Supports dual models, provides two unofficial `ChatGPT API` methods:
45
+
46
+ | Method | Free? | Reliability | Quality |
47
+ | --------------------------------------------- | ------ | ----------- | ------- |
48
+ | `ChatGPTAPI(gpt-3.5-turbo-0301)` | No | Reliable | Relatively clumsy |
49
+ | `ChatGPTUnofficialProxyAPI(Web accessToken)` | Yes | Relatively unreliable | Smart |
50
+
51
+ Comparison:
52
+ 1. `ChatGPTAPI` uses `gpt-3.5-turbo-0301` to simulate `ChatGPT` through the official `OpenAI` completion `API` (the most reliable method, but it is not free and does not use models specifically tuned for chat).
53
+ 2. `ChatGPTUnofficialProxyAPI` accesses `ChatGPT`'s backend `API` via an unofficial proxy server to bypass `Cloudflare` (uses the real `ChatGPT`, is very lightweight, but depends on third-party servers and has rate limits).
54
+
55
+ [Details](https://github.com/Chanzhaoyu/chatgpt-web/issues/138)
56
+
57
+ Switching Methods:
58
+ 1. Go to the `service/.env.example` file and copy the contents to the `service/.env` file.
59
+ 2. For `OpenAI API Key`, fill in the `OPENAI_API_KEY` field [(Get apiKey)](https://platform.openai.com/overview).
60
+ 3. For `Web API`, fill in the `OPENAI_ACCESS_TOKEN` field [(Get accessToken)](https://chat.openai.com/api/auth/session).
61
+ 4. When both are present, `OpenAI API Key` takes precedence.
62
+
63
+ Reverse Proxy:
64
+
65
+ Available when using `ChatGPTUnofficialProxyAPI`.[Details](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy)
66
+
67
+ ```shell
68
+ # service/.env
69
+ API_REVERSE_PROXY=
70
+ ```
71
+
72
+ Environment Variables:
73
+
74
+ For all parameter variables, check [here](#docker-parameter-example) or see:
75
+
76
+ ```
77
+ /service/.env
78
+ ```
79
+
80
+ ## Roadmap
81
+ [✓] Dual models
82
+
83
+ [✓] Multiple session storage and context logic
84
+
85
+ [✓] Formatting and beautifying code-like message types
86
+
87
+ [✓] Access rights control
88
+
89
+ [✓] Data import and export
90
+
91
+ [✓] Save message to local image
92
+
93
+ [✓] Multilingual interface
94
+
95
+ [✓] Interface themes
96
+
97
+ [✗] More...
98
+
99
+ ## Prerequisites
100
+
101
+ ### Node
102
+
103
+ `node` requires version `^16 || ^18` (`node >= 14` requires installation of [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill)), and multiple local `node` versions can be managed using [nvm](https://github.com/nvm-sh/nvm).
104
+
105
+ ```shell
106
+ node -v
107
+ ```
108
+
109
+ ### PNPM
110
+ If you have not installed `pnpm` before:
111
+ ```shell
112
+ npm install pnpm -g
113
+ ```
114
+
115
+ ### Fill in the Keys
116
+
117
+ Get `Openai Api Key` or `accessToken` and fill in the local environment variables [jump](#introduction)
118
+
119
+ ```
120
+ # service/.env file
121
+
122
+ # OpenAI API Key - https://platform.openai.com/overview
123
+ OPENAI_API_KEY=
124
+
125
+ # change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
126
+ OPENAI_ACCESS_TOKEN=
127
+ ```
128
+
129
+ ## Install Dependencies
130
+
131
+ > To make it easier for `backend developers` to understand, we did not use the front-end `workspace` mode, but stored it in different folders. If you only need to do secondary development of the front-end page, delete the `service` folder.
132
+
133
+ ### Backend
134
+
135
+ Enter the `/service` folder and run the following command
136
+
137
+ ```shell
138
+ pnpm install
139
+ ```
140
+
141
+ ### Frontend
142
+ Run the following command in the root directory
143
+ ```shell
144
+ pnpm bootstrap
145
+ ```
146
+
147
+ ## Run in Test Environment
148
+ ### Backend Service
149
+
150
+ Enter the `/service` folder and run the following command
151
+
152
+ ```shell
153
+ pnpm start
154
+ ```
155
+
156
+ ### Frontend Webpage
157
+ Run the following command in the root directory
158
+ ```shell
159
+ pnpm dev
160
+ ```
161
+
162
+ ## Packaging
163
+
164
+ ### Using Docker
165
+
166
+ #### Docker Parameter Example
167
+
168
+ - `OPENAI_API_KEY` one of two
169
+ - `OPENAI_ACCESS_TOKEN` one of two, `OPENAI_API_KEY` takes precedence when both are present
170
+ - `OPENAI_API_BASE_URL` optional, available when `OPENAI_API_KEY` is set
171
+ - `OPENAI_API_MODEL` optional, available when `OPENAI_API_KEY` is set
172
+ - `API_REVERSE_PROXY` optional, available when `OPENAI_ACCESS_TOKEN` is set [Reference](#introduction)
173
+ - `AUTH_SECRET_KEY` Access Password,optional
174
+ - `TIMEOUT_MS` timeout, in milliseconds, optional
175
+ - `SOCKS_PROXY_HOST` optional, effective with SOCKS_PROXY_PORT
176
+ - `SOCKS_PROXY_PORT` optional, effective with SOCKS_PROXY_HOST
177
+ - `HTTPS_PROXY` optional, support http,https, socks5
178
+ - `ALL_PROXY` optional, support http,https, socks5
179
+
180
+ ![docker](./docs/docker.png)
181
+
182
+ #### Docker Build & Run
183
+
184
+ ```bash
185
+ docker build -t chatgpt-web .
186
+
187
+ # foreground operation
188
+ docker run --name chatgpt-web --rm -it -p 3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
189
+
190
+ # background operation
191
+ docker run --name chatgpt-web -d -p 3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
192
+
193
+ # running address
194
+ http://localhost:3002/
195
+ ```
196
+
197
+ #### Docker Compose
198
+
199
+ [Hub Address](https://hub.docker.com/repository/docker/chenzhaoyu94/chatgpt-web/general)
200
+
201
+ ```yml
202
+ version: '3'
203
+
204
+ services:
205
+ app:
206
+ image: chenzhaoyu94/chatgpt-web # always use latest, pull the tag image again when updating
207
+ ports:
208
+ - 3002:3002
209
+ environment:
210
+ # one of two
211
+ OPENAI_API_KEY: xxxxxx
212
+ # one of two
213
+ OPENAI_ACCESS_TOKEN: xxxxxx
214
+ # api interface url, optional, available when OPENAI_API_KEY is set
215
+ OPENAI_API_BASE_URL: xxxx
216
+ # api model, optional, available when OPENAI_API_KEY is set
217
+ OPENAI_API_MODEL: xxxx
218
+ # reverse proxy, optional
219
+ API_REVERSE_PROXY: xxx
220
+ # access password,optional
221
+ AUTH_SECRET_KEY: xxx
222
+ # timeout, in milliseconds, optional
223
+ TIMEOUT_MS: 60000
224
+ # socks proxy, optional, effective with SOCKS_PROXY_PORT
225
+ SOCKS_PROXY_HOST: xxxx
226
+ # socks proxy port, optional, effective with SOCKS_PROXY_HOST
227
+ SOCKS_PROXY_PORT: xxxx
228
+ # HTTPS Proxy,optional, support http, https, socks5
229
+ HTTPS_PROXY: http://xxx:7890
230
+ ```
231
+ The `OPENAI_API_BASE_URL` is optional and only used when setting the `OPENAI_API_KEY`.
232
+ The `OPENAI_API_MODEL` is optional and only used when setting the `OPENAI_API_KEY`.
233
+
234
+ ### Deployment with Railway
235
+
236
+ [![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/yytmgc)
237
+
238
+ #### Railway Environment Variables
239
+
240
+ | Environment Variable | Required | Description |
241
+ | -------------------- | -------- | ------------------------------------------------------------------------------------------------- |
242
+ | `PORT` | Required | Default: `3002` |
243
+ | `AUTH_SECRET_KEY` | Optional | access password |
244
+ | `TIMEOUT_MS` | Optional | Timeout in milliseconds |
245
+ | `OPENAI_API_KEY` | Optional | Required for `OpenAI API`. `apiKey` can be obtained from [here](https://platform.openai.com/overview). |
246
+ | `OPENAI_ACCESS_TOKEN`| Optional | Required for `Web API`. `accessToken` can be obtained from [here](https://chat.openai.com/api/auth/session).|
247
+ | `OPENAI_API_BASE_URL` | Optional, only for `OpenAI API` | API endpoint. |
248
+ | `OPENAI_API_MODEL` | Optional, only for `OpenAI API` | API model. |
249
+ | `API_REVERSE_PROXY` | Optional, only for `Web API` | Reverse proxy address for `Web API`. [Details](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) |
250
+ | `SOCKS_PROXY_HOST` | Optional, effective with `SOCKS_PROXY_PORT` | Socks proxy. |
251
+ | `SOCKS_PROXY_PORT` | Optional, effective with `SOCKS_PROXY_HOST` | Socks proxy port. |
252
+ | `HTTPS_PROXY` | Optional | HTTPS Proxy. |
253
+ | `ALL_PROXY` | Optional | ALL Proxy. |
254
+
255
+ > Note: Changing environment variables in Railway will cause re-deployment.
256
+
257
+ ### Manual packaging
258
+
259
+ #### Backend service
260
+
261
+ > If you don't need the `node` interface of this project, you can skip the following steps.
262
+
263
+ Copy the `service` folder to a server that has a `node` service environment.
264
+
265
+ ```shell
266
+ # Install
267
+ pnpm install
268
+
269
+ # Build
270
+ pnpm build
271
+
272
+ # Run
273
+ pnpm prod
274
+ ```
275
+
276
+ PS: You can also run `pnpm start` directly on the server without packaging.
277
+
278
+ #### Frontend webpage
279
+
280
+ 1. Refer to the root directory `.env.example` file content to create `.env` file, modify `VITE_APP_API_BASE_URL` in `.env` at the root directory to your actual backend interface address.
281
+ 2. Run the following command in the root directory and then copy the files in the `dist` folder to the root directory of your website service.
282
+
283
+ [Reference information](https://cn.vitejs.dev/guide/static-deploy.html#building-the-app)
284
+
285
+ ```shell
286
+ pnpm build
287
+ ```
288
+
289
+ ## Frequently Asked Questions
290
+
291
+ Q: Why does Git always report an error when committing?
292
+
293
+ A: Because there is submission information verification, please follow the [Commit Guidelines](./CONTRIBUTING.en.md).
294
+
295
+ Q: Where to change the request interface if only the frontend page is used?
296
+
297
+ A: The `VITE_GLOB_API_URL` field in the `.env` file at the root directory.
298
+
299
+ Q: All red when saving the file?
300
+
301
+ A: For `vscode`, please install the recommended plug-in of the project or manually install the `Eslint` plug-in.
302
+
303
+ Q: Why doesn't the frontend have a typewriter effect?
304
+
305
+ A: One possible reason is that after Nginx reverse proxying, buffering is turned on, and Nginx will try to buffer a certain amount of data from the backend before sending it to the browser. Please try adding `proxy_buffering off;` after the reverse proxy parameter and then reloading Nginx. Other web server configurations are similar.
306
+
307
+ ## Contributing
308
+
309
+ Please read the [Contributing Guidelines](./CONTRIBUTING.en.md) before contributing.
310
+
311
+ Thanks to all the contributors!
312
+
313
+ <a href="https://github.com/Chanzhaoyu/chatgpt-web/graphs/contributors">
314
+ <img src="https://contrib.rocks/image?repo=Chanzhaoyu/chatgpt-web" />
315
+ </a>
316
+
317
+ ## Sponsorship
318
+
319
+ If you find this project helpful and circumstances permit, you can give me a little support. Thank you very much for your support~
320
+
321
+ <div style="display: flex; gap: 20px;">
322
+ <div style="text-align: center">
323
+ <img style="max-width: 100%" src="./docs/wechat.png" alt="WeChat" />
324
+ <p>WeChat Pay</p>
325
+ </div>
326
+ <div style="text-align: center">
327
+ <img style="max-width: 100%" src="./docs/alipay.png" alt="Alipay" />
328
+ <p>Alipay</p>
329
+ </div>
330
+ </div>
331
+
332
+ ## License
333
+ MIT © [ChenZhaoYu](./license)
config/index.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ export * from './proxy'
config/proxy.ts ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { ProxyOptions } from 'vite'
2
+
3
+ export function createViteProxy(isOpenProxy: boolean, viteEnv: ImportMetaEnv) {
4
+ if (!isOpenProxy)
5
+ return
6
+
7
+ const proxy: Record<string, string | ProxyOptions> = {
8
+ '/api': {
9
+ target: viteEnv.VITE_APP_API_BASE_URL,
10
+ changeOrigin: true,
11
+ rewrite: path => path.replace('/api/', '/'),
12
+ },
13
+ }
14
+
15
+ return proxy
16
+ }
docker-compose.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+
3
+ services:
4
+ app:
5
+ image: chenzhaoyu94/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
6
+ ports:
7
+ - 3002:3002
8
+ environment:
9
+ # 二选一
10
+ OPENAI_API_KEY: xxxx
11
+ # 二选一
12
+ OPENAI_ACCESS_TOKEN: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaEVOVUpHTkVNMVFURTRNMEZCTWpkQ05UZzVNRFUxUlRVd1FVSkRNRU13UmtGRVFrRXpSZyJ9.eyJodHRwczovL2FwaS5vcGVuYWkuY29tL3Byb2ZpbGUiOnsiZW1haWwiOiJpbXNlbGRyaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlfSwiaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS9hdXRoIjp7InVzZXJfaWQiOiJ1c2VyLUNDZ3BiWGxnT0tyTGM0NHdoTVE1VllPVSJ9LCJpc3MiOiJodHRwczovL2F1dGgwLm9wZW5haS5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDk2MTc0MDkyNDY0NzcwODk5NDUiLCJhdWQiOlsiaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MSIsImh0dHBzOi8vb3BlbmFpLm9wZW5haS5hdXRoMGFwcC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjc4NTM4Nzc1LCJleHAiOjE2Nzk3NDgzNzUsImF6cCI6IlRkSkljYmUxNldvVEh0Tjk1bnl5d2g1RTR5T282SXRHIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBtb2RlbC5yZWFkIG1vZGVsLnJlcXVlc3Qgb3JnYW5pemF0aW9uLnJlYWQgb2ZmbGluZV9hY2Nlc3MifQ.ng_xpHh8pxKgGxBzMSO82uIB4qS2LAAHG-agzLElG-goKx1rivYJINGMT0y8lm7ar7SlJunyHP0mGGCQ71G6BPxiKrSdLQ39WckbP-qMPaADHY-EsIUOnySVR9xXxI0GG78rL5DseQgN0KWkyFx_PN-rReFGKVQCHBSgn7LUQANSv4SRMF4pwYmkokKUjL81PyZxCEVSnqfGWpF-bVIY5vaGMFl3U0jLXLVQGNJsLykl-cZIKU2UbYf3CeY2ubB8MiYdn4wlpjqjQmmX-QdpSBRyFWHTfm918MCponFP-VIfRI44Rb7K-juVho161djLi3aFedrcSjnazMPPL7mxLQ"
13
+ # API接口地址,可选,设置 OPENAI_API_KEY 时可用
14
+ OPENAI_API_BASE_URL: xxxx
15
+ # API模型,可选,设置 OPENAI_API_KEY 时可用
16
+ OPENAI_API_MODEL: xxxx
17
+ # 反向代理,可选
18
+ API_REVERSE_PROXY: xxx
19
+ # 访问权限密钥,可选
20
+ AUTH_SECRET_KEY: xxx
21
+ # 超时,单位毫秒,可选
22
+ TIMEOUT_MS: 60000
23
+ # Socks代理,可选,和 SOCKS_PROXY_PORT 一起时生效
24
+ SOCKS_PROXY_HOST: xxxx
25
+ # Socks代理端口,可选,和 SOCKS_PROXY_HOST 一起时生效
26
+ SOCKS_PROXY_PORT: xxxx
27
+ # HTTPS_PROXY 代理,可选
28
+ HTTPS_PROXY: http://xxxx:7890
29
+ nginx:
30
+ image: nginx:alpine
31
+ ports:
32
+ - '80:80'
33
+ expose:
34
+ - '80'
35
+ volumes:
36
+ - ./nginx/html:/usr/share/nginx/html
37
+ - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
38
+ links:
39
+ - app
docker-compose/docker-compose.yml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+
3
+ services:
4
+ app:
5
+ image: chenzhaoyu94/chatgpt-web # 总是使用latest,更新时重新pull该tag镜像即可
6
+ ports:
7
+ - 3002:3002
8
+ environment:
9
+ # 二选一
10
+ OPENAI_API_KEY: xxxx
11
+ # 二选一
12
+ OPENAI_ACCESS_TOKEN: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaEVOVUpHTkVNMVFURTRNMEZCTWpkQ05UZzVNRFUxUlRVd1FVSkRNRU13UmtGRVFrRXpSZyJ9.eyJodHRwczovL2FwaS5vcGVuYWkuY29tL3Byb2ZpbGUiOnsiZW1haWwiOiJpbXNlbGRyaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlfSwiaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS9hdXRoIjp7InVzZXJfaWQiOiJ1c2VyLUNDZ3BiWGxnT0tyTGM0NHdoTVE1VllPVSJ9LCJpc3MiOiJodHRwczovL2F1dGgwLm9wZW5haS5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDk2MTc0MDkyNDY0NzcwODk5NDUiLCJhdWQiOlsiaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MSIsImh0dHBzOi8vb3BlbmFpLm9wZW5haS5hdXRoMGFwcC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjc4NTM4Nzc1LCJleHAiOjE2Nzk3NDgzNzUsImF6cCI6IlRkSkljYmUxNldvVEh0Tjk1bnl5d2g1RTR5T282SXRHIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBtb2RlbC5yZWFkIG1vZGVsLnJlcXVlc3Qgb3JnYW5pemF0aW9uLnJlYWQgb2ZmbGluZV9hY2Nlc3MifQ.ng_xpHh8pxKgGxBzMSO82uIB4qS2LAAHG-agzLElG-goKx1rivYJINGMT0y8lm7ar7SlJunyHP0mGGCQ71G6BPxiKrSdLQ39WckbP-qMPaADHY-EsIUOnySVR9xXxI0GG78rL5DseQgN0KWkyFx_PN-rReFGKVQCHBSgn7LUQANSv4SRMF4pwYmkokKUjL81PyZxCEVSnqfGWpF-bVIY5vaGMFl3U0jLXLVQGNJsLykl-cZIKU2UbYf3CeY2ubB8MiYdn4wlpjqjQmmX-QdpSBRyFWHTfm918MCponFP-VIfRI44Rb7K-juVho161djLi3aFedrcSjnazMPPL7mxLQ"
13
+ # API接口地址,可选,设置 OPENAI_API_KEY 时可用
14
+ OPENAI_API_BASE_URL: xxxx
15
+ # API模型,可选,设置 OPENAI_API_KEY 时可用
16
+ OPENAI_API_MODEL: xxxx
17
+ # 反向代理,可选
18
+ API_REVERSE_PROXY: xxx
19
+ # 访问权限密钥,可选
20
+ AUTH_SECRET_KEY: xxx
21
+ # 超时,单位毫秒,可选
22
+ TIMEOUT_MS: 60000
23
+ # Socks代理,可选,和 SOCKS_PROXY_PORT 一起时生效
24
+ SOCKS_PROXY_HOST: xxxx
25
+ # Socks代理端口,可选,和 SOCKS_PROXY_HOST 一起时生效
26
+ SOCKS_PROXY_PORT: xxxx
27
+ # HTTPS_PROXY 代理,可选
28
+ HTTPS_PROXY: http://xxxx:7890
29
+ nginx:
30
+ image: nginx:alpine
31
+ ports:
32
+ - '80:80'
33
+ expose:
34
+ - '80'
35
+ volumes:
36
+ - ./nginx/html:/usr/share/nginx/html
37
+ - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
38
+ links:
39
+ - app
docker-compose/nginx/nginx.conf ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 80;
3
+ server_name localhost;
4
+ charset utf-8;
5
+ error_page 500 502 503 504 /50x.html;
6
+ location / {
7
+ root /usr/share/nginx/html;
8
+ try_files $uri /index.html;
9
+ }
10
+
11
+ location /api {
12
+ proxy_set_header X-Real-IP $remote_addr; #转发用户IP
13
+ proxy_pass http://app:3002;
14
+ }
15
+
16
+ proxy_set_header Host $host;
17
+ proxy_set_header X-Real-IP $remote_addr;
18
+ proxy_set_header REMOTE-HOST $remote_addr;
19
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
20
+ }
docker-compose/readme.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### docker-compose 部署教程
2
+ - 将打包好的前端文件放到 `nginx/html` 目录下
3
+ - ```shell
4
+ # 启动
5
+ docker-compose up -d
6
+ ```
7
+ - ```shell
8
+ # 查看运行状态
9
+ docker ps
10
+ ```
11
+ - ```shell
12
+ # 结束运行
13
+ docker-compose down
14
+ ```
docs/alipay.png ADDED
docs/c1-2.8.0.png ADDED
docs/c1-2.9.0.png ADDED
docs/c1.png ADDED
docs/c2-2.8.0.png ADDED
docs/c2-2.9.0.png ADDED
docs/c2.png ADDED
docs/docker.png ADDED
docs/wechat.png ADDED
index.html ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-cmn-Hans">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg">
6
+ <meta content="yes" name="apple-mobile-web-app-capable"/>
7
+ <link rel="apple-touch-icon" href="/favicon.ico">
8
+ <meta name="viewport"
9
+ content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
10
+ <title>ChatGPT Web</title>
11
+ </head>
12
+
13
+ <body class="dark:bg-black">
14
+ <div id="app">
15
+ <style>
16
+ .loading-wrap {
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ height: 100vh;
21
+ }
22
+
23
+ .balls {
24
+ width: 4em;
25
+ display: flex;
26
+ flex-flow: row nowrap;
27
+ align-items: center;
28
+ justify-content: space-between;
29
+ }
30
+
31
+ .balls div {
32
+ width: 0.8em;
33
+ height: 0.8em;
34
+ border-radius: 50%;
35
+ background-color: #4b9e5f;
36
+ }
37
+
38
+ .balls div:nth-of-type(1) {
39
+ transform: translateX(-100%);
40
+ animation: left-swing 0.5s ease-in alternate infinite;
41
+ }
42
+
43
+ .balls div:nth-of-type(3) {
44
+ transform: translateX(-95%);
45
+ animation: right-swing 0.5s ease-out alternate infinite;
46
+ }
47
+
48
+ @keyframes left-swing {
49
+
50
+ 50%,
51
+ 100% {
52
+ transform: translateX(95%);
53
+ }
54
+ }
55
+
56
+ @keyframes right-swing {
57
+ 50% {
58
+ transform: translateX(-95%);
59
+ }
60
+
61
+ 100% {
62
+ transform: translateX(100%);
63
+ }
64
+ }
65
+
66
+ @media (prefers-color-scheme: dark) {
67
+ body {
68
+ background: #121212;
69
+ }
70
+ }
71
+ </style>
72
+ <div class="loading-wrap">
73
+ <div class="balls">
74
+ <div></div>
75
+ <div></div>
76
+ <div></div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ <script type="module" src="/src/main.ts"></script>
81
+ </body>
82
+
83
+ </html>
license ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 ChenZhaoYu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "chatgpt-web",
3
+ "version": "2.10.5",
4
+ "private": false,
5
+ "description": "ChatGPT Web",
6
+ "author": "ChenZhaoYu <[email protected]>",
7
+ "keywords": [
8
+ "chatgpt-web",
9
+ "chatgpt",
10
+ "chatbot",
11
+ "vue"
12
+ ],
13
+ "scripts": {
14
+ "dev": "vite",
15
+ "build": "run-p type-check build-only",
16
+ "preview": "vite preview",
17
+ "build-only": "vite build",
18
+ "type-check": "vue-tsc --noEmit",
19
+ "lint": "eslint .",
20
+ "lint:fix": "eslint . --fix",
21
+ "bootstrap": "pnpm install && pnpm run common:prepare",
22
+ "common:cleanup": "rimraf node_modules && rimraf pnpm-lock.yaml",
23
+ "common:prepare": "husky install"
24
+ },
25
+ "dependencies": {
26
+ "@traptitech/markdown-it-katex": "^3.6.0",
27
+ "@vueuse/core": "^9.13.0",
28
+ "highlight.js": "^11.7.0",
29
+ "html2canvas": "^1.4.1",
30
+ "katex": "^0.16.4",
31
+ "markdown-it": "^13.0.1",
32
+ "naive-ui": "^2.34.3",
33
+ "pinia": "^2.0.32",
34
+ "vue": "^3.2.47",
35
+ "vue-i18n": "^9.2.2",
36
+ "vue-router": "^4.1.6"
37
+ },
38
+ "devDependencies": {
39
+ "@antfu/eslint-config": "^0.35.3",
40
+ "@commitlint/cli": "^17.4.4",
41
+ "@commitlint/config-conventional": "^17.4.4",
42
+ "@iconify/vue": "^4.1.0",
43
+ "@types/crypto-js": "^4.1.1",
44
+ "@types/katex": "^0.16.0",
45
+ "@types/markdown-it": "^12.2.3",
46
+ "@types/node": "^18.14.6",
47
+ "@vitejs/plugin-vue": "^4.0.0",
48
+ "autoprefixer": "^10.4.13",
49
+ "axios": "^1.3.4",
50
+ "crypto-js": "^4.1.1",
51
+ "eslint": "^8.35.0",
52
+ "husky": "^8.0.3",
53
+ "less": "^4.1.3",
54
+ "lint-staged": "^13.1.2",
55
+ "npm-run-all": "^4.1.5",
56
+ "postcss": "^8.4.21",
57
+ "rimraf": "^4.2.0",
58
+ "tailwindcss": "^3.2.7",
59
+ "typescript": "~4.9.5",
60
+ "vite": "^4.1.4",
61
+ "vite-plugin-pwa": "^0.14.4",
62
+ "vue-tsc": "^1.2.0"
63
+ },
64
+ "lint-staged": {
65
+ "*.{ts,tsx,vue}": [
66
+ "pnpm lint:fix"
67
+ ]
68
+ }
69
+ }
pnpm-lock.yaml ADDED
The diff for this file is too large to render. See raw diff
 
postcss.config.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
public/favicon.ico ADDED
public/favicon.svg ADDED
public/pwa-192x192.png ADDED
public/pwa-512x512.png ADDED
service/.env ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OpenAI API Key - https://platform.openai.com/overview
2
+ OPENAI_API_KEY=
3
+
4
+ # change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
5
+ OPENAI_ACCESS_TOKEN= "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaEVOVUpHTkVNMVFURTRNMEZCTWpkQ05UZzVNRFUxUlRVd1FVSkRNRU13UmtGRVFrRXpSZyJ9.eyJodHRwczovL2FwaS5vcGVuYWkuY29tL3Byb2ZpbGUiOnsiZW1haWwiOiJpbXNlbGRyaXRoQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlfSwiaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS9hdXRoIjp7InVzZXJfaWQiOiJ1c2VyLUNDZ3BiWGxnT0tyTGM0NHdoTVE1VllPVSJ9LCJpc3MiOiJodHRwczovL2F1dGgwLm9wZW5haS5jb20vIiwic3ViIjoiZ29vZ2xlLW9hdXRoMnwxMDk2MTc0MDkyNDY0NzcwODk5NDUiLCJhdWQiOlsiaHR0cHM6Ly9hcGkub3BlbmFpLmNvbS92MSIsImh0dHBzOi8vb3BlbmFpLm9wZW5haS5hdXRoMGFwcC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNjc4NTM4Nzc1LCJleHAiOjE2Nzk3NDgzNzUsImF6cCI6IlRkSkljYmUxNldvVEh0Tjk1bnl5d2g1RTR5T282SXRHIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSBlbWFpbCBtb2RlbC5yZWFkIG1vZGVsLnJlcXVlc3Qgb3JnYW5pemF0aW9uLnJlYWQgb2ZmbGluZV9hY2Nlc3MifQ.ng_xpHh8pxKgGxBzMSO82uIB4qS2LAAHG-agzLElG-goKx1rivYJINGMT0y8lm7ar7SlJunyHP0mGGCQ71G6BPxiKrSdLQ39WckbP-qMPaADHY-EsIUOnySVR9xXxI0GG78rL5DseQgN0KWkyFx_PN-rReFGKVQCHBSgn7LUQANSv4SRMF4pwYmkokKUjL81PyZxCEVSnqfGWpF-bVIY5vaGMFl3U0jLXLVQGNJsLykl-cZIKU2UbYf3CeY2ubB8MiYdn4wlpjqjQmmX-QdpSBRyFWHTfm918MCponFP-VIfRI44Rb7K-juVho161djLi3aFedrcSjnazMPPL7mxLQ"
6
+
7
+ # OpenAI API Base URL - https://api.openai.com
8
+ OPENAI_API_BASE_URL=
9
+
10
+ # OpenAI API Model - https://platform.openai.com/docs/models
11
+ OPENAI_API_MODEL=
12
+
13
+ # Reverse Proxy
14
+ API_REVERSE_PROXY=
15
+
16
+ # timeout
17
+ TIMEOUT_MS=100000
18
+
19
+ # Secret key
20
+ AUTH_SECRET_KEY=
21
+
22
+ # Socks Proxy Host
23
+ SOCKS_PROXY_HOST=
24
+
25
+ # Socks Proxy Port
26
+ SOCKS_PROXY_PORT=
27
+
28
+ # HTTPS PROXY
29
+ HTTPS_PROXY=
service/.eslintrc.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "root": true,
3
+ "ignorePatterns": ["build"],
4
+ "extends": ["@antfu"]
5
+ }
service/.gitignore ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ .DS_Store
12
+ dist
13
+ dist-ssr
14
+ coverage
15
+ *.local
16
+
17
+ /cypress/videos/
18
+ /cypress/screenshots/
19
+
20
+ # Editor directories and files
21
+ .vscode/*
22
+ !.vscode/settings.json
23
+ !.vscode/extensions.json
24
+ .idea
25
+ *.suo
26
+ *.ntvs*
27
+ *.njsproj
28
+ *.sln
29
+ *.sw?
30
+
31
+ build
service/.npmrc ADDED
@@ -0,0 +1 @@
 
 
1
+ enable-pre-post-scripts=true
service/.vscode/extensions.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "recommendations": ["dbaeumer.vscode-eslint"]
3
+ }
service/.vscode/settings.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "prettier.enable": false,
3
+ "editor.formatOnSave": false,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": true
6
+ },
7
+ "eslint.validate": [
8
+ "javascript",
9
+ "typescript",
10
+ "json",
11
+ "jsonc",
12
+ "json5",
13
+ "yaml"
14
+ ],
15
+ "cSpell.words": [
16
+ "antfu",
17
+ "chatgpt",
18
+ "esno",
19
+ "GPTAPI",
20
+ "OPENAI"
21
+ ]
22
+ }