{"id":19217534,"url":"https://github.com/lwdgit/https-github.com-lwdgit-chatgpt-web","last_synced_at":"2026-03-01T11:32:41.989Z","repository":{"id":189407599,"uuid":"659389711","full_name":"lwdgit/https-github.com-lwdgit-chatgpt-web","owner":"lwdgit","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-27T18:19:55.000Z","size":5789,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-14T11:15:44.632Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lwdgit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.en.md","funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-27T18:19:53.000Z","updated_at":"2023-06-27T18:20:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"a598b37c-f1f3-4dd2-8fd2-87f16bdc091e","html_url":"https://github.com/lwdgit/https-github.com-lwdgit-chatgpt-web","commit_stats":null,"previous_names":["lwdgit/https-github.com-lwdgit-chatgpt-web"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lwdgit/https-github.com-lwdgit-chatgpt-web","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fhttps-github.com-lwdgit-chatgpt-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fhttps-github.com-lwdgit-chatgpt-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fhttps-github.com-lwdgit-chatgpt-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fhttps-github.com-lwdgit-chatgpt-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lwdgit","download_url":"https://codeload.github.com/lwdgit/https-github.com-lwdgit-chatgpt-web/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwdgit%2Fhttps-github.com-lwdgit-chatgpt-web/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29968480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T10:55:55.490Z","status":"ssl_error","status_checked_at":"2026-03-01T10:55:55.175Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T14:22:42.267Z","updated_at":"2026-03-01T11:32:41.966Z","avatar_url":"https://github.com/lwdgit.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChatGPT Web\n\n\u003e 声明：此项目只发布于 GitHub，基于 MIT 协议，免费且作为开源学习使用。并且不会有任何形式的卖号、付费服务、讨论群、讨论组等行为。谨防受骗。\n\n更多功能：[chatgpt-web-plus](https://github.com/Chanzhaoyu/chatgpt-web-plus)\n\n![cover](./docs/c1.png)\n![cover2](./docs/c2.png)\n\n- [ChatGPT Web](#chatgpt-web)\n\t- [介绍](#介绍)\n\t- [待实现路线](#待实现路线)\n\t- [前置要求](#前置要求)\n\t\t- [Node](#node)\n\t\t- [PNPM](#pnpm)\n\t\t- [填写密钥](#填写密钥)\n\t- [安装依赖](#安装依赖)\n\t\t- [后端](#后端)\n\t\t- [前端](#前端)\n\t- [测试环境运行](#测试环境运行)\n\t\t- [后端服务](#后端服务)\n\t\t- [前端网页](#前端网页)\n\t- [环境变量](#环境变量)\n\t- [打包](#打包)\n\t\t- [使用 Docker](#使用-docker)\n\t\t\t- [Docker 参数示例](#docker-参数示例)\n\t\t\t- [Docker build \\\u0026 Run](#docker-build--run)\n\t\t\t- [Docker compose](#docker-compose)\n\t\t\t- [防止爬虫抓取](#防止爬虫抓取)\n\t\t- [使用 Railway 部署](#使用-railway-部署)\n\t\t\t- [Railway 环境变量](#railway-环境变量)\n\t\t- [手动打包](#手动打包)\n\t\t\t- [后端服务](#后端服务-1)\n\t\t\t- [前端网页](#前端网页-1)\n\t- [常见问题](#常见问题)\n\t- [参与贡献](#参与贡献)\n\t- [赞助](#赞助)\n\t- [License](#license)\n## 介绍\n\n支持双模型，提供了两种非官方 `ChatGPT API` 方法\n\n| 方式                                          | 免费？ | 可靠性     | 质量 |\n| --------------------------------------------- | ------ | ---------- | ---- |\n| `ChatGPTAPI(gpt-3.5-turbo-0301)`                           | 否     | 可靠       | 相对较笨 |\n| `ChatGPTUnofficialProxyAPI(网页 accessToken)` | 是     | 相对不可靠 | 聪明 |\n\n对比：\n1. `ChatGPTAPI` 使用 `gpt-3.5-turbo` 通过 `OpenAI` 官方 `API` 调用 `ChatGPT`\n2. `ChatGPTUnofficialProxyAPI` 使用非官方代理服务器访问 `ChatGPT` 的后端`API`，绕过`Cloudflare`（依赖于第三方服务器，并且有速率限制）\n\n警告：\n1. 你应该首先使用 `API` 方式\n2. 使用 `API` 时，如果网络不通，那是国内被墙了，你需要自建代理，绝对不要使用别人的公开代理，那是危险的。\n3. 使用 `accessToken` 方式时反向代理将向第三方暴露您的访问令牌，这样做应该不会产生任何不良影响，但在使用这种方法之前请考虑风险。\n4. 使用 `accessToken` 时，不管你是国内还是国外的机器，都会使用代理。默认代理为 [pengzhile](https://github.com/pengzhile) 大佬的 `https://ai.fakeopen.com/api/conversation`，这不是后门也不是监听，除非你有能力自己翻过 `CF` 验证，用前请知悉。[社区代理](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy)（注意：只有这两个是推荐，其他第三方来源，请自行甄别）\n5. 把项目发布到公共网络时，你应该设置 `AUTH_SECRET_KEY` 变量添加你的密码访问权限，你也应该修改 `index.html` 中的 `title`，防止被关键词搜索到。\n\n切换方式：\n1. 进入 `service/.env.example` 文件，复制内容到 `service/.env` 文件\n2. 使用 `OpenAI API Key` 请填写 `OPENAI_API_KEY` 字段 [(获取 apiKey)](https://platform.openai.com/overview)\n3. 使用 `Web API` 请填写 `OPENAI_ACCESS_TOKEN` 字段 [(获取 accessToken)](https://chat.openai.com/api/auth/session)\n4. 同时存在时以 `OpenAI API Key` 优先\n\n环境变量：\n\n全部参数变量请查看或[这里](#环境变量)\n\n```\n/service/.env.example\n```\n\n## 待实现路线\n[✓] 双模型\n\n[✓] 多会话储存和上下文逻辑\n\n[✓] 对代码等消息类型的格式化美化处理\n\n[✓] 访问权限控制\n\n[✓] 数据导入、导出\n\n[✓] 保存消息到本地图片\n\n[✓] 界面多语言\n\n[✓] 界面主题\n\n[✗] More...\n\n## 前置要求\n\n### Node\n\n`node` 需要 `^16 || ^18 || ^19` 版本（`node \u003e= 14` 需要安装 [fetch polyfill](https://github.com/developit/unfetch#usage-as-a-polyfill)），使用 [nvm](https://github.com/nvm-sh/nvm) 可管理本地多个 `node` 版本\n\n```shell\nnode -v\n```\n\n### PNPM\n如果你没有安装过 `pnpm`\n```shell\nnpm install pnpm -g\n```\n\n### 填写密钥\n获取 `Openai Api Key` 或 `accessToken` 并填写本地环境变量 [跳转](#介绍)\n\n```\n# service/.env 文件\n\n# OpenAI API Key - https://platform.openai.com/overview\nOPENAI_API_KEY=\n\n# change this to an `accessToken` extracted from the ChatGPT site's `https://chat.openai.com/api/auth/session` response\nOPENAI_ACCESS_TOKEN=\n```\n\n## 安装依赖\n\n\u003e 为了简便 `后端开发人员` 的了解负担，所以并没有采用前端 `workspace` 模式，而是分文件夹存放。如果只需要前端页面做二次开发，删除 `service` 文件夹即可。\n\n### 后端\n\n进入文件夹 `/service` 运行以下命令\n\n```shell\npnpm install\n```\n\n### 前端\n根目录下运行以下命令\n```shell\npnpm bootstrap\n```\n\n## 测试环境运行\n### 后端服务\n\n进入文件夹 `/service` 运行以下命令\n\n```shell\npnpm start\n```\n\n### 前端网页\n根目录下运行以下命令\n```shell\npnpm dev\n```\n\n## 环境变量\n\n`API` 可用：\n\n- `OPENAI_API_KEY` 和 `OPENAI_ACCESS_TOKEN` 二选一\n- `OPENAI_API_MODEL`  设置模型，可选，默认：`gpt-3.5-turbo`\n- `OPENAI_API_BASE_URL` 设置接口地址，可选，默认：`https://api.openai.com`\n- `OPENAI_API_DISABLE_DEBUG` 设置接口关闭 debug 日志，可选，默认：empty 不关闭\n\n`ACCESS_TOKEN` 可用：\n\n- `OPENAI_ACCESS_TOKEN`  和 `OPENAI_API_KEY` 二选一，同时存在时，`OPENAI_API_KEY` 优先\n- `API_REVERSE_PROXY` 设置反向代理，可选，默认：`https://ai.fakeopen.com/api/conversation`，[社区](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy)（注意：只有这两个是推荐，其他第三方来源，请自行甄别）\n\n通用：\n\n- `AUTH_SECRET_KEY` 访问权限密钥，可选\n- `MAX_REQUEST_PER_HOUR` 每小时最大请求次数，可选，默认无限\n- `TIMEOUT_MS` 超时，单位毫秒，可选\n- `SOCKS_PROXY_HOST` 和 `SOCKS_PROXY_PORT` 一起时生效，可选\n- `SOCKS_PROXY_PORT` 和 `SOCKS_PROXY_HOST` 一起时生效，可选\n- `HTTPS_PROXY` 支持 `http`，`https`, `socks5`，可选\n- `ALL_PROXY` 支持 `http`，`https`, `socks5`，可选\n\n## 打包\n\n### 使用 Docker\n\n#### Docker 参数示例\n\n![docker](./docs/docker.png)\n\n#### Docker build \u0026 Run\n\n```bash\ndocker build -t chatgpt-web .\n\n# 前台运行\ndocker run --name chatgpt-web --rm -it -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web\n\n# 后台运行\ndocker run --name chatgpt-web -d -p 127.0.0.1:3002:3002 --env OPENAI_API_KEY=your_api_key chatgpt-web\n\n# 运行地址\nhttp://localhost:3002/\n```\n\n#### Docker compose\n\n[Hub 地址](https://hub.docker.com/repository/docker/chenzhaoyu94/chatgpt-web/general)\n\n```yml\nversion: '3'\n\nservices:\n  app:\n    image: chenzhaoyu94/chatgpt-web # 总是使用 latest ,更新时重新 pull 该 tag 镜像即可\n    ports:\n      - 127.0.0.1:3002:3002\n    environment:\n      # 二选一\n      OPENAI_API_KEY: sk-xxx\n      # 二选一\n      OPENAI_ACCESS_TOKEN: xxx\n      # API接口地址，可选，设置 OPENAI_API_KEY 时可用\n      OPENAI_API_BASE_URL: xxx\n      # API模型，可选，设置 OPENAI_API_KEY 时可用，https://platform.openai.com/docs/models\n      # gpt-4, gpt-4-0314, gpt-4-0613, gpt-4-32k, gpt-4-32k-0314, gpt-4-32k-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613, gpt-3.5-turbo, gpt-3.5-turbo-0301, gpt-3.5-turbo-0613, text-davinci-003, text-davinci-002, code-davinci-002\n      OPENAI_API_MODEL: xxx\n      # 反向代理，可选\n      API_REVERSE_PROXY: xxx\n      # 访问权限密钥，可选\n      AUTH_SECRET_KEY: xxx\n      # 每小时最大请求次数，可选，默认无限\n      MAX_REQUEST_PER_HOUR: 0\n      # 超时，单位毫秒，可选\n      TIMEOUT_MS: 60000\n      # Socks代理，可选，和 SOCKS_PROXY_PORT 一起时生效\n      SOCKS_PROXY_HOST: xxx\n      # Socks代理端口，可选，和 SOCKS_PROXY_HOST 一起时生效\n      SOCKS_PROXY_PORT: xxx\n      # HTTPS 代理，可选，支持 http，https，socks5\n      HTTPS_PROXY: http://xxx:7890\n```\n- `OPENAI_API_BASE_URL`  可选，设置 `OPENAI_API_KEY` 时可用\n- `OPENAI_API_MODEL`  可选，设置 `OPENAI_API_KEY` 时可用\n\n#### 防止爬虫抓取\n\n**nginx**\n\n将下面配置填入nginx配置文件中，可以参考 `docker-compose/nginx/nginx.conf` 文件中添加反爬虫的方法\n\n```\n    # 防止爬虫抓取\n    if ($http_user_agent ~* \"360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot\")\n    {\n      return 403;\n    }\n```\n\n###  使用 Railway 部署\n\n[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/yytmgc)\n\n#### Railway 环境变量\n\n| 环境变量名称          | 必填                   | 备注                                                                                               |\n| --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------- |\n| `PORT`                | 必填                   | 默认 `3002`\n| `AUTH_SECRET_KEY`          | 可选                   | 访问权限密钥                                        |\n| `MAX_REQUEST_PER_HOUR`          | 可选                   | 每小时最大请求次数，可选，默认无限                                        |\n| `TIMEOUT_MS`          | 可选                   | 超时时间，单位毫秒                                                                             |\n| `OPENAI_API_KEY`      | `OpenAI API` 二选一    | 使用 `OpenAI API` 所需的 `apiKey` [(获取 apiKey)](https://platform.openai.com/overview)            |\n| `OPENAI_ACCESS_TOKEN` | `Web API` 二选一       | 使用 `Web API` 所需的 `accessToken` [(获取 accessToken)](https://chat.openai.com/api/auth/session) |\n| `OPENAI_API_BASE_URL`   | 可选，`OpenAI API` 时可用 |  `API`接口地址  |\n| `OPENAI_API_MODEL`   | 可选，`OpenAI API` 时可用 |  `API`模型  |\n| `API_REVERSE_PROXY`   | 可选，`Web API` 时可用 | `Web API` 反向代理地址 [详情](https://github.com/transitive-bullshit/chatgpt-api#reverse-proxy)    |\n| `SOCKS_PROXY_HOST`   | 可选，和 `SOCKS_PROXY_PORT` 一起时生效 | Socks代理    |\n| `SOCKS_PROXY_PORT`   | 可选，和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理端口    |\n| `SOCKS_PROXY_USERNAME`   | 可选，和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理用户名    |\n| `SOCKS_PROXY_PASSWORD`   | 可选，和 `SOCKS_PROXY_HOST` 一起时生效 | Socks代理密码    |\n| `HTTPS_PROXY`   | 可选 | HTTPS 代理，支持 http，https, socks5    |\n| `ALL_PROXY`   | 可选 | 所有代理 代理，支持 http，https, socks5    |\n\n\u003e 注意: `Railway` 修改环境变量会重新 `Deploy`\n\n### 手动打包\n#### 后端服务\n\u003e 如果你不需要本项目的 `node` 接口，可以省略如下操作\n\n复制 `service` 文件夹到你有 `node` 服务环境的服务器上。\n\n```shell\n# 安装\npnpm install\n\n# 打包\npnpm build\n\n# 运行\npnpm prod\n```\n\nPS: 不进行打包，直接在服务器上运行 `pnpm start` 也可\n\n#### 前端网页\n\n1、修改根目录下 `.env` 文件中的 `VITE_GLOB_API_URL` 为你的实际后端接口地址\n\n2、根目录下运行以下命令，然后将 `dist` 文件夹内的文件复制到你网站服务的根目录下\n\n[参考信息](https://cn.vitejs.dev/guide/static-deploy.html#building-the-app)\n\n```shell\npnpm build\n```\n\n## 常见问题\nQ: 为什么 `Git` 提交总是报错？\n\nA: 因为有提交信息验证，请遵循 [Commit 指南](./CONTRIBUTING.md)\n\nQ: 如果只使用前端页面，在哪里改请求接口？\n\nA: 根目录下 `.env` 文件中的 `VITE_GLOB_API_URL` 字段。\n\nQ: 文件保存时全部爆红?\n\nA: `vscode` 请安装项目推荐插件，或手动安装 `Eslint` 插件。\n\nQ: 前端没有打字机效果？\n\nA: 一种可能原因是经过 Nginx 反向代理，开启了 buffer，则 Nginx 会尝试从后端缓冲一定大小的数据再发送给浏览器。请尝试在反代参数后添加 `proxy_buffering off;`，然后重载 Nginx。其他 web server 配置同理。\n\n## 参与贡献\n\n贡献之前请先阅读 [贡献指南](./CONTRIBUTING.md)\n\n感谢所有做过贡献的人!\n\n\u003ca href=\"https://github.com/Chanzhaoyu/chatgpt-web/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=Chanzhaoyu/chatgpt-web\" /\u003e\n\u003c/a\u003e\n\n## 赞助\n\n如果你觉得这个项目对你有帮助，并且情况允许的话，可以给我一点点支持，总之非常感谢支持～\n\n\u003cdiv style=\"display: flex; gap: 20px;\"\u003e\n\t\u003cdiv style=\"text-align: center\"\u003e\n\t\t\u003cimg style=\"max-width: 100%\" src=\"./docs/wechat.png\" alt=\"微信\" /\u003e\n\t\t\u003cp\u003eWeChat Pay\u003c/p\u003e\n\t\u003c/div\u003e\n\t\u003cdiv style=\"text-align: center\"\u003e\n\t\t\u003cimg style=\"max-width: 100%\" src=\"./docs/alipay.png\" alt=\"支付宝\" /\u003e\n\t\t\u003cp\u003eAlipay\u003c/p\u003e\n\t\u003c/div\u003e\n\u003c/div\u003e\n\n## License\nMIT © [ChenZhaoYu](./license)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwdgit%2Fhttps-github.com-lwdgit-chatgpt-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flwdgit%2Fhttps-github.com-lwdgit-chatgpt-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwdgit%2Fhttps-github.com-lwdgit-chatgpt-web/lists"}