Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] gpt 결과물 & SSML 연결 작업 #23

Merged
merged 5 commits into from
Jul 28, 2024

Conversation

yuuddin
Copy link
Collaborator

@yuuddin yuuddin commented Jul 28, 2024

DONE

  • 재환님이 구현하신 chat gpt로 받아온 script를 '@' 구분자를 통해 파싱
  • 각 파싱된 문장들 sentence entity안에 저장
  • ssml을 위한 각 문장 끝 추가 생성

TODO

  • 번역 api 결정 후 script 번역 로직 구현

@yuuddin yuuddin added the 💻 FEATURE New feature or request label Jul 28, 2024
@yuuddin yuuddin requested a review from ja7811 July 28, 2024 06:11
@yuuddin yuuddin self-assigned this Jul 28, 2024
@ja7811
Copy link
Member

ja7811 commented Jul 28, 2024

수고하셨습니다 🤝
저도 함 테스트 해볼게요

Comment on lines 62 to 72
byte[] audioBytes = Base64.getDecoder().decode(audioContent);
//S3 설정 후 변경 예정
String rand= UUID.randomUUID().toString();
String outputFilePath = "src/main/resources/speech/" + rand + ".mp3";
try (OutputStream out = new FileOutputStream(outputFilePath)) {
out.write(audioBytes);
} catch (Exception e) {
e.printStackTrace();
}
return "success";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다 잘 작동하네용 👍
requestSpeech() 함수 부분 읽으면서 든 생각 몇 가지 있는데 괜찮다 싶으면 적용해주세요

  • outputFilePath 같은 건 함수 윗 부분이나 static 변수로 따로 빼는 게 어떨지
  • "success"를 반환하기보단, 생성된 파일명 등을 return하는 게 어떨지 (이후 스트리밍 등에 사용할 테니까)
  • 파일 저장 중 예외 발생 시 콘솔 출력 후 끝나는데, 새로운 RuntimeException 등을 던지는 게 어떨지
    • 지금은 에러만 출력한 후 똑같이 return "success";를 거쳐서 정상적인 흐름으로 넘어가는데,
      파일 저장을 못하면 여기서 흐름을 끊어버리는 게 맞다고 생각해요
    • 그래서 RuntimeException을 새로 던져서 상위의 CastServiceExceptionAdvice 등에서 처리하도록 두는 게 더 나을 거 같습니다
    • 교수님이 '처리 못할 예외는 다시 던져라`라고 강조하시는 걸 여러 번 들어서 적음..

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. S3 설정 후 어짜피 바꿀 로직이여서 일단 그냥 두겠습니다!
  2. 반환하는 부분 파일명 반환으로 바꾸고 번역 기능 마무리 후에 exception 처리 하겠습니다아

Comment on lines 47 to 48
Map<String, Object> voice = new HashMap<>();
voice.put("name", ttsdto.getVoice());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 당장 할 부분은 아니긴 한데, voice에도 디폴트 값을 넣거나 예외처리하는 로직이 있으면 좋을 것 같아요
voice가 비었거나 이상한 값 넣으니까 요런 응답을 내뿜더라고요
image

물론 급한 기능 아니니까 나아중에 해도 될 것 같습니다

Copy link
Collaborator Author

@yuuddin yuuddin Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voice default 처리...
사실 enum 처리를 하는 방법도 있는데 나아중에 이야기 해봅시다ㅋㅋㅋ

Comment on lines +59 to +60
ResponseEntity<Map> response = restTemplate.exchange(url, HttpMethod.POST, entity, Map.class);
String audioContent = (String) response.getBody().get("audioContent");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 궁금한 점 있는데
Google API 읽어보니까 response에서 timepoints로 문장별 시작시간 접근할 수 있는 거 맞죠??
timepoints들을 어디다 저장해야할지 모르겠네

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네 따로 사진 보내드린 것처럼 나오는데 아무래도 sentence에 저장하는게 맞지 않을까요??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sentence에 칼럼 새로 추가해서요??
낫배드

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넴 반영할게요~

@yuuddin yuuddin merged commit 7e5868c into feat/cast-api/11 Jul 28, 2024
@yuuddin yuuddin mentioned this pull request Jul 28, 2024
3 tasks
@ja7811 ja7811 deleted the feat/parsing/22 branch August 11, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 FEATURE New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants