mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 15:13:55 +08:00
update:移除无用代码
This commit is contained in:
-26
@@ -83,9 +83,6 @@ public class AgentChatHistoryBizServiceImpl implements AgentChatHistoryBizServic
|
||||
log.warn("聊天记录上报时,未找到mac地址为 {} 的设备", macAddress);
|
||||
}
|
||||
|
||||
// 异步触发聊天记录总结(仅在对话结束时触发)
|
||||
triggerChatSummaryAsync(report.getSessionId(), chatType);
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -130,27 +127,4 @@ public class AgentChatHistoryBizServiceImpl implements AgentChatHistoryBizServic
|
||||
|
||||
log.info("设备 {} 对应智能体 {} 上报成功", macAddress, agentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步触发聊天记录总结
|
||||
* 仅在对话结束时(chatType=2)触发总结,避免频繁总结
|
||||
*/
|
||||
private void triggerChatSummaryAsync(String sessionId, Byte chatType) {
|
||||
// 仅在对话结束时触发总结(chatType=2表示对话结束)
|
||||
if (chatType != null && chatType == 2) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
log.info("开始为会话 {} 生成聊天记录总结", sessionId);
|
||||
boolean success = agentChatSummaryService.generateAndSaveChatSummary(sessionId);
|
||||
if (success) {
|
||||
log.info("会话 {} 的聊天记录总结生成并保存成功", sessionId);
|
||||
} else {
|
||||
log.warn("会话 {} 的聊天记录总结生成失败", sessionId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("触发会话 {} 的聊天记录总结时发生异常", sessionId, e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,11 +1,19 @@
|
||||
package xiaozhi.modules.agent.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import xiaozhi.modules.agent.dto.AgentChatHistoryDTO;
|
||||
import xiaozhi.modules.agent.dto.AgentChatSummaryDTO;
|
||||
import xiaozhi.modules.agent.dto.AgentMemoryDTO;
|
||||
@@ -14,19 +22,12 @@ import xiaozhi.modules.agent.entity.AgentChatHistoryEntity;
|
||||
import xiaozhi.modules.agent.service.AgentChatHistoryService;
|
||||
import xiaozhi.modules.agent.service.AgentChatSummaryService;
|
||||
import xiaozhi.modules.agent.service.AgentService;
|
||||
import xiaozhi.modules.config.service.ConfigService;
|
||||
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
||||
import xiaozhi.modules.device.entity.DeviceEntity;
|
||||
import xiaozhi.modules.device.service.DeviceService;
|
||||
import xiaozhi.modules.llm.service.LLMService;
|
||||
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
||||
import xiaozhi.modules.model.entity.ModelConfigEntity;
|
||||
import xiaozhi.modules.model.service.ModelConfigService;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 智能体聊天记录总结服务实现类
|
||||
@@ -42,7 +43,6 @@ public class AgentChatSummaryServiceImpl implements AgentChatSummaryService {
|
||||
private final AgentService agentService;
|
||||
private final DeviceService deviceService;
|
||||
private final LLMService llmService;
|
||||
private final ConfigService configService;
|
||||
private final ModelConfigService modelConfigService;
|
||||
|
||||
// 总结规则常量
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ShiroConfig {
|
||||
filterMap.put("/config/**", "server");
|
||||
filterMap.put("/agent/chat-history/report", "server");
|
||||
filterMap.put("/agent/chat-history/download/**", "anon");
|
||||
filterMap.put("/agent/saveMemory/**", "server");
|
||||
filterMap.put("/agent/chat-summary/**", "server");
|
||||
filterMap.put("/agent/play/**", "anon");
|
||||
filterMap.put("/voiceClone/play/**", "anon");
|
||||
filterMap.put("/**", "oauth2");
|
||||
|
||||
Reference in New Issue
Block a user