UX improvements: mobile bottom sheet, cuisine taxonomy, search enhancements
- Add BottomSheet component for Google Maps-style restaurant detail on mobile (3-snap drag: 40%/55%/92%, velocity-based close, backdrop overlay) - Mobile map mode now full-screen with bottom sheet overlay for details - Collapsible filter panel on mobile with active filter badge count - Standardized cuisine taxonomy (46 categories: 한식|국밥, 일식|스시 etc.) with LLM remap endpoint and admin UI button - Enhanced search: keyword search now includes foods_mentioned + video title - Search results include channels array for frontend filtering - Channel filter moved to frontend filteredRestaurants (not API-level) - LLM extraction prompt updated for pipe-delimited region + cuisine taxonomy - Vector rebuild endpoint with rich JSON chunks per restaurant - Geolocation-based auto region selection on page load - Desktop filters split into two clean rows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
102
backend/core/cuisine.py
Normal file
102
backend/core/cuisine.py
Normal file
@@ -0,0 +1,102 @@
|
||||
"""Standardized cuisine type taxonomy and LLM remapping."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
# ── Canonical cuisine types ──
|
||||
# Format: "대분류|소분류"
|
||||
CUISINE_TYPES = [
|
||||
# 한식
|
||||
"한식|백반/한정식",
|
||||
"한식|국밥/해장국",
|
||||
"한식|찌개/전골/탕",
|
||||
"한식|삼겹살/돼지구이",
|
||||
"한식|소고기/한우구이",
|
||||
"한식|곱창/막창",
|
||||
"한식|닭/오리구이",
|
||||
"한식|족발/보쌈",
|
||||
"한식|회/횟집",
|
||||
"한식|해산물",
|
||||
"한식|분식",
|
||||
"한식|면",
|
||||
"한식|죽/죽집",
|
||||
"한식|순대/순대국",
|
||||
"한식|장어/민물",
|
||||
"한식|주점/포차",
|
||||
# 일식
|
||||
"일식|스시/오마카세",
|
||||
"일식|라멘",
|
||||
"일식|돈카츠",
|
||||
"일식|텐동/튀김",
|
||||
"일식|이자카야",
|
||||
"일식|야키니쿠",
|
||||
"일식|카레",
|
||||
"일식|소바/우동",
|
||||
# 중식
|
||||
"중식|중화요리",
|
||||
"중식|마라/훠궈",
|
||||
"중식|딤섬/만두",
|
||||
"중식|양꼬치",
|
||||
# 양식
|
||||
"양식|파스타/이탈리안",
|
||||
"양식|스테이크",
|
||||
"양식|햄버거",
|
||||
"양식|피자",
|
||||
"양식|프렌치",
|
||||
"양식|바베큐",
|
||||
"양식|브런치",
|
||||
"양식|비건/샐러드",
|
||||
# 아시아
|
||||
"아시아|베트남",
|
||||
"아시아|태국",
|
||||
"아시아|인도/중동",
|
||||
"아시아|동남아기타",
|
||||
# 기타
|
||||
"기타|치킨",
|
||||
"기타|카페/디저트",
|
||||
"기타|베이커리",
|
||||
"기타|뷔페",
|
||||
"기타|퓨전",
|
||||
]
|
||||
|
||||
# For LLM prompt
|
||||
CUISINE_LIST_TEXT = "\n".join(f" - {c}" for c in CUISINE_TYPES)
|
||||
|
||||
_REMAP_PROMPT = """\
|
||||
아래 식당들의 cuisine_type을 표준 분류로 매핑하세요.
|
||||
|
||||
표준 분류 목록 (반드시 이 중 하나를 선택):
|
||||
{cuisine_types}
|
||||
|
||||
식당 목록:
|
||||
{restaurants}
|
||||
|
||||
규칙:
|
||||
- 모든 식당에 대해 빠짐없이 결과를 반환 (총 {count}개 모두 반환해야 함)
|
||||
- 반드시 위 표준 분류 목록의 값을 그대로 복사하여 사용 (오타 금지)
|
||||
- 식당 이름, 현재 분류, 메뉴를 종합적으로 고려
|
||||
- JSON 배열만 반환, 설명 없음
|
||||
- 형식: [{{"id": "식당ID", "cuisine_type": "한식|국밥/해장국"}}, ...]
|
||||
|
||||
JSON 배열:"""
|
||||
|
||||
|
||||
def build_remap_prompt(restaurants: list[dict]) -> str:
|
||||
"""Build a prompt for remapping cuisine types."""
|
||||
items = []
|
||||
for r in restaurants:
|
||||
items.append({
|
||||
"id": r["id"],
|
||||
"name": r["name"],
|
||||
"current_cuisine_type": r.get("cuisine_type"),
|
||||
"foods_mentioned": r.get("foods_mentioned"),
|
||||
})
|
||||
import json
|
||||
return _REMAP_PROMPT.format(
|
||||
cuisine_types=CUISINE_LIST_TEXT,
|
||||
restaurants=json.dumps(items, ensure_ascii=False),
|
||||
count=len(items),
|
||||
)
|
||||
|
||||
|
||||
# Valid prefixes for loose validation
|
||||
VALID_PREFIXES = ("한식|", "일식|", "중식|", "양식|", "아시아|", "기타|")
|
||||
Reference in New Issue
Block a user