Skip to content

feat: Gemini 기반 문자 어조/근거 분석 파이프라인 추가 - #13

Merged
kite-pp merged 1 commit into
mainfrom
feat/gemini-text-analysis
Jul 17, 2026
Merged

feat: Gemini 기반 문자 어조/근거 분석 파이프라인 추가#13
kite-pp merged 1 commit into
mainfrom
feat/gemini-text-analysis

Conversation

@kite-pp

@kite-pp kite-pp commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

📝 개요

Gemini API를 이용해 문자 메시지의 어조와 근거를 분석하고 스미싱 위험도를 판정하는 로직을 추가하고, /analyze 엔드포인트에 연결했습니다.

🔗 관련 이슈

🎯 주요 변경 사항

  • app/service/security/gemini_text_analyzer.py: Gemini generateContent 호출, JSON 스키마 강제 응답, 위험도 등급 산정(DANGEROUS/SUSPICIOUS/SAFE), 각종 실패 상황(429/Timeout/파싱실패/키 누락 등) 처리
    • Fail-closed 정책 적용: 분석 실패 시 SAFE로 떨어지지 않도록 UNKNOWN(판정 불가) 등급을 강제
    • 응답 재현성을 위해 generationConfig.temperature를 0.1로 고정
  • app/dto/request.py: AnalyzeRequest 요청 DTO 신규 추가
  • app/router/analyze.py: 더미 dict 대신 AnalyzeRequest를 받아 analyze_text_with_gemini 결과를 반환하도록 변경 (URL 분석은 기존 더미 유지)
  • app/service/security/mock_provider.py: 문자 분석용 Mock DB(MOCK_TEXT_DATABASE) 및 기본 안전 응답 추가
  • requirements.txt: python-dotenv 추가
  • README.md: .env 예시에 GEMINI_API_KEY, GEMINI_MODEL 추가
  • tests/security/test_gemini_text_analyzer.py: 등급 산정, Mock 모드, fail-closed(API 키 누락) 시나리오 단위 테스트 추가

📸 사진

✅ PR 체크리스트

  • 관련 이슈를 연결했습니다.
  • 구현 범위와 변경 이유를 설명했습니다.
  • 로컬 테스트(uvicorn 구동 또는 테스트 코드)를 통과했습니다.
  • API 변경 사항이 있다면 Swagger / API 명세에 반영했습니다.
  • 민감 정보(API Key, 시크릿 키 등)가 코드·로그·테스트 데이터에 포함되지 않았습니다.
  • 프론트엔드 또는 메인 백엔드(Spring)에 영향을 주는 응답 스키마 또는 Enum 변경이 있다면 팀에 공유했습니다.
  • 병합(Merge) 전 작업 브랜치를 삭제하지 않았습니다.

🤖 Generated with Claude Code

문자 메시지의 어조와 근거를 분석해 위험도를 판정하는 Gemini 연동을 추가하고,
/analyze 엔드포인트가 이를 사용하도록 연결. API 실패 시 SAFE로 오탐되지 않도록
fail-closed(UNKNOWN 등급) 정책을 적용하고, 채점 재현성을 위해 temperature를 낮춤.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ca6a183f-2924-42c7-85e5-7f076be00763

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/gemini-text-analysis

Comment @coderabbitai help to get the list of available commands.

@kite-pp
kite-pp merged commit 920aae7 into main Jul 17, 2026
1 check passed
@kite-pp
kite-pp deleted the feat/gemini-text-analysis branch July 17, 2026 06:59
@pearseona pearseona added the feat New feature or functional additions to the application label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature or functional additions to the application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants