package admin.rest; import admin.base.PageInfo; import admin.modules.chatgpt.service.ChatgptRoleRecordsService; import admin.modules.chatgpt.service.ChatgptRoleSessionService; import admin.modules.chatgpt.service.dto.ChatgptRoleRecordsDto; import admin.modules.chatgpt.service.dto.ChatgptRoleRecordsQueryCriteria; import admin.modules.chatgpt.service.dto.ChatgptRoleSessionQueryCriteria; import admin.resp.ApiResponse; import admin.util.ScreenEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Pageable; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.concurrent.TimeUnit; /** * @author wk * @date 2023-11-27 **/ @Slf4j @RestController @RequiredArgsConstructor @Api(tags = "微信小程序:对话记录") @RequestMapping(value = "wx/chatgptRoleRecords/") public class ChatgptRoleRecordsController { private final ChatgptRoleRecordsService chatgptRoleRecordsService; private final ChatgptRoleSessionService chatgptRoleSessionService; @ApiOperation("会话查询对话记录") @GetMapping(value = "sessionList") public ApiResponse<Object> querySessionList(ChatgptRoleRecordsQueryCriteria query, Pageable pageable) { return ApiResponse.buildSuccess(chatgptRoleRecordsService.queryAll(query, pageable)); } @ApiOperation("查询会话") @GetMapping(value = "list") public ApiResponse<Object> query(ChatgptRoleSessionQueryCriteria query, Pageable pageable){ Integer byUserName = ScreenEnum.getByUserName(query.getName()); query.setUserId(byUserName); return ApiResponse.buildSuccess(chatgptRoleSessionService.queryAll(query,pageable)); } }