Conversation
### Desc - OpenAI Whisper API 호출은 케어콜이 아닌 다른 기능에서도 쓸 수 있고, 케어콜 도메인이 아니라 외부 API 래퍼이다 - ai 패키지에 같은 계층의 AiSummaryService, OpenAiChatService가 이미 존재하니 OpenAiSttService도 패키지를 이동하자
📋 WalkthroughOpenAiSttService 클래스가 🔄 Changes
🎯 Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes 🏷️ Suggested Labels
👥 Suggested Reviewers
🎵 Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/java/com/example/medicare_call/service/ai/OpenAiSttService.java (1)
80-84: 원본 예외를CustomExceptioncause로 연결하는 게 좋을 것 같아요현재
catch (Exception e)블록에서e는log.error에는 전달되지만, 새로 던지는CustomException의 cause로는 연결되지 않아요. 로그 레벨 이상의 추적이 필요한 경우 스택 트레이스가 끊겨서 디버깅이 살짝 불편할 수 있어요.♻️ 원본 예외 cause 체이닝 제안
- throw new CustomException(ErrorCode.STT_PROCESSING_FAILED, "STT 처리 실패"); + throw new CustomException(ErrorCode.STT_PROCESSING_FAILED, "STT 처리 실패", e);(
CustomException이Throwable cause파라미터를 지원하는 경우에 한함)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/example/medicare_call/service/ai/OpenAiSttService.java` around lines 80 - 84, The catch block in OpenAiSttService currently logs the original exception `e` but throws a new CustomException without chaining the cause; modify the throw to pass `e` as the cause (e.g., new CustomException(ErrorCode.STT_PROCESSING_FAILED, "STT 처리 실패", e)) so the original stacktrace is preserved; if CustomException lacks a cause-taking constructor, add one or wrap `e` appropriately in CustomException's constructor and keep the existing log call that computes elapsed time using `startTime`.src/main/java/com/example/medicare_call/service/carecall/inbound/CareCallUploadService.java (1)
37-43:getSegments()null 가드가 없어요현재 코드는
sttResponse.getSegments()반환값이null이면.stream()호출 시 NPE가 발생해요. 이번 PR 변경은 아니지만 살짝 불안한 부분이에요.🛡️ 방어 코드 제안
- java.util.List<CareCallDataProcessRequest.TranscriptionData.TranscriptionSegment> segments = - sttResponse.getSegments().stream() + java.util.List<OpenAiSttResponse.Segment> rawSegments = + sttResponse.getSegments() != null ? sttResponse.getSegments() : java.util.Collections.emptyList(); + java.util.List<CareCallDataProcessRequest.TranscriptionData.TranscriptionSegment> segments = + rawSegments.stream()🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/com/example/medicare_call/service/carecall/inbound/CareCallUploadService.java` around lines 37 - 43, sttResponse.getSegments() can be null which will cause an NPE when calling .stream(); in CareCallUploadService where you build TranscriptionSegment from sttResponse.getSegments(), guard against null by treating a null segments list as empty (e.g., use Optional.ofNullable(sttResponse.getSegments()).orElse(Collections.emptyList()) or an explicit null check) before mapping to CareCallDataProcessRequest.TranscriptionData.TranscriptionSegment.builder(); ensure the rest of the mapping logic (speaker/text) remains unchanged so you produce an empty list instead of throwing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/main/java/com/example/medicare_call/service/ai/OpenAiSttService.java`:
- Around line 80-84: The catch block in OpenAiSttService currently logs the
original exception `e` but throws a new CustomException without chaining the
cause; modify the throw to pass `e` as the cause (e.g., new
CustomException(ErrorCode.STT_PROCESSING_FAILED, "STT 처리 실패", e)) so the
original stacktrace is preserved; if CustomException lacks a cause-taking
constructor, add one or wrap `e` appropriately in CustomException's constructor
and keep the existing log call that computes elapsed time using `startTime`.
In
`@src/main/java/com/example/medicare_call/service/carecall/inbound/CareCallUploadService.java`:
- Around line 37-43: sttResponse.getSegments() can be null which will cause an
NPE when calling .stream(); in CareCallUploadService where you build
TranscriptionSegment from sttResponse.getSegments(), guard against null by
treating a null segments list as empty (e.g., use
Optional.ofNullable(sttResponse.getSegments()).orElse(Collections.emptyList())
or an explicit null check) before mapping to
CareCallDataProcessRequest.TranscriptionData.TranscriptionSegment.builder();
ensure the rest of the mapping logic (speaker/text) remains unchanged so you
produce an empty list instead of throwing.
Desc
Summary by CodeRabbit
사용자에게 미치는 영향: 없음