feat: 가정통신문 분석 결과 다국어 생성 개선 - #32
Conversation
|
Warning Review limit reached
More reviews will be available in 41 minutes and 48 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 Walkthrough전체 개요뉴스레터 분석 응답에 KO/US/ZH/VI 4개 언어로 제목, 일정, 체크리스트 등의 동적 문구를 생성하도록 확장되었습니다. 프롬프트 서비스에 언어 기반 스키마를 추가하고, 추출 로직에서 다국어 맵을 생성하며, 종합 테스트로 검증합니다. 변경 사항다국어 알림 필드 생성
🎯 4 (복잡함) | ⏱️ ~45분🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/services/newsletter_extractor.py`:
- Around line 213-215: The code calls _compact_title(sentence) twice when
constructing ChecklistItem; compute compact = _compact_title(sentence) once and
reuse it for both content and contentI18n via _fallback_i18n(compact) to avoid
duplicate work—update the ChecklistItem creation (involving ChecklistItem,
_compact_title, and _fallback_i18n) to use the cached compact variable.
- Line 56: SUPPORTED_LANGUAGE_CODES is duplicated across modules
(newsletter_prompt, newsletter_extractor, and tests); extract this constant (and
optional LANGUAGE_NAMES) into a single module (e.g., app.constants) and replace
the local definitions by importing SUPPORTED_LANGUAGE_CODES (and LANGUAGE_NAMES)
where needed; specifically, create app.constants with SUPPORTED_LANGUAGE_CODES =
("KO","US","ZH","VI") (and LANGUAGE_NAMES if desired), then in
newsletter_extractor.py, newsletter_prompt.py, and
tests/test_newsletter_multilingual.py remove the local SUPPORTED_LANGUAGE_CODES
and add from app.constants import SUPPORTED_LANGUAGE_CODES (and LANGUAGE_NAMES)
so all modules share the single source of truth.
In `@tests/test_newsletter_multilingual.py`:
- Around line 1-9: The tests fail to import the app package (imports like
NewsletterAnalysisRequest, analyze_newsletter, ANALYSIS_RESPONSE_SCHEMA,
build_prompt_messages) because the repository lacks package initialization or a
PYTHONPATH entry; fix by either adding an empty app/__init__.py to make app a
package or add pythonpath configuration to the test runner (e.g., in
pyproject.toml or pytest.ini) so the repo root is on sys.path when running
tests; update the repo accordingly so tests/test_newsletter_multilingual.py can
import those symbols and use SUPPORTED_LANGUAGE_CODES without
ModuleNotFoundError.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cb264477-6a63-438f-9439-555cd15b8dbf
📒 Files selected for processing (4)
app/schemas.pyapp/services/newsletter_extractor.pyapp/services/newsletter_prompt.pytests/test_newsletter_multilingual.py
| "서명", | ||
| "제출", | ||
| ) | ||
| SUPPORTED_LANGUAGE_CODES = ("KO", "US", "ZH", "VI") |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
SUPPORTED_LANGUAGE_CODES 상수가 여러 파일에서 중복 정의되었습니다.
현재 다음 위치에서 동일한 상수가 정의되어 있습니다:
app/services/newsletter_prompt.py(Line 10)app/services/newsletter_extractor.py(Line 56)tests/test_newsletter_multilingual.py(Line 9)
언어 코드를 추가하거나 변경할 때 여러 파일을 동기화해야 하므로 유지보수성이 저하됩니다.
♻️ 제안: 공통 상수 파일로 추출
app/constants.py 또는 app/schemas.py에 상수를 정의하고 다른 파일에서 import하도록 변경:
# app/constants.py (새 파일)
SUPPORTED_LANGUAGE_CODES = ("KO", "US", "ZH", "VI")
LANGUAGE_NAMES = {
"KO": "한국어",
"US": "미국 영어",
"ZH": "중국어 간체",
"VI": "베트남어",
}그런 다음 다른 파일에서:
-SUPPORTED_LANGUAGE_CODES = ("KO", "US", "ZH", "VI")
+from app.constants import SUPPORTED_LANGUAGE_CODES🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/services/newsletter_extractor.py` at line 56, SUPPORTED_LANGUAGE_CODES is
duplicated across modules (newsletter_prompt, newsletter_extractor, and tests);
extract this constant (and optional LANGUAGE_NAMES) into a single module (e.g.,
app.constants) and replace the local definitions by importing
SUPPORTED_LANGUAGE_CODES (and LANGUAGE_NAMES) where needed; specifically, create
app.constants with SUPPORTED_LANGUAGE_CODES = ("KO","US","ZH","VI") (and
LANGUAGE_NAMES if desired), then in newsletter_extractor.py,
newsletter_prompt.py, and tests/test_newsletter_multilingual.py remove the local
SUPPORTED_LANGUAGE_CODES and add from app.constants import
SUPPORTED_LANGUAGE_CODES (and LANGUAGE_NAMES) so all modules share the single
source of truth.
📌 작업 요약
translatedText는 최종 번역본이 아니라 기계 번역 초안/참고자료로만 사용하도록 프롬프트 계약 정리titleI18n,items[].titleI18n,items[].checklistItems[].contentI18n필드 추가outputLanguage,localizedOutput추가translatedText를 제목 참고값으로 사용하되 LLM 검토 필요 상태 유지🌿 브랜치 정보
feat/#31-multilingual-newsletter-analysisdevelop(기본)✅ 체크리스트
feat/refac/hotfix/chore/design/bugfix)feat/fix/refactor/docs/style/chore)🧪 테스트 결과
Summary by CodeRabbit
새 기능
테스트