Skip to content

Conversation

@inoray
Copy link
Collaborator

@inoray inoray commented Jan 28, 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 Jan 28, 2026 that may be closed by this pull request
@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은 OCR 서비스와의 통신 방식을 업데이트하고 관련 설정을 중앙 집중화합니다. 기존 gRPC 기반의 OCR 호출을 HTTP POST 방식으로 전환하여 유연성을 높이고, OCR 엔드포인트의 IP 주소를 새로운 주소로 일괄 변경합니다. 이는 OCR 처리의 안정성과 유지보수성을 향상시키는 데 기여합니다.

Highlights

  • OCR 엔드포인트 IP 주소 변경: 두 개의 파일(intelligent_processor_law.pyintelligent_processor_ocr.py)에서 OCR 서비스 엔드포인트의 IP 주소가 새로운 주소로 업데이트되었습니다.
  • OCR 처리 방식 전환: 적재용(규정)v2.py 파일에서 OCR 처리 방식이 기존 gRPC 기반에서 HTTP POST 기반으로 변경되었습니다.
  • OCR 응답 처리 로직 개선: HTTP 응답을 처리하고 OCR 결과를 추출하기 위한 post_ocr_bytesextract_ocr_fields 헬퍼 함수가 추가되어 OCR 결과 파싱의 견고성을 높였습니다.

🧠 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 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은 OCR 엔드포인트를 변경하고, 레거시 코드에서 gRPC 기반 OCR 호출을 HTTP 기반으로 전환하는 내용을 담고 있습니다. 엔드포인트 URL이 코드에 하드코딩되어 있어 유지보수 및 환경 구성에 어려움이 있을 수 있습니다. 이를 설정 파일이나 환경 변수로 분리하는 것이 좋습니다. 또한, 예외 처리와 텍스트 조합 로직에서 개선할 점이 보입니다.

initialize Document Converter
'''
self.ocr_endpoint = "http://192.168.81.170:48080/ocr"
self.ocr_endpoint = "http://192.168.73.172:48080/ocr"

Choose a reason for hiding this comment

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

critical

OCR 엔드포인트 URL이 코드에 직접 하드코딩되어 있습니다. 이렇게 하면 개발, 스테이징, 운영 환경에 따라 코드를 수정해야 하므로 유지보수가 어렵고 잠재적인 보안 위험이 있습니다. os.environ.get() 등을 사용하여 환경 변수에서 URL을 읽어오도록 변경하는 것을 강력히 권장합니다.

Suggested change
self.ocr_endpoint = "http://192.168.73.172:48080/ocr"
self.ocr_endpoint = os.environ.get("OCR_ENDPOINT", "http://192.168.73.172:48080/ocr")

initialize Document Converter
'''
self.ocr_endpoint = "http://192.168.81.170:48080/ocr"
self.ocr_endpoint = "http://192.168.73.172:48080/ocr"

Choose a reason for hiding this comment

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

critical

OCR 엔드포인트 URL이 코드에 직접 하드코딩되어 있습니다. 이렇게 하면 개발, 스테이징, 운영 환경에 따라 코드를 수정해야 하므로 유지보수가 어렵고 잠재적인 보안 위험이 있습니다. os.environ.get() 등을 사용하여 환경 변수에서 URL을 읽어오도록 변경하는 것을 강력히 권장합니다.

Suggested change
self.ocr_endpoint = "http://192.168.73.172:48080/ocr"
self.ocr_endpoint = os.environ.get("OCR_ENDPOINT", "http://192.168.73.172:48080/ocr")

initialize Document Converter
'''

self.ocr_endpoint = "http://192.168.73.172:48080/ocr"

Choose a reason for hiding this comment

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

critical

OCR 엔드포인트 URL이 코드에 직접 하드코딩되어 있습니다. 이렇게 하면 개발, 스테이징, 운영 환경에 따라 코드를 수정해야 하므로 유지보수가 어렵고 잠재적인 보안 위험이 있습니다. os.environ.get() 등을 사용하여 환경 변수에서 URL을 읽어오도록 변경하는 것을 강력히 권장합니다.

Suggested change
self.ocr_endpoint = "http://192.168.73.172:48080/ocr"
self.ocr_endpoint = os.environ.get("OCR_ENDPOINT", "http://192.168.73.172:48080/ocr")

Comment on lines 1291 to +1295
cell.text = ""
for result in response.results:
for t in rec_texts:
if len(cell.text) > 0:
cell.text += " "
cell.text += result.text if result else ""
except grpc.RpcError as e:
cell.text += t if t else ""

Choose a reason for hiding this comment

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

high

현재 텍스트 조합 로직은 rec_texts에 빈 문자열이 있을 경우 불필요한 공백을 추가하는 버그가 있습니다. 예를 들어, ['a', '', 'b']가 입력되면 결과는 'a b'가 됩니다. " ".join(filter(None, rec_texts))를 사용하면 빈 문자열을 제외하고 하나의 공백으로 텍스트를 합칠 수 있어 더 간결하고 정확합니다.

Suggested change
cell.text = ""
for result in response.results:
for t in rec_texts:
if len(cell.text) > 0:
cell.text += " "
cell.text += result.text if result else ""
except grpc.RpcError as e:
cell.text += t if t else ""
cell.text = " ".join(filter(None, rec_texts))

cell.text += result.text if result else ""
except grpc.RpcError as e:
cell.text += t if t else ""
except Exception as e:

Choose a reason for hiding this comment

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

high

Exception은 너무 광범위한 예외입니다. OCR 요청 실패 시 발생하는 requests.exceptions.RequestException이나 RuntimeError와 같이 더 구체적인 예외를 잡는 것이 좋습니다. 이렇게 하면 예상치 못한 다른 오류들이 숨겨지는 것을 방지할 수 있습니다.

Suggested change
except Exception as e:
except (requests.exceptions.RequestException, RuntimeError) as e:

@inoray inoray requested a review from JaeseungYang January 28, 2026 05:36
@inoray inoray merged commit fa8b23d into develop Jan 28, 2026
2 checks passed
@inoray inoray deleted the task/150-change-ocr-endpoint branch January 28, 2026 06:15
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.

ocr 서버 엔드포인트 변경

3 participants