【会话回复逻辑人家机器人消息不做回复操作】

This commit is contained in:
weizhihong 2023-04-20 09:58:03 +08:00
parent 550b85b8ea
commit 07aa27bd4e
3 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroupHandlerService;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationManagerService;
import club.joylink.rtss.simulation.cbtc.discriminate.*;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
@ -18,7 +19,7 @@ import java.util.List;
public class ReplyParseServiceImpl implements VoiceTransactionalService {
@Autowired
private ConversationManagerService conversationManagerService;
private ConversationGroupHandlerService conversationGroupHandlerService;
@Override
@Async("voiceDiscriminateExecutor")
@ -55,7 +56,7 @@ public class ReplyParseServiceImpl implements VoiceTransactionalService {
replyResult.getParamList().toArray(objArr);
replyResult.setContent(String.format(replyRule.getMessageFormat(), objArr));
// 执行回复
simulationMemberList.forEach(member -> conversationManagerService.conversationChat(simulation, member, replyResult.getContent(), null));
simulationMemberList.forEach(member -> conversationGroupHandlerService.textChat(simulation, member, result.getConversionGroupId(), replyResult.getContent()));
}
/**

View File

@ -69,8 +69,9 @@ public class VoiceDiscriminateService {
/**
* 接受语音文件资源等必要条件解析开始
*/
public void doAnalysis(Simulation simulation, String content, List<SimulationMember> memberList) {
public void doAnalysis(Simulation simulation, Long id, String content, List<SimulationMember> memberList) {
VoiceDiscriminateResult result = voiceParseService.doParse(simulation, content);
result.setConversionGroupId(id);
result.setSimulationMemberList(memberList); // 匹配到人员集合
operateParseService.doExec(result, simulation); // 指令执行
replyParseService.doExec(result, simulation); // 回复执行
@ -93,7 +94,8 @@ public class VoiceDiscriminateService {
}
// 增加机器人已读操作
memberList.forEach(m -> conversationGroupManagerService.readConversationGroup(event.getSimulation(), m, conversationGroup.getId()));
// 执行语音识别
doAnalysis(event.getSimulation(), event.getMessage().getContent(), memberList);
if (!event.getMessage().getMember().isRobot()) { // 如果消息来源不为机器人则执行语音识别
doAnalysis(event.getSimulation(), conversationGroup.getId(), event.getMessage().getContent(), memberList);
}
}
}

View File

@ -52,6 +52,11 @@ public class VoiceDiscriminateResult {
*/
private List<ParamExtractResult> paramExtractResultList;
/**
* 会话的ID用于回复
*/
private Long conversionGroupId;
/**
* 匹配人员集合
*/