【语音识别与群组会话事件添加】

This commit is contained in:
weizhihong 2023-04-17 18:24:00 +08:00
parent 1eb4e2c6cf
commit 0dddb9b4e8
3 changed files with 58 additions and 1 deletions

View File

@ -1,16 +1,21 @@
package club.joylink.rtss.services.voice.discriminate;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
import club.joylink.rtss.simulation.cbtc.discriminate.VoiceDiscriminateResult;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.event.conversation.SimulationConversationGroupDissolveEvent;
import club.joylink.rtss.simulation.cbtc.event.conversation.SimulationConversationGroupMessageEvent;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
/**
* 语音识别服务类(多例)
* 语音识别服务类
*/
@Slf4j
@Service
@ -50,4 +55,16 @@ public class VoiceDiscriminateService {
replyParseService.doExec(result, simulation); // 回复执行
correctSourceService.doExec(result, simulation);// 原信息纠错
}
/**
* 处理聊天信息
* @param event 聊天事件信息
*/
@EventListener
public void handleMessage(SimulationConversationGroupMessageEvent event) {
ConversationGroup conversationGroup = event.getConversationGroup();
}
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.conversation;
import club.joylink.rtss.services.voice.VoiceService;
import club.joylink.rtss.services.voice.discriminate.VoiceDiscriminateService;
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationGroupMessageVO;
@ -445,6 +446,8 @@ public class ConversationGroupHandlerService {
if (!CollectionUtils.isEmpty(userIdSet)) {
doSendMessage(simulation, userIdSet, ConversationGroupSocketMessageVO.MessageType.MESSAGE.generateMessageVO(conversationGroup, messageVO));
}
// 语音识别开始
applicationEventPublisher.publishEvent(new SimulationConversationGroupMessageEvent(this, simulation, conversationGroup, member, message.getContent()));
return messageVO;
}

View File

@ -0,0 +1,37 @@
package club.joylink.rtss.simulation.cbtc.event.conversation;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
import club.joylink.rtss.simulation.cbtc.event.AbstractSimulationEvent;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.Getter;
/**
* 群组退群事件
*/
@Getter
public class SimulationConversationGroupMessageEvent extends AbstractSimulationEvent {
/**
* 会话对象
*/
private ConversationGroup conversationGroup;
/**
* 操作用户
*/
private SimulationMember member;
/**
* 消息内容
*/
private String content;
public SimulationConversationGroupMessageEvent(Object source, Simulation simulation, ConversationGroup conversationGroup
, SimulationMember member, String content) {
super(source, simulation);
this.conversationGroup = conversationGroup;
this.member = member;
this.content = content;
}
}