{"id":13455102,"url":"https://github.com/869413421/chatgpt-web","last_synced_at":"2025-05-14T14:09:00.793Z","repository":{"id":65855017,"uuid":"599976443","full_name":"869413421/chatgpt-web","owner":"869413421","description":"基于ChatGPT3.5 API实现的私有化web程序","archived":false,"fork":false,"pushed_at":"2024-03-25T06:12:48.000Z","size":3858,"stargazers_count":3181,"open_issues_count":29,"forks_count":737,"subscribers_count":34,"default_branch":"main","last_synced_at":"2025-04-12T03:45:07.304Z","etag":null,"topics":["chatgpt","website"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/869413421.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-10T09:54:10.000Z","updated_at":"2025-04-10T11:47:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f586233e-56ce-4bb4-917e-c2b3776a32bc","html_url":"https://github.com/869413421/chatgpt-web","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/869413421%2Fchatgpt-web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/869413421%2Fchatgpt-web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/869413421%2Fchatgpt-web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/869413421%2Fchatgpt-web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/869413421","download_url":"https://codeload.github.com/869413421/chatgpt-web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254160142,"owners_count":22024567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["chatgpt","website"],"created_at":"2024-07-31T08:01:01.300Z","updated_at":"2025-05-14T14:08:55.766Z","avatar_url":"https://github.com/869413421.png","language":"Go","funding_links":[],"categories":["Go","A01_文本生成_文本对话","Uncategorized","Others"],"sub_categories":["大语言对话模型及数据","Uncategorized"],"readme":"# chatgpt-web\n[![Release](https://img.shields.io/github/v/release/869413421/chatgpt-web.svg?style=flat-square)](https://github.com/869413421/wechatbot/releases/tag/v1.1.3)\n![Github stars](https://img.shields.io/github/stars/869413421/chatgpt-web.svg)\n![Forks](https://img.shields.io/github/forks/869413421/chatgpt-web.svg?style=flat-square)\n\u003e 本项目可以一键部署属于自己定制化的 chatgpt web 程序(兼容gpt3.5)，\n\u003e 只需下载release中对应平台的项目文件，修改配置后执行，打开 http://127.0.0.1:8080 ，便可以获得属于自己的chatgpt网站。\n\u003e\n\u003e 参考项目：[codegen](https://github.com/git-cloner/codegen)\n\n\u003e 项目当前默认为示例中AI聊天机器人参数，可以根据自己需求定制化。\n\u003e\n\u003e **注意，每个参数都可能影响你得到不一样的聊天效果,改变一个参数你就可能得到另一种回答，所以请自己尝试去调试，不要上来就抱怨人工智障。文档中有二十多中参数示例，如AI聊天机器人\n\u003e ，产品名称生成，python代码修复器等等等...**\n\u003e\n\u003e 详情参考官方详细[参数示例](https://beta.openai.com/examples)\n\n# 更新记录\n- [x] fix: 支持gpt-4模型，修改前端空白BUG。 2023-03-30\n- [x] fix: 增加用户模块，认证页面，接口jwt验证。 2023-03-27\n- [x] fix: 修复前端富文本显示问题，优化dockerfile。 2023-03-27\n- [x] fix: 优化前端显示界面。 2023-03-20\n- [x] feat: 增加接口代理配置。 2023-03-20\n- [x] fix: 修复前端部分BUG，优化富文本代码格式。 2023-03-13\n- [x] feat: 增加socsk5代理的支持，命令行参数配置。2023-03-13\n- [x] feat: 增加docker-compose.yaml。2023-03-08\n- [x] fix: 修复basic auth 。 2023-03-08\n- [x] feat：修改为默认不开启代理。2023-03-06\n- [x] feat：增加代理配置，解决国内无法使用。2023-03-04\n\n# 项目功能\n* 请求openai增加代理（防墙）\n* AI性格设定\n* 兼容3.0和3.5API\n* 基本问答界面\n* 参数可配置\n* markdown语法\n* 提问上下文\n# 使用前提\n\u003e 有openai账号，并且创建好api_key，注册事项可以参考[此文章](https://juejin.cn/post/7173447848292253704) 。\n\n\n# 快速开始\n\n`第一种：直接下载二进制(适合对编程不了解的同学)`\n\n\u003e 非技术人员请直接下载release中的[压缩包](https://github.com/869413421/chatgpt-web/releases) ，请根据自己系统以及架构选择合适的压缩包，下载之后直接解压运行。\n\n下载之后，在本地解压，即可看到可执行程序，与配置文件：\n\n```\n# windows\n1.下载压缩包解压\n2.复制文件中config.dev.json更改为config.json\n3.将config.json中的api_key替换为自己的\n4.双击exe运行，启动服务\n\n# linux\n$ tar xf chatgpt-web-v0.0.2-darwin-arm64.tar.gz # 解压\n$ cd chatgpt-web-v0.0.2-darwin-arm64\n$ cp config.dev.json # 根据情况调整配置文件内容\n$ ./chatgpt-web  # 直接运行\n\n# 如果要守护在后台运行\n$ nohup ./chatgpt-web \u0026\u003e run.log \u0026\n$ tail -f run.log\n```\n\n`第二种：基于源码运行(适合了解go语言编程的同学)`\n\n````\n# 获取项目\n$ git clone https://github.com/869413421/chatgpt-web.git\n\n# 进入项目目录\n$ cd chatgpt-web\n\n# 复制配置文件\n$ copy config.dev.json config.json\n\n# 启动项目\n$ go run main.go\n````\n\n# 使用docker运行\n你可以使用docker快速运行本项目。\n`第一种：基于环境变量运行`\n\n```sh\n# 运行项目，环境变量参考下方配置说明\n$ docker run -itd --name chatgpt-web --restart=always \\\n -e APIKEY=换成你的key \\\n -e APIURL= \\\n -e MODEL=gpt-3.5-turbo-0301 \\\n -e BOT_DESC=你是一个AI助手,我需要你模拟一名温柔贴心的女朋友来回答我的问题. \\\n -e MAX_TOKENS=512 \\\n -e TEMPREATURE=0.9 \\\n -e TOP_P=1 \\\n -e FREQ=0.0 \\\n -e PRES=0.6 \\\n -e PROXY=http://host.docker.internal:10809 \\\n -e AUTH_USER= \\\n -e AUTH_PASSWORD= \\\n -p 8080:8080 \\\n --add-host=\"host.docker.internal:host-gateway\" \\\n qingshui869413421/chatgpt-web:latest\n```\n\n`注意`：`host.docker.internal`会指向容器所在宿主机的IP，因此只需要更改端口为你的代理端口即可。\n\n运行命令中映射的配置文件参考下边的配置文件说明。\n\n`第二种：基于配置文件挂载运行`\n\n```sh\n# 复制配置文件，根据自己实际情况，调整配置里的内容\n$ cp config.dev.json config.json  # 其中 config.dev.json 从项目的根目录获取\n\n# 运行项目\n$ docker run -itd --name chatgpt-web -v `pwd`/config.json:/app/config.json -p 8080:8080 qingshui869413421/chatgpt-web:latest\n```\n\n其中配置文件参考下边的配置文件说明。\n\n# 使用docker-docompose 运行\n\n``docker compose up -d``\n\n\n# 配置文件说明\n\n```json\n{\n  \"api_key\": \"your api key\",\n  \"api_url\": \"\",\n  \"port\": 8080,\n  \"listen\": \"\",\n  \"bot_desc\": \"你是一个AI助手，我需要你模拟一名温柔贴心的女朋友来回答我的问题。\",\n  \"proxy\": \"http://host.docker.internal:10809\",\n  \"model\": \"gpt-3.5-turbo-0301\",\n  \"max_tokens\": 512,\n  \"temperature\": 0.9,\n  \"top_p\": 1,\n  \"frequency_penalty\": 0.0,\n  \"presence_penalty\": 0.6,\n  \"auth_user\": \"\",\n  \"auth_password\": \"\"\n}\n```\n\n````\napi_key：openai api_key\napi_url: openai api接口地址 不填使用默认 https://api.openai.com/v1 注，该服务的提供者可以看到你的明文请求(包括你在OpenAI的key)，建议自建或使用可信来源\nport: http服务端口\nlisten: http服务监听地址，不填默认监听0.0.0.0\nproxy: openai请求代理，防墙。 例如 http://127.0.0.1:7890 socks5://127.0.0.1:7890\nbot_desc：AI特征，非常重要，功能等同给与AI一个身份设定\nmax_tokens: GPT响应字符数，最大2048，默认值512。max_tokens会影响接口响应速度，字符越大响应越慢。\nmodel: GPT选用模型，默认text-davinci-003，具体选项参考官网训练场\ntemperature: GPT热度，0到1，默认0.9。数字越大创造力越强，但更偏离训练事实，越低越接近训练事实\ntop_p: 使用温度采样的替代方法称为核心采样，其中模型考虑具有top_p概率质量的令牌的结果。因此，0.1 意味着只考虑包含前 10% 概率质量的代币。\nfrequency_penalty:\npresence_penalty:\nauth_user\": http基本认证用户名(空表示不开启验证)\nauth_password\": http基本认证密码\n````\n\n# NGINX反向代理配置样例\n\n这里提供一份使用NGINX反向代理该软件的样例配置，方便集成于现有的站点，添加用户认证，套TLS等，该文件一般对应于`/etc/nginx/sites-available/default`文件，需要自行修改。\n\n```nginx\n# 监听80端口，跳转https\nserver {\n    listen 80 default_server;\n    listen [::]:80 default_server;\n    location / {\n        return 301 https://$host$request_uri;\n    }\n}\n# 监听443端口，使用https提供服务\nserver {\n    # SSL相关配置来自 https://ssl-config.mozilla.org/\n    listen 443 ssl http2;\n    listen [::]:443 ssl http2;\n    # 证书路径，建议Fullchain\n    ssl_certificate /path/to/your/cert.pem;\n    # 私钥路径\n    ssl_certificate_key /path/to/your/key.pem;\n    ssl_session_timeout 1d;\n    ssl_session_cache shared:MozSSL:10m;\n    ssl_session_tickets off;\n    # 执行下面的命令下载dhparam\n    # curl https://ssl-config.mozilla.org/ffdhe2048.txt \u003e /path/to/dhparam\n    ssl_dhparam /path/to/dhparam;\n    ssl_protocols TLSv1.2 TLSv1.3;\n    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;\n    ssl_prefer_server_ciphers off;\n    # HSTS (ngx_http_headers_module is required) (63072000 seconds)\n    add_header Strict-Transport-Security \"max-age=63072000\" always;\n    # SSL配置结束\n\n    server_name _;\n    charset utf-8;\n    client_max_body_size 5m;\n\n    # 如果需要将chatgpt-web置于某一路径下，使用这个location配置\n    location /your/path/ {\n        # 基本身份认证 设定\n        # 提示语\n        auth_basic \"Auth Require\";\n        # 认证配置文件 格式请参考 https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html\n        auth_basic_user_file /path/to/passwd;\n\n        # 反向代理 假设chatgpt-web监听端口为8080\n        proxy_pass http://127.0.0.1:8080/;\n        proxy_http_version 1.1;\n        # 反向代理超时时间设定(OpenAI的反应比较慢，设定为120秒后才超时)\n        proxy_read_timeout 120s;\n    }\n\n    # 如果chatgpt-web放置于根路径，使用这个location配置\n    location / {\n        auth_basic \"Auth Require\";\n        auth_basic_user_file /etc/nginx/passwd;\n\n        proxy_pass http://127.0.0.1:8080/;\n        proxy_http_version 1.1;\n        proxy_read_timeout 120s;\n\n        # 位于根路径时不需要修改index.html\n    }\n\n}\n```\n\n# Linux系统systemd服务配置\n\n可以使用`systemd`配置`chatgpt-web`开机自启，假设可执行文件和相关资源文件放置在`/var/www/chatgpt-web/`目录下，`chatgpt-web`二进制文件需要其他用户可读可执行权限，其余资源文件需要其他用户可读权限，并且已经配置好`config.json`。\n\n在目录`/etc/systemd/system/`下新建文件`chatgpt-web.service`，以下是文件样例。\n\n```ini\n[Unit]\nDescription=chatgpt-web\nDocumentation=https://github.com/869413421/chatgpt-web\n# 在网络启动完成后运行\nAfter=network.target nss-lookup.target\n\n[Service]\n# 使用随机用户执行该服务\nDynamicUser=yes\n# 指定工作目录\nWorkingDirectory=/var/www/chatgpt-web/\n# 执行程序\nExecStart=/var/www/chatgpt-web/chatgpt-web\n\n[Install]\nWantedBy=multi-user.target\n```\n保存后使用`systemctl daemon-reload`更新systemd配置文件，使用`systemctl start/stop chatgpt-web`启动/停止服务，使用`systemctl enable/disable chatgpt-web`启用/禁用服务开机自启。\n\n可以使用`journalctl --unit chatgpt-web.service`查看程序日志。\n\n# 免责声明 Disclaimers\nThe code is for demo and testing only. 代码仅用于演示和测试。\n\n⚠⚠⚠请勿将本系统代码用于商业用途！\n\n仿冒或冒用ChatGPT、OpenAI名义开展经营活动，可能构成《商标法》、《反不正当竞争法》下的一系列侵权行为； 以之牟利造成消费者损失的，可能产生《商标法》、《反不正当竞争法》、《消费者权益保护法》下的民事或行政责任，情节严重并造成重大损失的，还有可能构成刑事犯罪； 如果提供这种跨境经营服务存在私自搭建国际信道的情形，还有可能违反《网络安全法》、《刑法》的相关规定，承担行政责任或构成刑事犯罪。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F869413421%2Fchatgpt-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F869413421%2Fchatgpt-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F869413421%2Fchatgpt-web/lists"}