Skip to content

fix: duplicate function(중복된 기능 가진 함수 제거)#32

Merged
1024andrew merged 1 commit intodevfrom
fix/#31
May 4, 2026
Merged

fix: duplicate function(중복된 기능 가진 함수 제거)#32
1024andrew merged 1 commit intodevfrom
fix/#31

Conversation

@1024andrew
Copy link
Copy Markdown
Contributor

@1024andrew 1024andrew commented May 4, 2026

유형

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

수정 사항

  • query expansion fallback 구간에서 남아 있던 search_similar_chunks 계열 호출을 search_hybrid_chunks 계열로 통일했습니다.
  • 현재 프로젝트의 hybrid retrieval 구조와 맞지 않는 이전 검색 함수 호출로 인해 특정 질문에서 500 에러가 발생하던 문제를 수정했습니다.
  • cooking 관련 trigger 목록의 들여쓰기와 중복/누락된 콤마를 정리했습니다.
  • 사용하지 않는 search_similar_chunks_all_dormitories import를 제거했습니다.

수정 배경

2인실 몇개야와 같이 일부 질문이 query expansion fallback 흐름으로 들어갈 때, 존재하지 않는 search_similar_chunks 함수가 호출되어 NameError가 발생했습니다.

@1024andrew 1024andrew merged commit a33277f into dev May 4, 2026
1 check passed
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 transitions the chat service from simple similarity search to hybrid search by updating several search functions and adding necessary parameters like query_text and keyword_weight. Feedback highlights issues with redundant keyword entries containing spaces that will not match due to space-removal logic, potential string concatenation bugs caused by missing commas in lists, and an inconsistency in the top_k settings used for fallback logic compared to other service calls.

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

high

text 변수 생성 시 공백을 모두 제거(replace(" ", ""))하므로, "라면 먹어도"와 같이 공백이 포함된 트리거는 절대 매칭되지 않습니다. 또한 공백을 제외하면 이미 목록에 존재하는 "라면먹어도"(719라인)와 중복됩니다. PR 본문에서 언급하신 '중복 정리'를 위해 공백이 포함된 항목은 제거하는 것이 좋습니다. 추가로, 리스트 내부 항목의 들여쓰기가 변수 선언 레벨과 동일하게 되어 있습니다. PEP 8 스타일에 따라 추가 들여쓰기(8칸)를 적용하는 것이 가독성에 좋으며, 733라인("음식 해먹") 등 리스트 하단에도 여전히 콤마 누락으로 인한 문자열 결합 문제가 남아 있으니 함께 확인 부탁드립니다.

"방에서라면",
"방에서 라면",
"끓여 먹"
"끓여 먹",
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.

high

위의 _get_query_expansion_rerank_keywords 함수와 마찬가지로, compact_question에서 공백이 제거되므로 "끓여 먹"과 같이 공백이 포함된 트리거는 매칭되지 않으며 "끓여먹"(840라인)과 중복됩니다. 공백이 없는 형태로 통일하거나 중복 항목을 제거해 주세요.

query_text=expanded_query,
query_embedding=expanded_query_embedding,
dormitory=dormitory,
top_k=settings.chat_single_dormitory_top_k,
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.

medium

_answer_single_dormitory_chat 함수의 query expansion fallback 구간에서 top_k 값으로 settings.chat_single_dormitory_top_k(3)를 사용하고 있습니다. 이 함수 내의 다른 fallback 로직(207, 254, 314라인) 및 _answer_unspecified_dormitory_chat의 fallback(464라인)에서는 모두 settings.chat_fallback_top_k(5)를 사용하고 있으므로, 일관성을 위해 chat_fallback_top_k를 사용하는 것을 권장합니다. 또한 293-294라인의 인자들은 기본값과 동일하므로 다른 호출부와 같이 생략하여 코드를 간결하게 유지할 수 있습니다.

Suggested change
top_k=settings.chat_single_dormitory_top_k,
top_k=settings.chat_fallback_top_k,

@1024andrew 1024andrew changed the title fix: duplicate function fix: duplicate function(중복된 기능 가진 함수 제거) 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.

1 participant