From 7a2b9a2182c49218c62f466d66395c7be4dac4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E6=AC=A7=EF=BC=88=E6=9E=97=E5=B9=B3=E5=87=A1?= =?UTF-8?q?=EF=BC=89?= Date: Sat, 11 Oct 2025 16:14:40 +0800 Subject: [PATCH] 1 --- .../com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java index 6b46390..d592960 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java @@ -98,7 +98,7 @@ public class InstructionServiceImpl implements IInstructionService { // 从左边推入消息(新消息在前) stringRedisTemplate.opsForList().leftPush(key, timestampedMessage); // 保持列表最多100条,删除最早的消息 - stringRedisTemplate.opsForList().trim(key, 0, 99); + stringRedisTemplate.opsForList().trim(key, 0, 999); } catch (Exception e) { // 记录异常但不影响主流程 System.err.println("存储消息到Redis失败: " + e.getMessage()); @@ -123,7 +123,7 @@ public class InstructionServiceImpl implements IInstructionService { } // 确定获取数量,默认100条 - int count = (limit != null && limit > 0) ? Math.min(limit, 100) : 100; + int count = (limit != null && limit > 0) ? Math.min(limit, 1000) : 1000; // 从Redis获取历史消息(索引0到count-1) List messages = stringRedisTemplate.opsForList().range(key, 0, count - 1);