Conversation
Summary of ChangesHello @AlphaBs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 Gemini AI를 활용한 도서 추천 시스템을 도입합니다. 사용자 온보딩 데이터를 기반으로 개인화된 도서 추천을 생성하고, 이를 API를 통해 제공하며, 추천된 도서 목록을 저장하고 조회할 수 있는 기능을 추가합니다. 기존 크롤링 로직에서 책 검색 및 저장 부분을 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Test Results103 files 103 suites 22s ⏱️ Results for commit bcb5109. ♻️ This comment has been updated with latest results. |
src/main/java/book/book/recommendation/entity/MemberBookRecommendation.java
Outdated
Show resolved
Hide resolved
src/main/java/book/book/recommendation/service/GeminiBookRecommendationProvider.java
Show resolved
Hide resolved
src/main/java/book/book/recommendation/service/RecommendationService.java
Show resolved
Hide resolved
src/main/java/book/book/recommendation/service/RecommendationService.java
Outdated
Show resolved
Hide resolved
src/main/java/book/book/recommendation/service/RecommendationService.java
Show resolved
Hide resolved
| return geminiSdkClient.generateContent(request); | ||
| } | ||
|
|
||
| private GeminiRequest<BookRecommendationResponses> createRequest(OnboardingResultResponse onboarding) { |
src/main/java/book/book/recommendation/service/RecommendationService.java
Show resolved
Hide resolved
|
/gemini review |
| private final GeminiBookRecommendationProvider geminiBookRecommendationProvider; | ||
| private final AladinService aladinService; | ||
|
|
||
| @DistributedLock(key = "'recommendation_lock:' + #member.id", waitTime = 0) |
There was a problem hiding this comment.
Gemini API 호출을 포함하는 generateBookRecommendationForMember 메서드 전체에 @DistributedLock이 적용되어 있습니다. API 호출은 시간이 오래 걸릴 수 있는데, 기본 leaseTime인 10초를 초과할 경우 락이 조기 해제될 위험이 있습니다. 이 경우 다른 스레드가 진입하여 추천 컬렉션을 중복으로 저장하는 등의 경쟁 상태(race condition)가 발생할 수 있습니다. leaseTime을 API 타임아웃보다 충분히 긴 시간으로 명시적으로 설정하는 것을 권장합니다.
| @DistributedLock(key = "'recommendation_lock:' + #member.id", waitTime = 0) | |
| @DistributedLock(key = "'recommendation_lock:' + #member.id", waitTime = 0, leaseTime = 30) |
| private final MemberRepository memberRepository; | ||
|
|
||
| @GetMapping("/members/{memberId}/books/refresh") | ||
| public List<Book> refreshBooksForMember(@PathVariable Long memberId) { |
| } | ||
|
|
||
| @GetMapping("/members/{memberId}/books") | ||
| public List<Book> getBooksForMember(@PathVariable Long memberId) { |
| onboarding.favoriteAuthor(), | ||
| onboarding.favoriteBook()); |
There was a problem hiding this comment.
Gemini 프롬프트 생성 시 onboarding.favoriteAuthor()와 onboarding.favoriteBook()이 null이거나 비어있을 경우, 문자열 "null"이 프롬프트에 포함됩니다. 이는 모델에게 혼란을 줄 수 있습니다. keywords처럼 isBlank() 체크와 함께 "없음"과 같은 명확한 플레이스홀더를 사용하는 것이 좋습니다.
| onboarding.favoriteAuthor(), | |
| onboarding.favoriteBook()); | |
| (onboarding.favoriteAuthor() == null || onboarding.favoriteAuthor().isBlank()) ? "없음" : onboarding.favoriteAuthor(), | |
| (onboarding.favoriteBook() == null || onboarding.favoriteBook().isBlank()) ? "없음" : onboarding.favoriteBook()); |
| Book book = bookService.saveBooksParallel(searchResponse.getItem()).get(0); | ||
| return Optional.of(book); | ||
| } catch (Exception e) { | ||
| log.error("책 검색 중 오류 발생: {}, {}", e, bookTitle); |
There was a problem hiding this comment.
로깅 포맷이 잘못 사용되었습니다. log.error("..., {}, {}", e, bookTitle) 형식은 스택 트레이스를 출력하지 않고 예외 객체의 toString() 값만 로깅하게 됩니다. 정확한 오류 분석을 위해 스택 트레이스가 로깅되도록 예외 객체는 항상 마지막 인자로 전달해야 합니다. 또한, 메시지에 사용된 인수의 순서도 실제 의도와 다른 것 같습니다.
| log.error("책 검색 중 오류 발생: {}, {}", e, bookTitle); | |
| log.error("책 검색 중 오류 발생: {}", bookTitle, e); |
🌻 테스트 커버리지 리포트
|

History
🚀 Major Changes & Explanations
📷 Test Image
💡 ETC