一键话术增加语音聊天内容

This commit is contained in:
qinyong@9artedu.com 2026-06-26 10:26:31 +08:00
parent 55ca676231
commit a5b4f93227

View File

@ -294,10 +294,20 @@ public class GenerationController {
// 历史消息上下文
List<ArchiveMessage> top15 = (messages == null || messages.isEmpty())
? new ArrayList<>()
: messages.stream().limit(15).collect(Collectors.toList());
: messages.stream()
.filter(msg -> !(
"voice".equals(msg.getMsgtype()) &&
msg.getContent() != null &&
!msg.getContent().contains("[语音]")
))
.limit(15)
.collect(Collectors.toList());
StringBuilder sb = new StringBuilder();
boolean is_external = true;
for (ArchiveMessage msg : messages) {
if("voice".equals(msg.getMsgtype()) && msg.getContent() != null && !msg.getContent().contains("[语音]")){
continue;
}
sb.append(msg.getCreatedAt()).append(" ").append(msg.getFromRole()).append(" ").append(msg.getContent()).append("\n");
if ("EXTERNAL".equals(messages.get(0).getFromRole())){ //第一条消息是客户的消息 则继续
if ("EXTERNAL".equals(msg.getFromRole()) && is_external){ //判断只要消息不是内部人员,则后续不考虑