| | |
| | | //用来标记,是否有匹配上的 |
| | | Integer flag = 0; |
| | | //1-AI识别 |
| | | String aiUrl = configService.selectConfigByKey("sys.voice.match.ai.url"); |
| | | String url = configService.selectConfigByKey("sys.voice.match.ai.url",phoneCallReqYQVO.getOrgid()); |
| | | |
| | | if (ObjectUtils.isNotEmpty(aiUrl)) { |
| | | PhoneCallBackYQVO aiMatchResult = AiMatch(phoneCallReqYQVO, phoneCallBackYQVO, |
| | | if (ObjectUtils.isNotEmpty(url)) { |
| | | PhoneCallBackYQVO aiMatchResult = AiMatch(url, phoneCallReqYQVO, phoneCallBackYQVO, |
| | | ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate, |
| | | ivrTaskTemplateScripts, scriptId, flag, phoneCallReqYQVO.getUuid()); |
| | | if(aiMatchResult != null){ |
| | |
| | | * @param options |
| | | * @return |
| | | */ |
| | | public Integer matchOptionIndex(String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid){ |
| | | public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("userQuestion",questionText); |
| | | jsonObject.put("userAnswer",voiceText); |
| | |
| | | String result = null; |
| | | |
| | | // String url = "http://localhost:8099/matchOptionIndex"; |
| | | String url = configService.selectConfigByKey("sys.voice.match.ai.url"); |
| | | if(StringUtils.isNotEmpty(url)){ |
| | | try { |
| | | Map<String, String> headers = new HashMap<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | public PhoneCallBackYQVO AiMatch(PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, |
| | | public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, |
| | | IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate, |
| | | List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid){ |
| | | PhoneCallBackYQVO back = null; |
| | |
| | | String voiceText = phoneCallReqYQVO.getAsrtext(); |
| | | String questionText = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent(); |
| | | Integer matched = -1; |
| | | matched = matchOptionIndex(questionText, voiceText, options, uuid); |
| | | matched = matchOptionIndex(url, questionText, voiceText, options, uuid); |
| | | //说明匹配正确了 |
| | | if(matched != null && matched >= 0){ |
| | | IvrTaskTemplateTargetoption chosenOption = options.get(matched); |
| | |
| | | IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption3 = new IvrTaskTemplateTargetoption(); |
| | | ivrTaskTemplateTargetoption3.setTargetvalue("其他"); |
| | | options.add(ivrTaskTemplateTargetoption3); |
| | | |
| | | Integer matched = matchOptionIndex(questionText,voiceText,options,"1"); |
| | | //1-AI识别 |
| | | String url = configService.selectConfigByKey("sys.voice.match.ai.url"); |
| | | Integer matched = matchOptionIndex(url, questionText,voiceText,options,"1"); |
| | | if(ObjectUtils.isNotEmpty(matched)){ |
| | | if(matched >= 0){ |
| | | matchedText = options.get(matched).getTargetvalue(); |