Browse Source

add:大模型管理

zhongwei
haungxing 7 months ago
parent
commit
517a5996a7
  1. 6
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java
  2. 11
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/service/InteractiveWsService.java
  3. 3
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/service/WebSocketService.java

6
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java

@ -73,11 +73,7 @@ public class InteractiveSchedule {
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
WebSocketSession session = InteractiveSessionManager.get(answerVO.getSessionId()); WebSocketSession session = InteractiveSessionManager.get(answerVO.getSessionId());
TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO)); TextMessage message = InteractiveSessionManager.getTextMessage("1",JSON.toJSONString(answerVO));
try { wsService.sendMessage(session,message);
session.sendMessage(message);
} catch (IOException e) {
XxlJobLogger.log("消息中心推送失败,推送内容为:" + JSON.toJSONString(answerVO));
}
}, getAnswerPoolExecutor); }, getAnswerPoolExecutor);
}); });
return ReturnT.SUCCESS; return ReturnT.SUCCESS;

11
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/service/InteractiveWsService.java

@ -19,13 +19,18 @@ import java.io.IOException;
public class InteractiveWsService implements WebSocketService { public class InteractiveWsService implements WebSocketService {
@Override @Override
public Boolean sendMessage(String signage, TextMessage message) { public Boolean sendMessage(String sessionId, TextMessage message) {
WebSocketSession session = InteractiveSessionManager.get(signage); WebSocketSession session = InteractiveSessionManager.get(sessionId);
return this.sendMessage(session,message);
}
@Override
public Boolean sendMessage(WebSocketSession session, TextMessage message) {
try { try {
session.sendMessage(message); session.sendMessage(message);
return true; return true;
} catch (IOException e) { } catch (IOException e) {
log.error("消息推送失败,推送sessionId为:" + signage + ";消息体为:" + JSON.toJSONString(message)); log.error("消息推送失败;消息体为:" + JSON.toJSONString(message));
return false; return false;
} }
} }

3
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/service/WebSocketService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.bigmodel.websocket.service; package com.hnac.hzims.bigmodel.websocket.service;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
/** /**
* @Author: huangxing * @Author: huangxing
@ -10,4 +11,6 @@ public interface WebSocketService {
Boolean sendMessage(String signage, TextMessage message); Boolean sendMessage(String signage, TextMessage message);
Boolean sendMessage(WebSocketSession session, TextMessage message);
} }

Loading…
Cancel
Save