{"id":13646352,"url":"https://github.com/putyy/chatgpt","last_synced_at":"2025-12-26T13:41:59.331Z","repository":{"id":247536809,"uuid":"655974792","full_name":"putyy/chatgpt","owner":"putyy","description":"一款chatgpt应用，支持打包小程序、H5、App，基于hyperf、MineAdmin、uniapp 实现！","archived":false,"fork":false,"pushed_at":"2024-07-09T06:34:58.000Z","size":11614,"stargazers_count":229,"open_issues_count":0,"forks_count":81,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-09T19:41:38.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","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/putyy.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-06-20T02:38:32.000Z","updated_at":"2024-10-31T08:18:58.000Z","dependencies_parsed_at":"2024-07-09T09:00:06.593Z","dependency_job_id":"f52ebc15-cc3e-4195-baa2-1a1d27394b10","html_url":"https://github.com/putyy/chatgpt","commit_stats":null,"previous_names":["putyy/chatgpt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyy%2Fchatgpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyy%2Fchatgpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyy%2Fchatgpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/putyy%2Fchatgpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/putyy","download_url":"https://codeload.github.com/putyy/chatgpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250110779,"owners_count":21376536,"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":[],"created_at":"2024-08-02T01:02:53.543Z","updated_at":"2025-12-26T13:41:59.261Z","avatar_url":"https://github.com/putyy.png","language":"PHP","funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# uniapp、hyperf MineAdmin 实现的 chatgpt应用，支持小程序、H5、App！\n## 效果图\n#### App\n![](images/1.jpg)\n\n![](images/2.jpg)\n\n![](images/3.jpg)\n\n#### 后台系统\n.\n![admin.png](images/admin.png)\n\n## 技术栈 具体依赖看项目代码吧！\n### 前端\n\u003e uniapp vue3 pug scss 等\n### 后端\n\u003e swoole hyperf MineAdmin 等\n\n## 功能说明\n\u003e 客户端： 问答上下文、快捷提问、角色自定义、历史会话、公开频道、模型设置、VIP系统、邀请好友、分佣系统、联系客服、钱包系统、提现、订单、好友管理等\n\n\u003e 后台：chatgpt角色自定义、快捷提问管理、聊天数据管理、个人中心菜单管理、订单管理、用户管理、卡密管理、设置(openai地址、客服信息、用户协议等设置)、图片素材(个人中心banner)、openai_key管理(自动轮训)\n\n\n## 开始安装\n\u003e 下载本项目\n```shell\ngit clone https://github.com/putyy/chatgpt.git\n```\n\n## 安装 MineAdmin\n#### 1. 按照官方文档进行安装 [安装文档](https://doc.mineadmin.com/guide/install/)\n\n#### 2. 安装本项目mineadmin-php\n\n\u003e 安装composer依赖包\n\u003e\u003e composer require easyswoole/oss putyy/php-constants orhanerday/open-ai --ignore-platform-reqs\n\n\u003e复制本项目 ./MineAdmin/php/app/ai 下所有子文件夹，粘贴到到mineadmin-php app/ai目录下\n\u003e\u003e cp -r ./MineAdmin/php/app/ai/ ./you-mineadmin-php/app/ai\n\n\u003e 执行以下命令添加本项目需要的数据表及初始化数据\n\u003e\u003e php bin/hyperf.php mine:migrate-run ai\n\u003e\u003e\n\u003e\u003e php bin/hyperf.php mine:seeder-run ai\n\u003e\u003e\n\u003e\u003e php bin/hyperf.php ai:init-menu\n\n\u003e 生成Ai api需要的jwt key\n\u003e\u003ephp bin/hyperf.php mine:jwt-gen --jwtSecret=JWT_AI_SECRET\n\n\u003e 修改mineadmin后端 jwt 配置文件，位置: config/autoload/jwt.php,新增如下内容:\n\u003e ```php\n\u003e return [\n\u003e     // ......\n\u003e     'scene' =\u003e [\n\u003e          // 新增如下\n\u003e          'ai' =\u003e [\n\u003e             'secret' =\u003e env('JWT_AI_SECRET', ''), // 非对称加密使用字符串,请使用自己加密的字符串\n\u003e             'login_type' =\u003e 'sso',\n\u003e             'sso_key' =\u003e 'id',\n\u003e             'ttl' =\u003e 86400,\n\u003e             'blacklist_cache_ttl' =\u003e 86400, \n\u003e          ],\n\u003e          // ......\n\u003e     ]\n\u003e     // ......\n\u003e ]\n\u003e ```\n\n\u003e 修改mineadmin后端 route 配置文件，位置: config/routes.php,新增如下内容:\n\u003e ```php\n\u003e Router::addServer('message', function () {\n\u003e    // ......\n\u003e    // 新增如下内容\n\u003e    Router::get('/ws-chat', 'App\\Ai\\Api\\Websocket', [\n\u003e        'middleware' =\u003e [  ]\n\u003e    ]);\n\u003e    // ......\n\u003e })\n\u003e ```\n\u003e \n\u003e \n\u003e 修改mineadmin后端 file 配置文件，位置: config/autoload/file.php,新增如下内容:\n\u003e ```php\n\u003e return [\n\u003e   'storage'=\u003e[\n\u003e       'qiniu'=\u003e[\n\u003e           // ......\n\u003e           'accessKey' =\u003e '七牛云accessKey',   \n\u003e           'secretKey' =\u003e '七牛云secretKey',   \n\u003e           'host' =\u003e env('QINIU_HOST', '你的七牛云访问主域名,例: baidu.com'),\n\u003e           // 具体查看 https://developer.qiniu.com/kodo/1671/region-endpoint-fq\n\u003e           'upload_domain' =\u003e env('QINIU_UPLOAD_DOMAIN', 'https://up-cn-east-2.qiniup.com'),\n\u003e           'image_bucket' =\u003e env('QINIU_IMAGE_BUCKET', '七牛云图片空间'),\n\u003e           'image_domain' =\u003e env('QINIU_IMAGE_DOMAIN', '七牛云图片域名'),\n\u003e           // 以下未用到 不用配置\n\u003e           'audio_bucket' =\u003e env('QINIU_AUDIO_BUCKET'),\n\u003e           'video_bucket' =\u003e env('QINIU_VIDEO_BUCKET'),\n\u003e           'audio_domain' =\u003e env('QINIU_AUDIO_DOMAIN'),\n\u003e           'video_domain' =\u003e env('QINIU_VIDEO_DOMAIN'),\n\u003e           // ......\n\u003e       ]\n\u003e   ]\n\u003e ]\n\u003e```\n\n\u003e 4. 安装本项目mineadmin-vue\n\u003e\u003e 复制本项目 ./MineAdmin/vue/src 下所有子文件夹，粘贴到到mineadmin-vue src目录下\n\u003e\u003e\u003e cp -r ./MineAdmin/vue/src/ ./you-mineadmin-vue/src\n\u003e\u003e\n\u003e\u003e 安装 qiniu-js\n\u003e\u003e\u003e yarn add qiniu-js --save\n\u003e\u003e\n\u003e\u003e 运行\n\u003e\u003e\u003e yarn run dev\n\n#### 打开后台系统\n\u003e 添加openai api key： Ai系统-\u003eopenai_key-\u003e新增, 返回列表点击顶部刷新缓存\n\u003e \n\u003e 设置站点相关信息： Ai系统-\u003e设置\n\n\n\n### 大功告成，其他功能自行探索！\n\n.\n### 安装 uniapp\n#### 1. 按照uniapp官方文档安装好环境\n#### 2. 用HBuilderX打开本项目UniApp文件夹\n#### 3. 按照以下说明修改配置文件(相关文件都在UniApp文件夹内)\n\u003e uniapp开发者中心  [点击获取appid](https://dev.dcloud.net.cn/pages/app/list)\n```shell\n# 修改 ./manifest.json 文件中的appid\n{\n    \"name\" : \"应用名称\",\n    \"appid\" : \"你的应用ID\",\n    \"description\" : \"\",\n    ......\n}\n\n# 复制 ./config.example.ts =\u003e ./common/config.ts 文件, 修改对应配置\nlet config = [\n    {\n        wsUrl: 'ws://开发环境的域名ws/ws-chat',\n        baseURL: 'https://开发环境的域名/api/ai/api/'\n    },\n     {\n         wsUrl: 'ws://线上域名/ws/ws-chat',\n         baseURL: 'https://线上域名/api/ai/api/'\n    }\n]\n```\n.\n#### 4. 安装以下插件(点击打开，页面最右侧导入HBuilderX)，已安装过则忽略\n\u003e [uni-ui](https://ext.dcloud.net.cn/plugin?id=55)\n\u003e \n\u003e [compile-typescript](https://ext.dcloud.net.cn/plugin?name=compile-typescript) \n\u003e \n\u003e [compile-node-sass](https://ext.dcloud.net.cn/plugin?name=compile-node-sass) \n\u003e \n\u003e [pug-language](https://ext.dcloud.net.cn/plugin?name=pug-language) \n\u003e \n\u003e [compile-pug-cli](https://ext.dcloud.net.cn/plugin?name=compile-pug-cli)\n\n#### 6. HBuilderX最顶部： 运行-\u003e运行到浏览器\n#### 大功告成！\n\n## 其他\n## uniapp打包app、h5、小程序参考uniapp官方文档，使用HBuilderX配置manifest.json 之后进行打包操作！\n.\n## nginx配置文件可以参考如下\n```nginx\n# 前端\nlocation / {\n  index  index.html index.htm;\n  try_files $uri $uri/ /index.html;\n}\n\n # PHP后端代理，这里的 /prod/ 要跟前端 .env.production 的 VITE_APP_PROXY_PREFIX 值一致\nlocation /api/ {\n  \n  if ($request_method = 'OPTIONS') {\n    add_header Access-Control-Allow-Origin *;\n    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, DELETE';\n    add_header Access-Control-Allow-Headers 'DNT,Keep-Alive,User-Agent,Cache-Control,Content-Type,Authorization,X-Token';\n    return 204;\n  }\n  \n  # 将客户端的 Host 和 IP 信息一并转发到对应节点\n  proxy_set_header Host $http_host;\n  proxy_set_header X-Real-IP $remote_addr;\n  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n  # 将协议架构转发到对应节点，如果使用非https请改为http\n  proxy_set_header X-scheme https;\n\n  # 执行代理访问真实服务器\n  proxy_pass http://127.0.0.1:9501/;\n}\n\nlocation /ws/ {\n    # WebSocket Header\n    proxy_http_version 1.1;\n    proxy_set_header Upgrade websocket;\n    proxy_set_header Connection \"Upgrade\";\n\n    # 将客户端的 Host 和 IP 信息一并转发到对应节点\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    proxy_set_header Host $http_host;\n\n    # 客户端与服务端无交互 60s 后自动断开连接，请根据实际业务场景设置\n    proxy_read_timeout 60s ;\n\n    # 执行代理访问真实服务器\n    proxy_pass http://127.0.0.1:9502/;\n}\n  \n# ^~ 不能去掉，/upload/ 中的 upload 可以改成其他名称\nlocation ^~ /upload/ {\n    # 将客户端的 Host 和 IP 信息一并转发到对应节点\n    proxy_set_header Host $http_host;\n    proxy_set_header X-Real-IP $remote_addr;\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n    # 将协议架构转发到对应节点，如果使用非https请改为http\n    proxy_set_header X-scheme https;\n\n    # 执行代理访问真实服务器\n    proxy_pass http://127.0.0.1:9501/;\n}\n```\n#### MineAdmin-vue下的\n\u003e .env.development\n```env\nVITE_APP_BASE_URL = http://you.domain.com/api\n\nVITE_APP_UPLOAD_URL = http://you.domain.com/upload\n\nVITE_APP_WS_URL = ws://you.domain.com/ws/message.io\n```\n\n\u003e .env.production\n```env\nVITE_APP_BASE_URL = /\n\nVITE_APP_UPLOAD_URL = http://you.domain.com/upload\n\nVITE_APP_WS_URL = ws://you.domain.com/ws/message.io\n```\n\n#### uniapp下的./common/config.ts文件如下\n```\nlet config = [\n    {\n        wsUrl: 'ws://you.domain.com/ws/ws-chat',\n        baseURL: 'https://you.domain.com/api/ai/api/'\n    },\n     {\n         wsUrl: 'ws://you.domain.com/ws/ws-chat',\n         baseURL: 'https://you.domain.com/api/ai/api/'\n    }\n]\n```\n## 免责声明\n#### 使用本软件不得用于开发违反国家有关政策的相关软件和应用，若因使用本软件造成的一切法律责任均与本人无关！\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputyy%2Fchatgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputyy%2Fchatgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputyy%2Fchatgpt/lists"}