chatgpt stream
v1.0.0
OpenAi最简洁的Java流式返回接入方式,方便接入业务系统,没有第三方依赖,只需要使用Spring Boot即可!轻松构建你的带有聊天记忆、画图功能的chatgpt,支持代码块高亮、markdown语法!
GitHub仓库:https://github.com/NiuXiangQian/chatgpt-stream
采用sse技术,感兴趣的可以先了解一下
非专业前端,样式略丑
original-simplicity分支里openai:
key-list:
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # 你的key列表 默认是轮询使用
- xxxxx申请地址:https://platform.openai.com/
HttpClient httpClient = HttpClient.create()
.secure(sslContextSpec -> sslContextSpec.sslContext(finalSslContext))
.tcpConfiguration(tcpClient -> tcpClient.proxy(proxy ->
proxy.type(ProxyProvider.Proxy.HTTP).host("127.0.0.1").port(7890))); env: test启动springboot 然后访问 http://127.0.0.1:8080/
只需要稍微扩展如下接口,即可接入自己的业务系统将消息入库、记录....
public interface CompletedCallBack {
/**
* 成功完成回调用
*/
void completed(Message questions, String sessionId, String response);
/**
* 失败回调
*/
void fail(Message questions, String sessionId, String response);
}有问题可以提交issue,有想法也可以提交pr,欢迎大家
如果对你有帮助还请帮忙给个star,谢谢!