Skip to content

fix: 공지 요약 필드 문자열 정규화#42

Merged
kimssirr merged 2 commits into
devfrom
fix/#41
May 6, 2026
Merged

fix: 공지 요약 필드 문자열 정규화#42
kimssirr merged 2 commits into
devfrom
fix/#41

Conversation

@kimssirr

@kimssirr kimssirr commented May 6, 2026

Copy link
Copy Markdown
Contributor

유형

  • Feat
  • Fix
  • Design
  • Docs
  • Chore
  • Hotfix

작업 내용

공지 요약 결과 생성 시 LLM 응답의 일부 필드가 문자열이 아닌 dict/list 형태로 반환되면서 NoticeSummaryData 검증에 실패하는 문제를 수정했습니다.

target_info, schedule_info, caution_info 등 DB에 문자열로 저장되는 필드는 NoticeSummaryData 생성 전에 문자열로 정규화하도록 처리했습니다.

변경 사항 (있다면)

  • summarizer.py_to_text() 정규화 함수 추가
  • summary, target_info, schedule_info, caution_info 필드에 문자열 정규화 적용
  • dict/list 형태의 LLM 응답이 들어와도 정상 처리되는 테스트 추가

리뷰 포인트

  • dict/list 응답을 문자열로 변환하는 방식이 DB 저장 형식과 API 응답 의도에 맞는지 확인 부탁드립니다.
  • None 값이 빈 문자열로 변환된 뒤 기존 Pydantic validator에서 None으로 정리되는 흐름이 적절한지 봐주세요.

테스트

  • 로컬 실행 확인
  • /docs 수동 확인
  • pytest 실행

스크린샷

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a _to_text helper function in app/services/summarizer.py to normalize structured LLM outputs, such as lists and dictionaries, into plain strings for the NoticeSummaryData model. A new test file has been added to verify this normalization logic. The review feedback suggests refining the _to_text implementation to filter out empty or null values within collections, which prevents the generation of empty keys or unnecessary newlines in the final string output.

Comment thread app/services/summarizer.py
@kimssirr kimssirr merged commit 6f6bb05 into dev May 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant