Skip to content

Commit

Permalink
🔨 feat: add create summary #38
Browse files Browse the repository at this point in the history
  • Loading branch information
noparamin committed Nov 7, 2023
1 parent 7806099 commit 4047dca
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public ResponseEntity<?> getAudioFile(@PathVariable(value = "documentID") long d
}

@PostMapping("/testffff")
public ResponseEntity<?> test(@RequestHeader("Authorization") String accessToken) throws UnsupportedAudioFileException, IOException {
public ResponseEntity<?> test(@RequestParam("audioFile") MultipartFile audioFile, @RequestHeader("Authorization") String accessToken) throws UnsupportedAudioFileException, IOException {
String body = """
{
"segments":[
Expand Down Expand Up @@ -144,14 +144,20 @@ public ResponseEntity<?> test(@RequestHeader("Authorization") String accessToken
]
}
""";
ResponseEntity<String> response1 = new ResponseEntity<>(body, HttpStatus.OK);
List<SttData> data = sttService.getSTTData(response1);
System.out.println(data.get(0).getText());
lectureNoteService.createLectureNote(100L, data, "aa");
String path = "naver.com";
SttDto body2 = fileService.createResponseBody(path, data);
ResponseEntity<?> ss = new ResponseEntity<>(body2, HttpStatus.OK);
return ss;
// ResponseEntity<String> response1 = new ResponseEntity<>(body, HttpStatus.OK);
// List<SttData> data = sttService.getSTTData(response1);
// System.out.println(data.get(0).getText());
// lectureNoteService.createLectureNote(100L, data, "aa");
// String path = "naver.com";
// SttDto body2 = fileService.createResponseBody(path, data);
// ResponseEntity<?> ss = new ResponseEntity<>(body2, HttpStatus.OK);
// return ss;
S3Dto s3Dto = new S3Dto(audioFile, 26L);
String path = awsS3Uploader.uploadFile(s3Dto);
int startIndex = path.indexOf("application/pdf/") + "application/pdf/".length();
String extractedString = path.substring(startIndex);
System.out.println(extractedString);
return new ResponseEntity<>(HttpStatus.OK);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import com.smart.watchboard.dto.FileDto;
import com.smart.watchboard.dto.KeywordsDto;
import com.smart.watchboard.dto.S3Dto;
import com.smart.watchboard.service.FileService;
import com.smart.watchboard.service.MindmapService;
import com.smart.watchboard.service.RequestService;
import com.smart.watchboard.service.WhiteboardService;
import com.smart.watchboard.service.*;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -33,12 +30,15 @@ public class LearningFileController {
private final FileService fileService;
private final RequestService requestService;
private final WhiteboardService whiteboardService;
private final SummaryService summaryService;

@PostMapping("/{documentID}/pdf")
public ResponseEntity<?> uploadLearningFile(@PathVariable(value = "documentID") long documentId, @RequestParam("pdf") MultipartFile pdfFile, @RequestHeader("Authorization") String accessToken) throws UnsupportedAudioFileException, IOException {
S3Dto s3Dto = new S3Dto(pdfFile, documentId);
String path = awsS3Uploader.uploadFile(s3Dto);
ResponseEntity<String> responseEntity = requestService.requestPdfKeywords(path);
String summary = requestService.requestPdfSummary(path);
summaryService.createSummary(documentId, summary);
whiteboardService.setDataType(documentId, "pdf");

return new ResponseEntity<>(responseEntity.getBody(), HttpStatus.OK);
Expand Down

0 comments on commit 4047dca

Please sign in to comment.