This commit is contained in:
2025-10-01 17:12:14 +08:00
parent e5961bba23
commit a08dc8b17d
3 changed files with 102 additions and 23 deletions

View File

@@ -3,10 +3,7 @@ package com.ruoyi.web.controller.jarvis;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.jarvis.service.IInstructionService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@@ -33,6 +30,19 @@ public class InstructionController extends BaseController {
java.util.List<String> result = instructionService.execute(cmd);
return AjaxResult.success(result);
}
/**
* 获取历史消息记录
* @param type 消息类型request(请求) 或 response(响应)
* @param limit 获取数量默认100条
* @return 历史消息列表
*/
@GetMapping("/history")
public AjaxResult getHistory(@RequestParam(required = false, defaultValue = "request") String type,
@RequestParam(required = false, defaultValue = "100") Integer limit) {
java.util.List<String> history = instructionService.getHistory(type, limit);
return AjaxResult.success(history);
}
}