# ChatGPT Web
> Disclaimer: This project is only published on GitHub, based on the MIT license, free and for open source learning usage. And there will be no any form of account selling, paid service, discussion group, discussion group and other behaviors. Beware of being deceived.
![cover](./docs/c1.png)
![cover2](./docs/c2.png)
- [ChatGPT Web](#chatgpt-web)
- [Introduction](#introduction)
- [To-Do List](#to-do-list)
- [Prerequisites](#prerequisites)
- [Node](#node)
- [PNPM](#pnpm)
- [Fill in Keys](#fill-in-keys)
- [Install Dependencies](#install-dependencies)
- [Backend](#backend)
- [Frontend](#frontend)
- [Run in Test Environment](#run-in-test-environment)
- [Backend Service](#backend-service)
- [Frontend Webpage](#frontend-webpage)
- [Environment Variables](#environment-variables)
- [Packaging](#packaging)
- [Use Docker](#use-docker)
- [Docker Parameter Examples](#docker-parameter-examples)
- [Docker Build & Run](#docker-build--run)
- [Docker Compose](#docker-compose)
- [Prevent Crawlers](#prevent-crawlers)
- [Deploy with Railway](#deploy-with-railway)
- [Railway Environment Variables](#railway-environment-variables)
- [Deploy with Sealos](#deploy-with-sealos)
- [Package Manually](#package-manually)
- [Backend Service](#backend-service-1)
- [Frontend Webpage](#frontend-webpage-1)
- [FAQ](#faq)
- [Contributing](#contributing)
- [Sponsors](#sponsors)
- [License](#license)
## Introduction
Supports dual models and provides two unofficial `ChatGPT API` methods
| Method | Free? | Reliability | Quality |
| ---------------------------------- | ----- | ----------- | ------- |
| `ChatGPTAPI(gpt-3.5-turbo-0301)` | No | Reliable | Relatively stupid |
| `ChatGPTUnofficialProxyAPI(web accessToken)` | Yes | Relatively unreliable | Smart |
Comparison:
1. `ChatGPTAPI` uses `gpt-3.5-turbo` through `OpenAI` official `API` to call `ChatGPT`
2. `ChatGPTUnofficialProxyAPI` uses unofficial proxy server to access `ChatGPT`'s backend `API`, bypass `Cloudflare` (dependent on third-party servers, and has rate limits)
Warnings:
1. You should first use the `API` method
2. When using the `API`, if the network is not working, it is blocked in China, you need to build your own proxy, never use someone else's public proxy, which is dangerous.
3. When using the `accessToken` method, the reverse proxy will expose your access token to third parties. This should not have any adverse effects, but please consider the risks before using this method.
4. When using `accessToken`, whether you are a domestic or foreign machine, proxies will be used. The default proxy is [pengzhile](https://github.com/pengzhile)'s `https://ai.fakeopen.com/api/conversation`. This is not a backdoor or monitoring unless you have the ability to flip over `CF` verification yourself. Use beforehand acknowledge. [Community Proxy](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) (Note: Only these two are recommended, other third-party sources, please identify for yourself)
5. When publishing the project to public network, you should set the `AUTH_SECRET_KEY` variable to add your password access, you should also modify the `title` in `index. html` to prevent it from being searched by keywords.
Switching methods:
1. Enter the `service/.env.example` file, copy the contents to the `service/.env` file
2. To use `OpenAI API Key`, fill in the `OPENAI_API_KEY` field [(get apiKey)](https://platform.openai.com/overview)
3. To use `Web API`, fill in the `OPENAI_ACCESS_TOKEN` field [(get accessToken)](https://chat.openai.com/api/auth/session)
4. `OpenAI API Key` takes precedence when both exist
Environment variables:
See all parameter variables [here](#environment-variables)
## Roadmap
[✓] Dual models
[✓] Multi-session storage and context logic
[✓] Formatting and beautification of code and other message types
[✓] Access control
[✓] Data import/export
[✓] Save messages as local images
[✓] Multilingual interface
[✓] Interface themes
[✗] More...
## Prerequisites
### Node
`node` requires version `^16 || ^18 || ^19` (`node >= 14` needs [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill) installation), use [nvm](https://github.com/nvm-sh/nvm) to manage multiple local `node` versions
```shell
node -v
```
### PNPM
If you haven't installed `pnpm`
```shell
npm install pnpm -g
```
### Filling in the Key
Get `Openai Api Key` or `accessToken` and fill in the local environment variables [Go to Introduction](#introduction)
```
# service/.env file
# OpenAI API Key - https://platform.openai.com/overview
OPENAI_API_KEY=
# change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response
OPENAI_ACCESS_TOKEN=
```
## Install Dependencies
> For the convenience of "backend developers" to understand the burden, the front-end "workspace" mode is not adopted, but separate folders are used to store them. If you only need to do secondary development of the front-end page, delete the `service` folder.
### Backend
Enter the folder `/service` and run the following commands
```shell
pnpm install
```
### Frontend
Run the following commands at the root directory
```shell
pnpm bootstrap
```
## Run in Test Environment
### Backend Service
Enter the folder `/service` and run the following commands
```shell
pnpm start
```
### Frontend Webpage
Run the following commands at the root directory
```shell
pnpm dev
```
## Environment Variables
`API` available:
- `OPENAI_API_KEY` and `OPENAI_ACCESS_TOKEN` choose one
- `OPENAI_API_MODEL` Set model, optional, default: `gpt-3.5-turbo`
- `OPENAI_API_BASE_URL` Set interface address, optional, default: `https://api.openai.com`
- `OPENAI_API_DISABLE_DEBUG` Set interface to close debug logs, optional, default: empty does not close
`ACCESS_TOKEN` available:
- `OPENAI_ACCESS_TOKEN` and `OPENAI_API_KEY` choose one, `OPENAI_API_KEY` takes precedence when both exist
- `API_REVERSE_PROXY` Set reverse proxy, optional, default: `https://ai.fakeopen.com/api/conversation`, [Community](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy) (Note: Only these two are recommended, other third party sources, please identify for yourself)
Common:
- `AUTH_SECRET_KEY` Access permission key, optional
- `MAX_REQUEST_PER_HOUR` Maximum number of requests per hour, optional, unlimited by default
- `TIMEOUT_MS` Timeout, unit milliseconds, optional
- `SOCKS_PROXY_HOST` and `SOCKS_PROXY_PORT` take effect together, optional
- `SOCKS_PROXY_PORT` and `SOCKS_PROXY_HOST` take effect together, optional
- `HTTPS_PROXY` Support `http`, `https`, `socks5`, optional
- `ALL_PROXY` Support `http`, `https`, `socks5`, optional
## Packaging
### Use Docker
#### Docker Parameter Examples
![docker](./docs/docker.png)
#### Docker build & Run
```bash
docker build -t chatgpt-web .
# Foreground running
docker run --name chatgpt-web --rm -it -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
# Background running
docker run --name chatgpt-web -d -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web
# Run address
http://localhost:3002/
```
#### Docker compose
[Hub address](https://hub.docker.com/repository/docker/chenzhaoyu94/chatgpt-web/general)
```yml
version: '3'
services:
app:
image: chenzhaoyu94/chatgpt-web # always use latest, pull the tag image again to update
ports:
- 127.0.0.1:3002:3002
environment:
# choose one
OPENAI_API_KEY: sk-xxx
# choose one
OPENAI_ACCESS_TOKEN: xxx
# API interface address, optional, available when OPENAI_API_KEY is set
OPENAI_API_BASE_URL: xxx
# API model, optional, available when OPENAI_API_KEY is set, https://platform.openai.com/docs/models
# gpt-4, gpt-4-turbo-preview, gpt-4-0125-preview, gpt-4-1106-preview, gpt-4-0314, gpt-4-
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
大模型应用-使用Express+Vue3搭建ChatGPT应用Web-聊天机器人-附详细流程教程-优质大模型应用项目实战.zip (146个子文件)
.eslintrc.cjs 58B
start.cmd 163B
commit-msg 84B
nginx.conf 888B
tailwind.css 59B
Dockerfile 794B
.dockerignore 69B
.editorconfig 198B
.env 243B
.eslintignore 26B
.env.example 916B
.gitignore 332B
index.html 2KB
favicon.ico 41KB
avatar.jpg 5KB
tailwind.config.js 470B
postcss.config.js 82B
package-lock.json 753KB
package-lock.json 249KB
package.json 2KB
package.json 1KB
settings.json 1KB
devcontainer.json 909B
launch.json 812B
recommend.json 627B
tsconfig.json 588B
tsconfig.json 497B
settings.json 338B
.eslintrc.json 75B
extensions.json 65B
.commitlintrc.json 53B
extensions.json 52B
github-markdown.less 25KB
style.less 3KB
highlight.less 3KB
global.less 143B
README.md 12KB
README.md 265B
README.md 153B
.npmrc 31B
.npmrc 29B
c2-2.8.0.png 396KB
c1-2.9.0.png 282KB
c2-2.9.0.png 128KB
c1-2.8.0.png 123KB
docker.png 108KB
c1.png 96KB
c2.png 78KB
pwa-512x512.png 34KB
pwa-192x192.png 7KB
pre-commit 69B
start.sh 182B
404.svg 28KB
favicon.svg 1KB
index.ts 8KB
ru-RU.ts 6KB
index.ts 5KB
vi-VN.ts 4KB
ko-KR.ts 4KB
es-ES.ts 4KB
en-US.ts 3KB
zh-TW.ts 3KB
zh-CN.ts 3KB
index.ts 2KB
index.ts 2KB
index.ts 2KB
index.ts 1KB
vite.config.ts 1KB
index.ts 1KB
useScroll.ts 1KB
index.ts 1KB
index.ts 1KB
helper.ts 1013B
chat.d.ts 956B
useTheme.ts 942B
scrollbarStyle.ts 919B
index.ts 914B
helper.ts 809B
index.ts 801B
is.ts 764B
helper.ts 755B
types.ts 702B
permission.ts 700B
useChat.ts 698B
limiter.ts 698B
useLanguage.ts 695B
axios.ts 689B
useIconRender.ts 650B
auth.ts 618B
index.ts 593B
index.ts 590B
useUsingContext.ts 579B
helper.ts 558B
index.ts 539B
copy.ts 502B
index.ts 454B
assets.ts 447B
main.ts 434B
helper.ts 429B
types.ts 428B
共 146 条
- 1
- 2
资源评论
极智视界
- 粉丝: 2w+
- 资源: 1459
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 华为云会议安装包适配华为擎云L410 -1060 ARM架构
- 清空redis缓存脚本指令
- STM8S微控制器-寄存器操作指南
- apk一键安装,获取apk签名信息
- opencv4.8.0+contrib+cuda文件
- 【全网最新最全】大气公司年度月度总结汇报PPT
- C语言实现低功耗STM32F411开发板(原理图+PCB源文件+官方例程+驱动等).zip
- C语言实现基于STM32 的联合调试侦听设备解决方案(原理图、PCB源文件、调试工具、视频).zip
- 【全网最全最酷】部门年度年终工作总结汇报PPT模板
- C语言实现基于STM32F103RC的电子相册(原理图、PCB源文件、程序源码及制作).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功