|
|
@ -66,6 +66,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
// 这里调用京东数字人接口首先根据token获取房间号
|
|
|
|
// 这里调用京东数字人接口首先根据token获取房间号
|
|
|
|
String roomId = HumanUtil.queryRoomId(talkReqVO.getRoomKey(), talkReqVO.getRoomToken());
|
|
|
|
String roomId = HumanUtil.queryRoomId(talkReqVO.getRoomKey(), talkReqVO.getRoomToken());
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), "您好,我没有听懂您说什么");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TalkResultResVO talkResultResVO = new TalkResultResVO();
|
|
|
|
TalkResultResVO talkResultResVO = new TalkResultResVO();
|
|
|
|
// 这里校验,rasa回复的结果是不是action
|
|
|
|
// 这里校验,rasa回复的结果是不是action
|
|
|
@ -87,6 +88,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
if (ObjectUtil.isEmpty(library)) {
|
|
|
|
if (ObjectUtil.isEmpty(library)) {
|
|
|
|
log.info("{}:未从问题库中找到,回答未识别语句", rasaResult);
|
|
|
|
log.info("{}:未从问题库中找到,回答未识别语句", rasaResult);
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), "您好,我没有听懂您说什么");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
AskPatientAnswer askPatientAnswer = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getPatientId, process.getPatientId())
|
|
|
|
AskPatientAnswer askPatientAnswer = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getPatientId, process.getPatientId())
|
|
|
|
.eq(AskPatientAnswer::getLibraryQuestionId, library.getId()).last("limit 1").one();
|
|
|
|
.eq(AskPatientAnswer::getLibraryQuestionId, library.getId()).last("limit 1").one();
|
|
|
@ -98,19 +100,12 @@ public class AskServiceImpl implements AskService {
|
|
|
|
String resText = library.getDefaultAnswer().get(RandomUtil.randomInt(0, library.getDefaultAnswer().size()));
|
|
|
|
String resText = library.getDefaultAnswer().get(RandomUtil.randomInt(0, library.getDefaultAnswer().size()));
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
// 保存记录
|
|
|
|
// 保存记录
|
|
|
|
DiagnosisQaRecord record = new DiagnosisQaRecord();
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), resText);
|
|
|
|
record.setProcessId(talkReqVO.getProcessId());
|
|
|
|
|
|
|
|
record.setAnswerType("default");
|
|
|
|
|
|
|
|
// 注意,这里如果有默认回答,回答的结果是默认结果ID
|
|
|
|
|
|
|
|
record.setAnswerId(library.getId());
|
|
|
|
|
|
|
|
record.setQuestion(talkReqVO.getText());
|
|
|
|
|
|
|
|
record.setAnswer(resText);
|
|
|
|
|
|
|
|
record.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
|
|
|
record.insert();
|
|
|
|
|
|
|
|
log.info("{}:找到了默认答案:{}", rasaResult, talkReqVO.getText());
|
|
|
|
log.info("{}:找到了默认答案:{}", rasaResult, talkReqVO.getText());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.info("{}:没有从默认答案中找到找到默认内容,回复未识别语句", rasaResult);
|
|
|
|
log.info("{}:没有从默认答案中找到找到默认内容,回复未识别语句", rasaResult);
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), "您好,我没有听懂您说什么");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (CollUtil.isEmpty(askPatientAnswer.getAnswer())) {
|
|
|
|
if (CollUtil.isEmpty(askPatientAnswer.getAnswer())) {
|
|
|
@ -120,15 +115,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空不为空,但在获取的时候,答案为空,开始回复默认语句,默认语句内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空不为空,但在获取的时候,答案为空,开始回复默认语句,默认语句内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
// 保存记录
|
|
|
|
// 保存记录
|
|
|
|
DiagnosisQaRecord record = new DiagnosisQaRecord();
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), resText);
|
|
|
|
record.setProcessId(talkReqVO.getProcessId());
|
|
|
|
|
|
|
|
record.setAnswerType("default");
|
|
|
|
|
|
|
|
// 注意,这里如果有默认回答,回答的结果是默认结果ID
|
|
|
|
|
|
|
|
record.setAnswerId(library.getId());
|
|
|
|
|
|
|
|
record.setQuestion(talkReqVO.getText());
|
|
|
|
|
|
|
|
record.setAnswer(resText);
|
|
|
|
|
|
|
|
record.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
|
|
|
record.insert();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空,但在获取的时候,答案为空,但是获取默认语句也为空,那么回复未识别语句", rasaResult, askPatientAnswer.getId());
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空,但在获取的时候,答案为空,但是获取默认语句也为空,那么回复未识别语句", rasaResult, askPatientAnswer.getId());
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
@ -139,14 +126,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
log.info("{}:找到了病历配置的回答语句:{},回答内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
log.info("{}:找到了病历配置的回答语句:{},回答内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
// 保存记录
|
|
|
|
// 保存记录
|
|
|
|
DiagnosisQaRecord record = new DiagnosisQaRecord();
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "patient", askPatientAnswer.getId(), talkReqVO.getText(), resText);
|
|
|
|
record.setProcessId(talkReqVO.getProcessId());
|
|
|
|
|
|
|
|
record.setAnswerType("patient");
|
|
|
|
|
|
|
|
record.setAnswerId(askPatientAnswer.getId());
|
|
|
|
|
|
|
|
record.setQuestion(talkReqVO.getText());
|
|
|
|
|
|
|
|
record.setAnswer(resText);
|
|
|
|
|
|
|
|
record.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
|
|
|
record.insert();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -156,6 +136,17 @@ public class AskServiceImpl implements AskService {
|
|
|
|
return talkResultResVO;
|
|
|
|
return talkResultResVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void saveQaRecord(String processId, String answerType, String answerId, String question, String resText) {
|
|
|
|
|
|
|
|
DiagnosisQaRecord record = new DiagnosisQaRecord();
|
|
|
|
|
|
|
|
record.setProcessId(processId);
|
|
|
|
|
|
|
|
record.setAnswerType(answerType);
|
|
|
|
|
|
|
|
record.setAnswerId(answerId);
|
|
|
|
|
|
|
|
record.setQuestion(question);
|
|
|
|
|
|
|
|
record.setAnswer(resText);
|
|
|
|
|
|
|
|
record.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|
|
|
|
record.insert();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String replyVoice() {
|
|
|
|
public String replyVoice() {
|
|
|
|