|
|
|
@ -27,6 +27,7 @@ import com.supervision.util.UserUtil;
|
|
|
|
|
import com.supervision.vo.rasa.RasaTalkVo;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
@ -64,6 +65,9 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
|
|
|
|
|
private final DiagnosisAiRecordService diagnosisAiRecordService;
|
|
|
|
|
|
|
|
|
|
@Value("${qaSimilarityThreshold:0.4}")
|
|
|
|
|
private String qaSimilarityThreshold;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String receiveVoiceFile(MultipartFile file) {
|
|
|
|
|
if (file.getSize() <= 0) {
|
|
|
|
@ -306,7 +310,8 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
saveAiRecord(process.getId(), talkReqVO.getText(), talkVideoTtsResultResVO.getAnswerMessage());
|
|
|
|
|
} else {
|
|
|
|
|
// 如果阈值过低,也走大模型
|
|
|
|
|
if (qaSimilarityQuestionAnswer.getMatchScore() < 0.5) {
|
|
|
|
|
double threshold = Double.parseDouble(qaSimilarityThreshold);
|
|
|
|
|
if (qaSimilarityQuestionAnswer.getMatchScore() < threshold) {
|
|
|
|
|
log.info("{}:匹配到的结果阈值过低,走大模型回答", qaSimilarityQuestionAnswer);
|
|
|
|
|
String talk = aiService.talk(talkReqVO.getText(), medicalRec.getMedicalRecordAi());
|
|
|
|
|
talkVideoTtsResultResVO.setAnswerMessage(talk);
|
|
|
|
|