|
|
|
@ -13,6 +13,7 @@ import com.supervision.websocket.cache.WebSocketUserCache;
|
|
|
|
|
import com.supervision.websocket.dto.ActionDTO;
|
|
|
|
|
import com.supervision.websocket.dto.SocketMessageDTO;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import org.springframework.web.socket.TextMessage;
|
|
|
|
@ -21,6 +22,7 @@ import org.springframework.web.socket.WebSocketSession;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class AskServiceImpl implements AskService {
|
|
|
|
@ -42,6 +44,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
}
|
|
|
|
|
// 进行rasa对话
|
|
|
|
|
List<String> rasaResultList = RasaUtil.talkRasa(text, socketMessageDTO.getSocketId());
|
|
|
|
|
log.info("问题:{},rasa回复:{}", text, JSONUtil.toJsonStr(rasaResultList));
|
|
|
|
|
WebSocketSession session = WebSocketUserCache.getSession(socketMessageDTO.getSocketId());
|
|
|
|
|
for (String rasaResult : rasaResultList) {
|
|
|
|
|
if (StrUtil.isNotBlank(rasaResult)) {
|
|
|
|
@ -87,6 +90,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
res.setTextMessage("医生,我们有听懂您说的什么");
|
|
|
|
|
res.setType(1);
|
|
|
|
|
session.sendMessage(new TextMessage(JSONUtil.toJsonStr(res)));
|
|
|
|
|
log.info("兜底话术,需要检查上面是不是出什么问题了");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|