From 8822742664fbb17b413032f82afeef22f65b3cf7 Mon Sep 17 00:00:00 2001 From: cookeem Date: Mon, 6 Mar 2023 15:08:11 +0800 Subject: [PATCH] English README --- README.md | 53 +++++++++++++++++++------------------ README_CN.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ config.yaml | 8 ++++-- 3 files changed, 109 insertions(+), 27 deletions(-) create mode 100644 README_CN.md diff --git a/README.md b/README.md index 26f443e..e644b29 100644 --- a/README.md +++ b/README.md @@ -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 -# chatGPT的APIkey管理界面: 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 ``` \ No newline at end of file diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000..b951279 --- /dev/null +++ b/README_CN.md @@ -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 + +``` \ No newline at end of file diff --git a/config.yaml b/config.yaml index 9883b50..6ee0fef 100644 --- a/config.yaml +++ b/config.yaml @@ -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 -