From b15b5af349bec9f51055e93269163e4f4fe942b7 Mon Sep 17 00:00:00 2001 From: rainv123 <2148537152@qq.com> Date: Fri, 21 Nov 2025 18:31:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E8=AE=B0=E5=BF=86=E4=B8=8D=E6=98=AF=E3=80=90=E6=97=A0=E8=AE=B0?= =?UTF-8?q?=E5=BF=86=E3=80=91=E6=97=B6=EF=BC=8C=E9=BB=98=E8=AE=A4chatHisto?= =?UTF-8?q?ryConf=3D2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent/service/impl/AgentServiceImpl.java | 17 ++++++++++++++++- main/manager-web/src/views/roleConfig.vue | 17 ++++++++--------- 2 files changed, 24 insertions(+), 10 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 3556877d..a888f8d9 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 @@ -395,7 +395,22 @@ public class AgentServiceImpl extends BaseServiceImpl imp entity.setIntentModelId(template.getIntentModelId()); entity.setSystemPrompt(template.getSystemPrompt()); entity.setSummaryMemory(template.getSummaryMemory()); - entity.setChatHistoryConf(template.getChatHistoryConf()); + + // 根据记忆模型类型设置默认的chatHistoryConf值 + if (template.getMemModelId() != null) { + if (template.getMemModelId().equals("Memory_mem0ai") + || template.getMemModelId().equals("Memory_mem_local_short")) { + // 当记忆模型是Memory_mem0ai或Memory_mem_local_short时,默认chatHistoryConf设为2 + entity.setChatHistoryConf(2); + } else if (template.getMemModelId().equals("Memory_nomem")) { + entity.setChatHistoryConf(0); + } else { + entity.setChatHistoryConf(template.getChatHistoryConf()); + } + } else { + entity.setChatHistoryConf(template.getChatHistoryConf()); + } + entity.setLangCode(template.getLangCode()); entity.setLanguage(template.getLanguage()); } diff --git a/main/manager-web/src/views/roleConfig.vue b/main/manager-web/src/views/roleConfig.vue index e7b593e2..9d833e59 100644 --- a/main/manager-web/src/views/roleConfig.vue +++ b/main/manager-web/src/views/roleConfig.vue @@ -604,15 +604,14 @@ export default { if (type === "Intent" && value !== "Intent_nointent") { this.fetchAllFunctions(); } - if (type === "Memory" && value === "Memory_nomem") { - this.form.chatHistoryConf = 0; - } - if ( - type === "Memory" && - value !== "Memory_nomem" && - (this.form.chatHistoryConf === 0 || this.form.chatHistoryConf === null) - ) { - this.form.chatHistoryConf = 2; + if (type === "Memory") { + if (value === "Memory_nomem") { + this.form.chatHistoryConf = 0; + } else if (value === "Memory_mem0ai" || value === "Memory_mem_local_short") { + this.form.chatHistoryConf = 2; + } else if (this.form.chatHistoryConf === 0 || this.form.chatHistoryConf === null) { + this.form.chatHistoryConf = 2; + } } if (type === "LLM") { // 当LLM类型改变时,更新意图识别选项的可见性