Skip to content

Commit

Permalink
refactor: 重构商业化页面新增后台管理
Browse files Browse the repository at this point in the history
  • Loading branch information
79E committed May 21, 2023
1 parent 2cac991 commit df59fcc
Show file tree
Hide file tree
Showing 75 changed files with 5,575 additions and 2,360 deletions.
22 changes: 3 additions & 19 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
# 系统环境
VITE_APP_ENV=development

# 请求地址 (商业模式会走这条地址)
VITE_APP_REQUEST_HOST=https://api.aizj.top/api

# 内置请求地址和KEY设置
VITE_APP_AI_BASE_URL=https://api.openai.com

# Api 请求使用的 key, 支持多个 key,以逗号分隔(,)
VITE_APP_AI_KEYS=

# 多个 key 时的调度策略模式 随机(random)
VITE_APP_AI_KEY_STRATEGY=random
# 请求地址
VITE_APP_REQUEST_HOST=http://127.0.0.1:3200

# APP 名称&Logo
VITE_APP_TITLE=ChatGpt
VITE_APP_LOGO=https://cdn.jsdelivr.net/gh/duogongneng/testuitc/svg-1681898659579.svg

# web 应用模式
# 商业模式 --- business
# 代理模式 --- proxy
# 混合模式 --- mix
VITE_APP_MODE=mix

VITE_APP_LOGO=https://u1.dl0.cn/icon/openailogo.svg
21 changes: 3 additions & 18 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
# 系统环境
VITE_APP_ENV=production

# 请求地址 (商业模式会走这条地址)
VITE_APP_REQUEST_HOST=https://api.aizj.top/api

# 内置请求地址和KEY设置
VITE_APP_AI_BASE_URL=https://api.openai.com

# Api 请求使用的 key, 支持多个 key,以逗号分隔(,)
VITE_APP_AI_KEYS=

# 多个 key 时的调度策略模式 随机(random)
VITE_APP_AI_KEY_STRATEGY=random
# 请求地址
VITE_APP_REQUEST_HOST=

# APP 名称&Logo
VITE_APP_TITLE=ChatGpt
VITE_APP_LOGO=https://cdn.jsdelivr.net/gh/duogongneng/testuitc/svg-1681898659579.svg

# web 应用模式
# 商业模式 --- business
# 代理模式 --- proxy
# 混合模式 --- mix
VITE_APP_MODE=proxy
VITE_APP_LOGO=https://u1.dl0.cn/icon/openailogo.svg
3 changes: 1 addition & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module.exports = {
'node': true,
'es6': true
},
'overrides': [
],
'overrides': [],
'parser': '@typescript-eslint/parser',
'parserOptions': {
'ecmaVersion': 'latest',
Expand Down
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ node_modules
dist
dist-ssr
*.local
.vite

# Editor directories and files
.vscode/*
Expand All @@ -24,3 +25,34 @@ dist-ssr
*.njsproj
*.sln
*.sw?


# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
*.pem

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
82 changes: 31 additions & 51 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,47 @@

<h1 align="center">ChatGPT Web</h1>

[English](https://github.com/79E/ChatGpt-Web) / 简体中文
English / [简体中文](https://github.com/79E/ChatGpt-Web/blob/master/README-CN.md)

A commercially-viable ChatGpt web application built with React.

可部署商业化的 ChatGpt 网页应用。

[Proxy Demo]() / [Business Demo](https://chatgpt79.vercel.app/) / [Issues](https://github.com/79E/ChatGPT-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/beggar)

[代理(proxy)演示](https://chatgpt79.vercel.app/) / [商业(business)演示](https://aizj.top/) / [反馈](https://github.com/79E/ChatGPT-Web/issues) / [赞助我](https://www.imageoss.com/images/2023/05/06/e38f4a42046a1909773b955c56468d6b83fcd9b5d593c449.jpg)
[Issues](https://github.com/79E/ChatGPT-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/beggar) / [赞助我](https://files.catbox.moe/o0znrg.JPG)

[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/79E/ChatGpt-Web)

![cover](https://cdn.jsdelivr.net/gh/duogongneng/testuitc/1683604333996c1.png)
![cover](https://cdn.jsdelivr.net/gh/duogongneng/testuitc/1683604333960c2.png)
</div>

## 🐶 演示
### 页面链接
[Web 演示: https://www.aizj.top/](https://www.aizj.top/)

![群组](https://files.catbox.moe/hqwrq4.png)
[Admin 演示: https://www.aizj.top/admin](https://www.aizj.top/admin)

</div>
如需帮助请提交 [Issues](https://github.com/79E/ChatGPT-Web/issues) 或赞赏时留下联系方式。

### 页面截图

![cover](https://files.catbox.moe/tp963e.png)
![cover](https://files.catbox.moe/y5avbx.png)
![cover](https://files.catbox.moe/k16jsz.png)
![cover](https://files.catbox.moe/8o5oja.png)

## 🤖 主要功能

- 用户系统可对使用进行相关限制
- 精心设计的 UI,响应式设计
- 后台管理系统,可对用户,Token,商品,卡密等进行管理
- 精心设计的 UI,响应式设计
- 极快的首屏加载速度(~100kb)
- 支持Midjourney绘画和DALL·E模型绘画,GPT4等应用
- 海量的内置 prompt 列表,来自[中文](https://github.com/PlexPt/awesome-chatgpt-prompts-zh)[英文](https://github.com/f/awesome-chatgpt-prompts)
- 一键导出聊天记录,完整的 Markdown 支持
- 支持自定义API地址(如:[openAI](https://api.openai.com) / [API2D](https://api2d.com/r/192767)

## 🎮 开始使用
**Node 环境**

`node` 需要 `^16 || ^18 || ^19` 版本(node >= 16),可以使用 nvm 管理本地多个 node 版本。
`node` 需要 `^16 || ^18 || ^19` 版本(node >= 16.19.0),可以使用 nvm 管理本地多个 node 版本。

```
# 查看 node 版本
Expand All @@ -60,15 +69,15 @@ yarn install

**3.运行**
```
yarn dev
# web项目启动
yarn dev:web
```

**4.打包**
```
yarn build
```


## ⛺️ 环境变量

> 本项目大多数配置项都通过环境变量来设置。
Expand All @@ -85,61 +94,32 @@ Chat Web 标题名称。

Chat Web Logo。

#### `VITE_APP_MODE`

应用模式可选:商业模式(business)代理模式(proxy)混合模式(mix)

#### `VITE_APP_AI_BASE_URL`

可在内置请求地址设置(如用户未设置自己的key则走这里)

#### `VITE_APP_AI_KEYS`

Api 请求使用的 key, 支持多个 key,以逗号分隔(,)

## 🚧 开发

> 强烈不建议在本地进行开发或者部署,由于一些技术原因,很难在本地配置好 OpenAI API 代理,除非你能保证可以直连 OpenAI 服务器。
#### 本地开发

1. 安装 nodejs 和 yarn,具体细节请询问 ChatGPT;
2. 执行 `yarn install && yarn dev` 即可。
1. 安装 nodejs 和 yarn具体细节请询问 ChatGPT
2. 执行 `yarn install` 即可
3. web项目开发 `yarn dev:web`
4. 服务端项目开发 `yarn dev`
5. 打包项目 `yarn build`

#### 服务端

1. 目前服务端还不完善所以暂时未开源
2. 前端请求服务端的 [接口文档](https://console-docs.apipost.cn/preview/dcf9a900ac5a1154/00eeb0b3f589d8e6) 你们可以按照这个接口文档进行开发
1. 前端请求服务端的 [接口文档](https://console-docs.apipost.cn/preview/38826c52f656ef05/044846bd536b67bb) 你们可以按照这个接口文档进行开发
2. 如需帮助请提交 [Issues](https://github.com/79E/ChatGPT-Web/issues) 或赞赏时留下联系方式。

## 🎯 部署
> 直接将打包好的 `dist` 目录上传到服务器即可。WEB项目暂时不直接访问 OpenAI API 所有不要求服务器地址。
> 直接将`WEB`项目打包好的 `dist` 目录上传到服务器即可。注意服务器IP地址位置!
### Vercel
如果你将其托管在自己的 Vercel 服务器上,可点击 deploy 按钮来开始你的部署!

[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/79E/ChatGpt-Web)

<details>
<summary>设置 Vercel 的指导</summary>

1. 前往 [vercel.com](https://vercel.com/)
1. 点击 `Log in`
![](https://files.catbox.moe/tct1wg.png)
1. 点击 `Continue with GitHub` 通过 GitHub 进行登录
![](https://files.catbox.moe/btd78j.jpeg)
1. 登录 GitHub 并允许访问所有存储库(如果系统这样提示)
1. Fork 这个仓库
1. 返回到你的 [Vercel dashboard](https://vercel.com/dashboard)
1. 选择 `Import Project`
![](https://files.catbox.moe/qckos0.png)
1. 选择 `Import Git Repository`
![](https://files.catbox.moe/pqub9q.png)
1. 选择 root 并将所有内容保持不变,并且只需添加名为 PAT_1 的环境变量(如图所示),其中将包含一个个人访问令牌(PAT),你可以在[这里](https://github.com/settings/tokens/new)轻松创建(保留默认,并且只需要命名下,名字随便)
![](https://files.catbox.moe/0ez4g7.png)
1. 点击 deploy,这就完成了,查看你的域名就可使用 API 了!

</details>

如需帮助请提交 [Issues](https://github.com/79E/ChatGPT-Web/issues) 或赞赏时留下联系方式。

## 🧘 贡献者

Expand Down
76 changes: 43 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,47 @@ A commercially-viable ChatGpt web application built with React.

可部署商业化的 ChatGpt 网页应用。

[Proxy Demo]() / [Business Demo](https://chatgpt79.vercel.app/) / [Issues](https://github.com/79E/ChatGPT-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/beggar)

[代理(proxy)演示](https://chatgpt79.vercel.app/) / [商业(business)演示](https://aizj.top/) / [反馈](https://github.com/79E/ChatGPT-Web/issues) / [赞助我](https://www.imageoss.com/images/2023/05/06/e38f4a42046a1909773b955c56468d6b83fcd9b5d593c449.jpg)
[Issues](https://github.com/79E/ChatGPT-Web/issues) / [Buy Me a Coffee](https://www.buymeacoffee.com/beggar) / [赞助我](https://files.catbox.moe/o0znrg.JPG)

[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/79E/ChatGpt-Web)

![cover](https://cdn.jsdelivr.net/gh/duogongneng/testuitc/1683604333996c1.png)
![cover](https://cdn.jsdelivr.net/gh/duogongneng/testuitc/1683604333960c2.png)

![群组](https://files.catbox.moe/hqwrq4.png)
</div>

## 🐶 Demo
### Link

[Web Demo: https://www.aizj.top/](https://www.aizj.top/)

[Web 演示: https://www.aizj.top/](https://www.aizj.top/)

[Admin Demo: https://www.aizj.top/admin](https://www.aizj.top/admin)

[Admin 演示: https://www.aizj.top/admin](https://www.aizj.top/admin)

If you need help, please submit [Issues](https://github.com/79E/ChatGPT-Web/issues) Or leave contact information when appreciating.
### Snapshot

![cover](https://files.catbox.moe/tp963e.png)
![cover](https://files.catbox.moe/y5avbx.png)
![cover](https://files.catbox.moe/k16jsz.png)
![cover](https://files.catbox.moe/8o5oja.png)

![赞赏](https://files.catbox.moe/o0znrg.JPG)

## 🤖 Major Function

- The user system can impose relevant restrictions on usage
- Carefully designed UI, responsive design.
- Extremely fast first screen loading speed(~100kb)
- Massive built-in prompt list from[Chinese](https://github.com/PlexPt/awesome-chatgpt-prompts-zh) AND [English](https://github.com/f/awesome-chatgpt-prompts)
- One click export of chat records, complete Markdown support.
- Support for custom API addresses(example:[openAI](https://api.openai.com) / [API2D](https://api2d.com/r/192767)
- The backend management system can manage users, tokens, products, card passwords, etc
- Carefully designed UI, responsive design
- Extremely fast first screen loading speed (~100kb)
- Supports Midjournal painting, DALL · E model painting, GPT4 and other applications
- Massive built-in prompt list from [Chinese](https://github.com/PlexPt/awesome-chatgpt-prompts-zh)And [English](https://github.com/f/awesome-chatgpt-prompts)
- One click export of chat records, complete Markdown support
- Support for custom API addresses ([openAI](https://api.openai.com) / [API2D]( https://api2d.com/r/192767 ))

## 🎮 Start Using
**Node**

Node requires version `^ 16 | | ^ 18 | | ^ 19 `(node>=16), and NVM can be used to manage multiple local node versions.
Node requires version `^ 16 | | ^ 18 | | ^ 19 `(node >= 16.19.0), and NVM can be used to manage multiple local node versions.

```
# View node version
Expand All @@ -59,7 +75,8 @@ yarn install

**3.Run**
```
yarn dev
# run web
yarn dev:web
```

**4.Build**
Expand All @@ -82,42 +99,35 @@ Chat Web title.

#### `VITE_APP_LOGO`

Chat Web Logo。

#### `VITE_APP_MODE`

Optional application mode: business mode proxy pattern mixed mode.

#### `VITE_APP_AI_BASE_URL`

Built in request address and KEY settings

#### `VITE_APP_AI_KEYS`

The key used by Api requests, supporting multiple keys separated by commas (,)
Chat Web Logo.

## 🚧 Develop

> It is strongly not recommended to develop or deploy locally. Due to technical reasons, it is difficult to configure OpenAI API proxies locally, unless you can guarantee direct connection to the OpenAI server.
#### Local development

1. Install `Nodejs` and `Yarn`, please consult ChatGPT for specific details;
2. Execute `yarn install && yarn dev`.
1. Please consult ChatGPT for specific details on installing `Nodejs` and `Yarn`
2. Just execute `yarn install`
3. Web Project Development `yarn dev:web`
4. Server side project development `yarn dev`
5. Package Project `yarn build`

#### Server side

1. Currently, the server is not yet fully developed, so it is currently not open source.
2. Front end request server's [interface document](https://console-docs.apipost.cn/preview/dcf9a900ac5a1154/00eeb0b3f589d8e6) You can develop according to this interface document.
1. Front end request server's [interface document](https://console-docs.apipost.cn/preview/38826c52f656ef05/044846bd536b67bb) You can develop according to this interface document.
2. If you need help, please submit [Issues](https://github.com/79E/ChatGPT-Web/issues) Or leave contact information when appreciating.

## 🎯 Arrange
> Simply upload the packaged `dist` directory to the server. The WEB project temporarily does not directly access the OpenAI API and does not require a server address.
> Simply upload the packaged `dist` directory of the `WEB` project to the server. Pay attention to the server IP address location!
### Vercel
If you host it on your own Vercel server, you can click the deploy button to start your deployment!

[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/79E/ChatGpt-Web)

If you need help, please submit [Issues](https://github.com/79E/ChatGPT-Web/issues) Or leave contact information when appreciating.

## 🧘 Contributor

[See project contributor list](https://github.com/79E/ChatGPT-Web/graphs/contributors)
Expand Down
Loading

0 comments on commit df59fcc

Please sign in to comment.