OpenAi's most concise Java streaming return access method, which is convenient for accessing business systems. There is no third-party dependency, just use Spring Boot! Easily build your chatgpt with chat memory and drawing functions, and support code block highlighting and markdown syntax!
GitHub repository: https://github.com/NiuXiangQian/chatgpt-stream
Using SSE technology, those who are interested can learn about it first
Non-professional front-end, slightly ugly style



original-simplicity branch openai :
key-list :
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # 你的key列表 默认是轮询使用
- xxxxxApplication address: 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 : testStart springboot and visit http://127.0.0.1:8080/
Just slightly expand the following interface to access your own business system to store messages and record messages...
public interface CompletedCallBack {
/**
* 成功完成回调用
*/
void completed ( Message questions , String sessionId , String response );
/**
* 失败回调
*/
void fail ( Message questions , String sessionId , String response );
}If you have any questions, you can submit the issue, if you have any ideas, you can submit the PR. Everyone is welcome
If it is helpful to you, please give me a star, thank you!