diff --git a/src/main/java/com/easylead/easylead/config/GptConfig.java b/src/main/java/com/easylead/easylead/config/GptConfig.java index 62d4c1c..7b10fb1 100644 --- a/src/main/java/com/easylead/easylead/config/GptConfig.java +++ b/src/main/java/com/easylead/easylead/config/GptConfig.java @@ -7,7 +7,7 @@ public class GptConfig { public static final String AUTHORIZATION = "Authorization"; public static final String BEARER = "Bearer "; public static final String CHAT_MODEL = "gpt-4o-mini"; - public static final String CHAT_MODEL_CUSTOM = "ft:gpt-3.5-turbo-0613:personal::9rJq4pTM"; + public static final String CHAT_MODEL_CUSTOM = "ft:gpt-3.5-turbo-0613:personal::9rWlz51c"; public static final Integer MAX_TOKEN = 300; public static final Boolean STREAM = true; public static final String ROLE = "user"; diff --git a/src/main/java/com/easylead/easylead/domain/books/business/BookBusiness.java b/src/main/java/com/easylead/easylead/domain/books/business/BookBusiness.java index 974b84c..3bbd441 100644 --- a/src/main/java/com/easylead/easylead/domain/books/business/BookBusiness.java +++ b/src/main/java/com/easylead/easylead/domain/books/business/BookBusiness.java @@ -94,25 +94,25 @@ public void easyToRead(String isbn) throws JsonProcessingException { Book book = bookConverter.toBook(request); System.out.println(book.getISBN()+" "+ book.getTitle()); Book saveBook = bookService.save(book); - for(Origin originContent : originList){ - - String easyContent= null; - String imgUrl = null; - try { - // 두 비동기 작업을 병렬로 시작 - CompletableFuture easyContentFuture = bookService.transformContent(originContent.getPageContent()); - CompletableFuture imgUrlFuture = bookService.makeImage(originContent.getPageContent()); - - // 두 작업이 모두 완료될 때까지 기다림 - easyContent = easyContentFuture.get(); - imgUrl = imgUrlFuture.get(); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - - Content content = contentConverter.toContent(saveBook,easyContent,originContent.getOriginId(),imgUrl); - contentService.save(content); - } +// for(Origin originContent : originList){ +// +// String easyContent= null; +// String imgUrl = null; +// try { +// // 두 비동기 작업을 병렬로 시작 +// CompletableFuture easyContentFuture = bookService.transformContent(originContent.getPageContent()); +// CompletableFuture imgUrlFuture = bookService.makeImage(originContent.getPageContent()); +// +// // 두 작업이 모두 완료될 때까지 기다림 +// easyContent = easyContentFuture.get(); +// imgUrl = imgUrlFuture.get(); +// } catch (InterruptedException | ExecutionException e) { +// throw new RuntimeException(e); +// } +// +// Content content = contentConverter.toContent(saveBook,easyContent,originContent.getOriginId(),imgUrl); +// contentService.save(content); +// } request.updateProgress(Progress.P4); requestService.update(request); @@ -132,7 +132,7 @@ public BookContentResDTO readContent(Long userId, Long pageId, String isbn) { readService.save(read); - return BookContentResDTO.builder().content(contentList).maxPage(maxPage).build(); + return BookContentResDTO.builder().pageId(pageId).content(contentList).maxPage(maxPage).build(); } public List recentList() { diff --git a/src/main/java/com/easylead/easylead/domain/books/dto/BookContentResDTO.java b/src/main/java/com/easylead/easylead/domain/books/dto/BookContentResDTO.java index a282d06..182d679 100644 --- a/src/main/java/com/easylead/easylead/domain/books/dto/BookContentResDTO.java +++ b/src/main/java/com/easylead/easylead/domain/books/dto/BookContentResDTO.java @@ -14,6 +14,7 @@ @Builder public class BookContentResDTO { List content; + Long pageId; Long maxPage; } diff --git a/src/main/java/com/easylead/easylead/domain/gpt/service/GptService.java b/src/main/java/com/easylead/easylead/domain/gpt/service/GptService.java index a6186fa..47b6c9e 100644 --- a/src/main/java/com/easylead/easylead/domain/gpt/service/GptService.java +++ b/src/main/java/com/easylead/easylead/domain/gpt/service/GptService.java @@ -281,7 +281,7 @@ public HttpRequest requestGPTCustom(String text) throws JsonProcessingException messages.add(new Message(text, "user")); - ChatGPTRequestDTO chatGptRequest = new ChatGPTRequestDTO("ft:gpt-3.5-turbo-0613:personal::9rJq4pTM", messages, 0.3,false); + ChatGPTRequestDTO chatGptRequest = new ChatGPTRequestDTO("ft:gpt-3.5-turbo-0613:personal::9rWlz51c", messages, 0.3,false); String input = null; input = mapper.writeValueAsString(chatGptRequest); System.out.println(input); diff --git a/src/main/java/com/easylead/easylead/domain/text/business/TextBusiness.java b/src/main/java/com/easylead/easylead/domain/text/business/TextBusiness.java index d628c40..2c43a10 100644 --- a/src/main/java/com/easylead/easylead/domain/text/business/TextBusiness.java +++ b/src/main/java/com/easylead/easylead/domain/text/business/TextBusiness.java @@ -60,5 +60,6 @@ public TextFileResDTO easyToReadImage(MultipartFile file) throws JsonProcessingE HttpRequest request = gptService.requestGPT(reqText,"gpt-4o-mini"); return TextFileResDTO.builder().text(gptService.responseGPT(request)).build(); + } } diff --git a/src/main/java/com/easylead/easylead/domain/text/controller/TextController.java b/src/main/java/com/easylead/easylead/domain/text/controller/TextController.java index 325a1c8..9711ffa 100644 --- a/src/main/java/com/easylead/easylead/domain/text/controller/TextController.java +++ b/src/main/java/com/easylead/easylead/domain/text/controller/TextController.java @@ -24,9 +24,8 @@ public class TextController { private final TextBusiness textBusiness; @PostMapping(value = "/image") - public ResponseEntity easyToReadImage(Locale locale, - HttpServletRequest request, - HttpServletResponse response, + public ResponseEntity easyToReadImage( + @RequestPart(value = "image") MultipartFile file) throws JsonProcessingException { return ResponseEntity.ok(textBusiness.easyToReadImage(file));