来源 | OSCHINA 社区作者 | cookeem
原文链接:https://my.oschina.net/u/3133713/blog/7634396
chatGPT-service 和 chatGPT-stream
chatGPT-service: https://github.com/cookeem/chatgpt-service
chatGPT-service 是一个后端服务,用于实时接收 chatGPT 的消息,并通过 websocket 的方式实时反馈给 chatGPT-stream
chatGPT-stream: https://github.com/cookeem/chatgpt-stream
chatGPT-stream 是一个前端服务,以 websocket 的方式实时接收 chatGPT-service 返回的消息
https://gitee.com/cookeem/chatgpt-service
https://gitee.com/cookeem/chatgpt-stream
# 拉取代码
git clone https://github.com/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的appKeyvi config.yaml# openai的appKey,改为你的apiKeyappKey: "xxxxxx"# 使用docker启动服务docker-compose psName Command State Ports-----------------------------------------------------------------------------------------------chatgpt-service /chatgpt-service/chatgpt-s ... Up 0.0.0.0:59142->9000/tcpchatgpt-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# 安装wscatnpm install -g wscat# 使用wscat测试websocket,然后输入你要查询的问题wscat --connect ws://localhost:9000/api/ws/chat# 写一篇使用chatGPT的api接口的开源应用软件介绍,软件名字chat-stream,字数1000,后端基于golang语言开发,前端基于vue开发,使用websocket技术,能实时输出chatGPT的消息Chat-Stream是一款开源的聊天机器人软件,基于ChatGPT API,采用Golang作为后端开发语言,Vue作为前端开发框架,以及WebSocket技术实现实时消息推送。Chat-Stream的主要功能是利用ChatGPT API来进行聊天机器人对话,它能够根据用户的输入,自动生成有意义的回复。此外,它还支持语音识别,能够根据用户说出的话语来生成回复。Chat-Stream支持多种语言,用户可以根据自己的需要来选择不同的语言。同时,用户也可以利用Chat-Stream来记录自己的历史聊天记录,方便以后查阅。此外,Chat-Stream还支持多种社交媒体平台,例如微博、微信等,可以让用户在不同的平台上实时分享聊天内容。总之,Chat-Stream是一款非常实用的开源聊天机器人软件,它可以根据用户的输入,生成有意义的回复,并且支持多种语言和社交媒体平台。###### [END] ######重温经典老游戏