qimo2020 / chatgpt-service

基于 chatGPT 3.5-turbo API(更快更省)和 websocket 的实时机器人聊天应用,这是后端服务

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

实时ChatGPT服务,基于最新的gpt-3.5-turbo-0301模型

chatGPT-service和chatGPT-stream

gitee传送门

效果图

快速开始

# 拉取代码
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

如何编译

# 拉取构建依赖
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

About

基于 chatGPT 3.5-turbo API(更快更省)和 websocket 的实时机器人聊天应用,这是后端服务

License:MIT License


Languages

Language:Go 97.2%Language:Dockerfile 2.8%