Skip to content

fix: AI 분석 프롬프트와 응답 스키마 enum 12개로 통일#38

Merged
mangoooooo1 merged 1 commit intomainfrom
fix/analysis-enum-sync
Mar 19, 2026
Merged

fix: AI 분석 프롬프트와 응답 스키마 enum 12개로 통일#38
mangoooooo1 merged 1 commit intomainfrom
fix/analysis-enum-sync

Conversation

@mangoooooo1
Copy link
Copy Markdown
Collaborator

작업 내용

AI 분석 프롬프트(USER_PROMPT)와 Gemini 응답 스키마(RESPONSE_SCHEMA) 간의 enum 불일치 수정

변경 사항

  • USER_PROMPT에 누락된 위험 유형 판단 기준 추가
    (FIRE, FLOOD, LANDSLIDE, CHEMICAL, TRAFFIC, CONSTRUCTION, OTHER)
  • 프롬프트와 스키마 enum이 동일한 12개 타입으로 일치

테스트

  • 로컬에서 테스트 완료
  • 기존 기능 정상 동작 확인

리뷰어에게

기존에는 프롬프트에 5개 타입만 설명되어 있었지만 스키마에는 12개가 정의되어 있어,
AI가 판단 기준 없이 나머지 타입을 출력할 수 있는 상태였습니다.
프롬프트를 스키마에 맞게 맞췄습니다.

@mangoooooo1 mangoooooo1 self-assigned this Mar 19, 2026
@mangoooooo1 mangoooooo1 added the feature 신규 기능 개발 label Mar 19, 2026
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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은 AI 분석 프롬프트와 Gemini 응답 스키마 간의 위험 유형 enum 불일치를 해결합니다. 기존에는 프롬프트가 스키마에 정의된 모든 위험 유형에 대한 판단 기준을 포함하지 않아 AI의 분석 정확도에 문제가 발생할 수 있었습니다. 이번 변경을 통해 프롬프트에 모든 12가지 위험 유형에 대한 상세한 기준이 추가되어, AI가 보다 일관되고 정확하게 위험 요소를 분류할 수 있도록 개선되었습니다.

Highlights

  • AI 분석 프롬프트 업데이트: AI 분석 프롬프트(USER_PROMPT)에 누락되었던 화재, 홍수, 산사태, 화학물질, 교통, 건설, 기타 등 7가지 위험 유형에 대한 판단 기준이 추가되었습니다.
  • 프롬프트 및 스키마 일치: USER_PROMPT와 Gemini 응답 스키마(RESPONSE_SCHEMA) 간의 enum 타입이 기존 5개에서 12개로 통일되어, AI가 모든 위험 유형에 대해 명확한 판단 기준을 갖게 되었습니다.
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.

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
Copy Markdown

@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은 누락된 위험 유형을 추가하여 AI 분석 프롬프트를 응답 스키마와 일치시키는 올바른 수정입니다. 이를 통해 불일치가 해결되고 AI의 분류 정확도가 향상될 것으로 기대됩니다. 프롬프트 생성 로직의 유지보수성을 개선하기 위한 한 가지 제안 사항을 남깁니다.

Comment on lines 24 to 38
const USER_PROMPT = `이 이미지에서 위험 요소를 분석하세요.

각 유형 판단 기준:
- FIRE: 화재, 연기, 불꽃이 보이는 경우
- FLOOD: 침수, 도로나 건물에 물이 범람한 경우
- LANDSLIDE: 산사태, 토사 붕괴, 절개지 붕괴
- SINKHOLE: 도로 함몰, 방사형 균열, 맨홀 주변 침하 등 싱크홀 전조 증상
- ROAD_DAMAGE: 포트홀, 도로 균열, 맨홀 뚜껑 파손, 경계석 손상
- BUILDING_DAMAGE: 건물 외벽 균열, 기울음, 외장재 탈락
- COLLAPSE: 구조물이 무너지거나 낙하물 위험이 있는 상태
- BUILDING_DAMAGE: 건물 외벽 균열, 기울음, 외장재 탈락
- CHEMICAL: 화학물질 누출, 유해물질 방류, 오염 흔적
- TRAFFIC: 교통사고, 도로 위 장애물, 신호등 파손
- CONSTRUCTION: 공사 현장 안전 미비, 가설 구조물 위험
- OTHER: 위 유형에 해당하지 않는 기타 위험 요소
- NONE: 이미지에서 위험 요소를 찾을 수 없는 경우`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

프롬프트와 응답 스키마의 위험 유형을 일치시킨 점이 좋습니다. 하지만 현재 USER_PROMPT에 위험 유형과 설명이 하드코딩되어 있어, 향후 HazardType enum이 변경될 경우 또다시 불일치가 발생할 수 있습니다.

유지보수성을 높이고 HazardType enum과 프롬프트를 항상 동기화하기 위해, 위험 유형별 설명을 별도의 객체로 관리하고 이를 바탕으로 프롬프트를 동적으로 생성하는 것을 제안합니다. 아래와 같이 IIFE(즉시 실행 함수 표현식)를 사용하면 모듈 스코프를 깔끔하게 유지하면서 프롬프트를 동적으로 구성할 수 있습니다. 이렇게 하면 HazardType enum만 수정해도 프롬프트가 자동으로 업데이트되어 실수를 방지할 수 있습니다.

const USER_PROMPT = (() => {
  const HAZARD_DESCRIPTIONS: Record<string, string> = {
    FIRE: '화재, 연기, 불꽃이 보이는 경우',
    FLOOD: '침수, 도로나 건물에 물이 범람한 경우',
    LANDSLIDE: '산사태, 토사 붕괴, 절개지 붕괴',
    SINKHOLE: '도로 함몰, 방사형 균열, 맨홀 주변 침하 등 싱크홀 전조 증상',
    ROAD_DAMAGE: '포트홀, 도로 균열, 맨홀 뚜껑 파손, 경계석 손상',
    COLLAPSE: '구조물이 무너지거나 낙하물 위험이 있는 상태',
    BUILDING_DAMAGE: '건물 외벽 균열, 기울음, 외장재 탈락',
    CHEMICAL: '화학물질 누출, 유해물질 방류, 오염 흔적',
    TRAFFIC: '교통사고, 도로 위 장애물, 신호등 파손',
    CONSTRUCTION: '공사 현장 안전 미비, 가설 구조물 위험',
    OTHER: '위 유형에 해당하지 않는 기타 위험 요소',
    NONE: '이미지에서 위험 요소를 찾을 수 없는 경우',
  };

  const criteria = [...HAZARD_TYPES, 'NONE']
    .map((type) => `- ${type}: ${HAZARD_DESCRIPTIONS[type]}`)
    .join('\n');

  return `이 이미지에서 위험 요소를 분석하세요.\n\n각 유형 판단 기준:\n${criteria}`;
})();

@mangoooooo1 mangoooooo1 merged commit 41a3c14 into main Mar 19, 2026
1 check passed
@mangoooooo1 mangoooooo1 deleted the fix/analysis-enum-sync branch March 19, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 신규 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants