|
|
@@ -611,6 +611,7 @@ public class ChatController {
|
|
|
public ResponseEntity<Map<String, Object>> getHistory(
|
|
|
@RequestParam(defaultValue = "1") int page,
|
|
|
@RequestParam(defaultValue = "20") int pageSize) {
|
|
|
+ final String userKey = getCurrentUserKey();
|
|
|
// getHistory 现在直接返回包含 items/page/page_size/total/total_pages 的 Map
|
|
|
var result = persistenceService.getHistory(userKey, page, pageSize);
|
|
|
return ResponseEntity.ok(result);
|
|
|
@@ -626,6 +627,7 @@ public class ChatController {
|
|
|
@GetMapping("/recent-messages")
|
|
|
public ResponseEntity<Map<String, Object>> getRecentMessages(
|
|
|
@RequestParam(defaultValue = "50") int limit) {
|
|
|
+ final String userKey = getCurrentUserKey();
|
|
|
var msgs = persistenceService.getRecentMessages(userKey, Math.min(limit, 200));
|
|
|
return ResponseEntity.ok(Map.of("messages", msgs));
|
|
|
}
|