# chatgpt-service **Repository Path**: qingnaiomeng/chatgpt-service ## Basic Information - **Project Name**: chatgpt-service - **Description**: 基于 chatGPT 3.5-turbo API(更快更省)和 websocket 的实时机器人聊天应用,这是后端服务 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 111 - **Created**: 2023-03-13 - **Last Updated**: 2023-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Real-time ChatGPT service, based on the latest gpt-3.5-turbo-0301 model - [English README](README.md) - [中文 README](README_CN.md) ## About chatgpt-service and chatgpt-stream - 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'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 # Modify the config.yaml configuration file, modify the appKey, and change it to your openai.com API key vi config.yaml # your openai.com API key appKey: "xxxxxx" # Start the service with docker-compose docker-compose up -d # Check service status 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 # 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 # Install wscat npm install -g wscat # Use wscat to test websocket, then enter the question you want to query wscat --connect ws://localhost:9000/api/ws/chat ```