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);