|
|
@@ -46,10 +46,8 @@ import com.xueyi.nlt.nlt.template.MovieChatTemplate; |
|
|
|
import com.xueyi.system.api.digitalmans.domain.dto.DmManDeviceDto; |
|
|
|
import com.xueyi.system.api.digitalmans.domain.dto.DmSkillDto; |
|
|
|
import com.xueyi.system.api.digitalmans.domain.vo.DmBatchQuestionsVo; |
|
|
|
import com.xueyi.system.api.digitalmans.feign.RemoteDigitalmanService; |
|
|
|
import com.xueyi.system.api.digitalmans.feign.RemoteManDeviceService; |
|
|
|
import com.xueyi.system.api.digitalmans.feign.RemoteQuestionanswersService; |
|
|
|
import com.xueyi.system.api.digitalmans.feign.RemoteSkillService; |
|
|
|
import com.xueyi.system.api.digitalmans.domain.vo.DmBroadcastVo; |
|
|
|
import com.xueyi.system.api.digitalmans.feign.*; |
|
|
|
import com.xueyi.system.api.model.Source; |
|
|
|
import com.xueyi.system.api.organize.domain.dto.SysEnterpriseDto; |
|
|
|
import com.xueyi.system.api.organize.feign.RemoteEnterpriseService; |
|
|
@@ -145,6 +143,9 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt |
|
|
|
@Autowired |
|
|
|
RemoteDigitalmanService remoteDigitalmanService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
RemoteBroadcastService remoteBroadcastService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
RemoteEnterpriseService remoteEnterpriseService; |
|
|
|
@Autowired |
|
|
@@ -386,15 +387,12 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt |
|
|
|
@ResponseBody |
|
|
|
public R<JSONObject> conversationInner(@RequestBody DmIntentVo intent) { |
|
|
|
JSONObject joResult = null; |
|
|
|
if (intent.getMode() !=null && intent.getMode().equals(MessageConstants.MODE_FREE_CHAT)) { |
|
|
|
// 闲聊 |
|
|
|
joResult = movieChatTemplate.handle(intent.getDevId(),intent.getContent()); |
|
|
|
return R.ok(joResult); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String enterpriseId = (String)SecurityContextHolder.getLocalMap().get("enterprise_id"); |
|
|
|
String enterpriseName = ""; |
|
|
|
R<SysEnterpriseDto> enterpriseDtoR = remoteEnterpriseService.getInfo(Long.valueOf(enterpriseId)); |
|
|
|
Source source = SourceUtil.getSourceCache(enterpriseDtoR.getData().getStrategyId()); |
|
|
|
if (enterpriseDtoR.isOk()) { |
|
|
|
enterpriseName = enterpriseDtoR.getData().getName(); |
|
|
|
} |
|
|
@@ -418,7 +416,44 @@ public class DmIntentController extends BaseController<DmIntentQuery, DmIntentDt |
|
|
|
content = qajson.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("knowledge_lib"); |
|
|
|
} |
|
|
|
pushIntoDashboardRedis(enterpriseName,content,"knowledge"); |
|
|
|
return R.ok(JSONObject.from(qaAjax.get("data"))); |
|
|
|
// 判断当前模式是否为MODE_FREE_CHAT,如果为MODE_FREE_CHAT,将问题与答案存入redis |
|
|
|
if (intent.getMode() !=null && intent.getMode().equals(MessageConstants.MODE_FREE_CHAT )) { |
|
|
|
String answer = qajson.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("answer"); |
|
|
|
String type = qajson.getJSONObject("data").getJSONArray("result").getJSONObject(0).getString("model_type"); |
|
|
|
String accurate = qajson.getJSONObject("data").getString("accurate"); |
|
|
|
if (accurate.equals("1")) { |
|
|
|
// 如果type == 0, 直接将问题/答案存入缓存 |
|
|
|
if (type.equals("0")) { |
|
|
|
redisTemplate2.opsForList().rightPush("group:nlt" + ":" + enterpriseId + ":" + intent.getOperator(), intent.getContent()); |
|
|
|
redisTemplate2.opsForList().rightPush("group:nlt" + ":" + enterpriseId + ":" + intent.getOperator(), answer); |
|
|
|
} else { |
|
|
|
// 获取播报信息,将播报信息存入缓存 |
|
|
|
Long broadcastId = Long.parseLong(answer); |
|
|
|
R<DmBroadcastVo> rBroadcastVo = remoteBroadcastService.innerSelectById(broadcastId,Long.parseLong(enterpriseId),source.getMaster(),SecurityConstants.INNER); |
|
|
|
List<JSONObject> broadcastResourceList = rBroadcastVo.getData().getResource(); |
|
|
|
String result = ""; |
|
|
|
for (JSONObject jo : broadcastResourceList) { |
|
|
|
String tts = jo.getString("ttsText"); |
|
|
|
if (StringUtils.isNotEmpty(tts)) { |
|
|
|
result += tts; |
|
|
|
} |
|
|
|
} |
|
|
|
// 将拼接好的tts添加到缓存 |
|
|
|
redisTemplate2.opsForList().rightPush("group:nlt" + ":" + enterpriseId + ":" + intent.getOperator(), intent.getContent()); |
|
|
|
redisTemplate2.opsForList().rightPush("group:nlt" + ":" + enterpriseId + ":" + intent.getOperator(), result); |
|
|
|
} |
|
|
|
|
|
|
|
return R.ok(JSONObject.from(qaAjax.get("data"))); |
|
|
|
} |
|
|
|
} else { |
|
|
|
return R.ok(JSONObject.from(qaAjax.get("data"))); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (intent.getMode() !=null && intent.getMode().equals(MessageConstants.MODE_FREE_CHAT)) { |
|
|
|
// 闲聊 |
|
|
|
joResult = movieChatTemplate.handle(intent.getDevId(),intent.getContent()); |
|
|
|
return R.ok(joResult); |
|
|
|
} |
|
|
|
SkillType.BOOK_MEETING_ROOM.getCode(); |
|
|
|
// 判断skill code的值 |
|
|
|