diff --git a/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java b/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java index 6d5d1765c..3d8c528db 100644 --- a/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/voice/discriminate/ReplyParseServiceImpl.java @@ -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())); } /** diff --git a/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java b/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java index ac04ea401..76dcaf4b6 100644 --- a/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java +++ b/src/main/java/club/joylink/rtss/services/voice/discriminate/VoiceDiscriminateService.java @@ -69,8 +69,9 @@ public class VoiceDiscriminateService { /** * 接受语音文件、资源等必要条件,解析开始 */ - public void doAnalysis(Simulation simulation, String content, List memberList) { + public void doAnalysis(Simulation simulation, Long id, String content, List 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); + } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java b/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java index c296485b9..ff5766cec 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/discriminate/VoiceDiscriminateResult.java @@ -52,6 +52,11 @@ public class VoiceDiscriminateResult { */ private List paramExtractResultList; + /** + * 会话的ID,用于回复 + */ + private Long conversionGroupId; + /** * 匹配人员集合 */