From e339a501aa675624ea129e5f12b9c71b03aa41ce Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Mon, 26 Jan 2026 15:11:11 +0800 Subject: [PATCH] set ChatHistoryConf default value --- .../agent/service/impl/AgentServiceImpl.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java index 3237e22c..5485e425 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java @@ -1,6 +1,12 @@ package xiaozhi.modules.agent.service.impl; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; @@ -81,9 +87,9 @@ public class AgentServiceImpl extends BaseServiceImpl imp if (agent.getMemModelId() != null && agent.getMemModelId().equals(Constant.MEMORY_NO_MEM)) { agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.IGNORE.getCode()); - if (agent.getChatHistoryConf() == null) { - agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode()); - } + } + if (agent.getChatHistoryConf() == null) { + agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode()); } // 查询上下文源配置 @@ -132,7 +138,8 @@ public class AgentServiceImpl extends BaseServiceImpl imp if (StringUtils.isNotBlank(keyword)) { if ("mac".equals(searchType)) { // 按MAC地址搜索:先搜索设备,再获取对应的智能体 - List devices = Optional.ofNullable(deviceService.searchDevicesByMacAddress(keyword, userId)).orElseGet(ArrayList::new); + List devices = Optional + .ofNullable(deviceService.searchDevicesByMacAddress(keyword, userId)).orElseGet(ArrayList::new); // 获取设备对应的智能体ID列表 List agentIds = devices.stream() .map(DeviceEntity::getAgentId)