English README

This commit is contained in:
cookeem
2023-03-06 15:08:11 +08:00
parent 2ea1d1d02a
commit 8822742664
3 changed files with 109 additions and 27 deletions

View File

@@ -1,43 +1,46 @@
# 实时ChatGPT服务基于最新的gpt-3.5-turbo-0301模型
# Real-time ChatGPT service, based on the latest gpt-3.5-turbo-0301 model
## chatGPT-service和chatGPT-stream
- [English README](README.md)
- [中文 README](README_CN.md)
- chatGPT-service: [https://github.com/cookeem/chatgpt-service](https://github.com/cookeem/chatgpt-service)
- chatGPT-service是一个后端服务用于实时接收chatGPT的消息并通过websocket的方式实时反馈给chatGPT-stream
- chatGPT-stream: [https://github.com/cookeem/chatgpt-stream](https://github.com/cookeem/chatgpt-stream)
- chatGPT-stream是一个前端服务以websocket的方式实时接收chatGPT-service返回的消息
## About chatgpt-service and chatgpt-stream
## gitee传送门
- chatgpt-service: [https://github.com/cookeem/chatgpt-service](https://github.com/cookeem/chatgpt-service)
- chatgpt-service is a backend service, used to receive chatGPT messages in real time, and feed back to chatGPT-stream in real time through websocket
- chatgpt-stream: [https://github.com/cookeem/chatgpt-stream](https://github.com/cookeem/chatgpt-stream)
- chatgpt-stream is a front-end service that receives messages returned by chatGPT-service in real time through websocket
## gitee
- [https://gitee.com/cookeem/chatgpt-service](https://gitee.com/cookeem/chatgpt-service)
- [https://gitee.com/cookeem/chatgpt-stream](https://gitee.com/cookeem/chatgpt-stream)
## 效果图
## Demo
![](chatgpt-service.gif)
## 快速开始
## Quick start
```bash
# 拉取代码
# Pull source code
git clone https://github.com/cookeem/chatgpt-service.git
cd chatgpt-service
# chatGPT的注册页面: https://beta.openai.com/signup
# chatGPT的注册教程: https://www.cnblogs.com/damugua/p/16969508.html
# chatGPTAPIkey管理界面: https://beta.openai.com/account/api-keys
# ChatGPT's registration page: https://beta.openai.com/signup
# ChatGPT registration tutorial: https://www.cnblogs.com/damugua/p/16969508.html
# ChatGPT API key management page: https://beta.openai.com/account/api-keys
# 修改config.yaml配置文件修改appKey改为你的openai.com的appKey
# Modify the config.yaml configuration file, modify the appKey, and change it to your openai.com API key
vi config.yaml
# openai的appKey改为你的apiKey
# your openai.com API key
appKey: "xxxxxx"
# 使用docker-compose启动服务
# Start the service with docker-compose
docker-compose up -d
# 查看服务状态
# Check service status
docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------------
@@ -45,28 +48,28 @@ chatgpt-service /chatgpt-service/chatgpt-s ... Up 0.0.0.0:59142->9000/t
chatgpt-stream /docker-entrypoint.sh ngin ... Up 0.0.0.0:3000->80/tcp,:::3000->80/tcp
# 访问页面,请保证你的服务器可以访问chatGPT的api接口
# To access the page, please ensure that your server can access the chatGPT API
# http://localhost:3000
```
## 如何编译
## How to build
```bash
# 拉取构建依赖
# Pull build dependencies
go mod tidy
# 项目编译
# Compile the project
go build
# 执行程序
# Run the service
./chatgpt-service
# 相关接口
# API url
# ws://localhost:9000/api/ws/chat
# 安装wscat
# Install wscat
npm install -g wscat
# 使用wscat测试websocket然后输入你要查询的问题
# Use wscat to test websocket, then enter the question you want to query
wscat --connect ws://localhost:9000/api/ws/chat
```

75
README_CN.md Normal file
View File

@@ -0,0 +1,75 @@
# 实时ChatGPT服务基于最新的gpt-3.5-turbo-0301模型
- [English README](README.md)
- [中文 README](README_CN.md)
## chatGPT-service和chatGPT-stream
- chatGPT-service: [https://github.com/cookeem/chatgpt-service](https://github.com/cookeem/chatgpt-service)
- chatGPT-service是一个后端服务用于实时接收chatGPT的消息并通过websocket的方式实时反馈给chatGPT-stream
- chatGPT-stream: [https://github.com/cookeem/chatgpt-stream](https://github.com/cookeem/chatgpt-stream)
- chatGPT-stream是一个前端服务以websocket的方式实时接收chatGPT-service返回的消息
## gitee传送门
- [https://gitee.com/cookeem/chatgpt-service](https://gitee.com/cookeem/chatgpt-service)
- [https://gitee.com/cookeem/chatgpt-stream](https://gitee.com/cookeem/chatgpt-stream)
## 效果图
![](chatgpt-service.gif)
## 快速开始
```bash
# 拉取代码
git clone https://github.com/cookeem/chatgpt-service.git
cd chatgpt-service
# chatGPT的注册页面: https://beta.openai.com/signup
# chatGPT的注册教程: https://www.cnblogs.com/damugua/p/16969508.html
# chatGPT的APIkey管理界面: https://beta.openai.com/account/api-keys
# 修改config.yaml配置文件修改appKey改为你的openai.com的appKey
vi config.yaml
# openai的appKey改为你的apiKey
appKey: "xxxxxx"
# 使用docker-compose启动服务
docker-compose up -d
# 查看服务状态
docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------------
chatgpt-service /chatgpt-service/chatgpt-s ... Up 0.0.0.0:59142->9000/tcp
chatgpt-stream /docker-entrypoint.sh ngin ... Up 0.0.0.0:3000->80/tcp,:::3000->80/tcp
# 访问页面请保证你的服务器可以访问chatGPT的api接口
# http://localhost:3000
```
## 如何编译
```bash
# 拉取构建依赖
go mod tidy
# 项目编译
go build
# 执行程序
./chatgpt-service
# 相关接口
# ws://localhost:9000/api/ws/chat
# 安装wscat
npm install -g wscat
# 使用wscat测试websocket然后输入你要查询的问题
wscat --connect ws://localhost:9000/api/ws/chat
```

View File

@@ -1,11 +1,15 @@
# openai的appKey
# Your openai.com API key
# openai的API Key
appKey: "xxxxxx"
# Service port
# 服务端口
port: 9000
# The time interval for sending questions cannot be less than how long, unit: second
# 问题发送的时间间隔不能小于多长时间,单位:秒
intervalSeconds: 5
# The maximum length of the returned answer
# 返回答案的最大长度
maxLength: 2000
# Whether to allow cors cross-domain
# 是否允许cors跨域
cors: true