Skip to content

Commit

Permalink
fix: api endpoint 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
osoohynn committed Nov 28, 2024
1 parent 744895f commit 75932e1
Showing 1 changed file with 2 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
package com.project.oof.api.controller;

import com.project.oof.dto.ChatCompletionDto;
import com.project.oof.dto.CompletionDto;
import com.project.oof.service.ChatGPTService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
* ChatGPT API
*
* @author : lee
* @fileName : ChatGPTController
* @since : 12/29/23
*/

@Slf4j
@RestController
@RequestMapping(value = "/api/v1/chatGpt")
@RequestMapping(value = "/api")
public class ChatGPTController {

private final ChatGPTService chatGPTService;
Expand All @@ -34,46 +24,6 @@ public ChatGPTController(ChatGPTService chatGPTService) {
this.chatGPTService = chatGPTService;
}

/**
* [API] ChatGPT 모델 리스트를 조회합니다.
*/
@GetMapping("/modelList")
public ResponseEntity<List<Map<String, Object>>> selectModelList() {
List<Map<String, Object>> result = chatGPTService.modelList();
return new ResponseEntity<>(result, HttpStatus.OK);
}

/**
* [API] ChatGPT 유효한 모델인지 조회합니다.
*
* @param modelName
* @return
*/
@GetMapping("/model")
public ResponseEntity<Map<String, Object>> isValidModel(@RequestParam(name = "modelName") String modelName) {
Map<String, Object> result = chatGPTService.isValidModel(modelName);
return new ResponseEntity<>(result, HttpStatus.OK);
}

/**
* [API] Legacy ChatGPT 프롬프트 명령을 수행합니다. : gpt-3.5-turbo-instruct, babbage-002, davinci-002
*
* @param completionDto {}
* @return ResponseEntity<Map < String, Object>>
*/
@PostMapping("/legacyPrompt")
public ResponseEntity<Map<String, Object>> selectLegacyPrompt(@RequestBody CompletionDto completionDto) {
log.debug("param :: " + completionDto.toString());
Map<String, Object> result = chatGPTService.legacyPrompt(completionDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}

/**
* [API] 최신 ChatGPT 프롬프트 명령어를 수행합니다. : gpt-4, gpt-4 turbo, gpt-3.5-turbo
*
* @param chatCompletionDto
* @return
*/
@PostMapping("/prompt")
public ResponseEntity<Map<String, Object>> selectPrompt(@RequestBody ChatCompletionDto chatCompletionDto) {
log.debug("param :: " + chatCompletionDto.toString());
Expand Down

0 comments on commit 75932e1

Please sign in to comment.