|
|
@@ -69,7 +69,7 @@ public class BaiduChatUtils {
|
|
|
// 构造请求体
|
|
|
// String requestBody = "{\"messages\":[{\"role\":\"user\",\"content\":\"给我介绍一条从四川自驾到拉萨的路线\"}],\"stream\":true}";
|
|
|
String requestBody=JSON.toJSONString(inputSendChat);
|
|
|
- System.out.println(requestBody);
|
|
|
+// System.out.println(requestBody);
|
|
|
byte[] postData = requestBody.getBytes(StandardCharsets.UTF_8);
|
|
|
connection.setRequestProperty("Content-Length", String.valueOf(postData.length));
|
|
|
outputStream =connection.getOutputStream();
|
|
|
@@ -81,7 +81,7 @@ public class BaiduChatUtils {
|
|
|
|
|
|
while ((line = reader.readLine())!= null) {
|
|
|
// 每行数据中以 "data:" 开头的部分即为实际的响应数据
|
|
|
- System.out.println(line);
|
|
|
+// System.out.println(line);
|
|
|
if (StringUtils.isNotBlank(line)){
|
|
|
if (line.startsWith("data:")) {
|
|
|
String data = line.substring("data:".length()).trim();
|
|
|
@@ -219,7 +219,7 @@ public class BaiduChatUtils {
|
|
|
}else {
|
|
|
count++;
|
|
|
redisUtil.setString(hostIp,count.toString());
|
|
|
- System.out.println(count);
|
|
|
+// System.out.println(count);
|
|
|
}
|
|
|
}
|
|
|
return false;
|