# ChatGPT小助手 **Repository Path**: wlyfree/chat-gpt-assistant ## Basic Information - **Project Name**: ChatGPT小助手 - **Description**: 前端html+js、后端python+flask,接入openai官方文本生成、图片生成接口 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: http://www.betteru.top/v2.html - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-02-17 - **Last Updated**: 2023-08-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ChatGPT小助手 #### 功能介绍 - 基于python接入[openai](https://platform.openai.com/)官方文档实现[文本生成](https://platform.openai.com/docs/api-reference/completions)、[图片生成](https://platform.openai.com/docs/api-reference/images)功能 - [模型](https://platform.openai.com/docs/api-reference/models)用的是text-davinci-003 - [ChatGPT官方](https://chat.openai.com/)具备关联上下文交流能力,但[openai](https://platform.openai.com/)官方接口目前暂未开放此功能 **特此注意:** - **openai接口收费,作者账号有18$的免费额度,用完为止。** - **请遵守我国有关法律法规、勿用于非法用途。** - **仅供学习使用,请各位高抬贵手,不要刷作者的接口,谢谢!** ##### 体验链接 - [使用自己的organization、api_key体验](http://www.betteru.top) - [使用作者的organization、api_key体验v1(传统接口,速度较慢)](http://www.betteru.top/v1.html) - [使用作者的organization、api_key体验v2(流式接口,用户体验更好)](http://www.betteru.top/v2.html)(推荐!!) #### 开发相关 - 前端:html + css + JavaScript - 后端:python + flask #### 部署相关 > 因历史原因,作者搭建环境时,nginx跑在docker下,python和flask跑在宿主机下。 ##### 环境准备 - docker+nginx - python3.9 - flask ##### 概括 - 前端原生语言,无需额外环境,静态html放到nginx下即可。 - 后端需要python3.9环境,官方下载后,源码安装即可。 - pip需要安装flask、flask-cors、openai包。 ##### 核心命令 ```shell # nginx部署 docker run --name wlyNginx --network host -v /usr/local/nginx.conf:/etc/nginx/nginx.conf -v /usr/local/index.html:/usr/share/nginx/html/index.html -v /usr/local/v1.html:/usr/share/nginx/html/v1.html -v /usr/local/v2.html:/usr/share/nginx/html/v2.html -d nginx # flask部署 nohup python -m flask run --host=0.0.0.0 --port=5000 >a.log 2>&1 & ```