Skip to content

fix: add room floor resolver(호수 질문 해결 로직 추가)#29

Merged
1024andrew merged 5 commits intodevfrom
fix/#28
May 4, 2026
Merged

fix: add room floor resolver(호수 질문 해결 로직 추가)#29
1024andrew merged 5 commits intodevfrom
fix/#28

Conversation

@1024andrew
Copy link
Copy Markdown
Contributor

@1024andrew 1024andrew commented May 3, 2026

유형

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

작업 배경

호실 층수 질문에서 RAG 검색 결과가 잘못 잡히거나, 존재하지 않는 호실에 대해 LLM이 임의로 층수를 추론하는 문제가 있었습니다. -> 3011처럼 입력하면 잘못된 호수임에도 불구하고 내용의 일부인 301이 검색되어 301호에 대한 정보를 반환하는 문제

예시:

  • 401호 몇층이야? + 제3학생생활관

    • 실제로는 제3학생생활관 401호는 4층 범위에 포함됨
    • 기존에는 다른 생활관 정보를 기준으로 답변하는 문제가 발생
  • 4013호 몇층이야? + 제3학생생활관

    • 실제 데이터에 없는 호실
    • 기존에는 존재하지 않는 호실인데도 층수를 추론해 답변하는 문제가 발생

변경 사항

  • 호실 번호 기반 층수 질문을 RAG 검색 전에 규칙 기반으로 처리하도록 개선
  • room_floor_resolver.py 파일 추가함
  • 생활관별 호실 범위표를 기반으로 층수 판단
  • 존재하지 않는 호실은 확인되지 않는다고 응답
  • 호실 층수 질문은 OpenAI 답변 생성이나 벡터 검색을 거치지 않고 바로 응답
    -그리고 chat_grouped_dormitory_top_k: int = 2를 3으로 올려서 dormitory = null일 때 전체 생활관 검색에서 상위 3개 청크를 가져오도록함

스크린샷

image image image image

@1024andrew 1024andrew requested a review from kimssirr May 3, 2026 09:28
Copy link
Copy Markdown
Contributor

@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

This pull request introduces a rule-based floor resolver for dormitory room numbers and enhances the handling of cooking-related queries, particularly regarding eating ramen in rooms. Key updates include the addition of the room_floor_resolver.py service, refined LLM system prompts to avoid speculative answers, and expanded query expansion rules. Review feedback focuses on simplifying redundant logic in the floor resolver, improving room number extraction via more robust regex, and correcting indentation and keyword redundancy in the cooking trigger lists.

Comment thread app/services/room_floor_resolver.py Outdated
Comment thread app/services/room_floor_resolver.py Outdated
Comment thread app/services/chat_service.py Outdated
Comment thread app/services/chat_service.py Outdated
Copy link
Copy Markdown
Contributor

@kimssirr kimssirr left a comment

Choose a reason for hiding this comment

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

추가로 테스트 코드 작성하고 커밋했습니다.

변경사항

  • chat_grouped_dormitory_top_k 기본값 변경에 맞춰 config 테스트 기대값을 3으로 갱신했습니다.
  • room_floor_resolver 정상/예외 케이스 단위 테스트를 추가했습니다.
  • 호실 층수 질문이 임베딩, 검색, LLM 호출 없이 규칙 기반으로 바로 응답하는지 검증했습니다.

Comment thread app/services/chat_service.py Outdated
top_k=settings.chat_grouped_dormitory_top_k,
)

print("===== GROUPED SEARCH DEBUG =====")
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.

디버그용으로는 좋은데 많아지면 로그가 너무 많아질 거 같아서 실제 운영땐 빼는 게 좋을 거 같습니다!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

디버그용으로 썻던 코든데 제가 깜빡하고 삭제를 안했네요..수정했습니다

"라면먹어",
"라면먹어도",
"라면 먹어",
"라면 먹어도"
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.

쉼표가 누락된 부분이 있어서 한 단어로 취급될 수 있을 거 같은데 의도된건지 궁금합니다

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

제가 빼먹었네요..수정했습니다

@1024andrew 1024andrew merged commit e1bf180 into dev May 4, 2026
1 check passed
@1024andrew 1024andrew changed the title fix: add room floor resolver fix: add room floor resolver(호수 질문 해결 로직 추가) May 4, 2026
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.

2 participants