Add admin features, responsive UI, user reviews, visit stats, and channel-colored markers

- Admin: video management with Google Maps match status, manual restaurant mapping, restaurant remap on name change
- Admin: user management tab with favorites/reviews detail
- Admin: channel deletion fix for IDs with slashes
- Frontend: responsive mobile layout (map top, list bottom, 2-row header)
- Frontend: channel-colored map markers with legend
- Frontend: my reviews list, favorites toggle, visit counter overlay
- Frontend: force light mode for dark theme devices
- Backend: visit tracking (site_visits table), user reviews endpoint
- Backend: bulk transcript/extract streaming, geocode key fixes
- Nginx config for production deployment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
joungmin
2026-03-07 14:52:20 +09:00
parent 36bec10bd0
commit 3694730501
27 changed files with 4346 additions and 189 deletions

View File

@@ -28,7 +28,7 @@ def process_video(video: dict) -> int:
try:
# 1. Transcript
transcript = youtube.get_transcript(video_id)
transcript, _src = youtube.get_transcript(video_id)
if not transcript:
logger.warning("No transcript for %s, marking done", video_id)
youtube.update_video_status(video_db_id, "done")
@@ -72,6 +72,11 @@ def process_video(video: dict) -> int:
cuisine_type=rest_data.get("cuisine_type"),
price_range=rest_data.get("price_range"),
google_place_id=place_id,
phone=geo.get("phone") if geo else None,
website=geo.get("website") if geo else None,
business_status=geo.get("business_status") if geo else None,
rating=geo.get("rating") if geo else None,
rating_count=geo.get("rating_count") if geo else None,
)
# Link video <-> restaurant
@@ -101,6 +106,76 @@ def process_video(video: dict) -> int:
return 0
def process_video_extract(video: dict, transcript: str, custom_prompt: str | None = None) -> int:
"""Run LLM extraction + geocode + save on an existing transcript.
Returns number of restaurants found."""
video_db_id = video["id"]
title = video["title"]
logger.info("Extracting restaurants from video: %s", title)
try:
restaurants, llm_raw = extractor.extract_restaurants(title, transcript, custom_prompt=custom_prompt)
if not restaurants:
youtube.update_video_status(video_db_id, "done", llm_raw=llm_raw)
return 0
count = 0
for rest_data in restaurants:
name = rest_data.get("name")
if not name:
continue
geo = geocoding.geocode_restaurant(
name,
address=rest_data.get("address"),
region=rest_data.get("region"),
)
lat = geo["latitude"] if geo else None
lng = geo["longitude"] if geo else None
addr = geo["formatted_address"] if geo else rest_data.get("address")
place_id = geo["google_place_id"] if geo else None
rest_id = restaurant.upsert(
name=name,
address=addr,
region=rest_data.get("region"),
latitude=lat,
longitude=lng,
cuisine_type=rest_data.get("cuisine_type"),
price_range=rest_data.get("price_range"),
google_place_id=place_id,
phone=geo.get("phone") if geo else None,
website=geo.get("website") if geo else None,
business_status=geo.get("business_status") if geo else None,
rating=geo.get("rating") if geo else None,
rating_count=geo.get("rating_count") if geo else None,
)
restaurant.link_video_restaurant(
video_db_id=video_db_id,
restaurant_id=rest_id,
foods=rest_data.get("foods_mentioned"),
evaluation=rest_data.get("evaluation"),
guests=rest_data.get("guests"),
)
chunks = _build_chunks(name, rest_data, title)
if chunks:
vector.save_restaurant_vectors(rest_id, chunks)
count += 1
logger.info("Saved restaurant: %s (geocoded=%s)", name, bool(geo))
youtube.update_video_status(video_db_id, "done", llm_raw=llm_raw)
return count
except Exception as e:
logger.error("Extract error for %s: %s", video["video_id"], e, exc_info=True)
return 0
def _build_chunks(name: str, data: dict, video_title: str) -> list[str]:
"""Build text chunks for vector embedding."""
parts = [f"식당: {name}"]