-
Notifications
You must be signed in to change notification settings - Fork 0
fix: duplicate function(중복된 기능 가진 함수 제거) #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -284,11 +284,14 @@ def _answer_single_dormitory_chat( | |
| rewritten_query = expanded_query | ||
|
|
||
| # 1차: 확장 query로 사용자 dormitory + 공통 문서 검색 | ||
| expanded_chunks = search_similar_chunks( | ||
| expanded_chunks = search_hybrid_chunks( | ||
| db=db, | ||
| query_text=expanded_query, | ||
| query_embedding=expanded_query_embedding, | ||
| dormitory=dormitory, | ||
| top_k=settings.chat_single_dormitory_top_k, | ||
| candidate_k=20, | ||
| keyword_weight=0.3, | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -308,8 +311,9 @@ def _answer_single_dormitory_chat( | |
| # 확장 query + 사용자 dormitory 검색으로도 답변이 부족하면 | ||
| # 확장 query + 전체 생활관 검색을 반드시 한 번 더 수행 | ||
| if _is_no_answer(answer_result.answer): | ||
| expanded_all_chunks = search_similar_chunks_all_dormitories( | ||
| expanded_all_chunks = search_hybrid_chunks_all_dormitories( | ||
| db=db, | ||
| query_text=expanded_query, | ||
| query_embedding=expanded_query_embedding, | ||
| top_k=settings.chat_fallback_top_k, | ||
| ) | ||
|
|
@@ -452,8 +456,9 @@ def _answer_unspecified_dormitory_chat( | |
| expanded_query_embedding = create_query_embedding(expanded_query) | ||
| rewritten_query = expanded_query | ||
|
|
||
| expanded_chunks = search_similar_chunks_for_dormitories( | ||
| expanded_chunks = search_hybrid_chunks_for_dormitories( | ||
| db=db, | ||
| query_text=expanded_query, | ||
| query_embedding=expanded_query_embedding, | ||
| dormitories=settings.chat_grouped_dormitories, | ||
| top_k=settings.chat_fallback_top_k, | ||
|
|
@@ -713,10 +718,10 @@ def _get_query_expansion_rerank_keywords(question: str, expanded_query: str) -> | |
| "라면먹어", | ||
| "라면먹어도", | ||
| "라면 먹어", | ||
| "라면 먹어도" | ||
| "라면 먹어도", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. text 변수 생성 시 공백을 모두 제거(replace(" ", ""))하므로, "라면 먹어도"와 같이 공백이 포함된 트리거는 절대 매칭되지 않습니다. 또한 공백을 제외하면 이미 목록에 존재하는 "라면먹어도"(719라인)와 중복됩니다. PR 본문에서 언급하신 '중복 정리'를 위해 공백이 포함된 항목은 제거하는 것이 좋습니다. 추가로, 리스트 내부 항목의 들여쓰기가 변수 선언 레벨과 동일하게 되어 있습니다. PEP 8 스타일에 따라 추가 들여쓰기(8칸)를 적용하는 것이 가독성에 좋으며, 733라인("음식 해먹") 등 리스트 하단에도 여전히 콤마 누락으로 인한 문자열 결합 문제가 남아 있으니 함께 확인 부탁드립니다. |
||
| "방에서라면", | ||
| "방에서 라면", | ||
| "끓여 먹" | ||
| "끓여 먹", | ||
| "끓여먹", | ||
| "끓여", | ||
| "취사", | ||
|
|
@@ -831,7 +836,7 @@ def _should_pre_expand_query(question: str) -> bool: | |
| "라면 먹어도", | ||
| "방에서라면", | ||
| "방에서 라면", | ||
| "끓여 먹" | ||
| "끓여 먹", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "끓여먹", | ||
| "끓여", | ||
| "취사", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_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라인의 인자들은 기본값과 동일하므로 다른 호출부와 같이 생략하여 코드를 간결하게 유지할 수 있습니다.