|
|
|
@@ -193,7 +193,19 @@ public class LlmWebSocketListener extends WebSocketListener { |
|
|
|
//关闭释放资源 |
|
|
|
this.wsCloseFlag = true; |
|
|
|
// 如果是非流式调用,释放锁 |
|
|
|
if (!stream) { |
|
|
|
if (stream) { |
|
|
|
// 讯飞返回status为2时,可能不包含。结尾,所以需要判断answerBuf是否为空,如果不为空,则直接发送给前端 |
|
|
|
Channel ch = ServerConfig.sessionMap.get(llmContext.getDevId()); |
|
|
|
logger.info("当前ch:{}",ch.id().asLongText()); |
|
|
|
if (ch != null) { |
|
|
|
if (!StringUtils.isEmpty(answerBuf)) { |
|
|
|
JSONObject jo = formatToChannel(answerBuf, responseData.header.status, responseData.header.code); |
|
|
|
logger.info("发送到client:{},id:{},内容:{}", llmContext.getDevId(), ch.id().asLongText(), jo.toJSONString()); |
|
|
|
ch.writeAndFlush(new TextWebSocketFrame(jo.toJSONString())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
this.notifyAll(); |
|
|
|
} |
|
|
|
|
|
|
|
|