|
|
@@ -48,16 +48,17 @@ public class BaiduChatUtils {
|
|
|
@Async
|
|
|
public void sendBaiduAiStream(InputSendChat inputSendChat) throws IOException {
|
|
|
SseResult res = SseMap.sseEmitterMap.get(inputSendChat.getUserId());
|
|
|
- if (checkIp()){
|
|
|
- OutChatER er=new OutChatER();
|
|
|
- er.setError_code(4004);
|
|
|
- er.setError_msg("访问超过最大限制,陌生游客每天最多访问5次");
|
|
|
- res.sseEmitter.send(er);
|
|
|
- }
|
|
|
+// if (checkIp()){
|
|
|
+// res.sseEmitter.send(new OutChatER(4004,"访问超过最大限制,陌生游客每天最多访问5次"));
|
|
|
+// res.sseEmitter.complete();
|
|
|
+// SseMap.sseEmitterMap.remove(inputSendChat.getUserId());
|
|
|
+// return;
|
|
|
+// }
|
|
|
BufferedReader reader=null;
|
|
|
InputStreamReader inputStreamReader=null;
|
|
|
OutputStream outputStream=null;
|
|
|
try {
|
|
|
+
|
|
|
String baidu_url=BAIDU_CHAT_WXYY_URL+getRedisBaiduAccessToken();
|
|
|
URL url = new URL(baidu_url);
|
|
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
|
@@ -114,8 +115,8 @@ public class BaiduChatUtils {
|
|
|
} catch (ProtocolException e) {
|
|
|
e.printStackTrace();
|
|
|
}catch (IllegalStateException e){
|
|
|
- LoggerUtils.debug(getClass(),"前端网页已关闭");
|
|
|
- }finally {
|
|
|
+ LoggerUtils.debug(this.getClass(),"前端网页已关闭");
|
|
|
+ } finally {
|
|
|
inputStreamReader.close();
|
|
|
outputStream.close();
|
|
|
reader.close();
|