From 95e2e64147dbcb9304b432423dd02722a4d6f4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A7=80=EC=9B=90?= <110761377+andrewkimswe@users.noreply.github.com> Date: Fri, 7 Feb 2025 22:18:49 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20Swagger=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team4/giftidea/controller/GptController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/team4/giftidea/controller/GptController.java b/src/main/java/com/team4/giftidea/controller/GptController.java index 612f6b1..f347e6e 100644 --- a/src/main/java/com/team4/giftidea/controller/GptController.java +++ b/src/main/java/com/team4/giftidea/controller/GptController.java @@ -9,6 +9,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -22,6 +25,7 @@ /** * GPT API와 연동하여 선물 추천을 제공하는 컨트롤러 */ +@Tag(name = "GPT 추천 API", description = "GPT를 이용하여 사용자 맞춤 선물 추천을 제공하는 API") @RestController @RequestMapping("/api/gpt") @Slf4j @@ -46,8 +50,13 @@ public GptController(RestTemplate restTemplate, GptConfig gptConfig, ProductServ * @param theme 선물의 주제 (ex: 'birthday', 'valentine', etc.) * @return 추천된 상품 목록 */ - @PostMapping("/process") - @Operation(description = "카카오톡 대화를 분석하여 키워드를 추출하고 그에 맞는 선물 목록을 추천합니다.") + @Operation(summary = "대화 분석 후 추천 상품 반환", description = "카카오톡 대화를 분석하여 GPT API를 통해 키워드를 추출하고, 해당 키워드에 맞는 추천 상품을 반환합니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "추천 상품 목록 반환"), + @ApiResponse(responseCode = "400", description = "잘못된 요청 파라미터"), + @ApiResponse(responseCode = "500", description = "서버 내부 오류 발생") + }) + @PostMapping("/process") public List processFileAndRecommend( @RequestParam("file") @Parameter(description = "카카오톡 대화 내용이 포함된 파일", required = true) MultipartFile file, @RequestParam("targetName") @Parameter(description = "대상 이름", required = true) String targetName,