-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatController.java
More file actions
49 lines (41 loc) · 2.34 KB
/
ChatController.java
File metadata and controls
49 lines (41 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.perfact.be.domain.chat.controller;
import com.perfact.be.domain.chat.dto.ChatRequest;
import com.perfact.be.domain.chat.dto.ChatResponse;
import com.perfact.be.domain.chat.service.ChatService;
import com.perfact.be.global.apiPayload.ApiResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@Validated
@RestController
@RequestMapping("/api/report")
@RequiredArgsConstructor
@Tag(name = "Chat", description = "챗봇 API")
public class ChatController {
private final ChatService chatServiceImpl;
@Operation(summary = "리포트 기반 채팅", description = "특정 리포트의 분석 결과를 바탕으로 AI와 채팅합니다.")
@PostMapping("/{reportId}/chat")
public ApiResponse<ChatResponse.ChatResponseDTO> sendMessage(
@Parameter(description = "리포트 ID", required = true, example = "1") @PathVariable Long reportId,
@Parameter(description = "채팅 요청", required = true) @RequestBody ChatRequest request) {
ChatResponse.ChatResponseDTO response = chatServiceImpl.sendMessage(reportId, request);
return ApiResponse.onSuccess(response);
}
@Operation(summary = "채팅 로그 조회", description = "특정 리포트의 채팅 로그를 시간 순으로 조회합니다.")
@GetMapping("/{reportId}/chat")
public ApiResponse<ChatResponse.ChatLogListResponseDTO> getChatLogs(
@Parameter(description = "리포트 ID", required = true, example = "1") @PathVariable Long reportId) {
ChatResponse.ChatLogListResponseDTO response = chatServiceImpl.getChatLogs(reportId);
return ApiResponse.onSuccess(response);
}
@Operation(summary = "추천 질문 조회", description = "특정 리포트의 분석 결과를 바탕으로 AI가 추천하는 질문을 조회합니다.")
@GetMapping("/{reportId}/chat/recommend")
public ApiResponse<ChatResponse.RecommendQuestionsResponseDTO> getRecommendQuestions(
@Parameter(description = "리포트 ID", required = true, example = "1") @PathVariable Long reportId) {
ChatResponse.RecommendQuestionsResponseDTO response = chatServiceImpl.getRecommendQuestions(reportId);
return ApiResponse.onSuccess(response);
}
}