refactor(word): clean up word generation flow#341
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
word 생성 경로의 코드 스타일, 프롬프트 관리, 로그 기준, AI 사용량/비용 로깅을 정리했습니다.
Problem
word 패키지에 프롬프트 문자열과 생성 응답 조립 로직이 길게 섞여 있었고, 일부 로그 레벨과 AI 사용량/비용 로깅 위치가 운영 관측 기준과 맞지 않았습니다.
Solution
프롬프트를 리소스로 분리하고, word 응답 생성 흐름과 single-flight listener 종료 처리를 정리했습니다. 또한 Spring AI token usage API 변경에 맞춰 사용량 조회 메서드를 교체하고, Bedrock 비용 계산을 달러 기준으로 갱신했습니다.
Changes
src/main/resources/prompts/word-analysis.md로 분리WordAiService의 응답 생성/검증/로깅 흐름 정리Example
API 계약 변경 없음. 기존 word 생성 요청/응답 형식은 유지됩니다.
Related Issues
없음
Validation
./gradlew checkFormat test --tests com.linglevel.api.word.service.WordServiceTest --tests com.linglevel.api.word.service.WordVariantServiceTest --tests com.linglevel.api.word.controller.WordsAdminControllerTest