|
@@ -139,17 +139,17 @@ public class GRPCController extends BaseController {
|
|
|
.buildPartial();
|
|
|
outputStream = response.getOutputStream();
|
|
|
Iterator<PredictionResponse> predictions = stub.streamPredictions(request);
|
|
|
- outputStream.write("begin".getBytes());
|
|
|
- outputStream.flush();
|
|
|
+ /*outputStream.write("begin".getBytes());
|
|
|
+ outputStream.flush();*/
|
|
|
while (predictions.hasNext()) {
|
|
|
String responseStr = predictions.next().getPrediction().toStringUtf8();
|
|
|
log.info("决策流式返回的结果是{}", responseStr);
|
|
|
responseStr = JSON.parseObject(responseStr).getString("message");
|
|
|
if("complete".equals(responseStr)){
|
|
|
System.out.println("结尾语句并且是非JSON,无需处理");
|
|
|
- //结束语句也流式输出,但是并不记录下来
|
|
|
- outputStream.write(responseStr.getBytes());
|
|
|
- outputStream.flush();
|
|
|
+ //结束语句也流式输出,但是并不记录下来 2024年5月24日11:15:23 也不返回前端
|
|
|
+ /*outputStream.write(responseStr.getBytes());
|
|
|
+ outputStream.flush();*/
|
|
|
}else{
|
|
|
// sb.append(responseStr);
|
|
|
resultData.add(responseStr);
|
|
@@ -248,8 +248,8 @@ public class GRPCController extends BaseController {
|
|
|
.buildPartial();
|
|
|
outputStream = response.getOutputStream();
|
|
|
Iterator<PredictionResponse> predictions = stub.streamPredictions(request);
|
|
|
- outputStream.write("begin".getBytes());
|
|
|
- outputStream.flush();
|
|
|
+ /*outputStream.write("begin".getBytes());
|
|
|
+ outputStream.flush();*/
|
|
|
//将结果记录到问答表
|
|
|
while (predictions.hasNext()) {
|
|
|
String responseStr = predictions.next().getPrediction().toStringUtf8();
|
|
@@ -257,18 +257,18 @@ public class GRPCController extends BaseController {
|
|
|
responseStr = JSON.parseObject(responseStr).getString("message");
|
|
|
if("complete".equals(responseStr)){
|
|
|
System.out.println("结尾语句并且是非JSON,无需处理");
|
|
|
- //结束语句也流式输出,但是并不记录下来
|
|
|
- outputStream.write(responseStr.getBytes());
|
|
|
- outputStream.flush();
|
|
|
+ //结束语句也流式输出,但是并不记录下来 2024年5月24日11:15:23 也不返回前端
|
|
|
+ /*outputStream.write(responseStr.getBytes());
|
|
|
+ outputStream.flush();*/
|
|
|
}else{
|
|
|
sb.append(responseStr);
|
|
|
outputStream.write(responseStr.getBytes());
|
|
|
outputStream.flush();
|
|
|
}
|
|
|
}
|
|
|
- //把SessionId返回给前端
|
|
|
- outputStream.write(sessionId.getBytes());
|
|
|
- outputStream.flush();
|
|
|
+ //把SessionId返回给前端 2024年5月24日11:15:23 也不返回前端
|
|
|
+ /*outputStream.write(sessionId.getBytes());
|
|
|
+ outputStream.flush();*/
|
|
|
} catch (IOException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
} finally {
|