Skip to content

facade 코드 정리 (첨부, 변환, 적재)#160

Merged
inoray merged 6 commits intodevelopfrom
task/152-facade-refactoring
Feb 4, 2026
Merged

facade 코드 정리 (첨부, 변환, 적재)#160
inoray merged 6 commits intodevelopfrom
task/152-facade-refactoring

Conversation

@inoray
Copy link
Collaborator

@inoray inoray commented Feb 4, 2026

Checklist:

  • Documentation has been updated, if necessary.
  • Examples have been added, if necessary.
  • Tests have been added, if necessary.

@inoray inoray linked an issue Feb 4, 2026 that may be closed by this pull request
@inoray inoray requested a review from JaeseungYang February 4, 2026 08:17
@gemini-code-assist
Copy link

Summary of Changes

Hello @inoray, 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은 문서 전처리 파사드(facade)의 주요 리팩토링 및 기능 개선을 포함합니다. 핵심 변경 사항은 문서 청킹 로직의 지능화, OCR 통합 강화, 그리고 다양한 파일 형식 변환을 위한 전용 프로세서 도입입니다. 이를 통해 문서 처리의 정확성과 유연성을 높이고, 특정 문서 유형에 대한 처리 효율을 개선합니다.

Highlights

  • 지능형 청킹 로직 개선: 새로운 GenosBucketChunker를 도입하여 문서 구조, 토큰 제한, 섹션 헤더를 기반으로 한 다단계 청킹 및 병합 로직을 구현했습니다. 이는 문서의 의미론적 경계를 더 잘 유지하면서 효율적인 청크 생성을 목표로 합니다.
  • 선택적 OCR 통합: 문서 내 글리프(glyph) 깨짐 현상을 감지하고, 문제가 있는 테이블 셀에 대해서만 OCR을 선택적으로 수행하여 텍스트 추출 품질을 향상시켰습니다.
  • 파일 변환 및 Langchain 통합: convert_processor.py를 새로 도입하여 PPT, DOCX 등 다양한 파일 형식을 PDF로 변환하고, 특히 PPT 파일 처리를 위해 Langchain 로더 및 이미지 추출 기능을 통합했습니다.
  • 메타데이터 처리 개선: GenOSVectorMetaGenOSVectorMetaBuilder 구조를 업데이트하여 문서의 생성일, 저자, 제목, 부록 정보 등을 더 효과적으로 관리할 수 있도록 했습니다. (참고: intelligent_processor.pyconvert_processor.py 간 메타데이터 필드 구성에 차이가 있습니다.)
  • TOC 생성 프롬프트 상세화: LLM 기반 목차(TOC) 생성 프롬프트가 한국어 문서의 특성을 반영하여 더욱 상세하고 구조화된 지침을 포함하도록 업데이트되었습니다.

🧠 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.

Changelog
  • genon/preprocessor/facade/attachment_processor.py
    • 로깅 설정 주석(🔥) 제거.
  • genon/preprocessor/facade/attachment_processor_origin.py
    • 파일 삭제.
  • genon/preprocessor/facade/basic_processor.py
    • 파일 삭제.
  • genon/preprocessor/facade/basic_processor_origin.py
    • 파일 삭제.
  • genon/preprocessor/facade/intelligent_processor.py
    • HierarchicalChunkerGenosBucketChunker로 변경하고, 다단계 청킹 로직(섹션 분할, 토큰 기반 병합, 캡션/그림 처리)을 대폭 개선.
    • 글리프 감지 및 테이블 셀 OCR 기능 추가.
    • GenOSVectorMetae_pageappendix 필드 추가, authors 필드 제거.
    • LLM 기반 TOC 생성 프롬프트 상세화.
  • genon/preprocessor/facade/intelligent_processor_law.py
    • genon/preprocessor/facade/convert_processor.py로 파일명 변경.
    • Langchain 기반 PPT 처리 및 PDF 변환 로직 추가.
    • GenOSVectorMetaauthorstitle 필드 추가.
  • genon/preprocessor/facade/intelligent_processor_ocr.py
    • 파일 삭제.
  • genon/preprocessor/facade/test.py
    • 테스트 스크립트에서 intelligent_processor_ocr 대신 intelligent_processor를 사용하도록 업데이트.
Activity
  • inoray 님이 facade 코드 정리 (첨부, 변환, 적재) 제목으로 PR을 생성했습니다.
  • PR 본문에는 변경 사항에 대한 구체적인 설명 없이 일반적인 기여 가이드라인과 체크리스트만 포함되어 있습니다.
  • 이 PR은 여러 기존 파사드 파일을 제거하고, intelligent_processorconvert_processor를 중심으로 기능을 재구성하는 대규모 리팩토링 작업을 수행했습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

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

Choose a reason for hiding this comment

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

Code Review

이번 PR은 전처리기 파사드 코드를 대대적으로 리팩토링하고 정리하는 작업을 포함하고 있습니다. 주요 변경 사항은 다음과 같습니다:

  • attachment_processor, convert_processor, intelligent_processor로 역할을 분리하여 코드 구조를 개선했습니다.
  • attachment_processor_origin, basic_processor 등 오래되거나 중복되는 파일을 삭제하여 코드를 정리했습니다.
  • intelligent_processor에 문서 구조와 토큰 크기를 고려한 새로운 GenosBucketChunker를 도입하여 청킹 로직을 고도화했습니다.
  • convert_processor에서 PPT 파일 처리를 위해 langchain 로더를 사용하는 등 특정 파일 형식에 대한 처리 방식을 개선했습니다.
  • 전반적으로 코드의 가독성과 유지보수성이 향상되었습니다.

다만, convert_processor.py의 예외 처리 방식에 일부 위험 요소가 있어 리뷰 코멘트를 남겼습니다. 해당 부분을 수정하면 더 안정적인 코드가 될 것입니다. 전반적으로 훌륭한 리팩토링 작업입니다.

Comment on lines +195 to +197
except Exception as e:
if pdf_path.exists():
return str(pdf_path)

Choose a reason for hiding this comment

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

medium

convert_to_pdf 함수 내의 예외 처리 블록이 모든 Exception을 잡고 pdf_path가 존재하면 경로를 반환하도록 되어 있습니다. 이 방식은 soffice 변환 실패로 인해 비어 있거나 손상된 PDF 파일이 생성되었을 때 오류를 숨길 수 있는 위험이 있습니다. 오류를 로깅하고 None을 반환하여 후속 처리 단계에서 실패를 인지할 수 있도록 하는 것이 더 안전합니다.

Suggested change
except Exception as e:
if pdf_path.exists():
return str(pdf_path)
except Exception as e:
_log.error(f"[convert_to_pdf] PDF 변환 중 오류 발생: {e}", exc_info=True)
return None

Comment on lines +1822 to +1825
try:
page_image_meta = await self._extract_page_images(pdf_path, request)
except:
pass

Choose a reason for hiding this comment

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

medium

_extract_page_images 호출을 try...except: pass로 감싸 예외를 조용히 무시하고 있습니다. 이미지 추출에 실패하더라도 오류 로그 없이 넘어가게 되어 디버깅이 어려워질 수 있습니다. 최소한 오류를 로깅하는 것이 좋습니다.

            except Exception as e:
                _log.warning(f"페이지 이미지 추출 실패: {e}", exc_info=True)
                pass

@inoray inoray merged commit b165b3b into develop Feb 4, 2026
2 checks 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.

facade코드 정리

2 participants