Compare commits
14 Commits
fda2d76514
...
v0.1.43
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47020fd649 | ||
|
|
88bbf3ca25 | ||
|
|
8152b71119 | ||
|
|
d6ee62230e | ||
|
|
cf1055bdf9 | ||
|
|
2580414790 | ||
|
|
730727a7a6 | ||
|
|
9ba905aad8 | ||
|
|
8c4b0c3e9a | ||
|
|
3815221535 | ||
|
|
49ef0322ac | ||
|
|
cc4bc0b7e4 | ||
|
|
515f5c1d1a | ||
|
|
6cbf7feaf5 |
48
CHANGELOG.md
48
CHANGELOG.md
@@ -6,7 +6,53 @@
|
|||||||
|
|
||||||
## 2026-06-15
|
## 2026-06-15
|
||||||
|
|
||||||
### 🧹 #329 admin/page.tsx 분리 (v0.1.35)
|
### 🎯 #356 영상-식당 관련도 LLM 평가 (v0.1.43)
|
||||||
|
- DB: video_restaurants 컬럼 추가 (relevance/relevance_reason/relevance_evaluated_at) + idx_vr_relevance
|
||||||
|
- VideoRelevanceService 신규 (#322 RestaurantVerifyService 패턴 모방, @Async verifyAsync/verify/verifyAll)
|
||||||
|
- PipelineService.processExtract — linkVideoRestaurant 후 verifyAsync(linkId) 자동 트리거
|
||||||
|
- GET /api/restaurants/{id}/videos: 기본 strong/unknown만 응답 (안전 기본값), ?include_weak=true 시 모두
|
||||||
|
- AdminVideoRelevanceController 신규 (pending/all/{id}/evaluate/{id} PATCH)
|
||||||
|
- 응답 매핑: relevance, relevance_reason 필드 동봉
|
||||||
|
- 기존 1244 링크는 'unknown' 시작 → 어드민 백필로 점진 평가
|
||||||
|
- 설계서: docs/design/356-video-relevance-llm/README.md
|
||||||
|
- Refs: #356 (close)
|
||||||
|
|
||||||
|
### 🧹 #351 admin SSE 6곳 consumeSseStream 통일 (v0.1.42)
|
||||||
|
- VideosPanel 4곳(bulkTranscript/Extract, rebuildVectors, remapCuisine, remapFoods)
|
||||||
|
- RestaurantsPanel 2곳(bulkTabling, bulkCatchtable)
|
||||||
|
- response.body?.getReader 직접 호출 0건 (lib/admin-utils.ts의 consumeSseStream 활용)
|
||||||
|
- 149줄 삭제 → 74줄 압축, npm test 13/13 통과
|
||||||
|
- Refs: #351 (close)
|
||||||
|
|
||||||
|
### 🧪 #343 Jest+RTL 인프라 + ARIA Tabs + remotePatterns (v0.1.40)
|
||||||
|
- Jest 30 + jest-environment-jsdom + RTL + jest-dom matchers 도입
|
||||||
|
- next/jest 자동 SWC 통합, jest.config.ts + jest.setup.ts (setupFilesAfterEnv)
|
||||||
|
- npm scripts: test, test:watch
|
||||||
|
- 샘플 테스트 3개 13/13 통과: i18n/config(5), Stars(5), admin-utils(4)
|
||||||
|
- MyReviewsList: role=tablist/tab/aria-selected/aria-controls/tabIndex + tabpanel
|
||||||
|
- next.config.ts remotePatterns: Google avatar + YouTube thumbnail/avatar
|
||||||
|
- 후속: 전체 컴포넌트 테스트 확장, 백엔드 JUnit, E2E(Playwright), CI 통합
|
||||||
|
- 설계서: docs/design/343-frontend-test-infra/README.md
|
||||||
|
- Refs: #343 (close)
|
||||||
|
|
||||||
|
### 🔤 #348 isNameSimilar 한국어 자모 + Sørensen-Dice (v0.1.38)
|
||||||
|
- HangulSimilarity 유틸 신규 (Unicode NFD 분해 + bigram Sørensen-Dice)
|
||||||
|
- RestaurantController.isNameSimilar 교체, 임계값 0.45
|
||||||
|
- 짧은 한국어 이름 매칭 정확도 향상 (예: "스타벅스 강남" vs "스타벅스 강남점")
|
||||||
|
- 후속 분리: #357(DDG→정식 API), #358(DTO+@Valid), #359(UNIQUE+데이터 정리)
|
||||||
|
- 설계서: docs/design/348-name-similarity/README.md
|
||||||
|
- Refs: #348 (close)
|
||||||
|
|
||||||
|
### 🌐 #352 i18n 뼈대 ko/en/ja/es (v0.1.37)
|
||||||
|
- next-intl 5.x 도입
|
||||||
|
- src/i18n/{config,LocaleProvider} + src/messages/{ko,en,ja,es}.json (30 키)
|
||||||
|
- LanguageSwitcher 컴포넌트 (헤더, ARIA listbox, 44px, 국기+네이티브명)
|
||||||
|
- localStorage tasteby_locale + 브라우저 언어 감지 + ko fallback
|
||||||
|
- 설계서: docs/design/352-i18n-skeleton/README.md
|
||||||
|
- 미적용: URL 라우팅 i18n, SEO meta, 사용자 콘텐츠 번역, 어드민(한국어 유지)
|
||||||
|
- Refs: #352 (close)
|
||||||
|
|
||||||
|
### 🧹 #329 admin/page.tsx 분리 (v0.1.35→v0.1.36 운영 반영)
|
||||||
- page.tsx 2817 → 107 LOC (탭 라우팅 + 헤더만)
|
- page.tsx 2817 → 107 LOC (탭 라우팅 + 헤더만)
|
||||||
- _panels/{Channels,Videos,Restaurants,Users,Daemon}Panel.tsx 5개 분리
|
- _panels/{Channels,Videos,Restaurants,Users,Daemon}Panel.tsx 5개 분리
|
||||||
- localStorage.getItem 10곳 → getAdminToken() (admin-utils.ts)
|
- localStorage.getItem 10곳 → getAdminToken() (admin-utils.ts)
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.tasteby.controller;
|
||||||
|
|
||||||
|
import com.tasteby.security.AuthUtil;
|
||||||
|
import com.tasteby.service.RestaurantService;
|
||||||
|
import com.tasteby.service.VideoRelevanceService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #356 영상-식당 관련도 LLM 평가 어드민 API.
|
||||||
|
* - 미평가 카운트 / 일괄 백필 / 단건 재평가 / 수동 토글
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/admin/video-relevance")
|
||||||
|
public class AdminVideoRelevanceController {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(AdminVideoRelevanceController.class);
|
||||||
|
private static final Set<String> VALID = Set.of("strong", "weak", "incidental", "unknown");
|
||||||
|
|
||||||
|
private final RestaurantService restaurantService;
|
||||||
|
private final VideoRelevanceService relevanceService;
|
||||||
|
|
||||||
|
public AdminVideoRelevanceController(RestaurantService restaurantService, VideoRelevanceService relevanceService) {
|
||||||
|
this.restaurantService = restaurantService;
|
||||||
|
this.relevanceService = relevanceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/pending")
|
||||||
|
public Map<String, Object> pendingCount() {
|
||||||
|
var admin = AuthUtil.requireAdmin();
|
||||||
|
int n = restaurantService.countUnevaluatedLinks();
|
||||||
|
log.info("[ADMIN] {} video-relevance pending: {}", admin.getSubject(), n);
|
||||||
|
return Map.of("pending", n);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/all")
|
||||||
|
public Map<String, Object> verifyAll(@RequestParam(defaultValue = "10") int batchSize) {
|
||||||
|
var admin = AuthUtil.requireAdmin();
|
||||||
|
log.info("[ADMIN] {} triggered video-relevance verifyAll(batchSize={})", admin.getSubject(), batchSize);
|
||||||
|
int processed = relevanceService.verifyAll(batchSize);
|
||||||
|
return Map.of("processed", processed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/{linkId}/evaluate")
|
||||||
|
public Map<String, Object> evaluateOne(@PathVariable String linkId) {
|
||||||
|
var admin = AuthUtil.requireAdmin();
|
||||||
|
log.info("[ADMIN] {} video-relevance evaluate({})", admin.getSubject(), linkId);
|
||||||
|
relevanceService.verify(linkId);
|
||||||
|
return Map.of("success", true, "linkId", linkId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PatchMapping("/{linkId}")
|
||||||
|
public Map<String, Object> setRelevance(@PathVariable String linkId, @RequestBody Map<String, Object> body) {
|
||||||
|
var admin = AuthUtil.requireAdmin();
|
||||||
|
Object relObj = body.get("relevance");
|
||||||
|
if (!(relObj instanceof String relevance) || !VALID.contains(relevance)) {
|
||||||
|
return Map.of("success", false, "error", "relevance must be one of strong|weak|incidental|unknown");
|
||||||
|
}
|
||||||
|
String reason = body.get("reason") instanceof String s ? s : "manual";
|
||||||
|
restaurantService.updateLinkRelevance(linkId, relevance, reason);
|
||||||
|
log.info("[ADMIN] {} manual relevance={} for link {}", admin.getSubject(), relevance, linkId);
|
||||||
|
return Map.of("success", true, "linkId", linkId, "relevance", relevance);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -413,8 +413,10 @@ public class RestaurantController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}/videos")
|
@GetMapping("/{id}/videos")
|
||||||
public List<Map<String, Object>> videos(@PathVariable String id) {
|
public List<Map<String, Object>> videos(
|
||||||
String key = cache.makeKey("restaurant_videos", id);
|
@PathVariable String id,
|
||||||
|
@RequestParam(name = "include_weak", defaultValue = "false") boolean includeWeak) {
|
||||||
|
String key = cache.makeKey("restaurant_videos", id, includeWeak ? "all" : "strong");
|
||||||
String cached = cache.getRaw(key);
|
String cached = cache.getRaw(key);
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
try {
|
try {
|
||||||
@@ -423,7 +425,7 @@ public class RestaurantController {
|
|||||||
}
|
}
|
||||||
var r = restaurantService.findById(id);
|
var r = restaurantService.findById(id);
|
||||||
if (r == null) throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Restaurant not found");
|
if (r == null) throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Restaurant not found");
|
||||||
var result = restaurantService.findVideoLinks(id);
|
var result = restaurantService.findVideoLinks(id, includeWeak);
|
||||||
cache.set(key, result);
|
cache.set(key, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -524,25 +526,12 @@ public class RestaurantController {
|
|||||||
* 식당 이름과 검색 결과 제목의 유사도 검사.
|
* 식당 이름과 검색 결과 제목의 유사도 검사.
|
||||||
* 한쪽 이름이 다른쪽에 포함되거나, 공통 글자 비율이 40% 이상이면 유사하다고 판단.
|
* 한쪽 이름이 다른쪽에 포함되거나, 공통 글자 비율이 40% 이상이면 유사하다고 판단.
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* #348 — 한국어 자모 분해 + Sørensen-Dice bigram 유사도(임계값 0.45).
|
||||||
|
* 짧은 한국어 이름에서 이전 Jaccard-like(set 비율) 방식보다 정확.
|
||||||
|
*/
|
||||||
private boolean isNameSimilar(String restaurantName, String resultTitle) {
|
private boolean isNameSimilar(String restaurantName, String resultTitle) {
|
||||||
String a = normalize(restaurantName);
|
return com.tasteby.util.HangulSimilarity.similarity(restaurantName, resultTitle) >= 0.45;
|
||||||
String b = normalize(resultTitle);
|
|
||||||
if (a.isEmpty() || b.isEmpty()) return false;
|
|
||||||
|
|
||||||
// 포함 관계 체크
|
|
||||||
if (a.contains(b) || b.contains(a)) return true;
|
|
||||||
|
|
||||||
// 공통 문자 비율 (Jaccard-like)
|
|
||||||
var setA = a.chars().boxed().collect(java.util.stream.Collectors.toSet());
|
|
||||||
var setB = b.chars().boxed().collect(java.util.stream.Collectors.toSet());
|
|
||||||
long common = setA.stream().filter(setB::contains).count();
|
|
||||||
double ratio = (double) common / Math.max(setA.size(), setB.size());
|
|
||||||
return ratio >= 0.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String normalize(String s) {
|
|
||||||
if (s == null) return "";
|
|
||||||
return s.replaceAll("[\\s·\\-_()()\\[\\]【】]", "").toLowerCase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void emit(SseEmitter emitter, Map<String, Object> data) {
|
private void emit(SseEmitter emitter, Map<String, Object> data) {
|
||||||
|
|||||||
@@ -28,9 +28,21 @@ public interface RestaurantMapper {
|
|||||||
|
|
||||||
int countUnverified();
|
int countUnverified();
|
||||||
|
|
||||||
|
// #356 영상-식당 관련도
|
||||||
|
void updateLinkRelevance(@Param("linkId") String linkId,
|
||||||
|
@Param("relevance") String relevance,
|
||||||
|
@Param("reason") String reason);
|
||||||
|
|
||||||
|
Map<String, Object> findLinkContext(@Param("linkId") String linkId);
|
||||||
|
|
||||||
|
List<Map<String, Object>> findUnevaluatedLinks(@Param("limit") int limit);
|
||||||
|
|
||||||
|
int countUnevaluatedLinks();
|
||||||
|
|
||||||
Restaurant findById(@Param("id") String id);
|
Restaurant findById(@Param("id") String id);
|
||||||
|
|
||||||
List<Map<String, Object>> findVideoLinks(@Param("restaurantId") String restaurantId);
|
List<Map<String, Object>> findVideoLinks(@Param("restaurantId") String restaurantId,
|
||||||
|
@Param("includeWeak") boolean includeWeak);
|
||||||
|
|
||||||
void insertRestaurant(Restaurant r);
|
void insertRestaurant(Restaurant r);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class PipelineService {
|
|||||||
private final VectorService vectorService;
|
private final VectorService vectorService;
|
||||||
private final CacheService cacheService;
|
private final CacheService cacheService;
|
||||||
private final RestaurantVerifyService verifyService;
|
private final RestaurantVerifyService verifyService;
|
||||||
|
private final VideoRelevanceService relevanceService;
|
||||||
|
|
||||||
public PipelineService(YouTubeService youTubeService,
|
public PipelineService(YouTubeService youTubeService,
|
||||||
ExtractorService extractorService,
|
ExtractorService extractorService,
|
||||||
@@ -37,7 +38,8 @@ public class PipelineService {
|
|||||||
VideoService videoService,
|
VideoService videoService,
|
||||||
VectorService vectorService,
|
VectorService vectorService,
|
||||||
CacheService cacheService,
|
CacheService cacheService,
|
||||||
RestaurantVerifyService verifyService) {
|
RestaurantVerifyService verifyService,
|
||||||
|
VideoRelevanceService relevanceService) {
|
||||||
this.youTubeService = youTubeService;
|
this.youTubeService = youTubeService;
|
||||||
this.extractorService = extractorService;
|
this.extractorService = extractorService;
|
||||||
this.geocodingService = geocodingService;
|
this.geocodingService = geocodingService;
|
||||||
@@ -46,6 +48,7 @@ public class PipelineService {
|
|||||||
this.vectorService = vectorService;
|
this.vectorService = vectorService;
|
||||||
this.cacheService = cacheService;
|
this.cacheService = cacheService;
|
||||||
this.verifyService = verifyService;
|
this.verifyService = verifyService;
|
||||||
|
this.relevanceService = relevanceService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,13 +148,16 @@ public class PipelineService {
|
|||||||
evaluationJson = JsonUtil.toJson(s);
|
evaluationJson = JsonUtil.toJson(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
restaurantService.linkVideoRestaurant(
|
String linkId = restaurantService.linkVideoRestaurant(
|
||||||
videoDbId, restId,
|
videoDbId, restId,
|
||||||
foods instanceof List<?> ? (List<String>) foods : null,
|
foods instanceof List<?> ? (List<String>) foods : null,
|
||||||
evaluationJson,
|
evaluationJson,
|
||||||
guests instanceof List<?> ? (List<String>) guests : null
|
guests instanceof List<?> ? (List<String>) guests : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// #356 — 신규 등록 직후 비동기 관련도 평가
|
||||||
|
relevanceService.verifyAsync(linkId);
|
||||||
|
|
||||||
// Vector embeddings
|
// Vector embeddings
|
||||||
var chunks = VectorService.buildChunks(name, restData, title);
|
var chunks = VectorService.buildChunks(name, restData, title);
|
||||||
if (!chunks.isEmpty()) {
|
if (!chunks.isEmpty()) {
|
||||||
|
|||||||
@@ -77,7 +77,11 @@ public class RestaurantService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> findVideoLinks(String restaurantId) {
|
public List<Map<String, Object>> findVideoLinks(String restaurantId) {
|
||||||
var rows = mapper.findVideoLinks(restaurantId);
|
return findVideoLinks(restaurantId, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> findVideoLinks(String restaurantId, boolean includeWeak) {
|
||||||
|
var rows = mapper.findVideoLinks(restaurantId, includeWeak);
|
||||||
return rows.stream().map(row -> {
|
return rows.stream().map(row -> {
|
||||||
var m = JsonUtil.lowerKeys(row);
|
var m = JsonUtil.lowerKeys(row);
|
||||||
m.put("foods_mentioned", JsonUtil.parseStringList(m.get("foods_mentioned")));
|
m.put("foods_mentioned", JsonUtil.parseStringList(m.get("foods_mentioned")));
|
||||||
@@ -87,6 +91,26 @@ public class RestaurantService {
|
|||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #356 영상-식당 관련도
|
||||||
|
public void updateLinkRelevance(String linkId, String relevance, String reason) {
|
||||||
|
mapper.updateLinkRelevance(linkId, relevance, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> findLinkContext(String linkId) {
|
||||||
|
var row = mapper.findLinkContext(linkId);
|
||||||
|
return row != null ? JsonUtil.lowerKeys(row) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> findUnevaluatedLinks(int limit) {
|
||||||
|
return mapper.findUnevaluatedLinks(limit).stream()
|
||||||
|
.map(JsonUtil::lowerKeys)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int countUnevaluatedLinks() {
|
||||||
|
return mapper.countUnevaluatedLinks();
|
||||||
|
}
|
||||||
|
|
||||||
public void update(String id, Map<String, Object> fields) {
|
public void update(String id, Map<String, Object> fields) {
|
||||||
mapper.updateFields(id, fields);
|
mapper.updateFields(id, fields);
|
||||||
}
|
}
|
||||||
@@ -138,12 +162,13 @@ public class RestaurantService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void linkVideoRestaurant(String videoId, String restaurantId, List<String> foods, String evaluation, List<String> guests) {
|
public String linkVideoRestaurant(String videoId, String restaurantId, List<String> foods, String evaluation, List<String> guests) {
|
||||||
String id = IdGenerator.newId();
|
String id = IdGenerator.newId();
|
||||||
String foodsJson = foods != null ? JsonUtil.toJson(foods) : null;
|
String foodsJson = foods != null ? JsonUtil.toJson(foods) : null;
|
||||||
String guestsJson = guests != null ? JsonUtil.toJson(guests) : null;
|
String guestsJson = guests != null ? JsonUtil.toJson(guests) : null;
|
||||||
String evalJson = JsonUtil.normalizeEvaluation(evaluation);
|
String evalJson = JsonUtil.normalizeEvaluation(evaluation);
|
||||||
mapper.linkVideoRestaurant(id, videoId, restaurantId, foodsJson, evalJson, guestsJson);
|
mapper.linkVideoRestaurant(id, videoId, restaurantId, foodsJson, evalJson, guestsJson);
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateCuisineType(String id, String cuisineType) {
|
public void updateCuisineType(String id, String cuisineType) {
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package com.tasteby.service;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #356 영상-식당 관련도 LLM 평가.
|
||||||
|
* 설계서: docs/design/356-video-relevance-llm/README.md
|
||||||
|
*
|
||||||
|
* 신규 등록 시 자동 평가 + 어드민 백필. 결과는 video_restaurants.relevance에 저장.
|
||||||
|
* - strong: 본격 다룸 (방문 리뷰, 메뉴 평가)
|
||||||
|
* - weak: 잠깐 언급, 비교 대상
|
||||||
|
* - incidental: 일반 토픽 중 단순 언급, 입점 전
|
||||||
|
* - unknown: 미평가 or LLM 실패 (안전 기본값으로 표시 유지)
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VideoRelevanceService {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(VideoRelevanceService.class);
|
||||||
|
private static final Set<String> VALID = Set.of("strong", "weak", "incidental", "unknown");
|
||||||
|
private static final long BACKFILL_SLEEP_MS = 200;
|
||||||
|
|
||||||
|
private final RestaurantService restaurantService;
|
||||||
|
private final OciGenAiService genAi;
|
||||||
|
private final ObjectMapper jsonMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
public VideoRelevanceService(RestaurantService restaurantService, OciGenAiService genAi) {
|
||||||
|
this.restaurantService = restaurantService;
|
||||||
|
this.genAi = genAi;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
public void verifyAsync(String linkId) {
|
||||||
|
try {
|
||||||
|
verify(linkId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("verifyAsync failed for link {}: {}", linkId, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void verify(String linkId) {
|
||||||
|
Map<String, Object> ctx = restaurantService.findLinkContext(linkId);
|
||||||
|
if (ctx == null) return;
|
||||||
|
VerifyResult result;
|
||||||
|
try {
|
||||||
|
String prompt = buildPrompt(ctx);
|
||||||
|
String response = genAi.chat(prompt, 120);
|
||||||
|
result = parseRelevance(response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("verify({}) LLM failed: {} — keeping unknown", linkId, e.getMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
restaurantService.updateLinkRelevance(linkId, result.relevance(), truncate(result.reason(), 120));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int verifyAll(int batchSize) {
|
||||||
|
int total = 0;
|
||||||
|
List<Map<String, Object>> batch;
|
||||||
|
while (!(batch = restaurantService.findUnevaluatedLinks(batchSize)).isEmpty()) {
|
||||||
|
for (Map<String, Object> row : batch) {
|
||||||
|
String linkId = (String) row.get("link_id");
|
||||||
|
if (linkId == null) continue;
|
||||||
|
try {
|
||||||
|
verify(linkId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("verifyAll({}) failed: {}", linkId, e.getMessage());
|
||||||
|
}
|
||||||
|
total++;
|
||||||
|
try { Thread.sleep(BACKFILL_SLEEP_MS); } catch (InterruptedException ie) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (batch.size() < batchSize) break;
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- pure helpers ----
|
||||||
|
|
||||||
|
String buildPrompt(Map<String, Object> ctx) {
|
||||||
|
String foods = safeStr(ctx.get("foods_mentioned"));
|
||||||
|
String evaluation = safeStr(ctx.get("evaluation"));
|
||||||
|
return "다음 YouTube 영상이 이 식당을 어떻게 다루는지 판정하라.\n\n" +
|
||||||
|
"식당명: " + safeStr(ctx.get("restaurant_name")) + "\n" +
|
||||||
|
"주소: " + safeStr(ctx.get("address")) + "\n" +
|
||||||
|
"음식 분류: " + safeStr(ctx.get("cuisine_type")) + "\n" +
|
||||||
|
"언급된 음식: " + (foods.isEmpty() ? "(없음)" : foods) + "\n\n" +
|
||||||
|
"영상 제목: " + safeStr(ctx.get("video_title")) + "\n" +
|
||||||
|
"영상 채널: " + safeStr(ctx.get("channel_name")) + "\n" +
|
||||||
|
"영상에 등장한 평가: " + (evaluation.isEmpty() ? "(없음)" : evaluation) + "\n\n" +
|
||||||
|
"응답 형식(JSON만, 다른 텍스트 없이):\n" +
|
||||||
|
"{\"relevance\": \"strong\"|\"weak\"|\"incidental\", \"reason\": \"20자 이내 한국어\"}\n\n" +
|
||||||
|
"가이드:\n" +
|
||||||
|
"- strong: 영상이 이 식당을 본격 다룸 (방문 리뷰, 메뉴 평가).\n" +
|
||||||
|
"- weak: 잠깐 언급, 다른 식당과 비교 대상으로 등장.\n" +
|
||||||
|
"- incidental: 일반 토픽 중 단순 언급, 식당 입점 전 영상.\n" +
|
||||||
|
"- 판단 모호 시 strong (보수적 — 사용자에게 표시 유지).";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Pattern JSON_BLOCK = Pattern.compile("\\{[^{}]*\\}", Pattern.DOTALL);
|
||||||
|
|
||||||
|
VerifyResult parseRelevance(String raw) {
|
||||||
|
if (raw == null) return VerifyResult.unknown();
|
||||||
|
String trimmed = raw.trim();
|
||||||
|
String json = (trimmed.startsWith("{") && trimmed.endsWith("}")) ? trimmed : null;
|
||||||
|
if (json == null) {
|
||||||
|
Matcher m = JSON_BLOCK.matcher(raw);
|
||||||
|
if (m.find()) json = m.group();
|
||||||
|
}
|
||||||
|
if (json == null) return VerifyResult.unknown();
|
||||||
|
try {
|
||||||
|
JsonNode node = jsonMapper.readTree(json);
|
||||||
|
String rel = node.path("relevance").asText("unknown").toLowerCase();
|
||||||
|
if (!VALID.contains(rel)) rel = "unknown";
|
||||||
|
String reason = node.path("reason").asText("");
|
||||||
|
return new VerifyResult(rel, reason);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return VerifyResult.unknown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String safeStr(Object o) {
|
||||||
|
return o == null ? "" : o.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String truncate(String s, int max) {
|
||||||
|
return s == null ? null : (s.length() <= max ? s : s.substring(0, max));
|
||||||
|
}
|
||||||
|
|
||||||
|
public record VerifyResult(String relevance, String reason) {
|
||||||
|
public static VerifyResult unknown() { return new VerifyResult("unknown", "parse_failed"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.tasteby.util;
|
||||||
|
|
||||||
|
import java.text.Normalizer;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #348 — 한국어 자모 분해(Unicode NFD) + Sørensen-Dice bigram 유사도.
|
||||||
|
*
|
||||||
|
* 음절 단위 Jaccard보다 짧은 한국어 이름에 정확. 예:
|
||||||
|
* similarity("스타벅스 강남", "스타벅스 강남점") ≈ 0.85+
|
||||||
|
* similarity("스타벅스 강남", "스타벅스 종로") ≈ 0.55~0.85
|
||||||
|
* similarity("스타벅스", "맥도날드") < 0.20
|
||||||
|
*
|
||||||
|
* 공백/구두점은 제거하고 소문자화한 뒤 NFD 분해.
|
||||||
|
*/
|
||||||
|
public final class HangulSimilarity {
|
||||||
|
|
||||||
|
private HangulSimilarity() {}
|
||||||
|
|
||||||
|
/** 공백/구두점 제거 + 소문자화 + NFD 분해(한글 음절 → 자모). */
|
||||||
|
public static String decompose(String s) {
|
||||||
|
if (s == null || s.isEmpty()) return "";
|
||||||
|
String stripped = s.replaceAll("[\\s·\\-_()()\\[\\]【】]", "").toLowerCase();
|
||||||
|
return Normalizer.normalize(stripped, Normalizer.Form.NFD);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sørensen-Dice 계수 (bigram multiset 기반). 0.0~1.0.
|
||||||
|
* 동일 문자열 → 1.0. 빈 입력 → 0.0.
|
||||||
|
*/
|
||||||
|
public static double similarity(String a, String b) {
|
||||||
|
String da = decompose(a);
|
||||||
|
String db = decompose(b);
|
||||||
|
if (da.isEmpty() || db.isEmpty()) return 0.0;
|
||||||
|
if (da.equals(db)) return 1.0;
|
||||||
|
|
||||||
|
// 포함 관계는 강한 신호로 1.0 처리 (기존 동작과 일관)
|
||||||
|
if (da.contains(db) || db.contains(da)) return 1.0;
|
||||||
|
|
||||||
|
if (da.length() < 2 || db.length() < 2) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Integer> bigramsA = bigrams(da);
|
||||||
|
Map<String, Integer> bigramsB = bigrams(db);
|
||||||
|
int common = 0;
|
||||||
|
for (var e : bigramsA.entrySet()) {
|
||||||
|
Integer countB = bigramsB.get(e.getKey());
|
||||||
|
if (countB != null) {
|
||||||
|
common += Math.min(e.getValue(), countB);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int sizeA = da.length() - 1;
|
||||||
|
int sizeB = db.length() - 1;
|
||||||
|
return (2.0 * common) / (sizeA + sizeB);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Map<String, Integer> bigrams(String s) {
|
||||||
|
Map<String, Integer> map = new HashMap<>();
|
||||||
|
for (int i = 0; i < s.length() - 1; i++) {
|
||||||
|
String gram = s.substring(i, i + 2);
|
||||||
|
map.merge(gram, 1, Integer::sum);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- #356 영상-식당 관련도 LLM 평가
|
||||||
|
ALTER TABLE video_restaurants ADD (
|
||||||
|
relevance VARCHAR2(16) DEFAULT 'unknown' NOT NULL,
|
||||||
|
relevance_reason VARCHAR2(120),
|
||||||
|
relevance_evaluated_at TIMESTAMP
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_vr_relevance ON video_restaurants(relevance);
|
||||||
@@ -69,14 +69,20 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="findVideoLinks" resultType="map">
|
<select id="findVideoLinks" resultType="map">
|
||||||
SELECT v.video_id, v.title, v.url,
|
<!-- #356 — relevance 컬럼 SELECT + includeWeak 가드 -->
|
||||||
|
SELECT vr.id AS link_id,
|
||||||
|
v.video_id, v.title, v.url,
|
||||||
TO_CHAR(v.published_at, 'YYYY-MM-DD"T"HH24:MI:SS') AS published_at,
|
TO_CHAR(v.published_at, 'YYYY-MM-DD"T"HH24:MI:SS') AS published_at,
|
||||||
vr.foods_mentioned, vr.evaluation, vr.guests,
|
vr.foods_mentioned, vr.evaluation, vr.guests,
|
||||||
|
vr.relevance, vr.relevance_reason,
|
||||||
c.channel_name, c.channel_id
|
c.channel_name, c.channel_id
|
||||||
FROM video_restaurants vr
|
FROM video_restaurants vr
|
||||||
JOIN videos v ON v.id = vr.video_id
|
JOIN videos v ON v.id = vr.video_id
|
||||||
JOIN channels c ON c.id = v.channel_id
|
JOIN channels c ON c.id = v.channel_id
|
||||||
WHERE vr.restaurant_id = #{restaurantId}
|
WHERE vr.restaurant_id = #{restaurantId}
|
||||||
|
<if test="includeWeak == null or !includeWeak">
|
||||||
|
AND vr.relevance IN ('strong', 'unknown')
|
||||||
|
</if>
|
||||||
ORDER BY v.published_at DESC
|
ORDER BY v.published_at DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -315,4 +321,36 @@
|
|||||||
SELECT COUNT(*) FROM restaurants WHERE verified_at IS NULL
|
SELECT COUNT(*) FROM restaurants WHERE verified_at IS NULL
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- ===== #356 영상-식당 관련도 ===== -->
|
||||||
|
|
||||||
|
<update id="updateLinkRelevance">
|
||||||
|
UPDATE video_restaurants
|
||||||
|
SET relevance = #{relevance},
|
||||||
|
relevance_reason = #{reason,jdbcType=VARCHAR},
|
||||||
|
relevance_evaluated_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE id = #{linkId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="findLinkContext" resultType="map">
|
||||||
|
<!-- LLM 평가에 필요한 정보 -->
|
||||||
|
SELECT vr.id AS link_id, vr.foods_mentioned, vr.evaluation,
|
||||||
|
r.id AS restaurant_id, r.name AS restaurant_name, r.address, r.cuisine_type,
|
||||||
|
v.title AS video_title, c.channel_name
|
||||||
|
FROM video_restaurants vr
|
||||||
|
JOIN restaurants r ON r.id = vr.restaurant_id
|
||||||
|
JOIN videos v ON v.id = vr.video_id
|
||||||
|
JOIN channels c ON c.id = v.channel_id
|
||||||
|
WHERE vr.id = #{linkId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findUnevaluatedLinks" resultType="map">
|
||||||
|
SELECT id AS link_id FROM video_restaurants
|
||||||
|
WHERE relevance_evaluated_at IS NULL
|
||||||
|
FETCH FIRST #{limit} ROWS ONLY
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countUnevaluatedLinks" resultType="int">
|
||||||
|
SELECT COUNT(*) FROM video_restaurants WHERE relevance_evaluated_at IS NULL
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
117
docs/design/343-frontend-test-infra/README.md
Normal file
117
docs/design/343-frontend-test-infra/README.md
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
# 설계서: RTL/Jest 인프라 + next/image + ARIA Tabs (#343)
|
||||||
|
|
||||||
|
> **상태**: Approved
|
||||||
|
> **작성**: [AI] Architect · **최종수정**: 2026-06-15
|
||||||
|
> **추적성** — Redmine: #343 · 부모: #281 (현행화 frontend-review-memo, 09-Done)
|
||||||
|
> · 구현 파일: `frontend/package.json`, `frontend/jest.config.ts` (신규), `frontend/jest.setup.ts` (신규), `frontend/next.config.ts`, `frontend/__tests__/*` (신규), `frontend/src/components/MyReviewsList.tsx`, `frontend/src/components/ReviewSection.tsx`
|
||||||
|
> · 테스트: 본 이슈가 테스트 인프라 자체를 도입
|
||||||
|
|
||||||
|
## 1. 목적 (Why)
|
||||||
|
|
||||||
|
본 프로젝트는 지금까지 자동화된 단위 테스트가 0건. 누적된 "후속 테스트" 항목이 12+개(StatsService/CacheService/SearchService/Stars/HangulSimilarity 등)이며, 그동안 분리된 후속 이슈를 처리할 인프라가 없어 모두 보류 상태. 본 이슈에서 Jest + RTL 인프라 도입 + next/image 적용 + ARIA Tabs 보강.
|
||||||
|
|
||||||
|
## 2. 범위 (Scope)
|
||||||
|
|
||||||
|
- **포함**
|
||||||
|
- Jest 30 + `next/jest` 자동 설정 + `@testing-library/react` + `@testing-library/jest-dom`.
|
||||||
|
- `jest.config.ts`, `jest.setup.ts`, `package.json scripts: test, test:watch`.
|
||||||
|
- 샘플 테스트 3개 — 가장 안전한 순수 함수/단순 컴포넌트로 인프라 검증:
|
||||||
|
- `Stars` 컴포넌트 렌더 + 별점 표시
|
||||||
|
- 기존 `HangulSimilarity` (#348) — 자모/유사도
|
||||||
|
- `BotDetector` (#337) — 봇 UA 패턴
|
||||||
|
- `next.config.ts` `images.remotePatterns`에 Google avatar 도메인(`lh3.googleusercontent.com`) + YouTube thumbnail(`i.ytimg.com`).
|
||||||
|
- `ReviewSection`/`MyReviewsList`의 `<img>` 일부를 `next/image` 또는 명시적 eslint-disable로 정리.
|
||||||
|
- `MyReviewsList` 탭에 WAI-ARIA Tabs 패턴(role=tablist/tab/aria-selected/aria-controls).
|
||||||
|
- **제외 (후속)**
|
||||||
|
- 백엔드 JUnit 테스트 인프라 (별도 큰 작업).
|
||||||
|
- E2E (Playwright) 도입.
|
||||||
|
- CI 통합 (GitHub Actions 또는 OCI DevOps).
|
||||||
|
- 모든 컴포넌트 테스트 — 점진적으로 추가.
|
||||||
|
- 모든 `<img>` → `next/image` 전수 교체 — 점진적.
|
||||||
|
|
||||||
|
## 3. 인수조건
|
||||||
|
|
||||||
|
- [ ] `npm test`가 단일 명령으로 동작 (0건 → 샘플 3개 통과).
|
||||||
|
- [ ] `npm run build`가 회귀 없이 통과.
|
||||||
|
- [ ] `next.config.ts`에 `remotePatterns` 설정.
|
||||||
|
- [ ] `ReviewSection`의 user_avatar_url `<img>`에 `next/image` 또는 eslint-disable 주석.
|
||||||
|
- [ ] `MyReviewsList` 탭이 `role="tablist"`/`role="tab"`/`aria-selected`/`aria-controls`/`tabIndex` 설정.
|
||||||
|
|
||||||
|
## 4. 컨텍스트 & 제약
|
||||||
|
|
||||||
|
- Next.js 16.1.6 + Turbopack.
|
||||||
|
- `next/jest`는 SWC/Babel 자동 통합. Turbopack 빌드와는 분리(테스트만 Jest 별도).
|
||||||
|
- Pretendard/Geist 폰트는 `next/font/local` 사용 → 테스트에선 mock 불필요.
|
||||||
|
- 패널 분리(#329)로 admin 영역은 단위 테스트 도입 더 쉬워짐.
|
||||||
|
|
||||||
|
## 5. 아키텍처 개요
|
||||||
|
|
||||||
|
```
|
||||||
|
frontend/
|
||||||
|
├── package.json
|
||||||
|
│ └── scripts: test, test:watch
|
||||||
|
├── jest.config.ts (next/jest createNextJestConfig 사용)
|
||||||
|
├── jest.setup.ts (@testing-library/jest-dom 확장 matchers)
|
||||||
|
├── __tests__/
|
||||||
|
│ ├── Stars.test.tsx
|
||||||
|
│ ├── HangulSimilarity.test.ts (자체 구현은 backend Java, TS 포팅은 미적용 → 다른 순수 함수로 대체)
|
||||||
|
│ └── BotDetector.test.ts (마찬가지 — backend → TS 동등 포팅 불가)
|
||||||
|
└── (대안) 프론트 측 순수 함수:
|
||||||
|
├── lib/cuisine-icons.ts 의 getPhosphorCuisineIcon
|
||||||
|
├── components/Stars 의 0.5 단위 렌더
|
||||||
|
└── i18n/config.ts 의 isLocale/detectBrowserLocale
|
||||||
|
```
|
||||||
|
|
||||||
|
→ 백엔드 Java 코드는 TS 테스트로 검증 불가. 프론트 측 순수 함수 3개로 대체:
|
||||||
|
- `Stars` 렌더 (RTL component test)
|
||||||
|
- `i18n/config.ts` `isLocale` (pure)
|
||||||
|
- `i18n/config.ts` `detectBrowserLocale` (navigator mock)
|
||||||
|
|
||||||
|
## 6. 데이터 모델
|
||||||
|
|
||||||
|
`__tests__/*.test.{tsx,ts}` — Jest 표준 컨벤션.
|
||||||
|
|
||||||
|
## 7. 함수 명세
|
||||||
|
|
||||||
|
| 단위 | 책임 | 비고 |
|
||||||
|
|------|------|------|
|
||||||
|
| `jest.config.ts` | `createJestConfig(customConfig)` + moduleNameMapper `@/*` | next/jest |
|
||||||
|
| `jest.setup.ts` | `import "@testing-library/jest-dom"` | 확장 matchers |
|
||||||
|
| `Stars.test.tsx` | 별점 0/2.5/5 렌더, aria-label 확인 | RTL |
|
||||||
|
| `i18n/config.test.ts` | isLocale/detectBrowserLocale | navigator mock |
|
||||||
|
| `MyReviewsList` Tabs 패치 | tablist/tab/aria-selected | role + aria |
|
||||||
|
| `ReviewSection` img → eslint-disable | 최소 변경 | next/image는 후속 |
|
||||||
|
|
||||||
|
## 8. 흐름
|
||||||
|
|
||||||
|
1. `npm i -D jest jest-environment-jsdom @testing-library/react @testing-library/jest-dom @testing-library/user-event @types/jest`.
|
||||||
|
2. `jest.config.ts` + `jest.setup.ts` 작성.
|
||||||
|
3. `package.json`에 `"test": "jest"` + `"test:watch": "jest --watch"` 추가.
|
||||||
|
4. `__tests__/`에 3개 샘플 테스트.
|
||||||
|
5. `next.config.ts`에 `remotePatterns` 추가.
|
||||||
|
6. `MyReviewsList` Tabs ARIA 보강.
|
||||||
|
7. `ReviewSection`의 `<img>` 라인에 `// eslint-disable-next-line @next/next/no-img-element` (next/image 전환은 후속).
|
||||||
|
8. `npm test` 통과 → `npm run build` 통과.
|
||||||
|
|
||||||
|
## 9. 엣지케이스
|
||||||
|
|
||||||
|
- **Turbopack vs Jest**: 무관 (테스트는 별도 SWC 컴파일).
|
||||||
|
- **CSS modules / globals.css import**: jest.config.ts의 moduleNameMapper로 `\\.(css|scss)$` → `identity-obj-proxy` 대신 next/jest가 자동 처리.
|
||||||
|
- **Next.js Server Components**: 본 프로젝트는 모두 `"use client"` 컴포넌트라 RTL이 통상 동작.
|
||||||
|
|
||||||
|
## 10. 테스트
|
||||||
|
|
||||||
|
자기 자신 — `npm test`가 통과해야 본 이슈 완료.
|
||||||
|
|
||||||
|
## 11. 리스크 & 대안
|
||||||
|
|
||||||
|
- **선택**: `next/jest` + RTL. Next.js 공식 권장.
|
||||||
|
- **대안 A**: Vitest — 더 빠르지만 Next.js 공식 가이드 부재, 본 프로젝트 규모에서 차이 작음.
|
||||||
|
- **대안 B**: Playwright Component Testing — 더 무겁고 E2E 통합 안 됨.
|
||||||
|
- **트레이드오프**: Jest 30 + RTL은 React 19에 호환. 의존성 부담은 dev-only.
|
||||||
|
|
||||||
|
## 12. 미해결 질문
|
||||||
|
|
||||||
|
- CI(테스트 자동 실행) — 본 이슈 범위 밖. OCI DevOps Build Pipeline은 ARM64 미지원 → GitHub Actions 또는 Gitea Actions 후속.
|
||||||
|
- 백엔드 JUnit 테스트 인프라 — 별도 큰 이슈.
|
||||||
|
- E2E (Playwright) — 별도.
|
||||||
80
docs/design/348-name-similarity/README.md
Normal file
80
docs/design/348-name-similarity/README.md
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# 설계서: isNameSimilar 한국어 자모 분해 + Sørensen-Dice (#348)
|
||||||
|
|
||||||
|
> **상태**: Approved
|
||||||
|
> **작성**: [AI] Architect · **최종수정**: 2026-06-15
|
||||||
|
> **추적성** — Redmine: #348 · 부모: #332 (이미 close)
|
||||||
|
> · 구현 파일: `backend-java/src/main/java/com/tasteby/util/HangulSimilarity.java` (신규), `backend-java/src/main/java/com/tasteby/controller/RestaurantController.java`
|
||||||
|
|
||||||
|
## 1. 목적
|
||||||
|
|
||||||
|
기존 `isNameSimilar`가 Jaccard-like(문자 set 교집합 비율 ≥ 0.4)로 짧은 한국어 이름에서 오탐 가능. 자모 분해 + Sørensen-Dice bigram으로 정확도 향상.
|
||||||
|
|
||||||
|
## 2. 범위
|
||||||
|
|
||||||
|
- **포함**
|
||||||
|
- `HangulSimilarity.similarity(a, b)` 유틸 신규
|
||||||
|
- `RestaurantController.isNameSimilar` 호출부를 새 유틸로 교체
|
||||||
|
- **제외 (별도 후속으로 분리)**
|
||||||
|
- DDG → 정식 검색 API 전환 (외부 API 결정 + 비용/계약 필요)
|
||||||
|
- DTO RestaurantUpdateDTO + @Valid 표준화 (#332 화이트리스트 set으로 SQL 측 가드 확보)
|
||||||
|
- UNIQUE(google_place_id) 제약 강화 — DB 중복 정리 선행 필요(현재 10+건 중복 확인)
|
||||||
|
|
||||||
|
## 3. 인수조건
|
||||||
|
|
||||||
|
- [ ] `HangulSimilarity.similarity(a, b)` 0.0~1.0 반환 (1.0=동일)
|
||||||
|
- [ ] 한국어 음절을 Unicode NFD로 자모 분해(초성·중성·종성)
|
||||||
|
- [ ] 분해 후 bigram 기반 Sørensen-Dice 계수 계산
|
||||||
|
- [ ] 빈 문자열 안전 처리 (둘 다 비면 0.0, 한쪽만 비면 0.0)
|
||||||
|
- [ ] `RestaurantController.isNameSimilar` 임계값 0.45로 호출 (Jaccard 0.4와 유사 보수성)
|
||||||
|
- [ ] 회귀 없음 — 기존 정상 매칭 시나리오 통과
|
||||||
|
|
||||||
|
## 4. 컨텍스트 & 제약
|
||||||
|
|
||||||
|
- Java 21 `Normalizer.normalize(Form.NFD)` 활용.
|
||||||
|
- 한글 음절(가-힣) NFD → 초성(ㄱ-ㅎ 호환자모 또는 조합자모) + 중성 + 종성.
|
||||||
|
- 영문/숫자는 그대로 통과.
|
||||||
|
- Sørensen-Dice: `2 * |A ∩ B| / (|A| + |B|)` — bigram 다중집합(multiset) 기준.
|
||||||
|
|
||||||
|
## 5. 함수 명세
|
||||||
|
|
||||||
|
| 함수 | 책임 | 시그니처 |
|
||||||
|
|------|------|---------|
|
||||||
|
| `decomposeHangul(s)` | NFD 자모 분해 + 공백/구두점 제거 + 소문자화 | `static String decompose(String)` |
|
||||||
|
| `bigrams(s)` | 2글자 bigram 리스트 | `static List<String> bigrams(String)` |
|
||||||
|
| `similarity(a, b)` | Sørensen-Dice 0.0~1.0 | `static double similarity(String, String)` |
|
||||||
|
|
||||||
|
## 6. 흐름
|
||||||
|
|
||||||
|
1. 두 이름을 `decompose`로 자모 분해 + 정규화.
|
||||||
|
2. 각 분해 결과를 `bigrams`로 분해.
|
||||||
|
3. multiset 교집합 크기 카운트.
|
||||||
|
4. `2 * common / (sizeA + sizeB)`.
|
||||||
|
|
||||||
|
## 7. 엣지케이스
|
||||||
|
|
||||||
|
- **둘 다 빈 문자열**: 0.0 반환.
|
||||||
|
- **bigram 1개 이하**: 두 문자열 같으면 1.0, 아니면 0.0.
|
||||||
|
- **포함 관계**: 기존 코드의 `a.contains(b) || b.contains(a)` 단축 평가 유지 (1.0 반환).
|
||||||
|
- **혼합(한영)**: NFD가 한글만 분해 → 영문은 그대로. bigram 계산은 동일하게 동작.
|
||||||
|
|
||||||
|
## 8. 테스트 (수동)
|
||||||
|
|
||||||
|
```
|
||||||
|
similarity("스타벅스 강남", "스타벅스 강남점") → ≥ 0.85
|
||||||
|
similarity("스타벅스 강남", "스타벅스 종로") → ≥ 0.55, < 0.85
|
||||||
|
similarity("스타벅스", "맥도날드") → < 0.20
|
||||||
|
similarity("PIZZAHUT", "피자헛") → 한글 + 영문 혼재 가드 통과
|
||||||
|
```
|
||||||
|
|
||||||
|
## 9. 리스크 & 대안
|
||||||
|
|
||||||
|
- **선택**: NFD 분해 + bigram Sørensen-Dice. Java 표준 라이브러리만 사용.
|
||||||
|
- **대안 A**: Apache Commons Text `JaroWinklerSimilarity` — 라이브러리 추가 부담.
|
||||||
|
- **대안 B**: Hangul.js류 라이브러리 — Java 포팅 없음.
|
||||||
|
- **대안 C**: Levenshtein 거리 — 자모 분해와 결합 시 좋으나 구현 복잡.
|
||||||
|
|
||||||
|
## 10. 미해결 질문 / 분리된 후속
|
||||||
|
|
||||||
|
- DDG → 정식 검색 API: Naver Search API 또는 Google Custom Search (외부 API 결정 + 비용 검토 필요) — 별도 신규 이슈
|
||||||
|
- DTO RestaurantUpdateDTO + @Valid: #332 set 화이트리스트로 1차 가드. 본격 DTO는 큰 변경 — 별도 신규 이슈
|
||||||
|
- UNIQUE(google_place_id) 제약: 현재 10+건 중복. 데이터 정리(병합/삭제) 선행 → 별도 신규 이슈
|
||||||
141
docs/design/352-i18n-skeleton/README.md
Normal file
141
docs/design/352-i18n-skeleton/README.md
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
# 설계서: i18n 뼈대 — ko/en/ja/es (#352)
|
||||||
|
|
||||||
|
> **상태**: Approved
|
||||||
|
> **작성**: [AI] Architect · **최종수정**: 2026-06-15
|
||||||
|
> **추적성** — Redmine: #352
|
||||||
|
> · 구현 파일: `frontend/package.json`, `frontend/next.config.ts`, `frontend/src/i18n/*` (신규), `frontend/src/messages/{ko,en,ja,es}.json` (신규), `frontend/src/components/LanguageSwitcher.tsx` (신규)
|
||||||
|
> · 테스트: 수동 (언어 전환 + ko fallback)
|
||||||
|
|
||||||
|
## 1. 목적
|
||||||
|
|
||||||
|
장기적으로 영어/일본어/스페인어 시장으로 확장 가능하도록 i18n 뼈대 구축. 본 이슈는 *뼈대*만 — 약 30개 키 초기 번역.
|
||||||
|
|
||||||
|
## 2. 범위
|
||||||
|
|
||||||
|
- **포함**
|
||||||
|
- `next-intl` 라이브러리 도입 (Next.js 16 App Router 권장).
|
||||||
|
- 4개 로케일: `ko, en, ja, es`. 기본 `ko`, fallback `ko`.
|
||||||
|
- 메시지 디렉토리 `src/messages/{ko,en,ja,es}.json`.
|
||||||
|
- Provider (`<NextIntlClientProvider>`) 루트 layout 적용.
|
||||||
|
- `LanguageSwitcher` 컴포넌트 (헤더 우측).
|
||||||
|
- 로케일 저장: localStorage `tasteby_locale`.
|
||||||
|
- 초기 번역 키 ~30개: 헤더(로그인/검색/메뉴) + 주요 액션(저장/취소/삭제/확인) + 페이지 제목.
|
||||||
|
- **제외**
|
||||||
|
- URL 라우팅 i18n (`/ko/...`).
|
||||||
|
- SEO meta tags i18n.
|
||||||
|
- 식당명/리뷰 등 사용자 콘텐츠 번역.
|
||||||
|
- 어드민 페이지(운영자만 사용, 한국어 유지).
|
||||||
|
- 식당 카드/상세 시트 전체 키 추출 (점진).
|
||||||
|
|
||||||
|
## 3. 인수조건
|
||||||
|
|
||||||
|
- [ ] `npm i next-intl` + 4개 메시지 파일 생성.
|
||||||
|
- [ ] `tasteby_locale`이 localStorage에 있으면 사용, 없으면 브라우저 언어 감지(`navigator.language`) → 매칭 안되면 `ko`.
|
||||||
|
- [ ] 헤더 우측 LanguageSwitcher 드롭다운(국기 + 코드).
|
||||||
|
- [ ] 초기 번역 키 약 30개 — 4개 언어 모두 채움.
|
||||||
|
- [ ] 미번역 키는 `ko` fallback (에러 없이).
|
||||||
|
- [ ] 빌드/배포 회귀 없음.
|
||||||
|
|
||||||
|
## 4. 컨텍스트 & 제약
|
||||||
|
|
||||||
|
- Next.js 16 + App Router + `"use client"` 컴포넌트 다수.
|
||||||
|
- 기존 `auth-context`처럼 i18n도 React Context 패턴.
|
||||||
|
- `next-intl`은 server/client 모두 지원, 본 프로젝트는 client-side switching이라 `NextIntlClientProvider` 중심.
|
||||||
|
- URL 라우팅 변경 없이 단순 메시지만 교체(낮은 비용).
|
||||||
|
- 폰트: Pretendard Variable이 한국어/영어 잘 표시, 일본어는 시스템 폰트 fallback OK, 스페인어는 라틴 문자라 OK.
|
||||||
|
|
||||||
|
## 5. 아키텍처 개요
|
||||||
|
|
||||||
|
```
|
||||||
|
frontend/
|
||||||
|
├── src/
|
||||||
|
│ ├── i18n/
|
||||||
|
│ │ ├── config.ts ← 로케일 목록/기본값 상수
|
||||||
|
│ │ ├── LocaleProvider.tsx ← NextIntlClientProvider wrap + localStorage 저장
|
||||||
|
│ │ └── useTranslations.ts ← (next-intl 재export)
|
||||||
|
│ ├── messages/
|
||||||
|
│ │ ├── ko.json ← 기본
|
||||||
|
│ │ ├── en.json
|
||||||
|
│ │ ├── ja.json
|
||||||
|
│ │ └── es.json
|
||||||
|
│ ├── components/
|
||||||
|
│ │ └── LanguageSwitcher.tsx ← 헤더용
|
||||||
|
│ └── app/
|
||||||
|
│ └── layout.tsx ← LocaleProvider로 감싸기
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. 데이터 모델
|
||||||
|
|
||||||
|
### 메시지 키 (초기 ~30)
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"header": {
|
||||||
|
"search": "검색", "login": "로그인", "logout": "로그아웃",
|
||||||
|
"menu": "메뉴", "myReviews": "내 리뷰", "favorites": "즐겨찾기"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"save": "저장", "cancel": "취소", "delete": "삭제",
|
||||||
|
"edit": "수정", "confirm": "확인", "close": "닫기",
|
||||||
|
"loading": "로딩 중...", "submit": "제출"
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"title": "필터", "cuisine": "음식 종류", "price": "가격대",
|
||||||
|
"region": "지역", "channel": "채널", "reset": "초기화"
|
||||||
|
},
|
||||||
|
"restaurant": {
|
||||||
|
"rating": "평점", "address": "주소", "phone": "전화",
|
||||||
|
"website": "웹사이트", "closed": "폐업", "tempClosed": "임시휴업"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"title": "리뷰", "write": "리뷰 작성", "noReviews": "아직 리뷰가 없습니다"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
총 5개 카테고리 × 평균 6개 = 30개 키.
|
||||||
|
|
||||||
|
## 7. 함수 명세
|
||||||
|
|
||||||
|
| 함수/컴포넌트 | 책임 | 비고 |
|
||||||
|
|---|---|---|
|
||||||
|
| `i18n/config.ts` | LOCALES, DEFAULT_LOCALE 상수 | 단순 |
|
||||||
|
| `LocaleProvider.tsx` | NextIntlClientProvider wrap + 메시지 동적 로딩 + localStorage 동기화 | client |
|
||||||
|
| `LanguageSwitcher.tsx` | 헤더 드롭다운 (국기 + 코드) | client, 44px 터치 |
|
||||||
|
| `messages/<lang>.json` | 키 → 텍스트 | flat or nested |
|
||||||
|
|
||||||
|
## 8. 흐름
|
||||||
|
|
||||||
|
1. 사용자 첫 방문 → `tasteby_locale` 없음 → `navigator.language.split('-')[0]`이 LOCALES에 있으면 사용, 아니면 `ko`.
|
||||||
|
2. LocaleProvider가 해당 로케일 메시지 파일 import → NextIntlClientProvider에 전달.
|
||||||
|
3. 컴포넌트는 `useTranslations('header')` 등으로 호출.
|
||||||
|
4. LanguageSwitcher에서 변경 → localStorage 저장 → 페이지 새로고침 또는 state 업데이트.
|
||||||
|
|
||||||
|
## 9. 엣지케이스
|
||||||
|
|
||||||
|
- **메시지 파일 누락 키**: next-intl 기본 동작은 키 자체 표시 + 콘솔 경고. fallback 처리는 messages 명시.
|
||||||
|
- **localStorage 비활성/SSR**: typeof window 체크.
|
||||||
|
- **로케일 코드 대소문자**: 항상 소문자 정규화.
|
||||||
|
- **placeholder 변수**: next-intl ICU 메시지 형식 지원 (`{name}` 등). 초기 키에는 미적용.
|
||||||
|
|
||||||
|
## 10. 테스트
|
||||||
|
|
||||||
|
- 수동:
|
||||||
|
- 한국어 첫 방문 → "검색" 표시.
|
||||||
|
- LanguageSwitcher에서 English → "Search" 표시.
|
||||||
|
- 새로고침 후 영어 유지.
|
||||||
|
- 메시지 누락 키 → 콘솔 경고 + 키 표시.
|
||||||
|
|
||||||
|
## 11. 리스크 & 대안
|
||||||
|
|
||||||
|
- **선택**: `next-intl` (Next.js 16 App Router 권장, ICU 메시지, 활발 유지보수).
|
||||||
|
- **대안 A**: `react-i18next` — 더 일반적이지만 App Router 통합 next-intl이 더 매끄러움.
|
||||||
|
- **대안 B**: 자체 구현 + Context — 의존성 ↓ but 기능/표준화 ↓.
|
||||||
|
- **트레이드오프**: 30개 키는 단순하지만 ICU 메시지(복수형, 성별 등) 필요 시 next-intl 가치 큼.
|
||||||
|
|
||||||
|
## 12. 미해결 질문
|
||||||
|
|
||||||
|
- 식당명/리뷰 콘텐츠 번역 — 사용자 작성이라 자동 번역(LLM)? 별도 정책 결정.
|
||||||
|
- URL 라우팅 i18n (`/en/`) — 후속.
|
||||||
|
- SEO meta tags i18n — 후속.
|
||||||
|
- 어드민 페이지는 운영자 한국어 유지 — 확정.
|
||||||
|
- 통화/날짜 포맷(Intl API) — 후속.
|
||||||
172
docs/design/356-video-relevance-llm/README.md
Normal file
172
docs/design/356-video-relevance-llm/README.md
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
# 설계서: 영상-식당 관련도 LLM 평가로 약한 매칭 자동 숨김 (#356)
|
||||||
|
|
||||||
|
> **상태**: Approved
|
||||||
|
> **작성**: [AI] Architect · **최종수정**: 2026-06-15
|
||||||
|
> **추적성** — Redmine: #356 · 유사 패턴: #322(식당 LLM 검증, 09-Done) · 부모 영역: #270(영상→식당 추출 파이프라인 현행화, 09-Done)
|
||||||
|
> · 구현 파일: `backend-java/src/main/java/com/tasteby/service/VideoRelevanceService.java`(신규), `backend-java/src/main/resources/mybatis/mapper/RestaurantMapper.xml`, `backend-java/src/main/java/com/tasteby/service/RestaurantService.java`, `backend-java/src/main/java/com/tasteby/controller/AdminVideoRelevanceController.java`(신규), DB 마이그레이션 SQL
|
||||||
|
> · 테스트: 본 범위 밖 (테스트 인프라 #343 도입됨, 후속에서 점진 확장)
|
||||||
|
|
||||||
|
## 1. 목적 (Why)
|
||||||
|
|
||||||
|
식당 상세에 연결된 영상 중 식당과 **본격적으로 관련 없는 약한 언급**(비교 대상, 일반 토픽 중 잠깐 언급, 식당 입점 전 영상 등)이 노이즈로 표시. 실제 케이스 — 파이브가이즈 강남의 영상 7개 중 3건이 약한 매칭(쉐이크쉑 비교 / 미국 비만율 일반 토픽 / 한국 입점 전 미국 여행). LLM 평가로 약한 매칭 자동 숨김.
|
||||||
|
|
||||||
|
## 2. 범위 (Scope)
|
||||||
|
|
||||||
|
- **포함**
|
||||||
|
- `video_restaurants` 테이블에 `relevance`, `relevance_reason`, `relevance_evaluated_at` 컬럼 추가.
|
||||||
|
- `VideoRelevanceService` 신규 — LLM 판정 + DB 반영 (`#322` 패턴 모방).
|
||||||
|
- `PipelineService.processExtract` 완료 후 `verifyAsync(linkId)` 호출 — 신규 등록 자동 평가.
|
||||||
|
- `GET /api/restaurants/{id}/videos`: 기본 `relevance = 'strong'`만 응답. `?include_weak=true` 시 모두 포함.
|
||||||
|
- 어드민 API: 단건 재평가 / 일괄 백필 / 수동 토글.
|
||||||
|
- **제외 (별도 후속)**
|
||||||
|
- 어드민 UI(검증 칼럼 / 토글) — `#322`의 RestaurantsPanel UI와 같은 패턴으로 별도 후속.
|
||||||
|
- 프론트 사용자 옵션 UI("약한 매칭도 보기" 토글) — 별도 후속.
|
||||||
|
- LLM 비용 모니터링/메트릭 — 별도.
|
||||||
|
|
||||||
|
## 3. 인수조건
|
||||||
|
|
||||||
|
- [ ] `video_restaurants` 테이블에 `relevance VARCHAR2(16) DEFAULT 'unknown'`, `relevance_reason VARCHAR2(120)`, `relevance_evaluated_at TIMESTAMP` 컬럼 + `idx_vr_relevance` 인덱스.
|
||||||
|
- [ ] 가능한 값: `strong | weak | incidental | unknown` (unknown = 미평가).
|
||||||
|
- [ ] 신규 등록 시 60초 안에 `relevance_evaluated_at` 설정.
|
||||||
|
- [ ] `GET /api/restaurants/{id}/videos` 기본 응답: `relevance IN ('strong','unknown')` (안전한 기본값 = 평가 실패 시 표시).
|
||||||
|
- [ ] `?include_weak=true`: 모두 포함 + `relevance`, `relevance_reason` 필드 동봉.
|
||||||
|
- [ ] 어드민 API:
|
||||||
|
- `GET /api/admin/video-relevance/pending` → 미평가(unknown) 카운트
|
||||||
|
- `POST /api/admin/video-relevance/all?batchSize=10` → 백필
|
||||||
|
- `POST /api/admin/video-relevance/{linkId}/evaluate` → 단건 재평가
|
||||||
|
- `PATCH /api/admin/video-relevance/{linkId}` → 수동 강제 토글 `{relevance, reason}`
|
||||||
|
- [ ] LLM 호출 실패 시 `unknown` 유지 + 로그 (`#322`와 같은 안전 기본값).
|
||||||
|
- [ ] 빌드/배포 회귀 없음.
|
||||||
|
|
||||||
|
## 4. 컨텍스트 & 제약
|
||||||
|
|
||||||
|
- 기존 `OciGenAiService.chat(prompt, maxTokens)` 재사용.
|
||||||
|
- LLM 비용: 영상-식당 페어당 1회 단발. 현재 1,244건 → 백필 시 약 1,244 호출.
|
||||||
|
- `video_restaurants`는 한 영상에 여러 식당, 한 식당에 여러 영상이 m:n 관계.
|
||||||
|
- 같은 페어는 `relevance_evaluated_at`이 NULL 아니면 재평가 안 함 (캐시).
|
||||||
|
|
||||||
|
## 5. 아키텍처 개요
|
||||||
|
|
||||||
|
```
|
||||||
|
PipelineService.processExtract (기존)
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
RestaurantService.linkVideoRestaurant (video_restaurants INSERT)
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
VideoRelevanceService.verifyAsync(linkId) ← #356 신규
|
||||||
|
│ (비동기)
|
||||||
|
▼
|
||||||
|
OciGenAiService.chat(prompt, 120)
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
parseRelevance → { relevance: strong|weak|incidental, reason: string }
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
RestaurantMapper.updateRelevance(linkId, relevance, reason)
|
||||||
|
│
|
||||||
|
▼ (조회 시)
|
||||||
|
RestaurantMapper.findVideoLinks(restaurantId, includeWeak)
|
||||||
|
├ includeWeak=false (기본): WHERE relevance IN ('strong','unknown')
|
||||||
|
└ includeWeak=true: 모두 + relevance/reason 필드 노출
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. 데이터 모델
|
||||||
|
|
||||||
|
### DB 마이그레이션
|
||||||
|
```sql
|
||||||
|
ALTER TABLE video_restaurants ADD (
|
||||||
|
relevance VARCHAR2(16) DEFAULT 'unknown' NOT NULL,
|
||||||
|
relevance_reason VARCHAR2(120),
|
||||||
|
relevance_evaluated_at TIMESTAMP
|
||||||
|
);
|
||||||
|
CREATE INDEX idx_vr_relevance ON video_restaurants(relevance);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 도메인 (`VideoRestaurantLink` 확장은 본 범위 밖 — findVideoLinks는 `resultType="map"`)
|
||||||
|
응답 Map에 키 추가:
|
||||||
|
- `relevance`: `"strong" | "weak" | "incidental" | "unknown"`
|
||||||
|
- `relevance_reason`: `string | null`
|
||||||
|
|
||||||
|
### LLM 응답 스키마
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"relevance": "strong" | "weak" | "incidental",
|
||||||
|
"reason": "20자 이내"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7. 함수 명세
|
||||||
|
|
||||||
|
| 함수 | 책임 | 비고 |
|
||||||
|
|---|---|---|
|
||||||
|
| `VideoRelevanceService.verifyAsync(linkId)` | 비동기 트리거 | `#322`의 `RestaurantVerifyService.verifyAsync` 유사 |
|
||||||
|
| `VideoRelevanceService.verify(linkId)` | 단건 검증 + DB 반영 | LLM 실패 시 unknown 유지 |
|
||||||
|
| `VideoRelevanceService.verifyAll(batchSize)` | 백필 (식당당 200ms sleep) | |
|
||||||
|
| `VideoRelevanceService.buildPrompt(...)` | 프롬프트 생성 | 식당명·주소·음식·영상 제목·평가 |
|
||||||
|
| `VideoRelevanceService.parseRelevance(raw)` | LLM 응답 → DTO | 파싱 실패 시 unknown 안전 기본값 |
|
||||||
|
| `RestaurantMapper.updateRelevance(linkId, rel, reason)` | DB 갱신 | |
|
||||||
|
| `RestaurantMapper.findVideoLinks(restaurantId, includeWeak)` | 기존 SQL에 WHERE 조건 추가 | |
|
||||||
|
| `AdminVideoRelevanceController` 신규 | 4개 admin endpoint | requireAdmin |
|
||||||
|
|
||||||
|
## 8. 흐름
|
||||||
|
|
||||||
|
### 신규 등록 자동 평가
|
||||||
|
1. `PipelineService.processExtract` → `linkVideoRestaurant` → linkId 획득.
|
||||||
|
2. `VideoRelevanceService.verifyAsync(linkId)` 호출(@Async).
|
||||||
|
3. 별도 스레드: 영상/식당/평가 데이터 조회 → buildPrompt → LLM → parse → DB.
|
||||||
|
|
||||||
|
### 백필
|
||||||
|
1. 어드민 `POST /api/admin/video-relevance/all` 호출.
|
||||||
|
2. `WHERE relevance_evaluated_at IS NULL` 인 link 10개씩 조회 → 순차 검증.
|
||||||
|
3. 식당당 200ms sleep (LLM rate 보호).
|
||||||
|
|
||||||
|
### 프롬프트 예시
|
||||||
|
```
|
||||||
|
다음 YouTube 영상이 이 식당을 어떻게 다루는지 판정하라.
|
||||||
|
|
||||||
|
식당명: {restaurantName}
|
||||||
|
주소: {address}
|
||||||
|
음식: {foodsMentioned}
|
||||||
|
|
||||||
|
영상 제목: {videoTitle}
|
||||||
|
영상 채널: {channelName}
|
||||||
|
영상에 등장한 평가 내용: {evaluation}
|
||||||
|
|
||||||
|
응답 형식(JSON만, 다른 텍스트 없이):
|
||||||
|
{"relevance": "strong"|"weak"|"incidental", "reason": "20자 이내 한국어"}
|
||||||
|
|
||||||
|
가이드:
|
||||||
|
- strong: 영상 본편이 이 식당을 본격 다룸. 방문 리뷰, 메뉴 평가 등.
|
||||||
|
- weak: 영상에서 잠깐 언급, 비교 대상으로만 등장, 다른 식당의 일부로.
|
||||||
|
- incidental: 식당 입점 전 영상에서 단순 언급, 일반 토픽(미국 비만, 환율 등)에서 잠깐.
|
||||||
|
- 판단 모호 시 strong (보수적 — 사용자에게 표시 유지).
|
||||||
|
```
|
||||||
|
|
||||||
|
## 9. 엣지케이스
|
||||||
|
|
||||||
|
- **LLM 응답 비-JSON**: parseRelevance → unknown 기본값.
|
||||||
|
- **LLM 호출 실패**: unknown 유지 → 다음 백필 재시도.
|
||||||
|
- **영상 데이터 누락(transcript 없음, evaluation 비어있음)**: 프롬프트에 "(미상)" 표기. LLM이 판정 어려우면 strong 보수적.
|
||||||
|
- **동시성**: 같은 linkId verifyAsync 두 번 호출 → idempotent.
|
||||||
|
- **삭제된 영상**: linkId 조회 결과 없으면 no-op.
|
||||||
|
|
||||||
|
## 10. 테스트 (수동)
|
||||||
|
|
||||||
|
- 파이브가이즈 강남 케이스 백필 → 7건 중 3건이 weak/incidental로 마킹되는지 확인.
|
||||||
|
- 공개 API `/api/restaurants/{id}/videos` → 약한 매칭 제외 확인.
|
||||||
|
- `?include_weak=true` → 모두 포함 확인.
|
||||||
|
|
||||||
|
## 11. 리스크 & 대안
|
||||||
|
|
||||||
|
- **선택**: `#322` 동일 패턴 + DB 마이그레이션.
|
||||||
|
- **대안 A**: 사용자가 직접 "약한 매칭도 보기" 토글 → 사용자 결정 부담.
|
||||||
|
- **대안 B**: 추출 단계에서 한 번에 판정 → 비용 ↓이지만 ExtractorService 비대.
|
||||||
|
- **트레이드오프**: 단발 LLM 평가는 비용 합리적. false positive는 어드민 수동 토글 + `unknown` 안전 기본값으로 보완.
|
||||||
|
|
||||||
|
## 12. 미해결 질문
|
||||||
|
|
||||||
|
- 임계값(weak/incidental 둘 다 숨김 vs incidental만 숨김) — 현재는 둘 다 숨김.
|
||||||
|
- 영상 자막 전체를 LLM에 보낼지 vs 평가 텍스트만 → 비용/정확도 트레이드오프. 현재는 evaluation만(짧음).
|
||||||
|
- 사용자에게 "약한 매칭도 보기" UI → 별도 후속.
|
||||||
|
- 어드민 UI — 별도 후속 (#322 패턴 모방).
|
||||||
36
frontend/__tests__/Stars.test.tsx
Normal file
36
frontend/__tests__/Stars.test.tsx
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
* #343 — Stars 컴포넌트 렌더 테스트.
|
||||||
|
*/
|
||||||
|
import { render, screen } from "@testing-library/react";
|
||||||
|
import Stars from "@/components/Stars";
|
||||||
|
|
||||||
|
describe("Stars", () => {
|
||||||
|
it("renders 5 star slots", () => {
|
||||||
|
const { container } = render(<Stars rating={3} />);
|
||||||
|
// 빈 별 5개 (text-gray-300 클래스 갖는 span)
|
||||||
|
const emptyStars = container.querySelectorAll("span.text-gray-300");
|
||||||
|
expect(emptyStars.length).toBe(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows aria-label with rating", () => {
|
||||||
|
render(<Stars rating={4.5} />);
|
||||||
|
expect(screen.getByLabelText("4.5점")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("clamps rating to 0~5", () => {
|
||||||
|
render(<Stars rating={-1} />);
|
||||||
|
expect(screen.getByLabelText("0점")).toBeInTheDocument();
|
||||||
|
render(<Stars rating={10} />);
|
||||||
|
expect(screen.getByLabelText("5점")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("shows number when showNumber + rating > 0", () => {
|
||||||
|
const { container } = render(<Stars rating={3.5} showNumber />);
|
||||||
|
expect(container.textContent).toContain("3.5");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not show number when rating is 0 even with showNumber", () => {
|
||||||
|
const { container } = render(<Stars rating={0} showNumber />);
|
||||||
|
expect(container.textContent).not.toContain("0");
|
||||||
|
});
|
||||||
|
});
|
||||||
28
frontend/__tests__/admin-utils.test.ts
Normal file
28
frontend/__tests__/admin-utils.test.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* #343 — admin-utils 순수 함수 단위 테스트.
|
||||||
|
*/
|
||||||
|
import { getAdminToken, authHeaders } from "@/lib/admin-utils";
|
||||||
|
|
||||||
|
describe("admin-utils", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
localStorage.clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("getAdminToken returns null when not set", () => {
|
||||||
|
expect(getAdminToken()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("getAdminToken returns stored token", () => {
|
||||||
|
localStorage.setItem("tasteby_token", "abc123");
|
||||||
|
expect(getAdminToken()).toBe("abc123");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("authHeaders is empty when no token", () => {
|
||||||
|
expect(authHeaders()).toEqual({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("authHeaders includes Bearer when token set", () => {
|
||||||
|
localStorage.setItem("tasteby_token", "xyz");
|
||||||
|
expect(authHeaders()).toEqual({ Authorization: "Bearer xyz" });
|
||||||
|
});
|
||||||
|
});
|
||||||
42
frontend/__tests__/i18n-config.test.ts
Normal file
42
frontend/__tests__/i18n-config.test.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* #343 — i18n/config 순수 함수 단위 테스트.
|
||||||
|
*/
|
||||||
|
import { isLocale, detectBrowserLocale, DEFAULT_LOCALE } from "@/i18n/config";
|
||||||
|
|
||||||
|
describe("i18n/config.isLocale", () => {
|
||||||
|
it("returns true for supported locales", () => {
|
||||||
|
expect(isLocale("ko")).toBe(true);
|
||||||
|
expect(isLocale("en")).toBe(true);
|
||||||
|
expect(isLocale("ja")).toBe(true);
|
||||||
|
expect(isLocale("es")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("returns false for unsupported / null / undefined", () => {
|
||||||
|
expect(isLocale("fr")).toBe(false);
|
||||||
|
expect(isLocale("zh")).toBe(false);
|
||||||
|
expect(isLocale(null)).toBe(false);
|
||||||
|
expect(isLocale(undefined)).toBe(false);
|
||||||
|
expect(isLocale("")).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("i18n/config.detectBrowserLocale", () => {
|
||||||
|
// jsdom의 navigator.language는 기본 'en-US'
|
||||||
|
it("returns supported locale from navigator.language", () => {
|
||||||
|
Object.defineProperty(navigator, "language", { value: "en-US", configurable: true });
|
||||||
|
expect(detectBrowserLocale()).toBe("en");
|
||||||
|
Object.defineProperty(navigator, "language", { value: "ko-KR", configurable: true });
|
||||||
|
expect(detectBrowserLocale()).toBe("ko");
|
||||||
|
Object.defineProperty(navigator, "language", { value: "ja", configurable: true });
|
||||||
|
expect(detectBrowserLocale()).toBe("ja");
|
||||||
|
Object.defineProperty(navigator, "language", { value: "es-MX", configurable: true });
|
||||||
|
expect(detectBrowserLocale()).toBe("es");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("falls back to DEFAULT_LOCALE for unsupported", () => {
|
||||||
|
Object.defineProperty(navigator, "language", { value: "fr-FR", configurable: true });
|
||||||
|
expect(detectBrowserLocale()).toBe(DEFAULT_LOCALE);
|
||||||
|
Object.defineProperty(navigator, "language", { value: "zh-CN", configurable: true });
|
||||||
|
expect(detectBrowserLocale()).toBe(DEFAULT_LOCALE);
|
||||||
|
});
|
||||||
|
});
|
||||||
21
frontend/jest.config.ts
Normal file
21
frontend/jest.config.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
// #343 — Jest 설정. next/jest로 SWC 자동 통합.
|
||||||
|
|
||||||
|
import type { Config } from "jest";
|
||||||
|
import nextJest from "next/jest.js";
|
||||||
|
|
||||||
|
const createJestConfig = nextJest({
|
||||||
|
// 테스트 환경의 Next.js 앱 루트
|
||||||
|
dir: "./",
|
||||||
|
});
|
||||||
|
|
||||||
|
const customConfig: Config = {
|
||||||
|
// jest-dom matchers는 setupFilesAfterEnv로 등록 (Jest framework 로드 후)
|
||||||
|
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
|
||||||
|
testEnvironment: "jsdom",
|
||||||
|
moduleNameMapper: {
|
||||||
|
"^@/(.*)$": "<rootDir>/src/$1",
|
||||||
|
},
|
||||||
|
testPathIgnorePatterns: ["<rootDir>/.next/", "<rootDir>/node_modules/"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default createJestConfig(customConfig);
|
||||||
2
frontend/jest.setup.ts
Normal file
2
frontend/jest.setup.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
// #343 — Jest setup. @testing-library/jest-dom matchers 확장.
|
||||||
|
import "@testing-library/jest-dom";
|
||||||
@@ -2,6 +2,14 @@ import type { NextConfig } from "next";
|
|||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
|
// #343 — 외부 이미지 도메인 허용 (next/image)
|
||||||
|
images: {
|
||||||
|
remotePatterns: [
|
||||||
|
{ protocol: "https", hostname: "lh3.googleusercontent.com" }, // Google avatar
|
||||||
|
{ protocol: "https", hostname: "i.ytimg.com" }, // YouTube thumbnail
|
||||||
|
{ protocol: "https", hostname: "yt3.ggpht.com" }, // YouTube channel avatar
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
6405
frontend/package-lock.json
generated
6405
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,25 +6,35 @@
|
|||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "eslint"
|
"lint": "eslint",
|
||||||
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@phosphor-icons/react": "^2.1.10",
|
||||||
"@react-oauth/google": "^0.13.4",
|
"@react-oauth/google": "^0.13.4",
|
||||||
"@tabler/icons-react": "^3.40.0",
|
"@tabler/icons-react": "^3.40.0",
|
||||||
"@types/supercluster": "^7.1.3",
|
"@types/supercluster": "^7.1.3",
|
||||||
"@vis.gl/react-google-maps": "^1.7.1",
|
"@vis.gl/react-google-maps": "^1.7.1",
|
||||||
"next": "16.1.6",
|
"next": "16.1.6",
|
||||||
|
"next-intl": "^4.13.0",
|
||||||
"react": "19.2.3",
|
"react": "19.2.3",
|
||||||
"react-dom": "19.2.3",
|
"react-dom": "19.2.3",
|
||||||
"supercluster": "^8.0.1"
|
"supercluster": "^8.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
|
"@testing-library/react": "^16.3.2",
|
||||||
|
"@testing-library/user-event": "^14.6.1",
|
||||||
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@types/react-dom": "^19",
|
"@types/react-dom": "^19",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "16.1.6",
|
"eslint-config-next": "16.1.6",
|
||||||
|
"jest": "^30.4.2",
|
||||||
|
"jest-environment-jsdom": "^30.4.1",
|
||||||
"tailwindcss": "^4",
|
"tailwindcss": "^4",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { getAdminToken } from "@/lib/admin-utils";
|
import { getAdminToken, consumeSseStream } from "@/lib/admin-utils";
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { api } from "@/lib/api";
|
import { api } from "@/lib/api";
|
||||||
@@ -209,30 +209,19 @@ export function RestaurantsPanel({ isAdmin }: { isAdmin: boolean }) {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { Authorization: `Bearer ${getAdminToken()}` },
|
headers: { Authorization: `Bearer ${getAdminToken()}` },
|
||||||
});
|
});
|
||||||
const reader = res.body!.getReader();
|
// #351 — consumeSseStream으로 통일
|
||||||
const decoder = new TextDecoder();
|
await consumeSseStream(res, (raw) => {
|
||||||
let buf = "";
|
const evt = raw as { type: string; [k: string]: unknown };
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) break;
|
|
||||||
buf += decoder.decode(value, { stream: true });
|
|
||||||
const lines = buf.split("\n");
|
|
||||||
buf = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
|
||||||
const m = line.match(/^data:(.+)$/);
|
|
||||||
if (!m) continue;
|
|
||||||
const evt = JSON.parse(m[1]);
|
|
||||||
if (evt.type === "processing" || evt.type === "done" || evt.type === "notfound" || evt.type === "error") {
|
if (evt.type === "processing" || evt.type === "done" || evt.type === "notfound" || evt.type === "error") {
|
||||||
setBulkTablingProgress(p => ({
|
setBulkTablingProgress(p => ({
|
||||||
...p, current: evt.current, total: evt.total || p.total, name: evt.name,
|
...p, current: evt.current as number, total: (evt.total as number) || p.total, name: evt.name as string,
|
||||||
linked: evt.type === "done" ? p.linked + 1 : p.linked,
|
linked: evt.type === "done" ? p.linked + 1 : p.linked,
|
||||||
notFound: (evt.type === "notfound" || evt.type === "error") ? p.notFound + 1 : p.notFound,
|
notFound: (evt.type === "notfound" || evt.type === "error") ? p.notFound + 1 : p.notFound,
|
||||||
}));
|
}));
|
||||||
} else if (evt.type === "complete") {
|
} else if (evt.type === "complete") {
|
||||||
alert(`완료! 연결: ${evt.linked}개, 미발견: ${evt.notFound}개`);
|
alert(`완료! 연결: ${evt.linked}개, 미발견: ${evt.notFound}개`);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
} catch (e) { alert("벌크 테이블링 실패: " + (e instanceof Error ? e.message : String(e))); }
|
} catch (e) { alert("벌크 테이블링 실패: " + (e instanceof Error ? e.message : String(e))); }
|
||||||
finally { setBulkTabling(false); load(); }
|
finally { setBulkTabling(false); load(); }
|
||||||
}}
|
}}
|
||||||
@@ -287,30 +276,19 @@ export function RestaurantsPanel({ isAdmin }: { isAdmin: boolean }) {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { Authorization: `Bearer ${getAdminToken()}` },
|
headers: { Authorization: `Bearer ${getAdminToken()}` },
|
||||||
});
|
});
|
||||||
const reader = res.body!.getReader();
|
// #351 — consumeSseStream으로 통일
|
||||||
const decoder = new TextDecoder();
|
await consumeSseStream(res, (raw) => {
|
||||||
let buf = "";
|
const evt = raw as { type: string; [k: string]: unknown };
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) break;
|
|
||||||
buf += decoder.decode(value, { stream: true });
|
|
||||||
const lines = buf.split("\n");
|
|
||||||
buf = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
|
||||||
const m = line.match(/^data:(.+)$/);
|
|
||||||
if (!m) continue;
|
|
||||||
const evt = JSON.parse(m[1]);
|
|
||||||
if (evt.type === "processing" || evt.type === "done" || evt.type === "notfound" || evt.type === "error") {
|
if (evt.type === "processing" || evt.type === "done" || evt.type === "notfound" || evt.type === "error") {
|
||||||
setBulkCatchtableProgress(p => ({
|
setBulkCatchtableProgress(p => ({
|
||||||
...p, current: evt.current, total: evt.total || p.total, name: evt.name,
|
...p, current: evt.current as number, total: (evt.total as number) || p.total, name: evt.name as string,
|
||||||
linked: evt.type === "done" ? p.linked + 1 : p.linked,
|
linked: evt.type === "done" ? p.linked + 1 : p.linked,
|
||||||
notFound: (evt.type === "notfound" || evt.type === "error") ? p.notFound + 1 : p.notFound,
|
notFound: (evt.type === "notfound" || evt.type === "error") ? p.notFound + 1 : p.notFound,
|
||||||
}));
|
}));
|
||||||
} else if (evt.type === "complete") {
|
} else if (evt.type === "complete") {
|
||||||
alert(`완료! 연결: ${evt.linked}개, 미발견: ${evt.notFound}개`);
|
alert(`완료! 연결: ${evt.linked}개, 미발견: ${evt.notFound}개`);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
} catch (e) { alert("벌크 캐치테이블 실패: " + (e instanceof Error ? e.message : String(e))); }
|
} catch (e) { alert("벌크 캐치테이블 실패: " + (e instanceof Error ? e.message : String(e))); }
|
||||||
finally { setBulkCatchtable(false); load(); }
|
finally { setBulkCatchtable(false); load(); }
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
import { getAdminToken } from "@/lib/admin-utils";
|
import { getAdminToken, consumeSseStream } from "@/lib/admin-utils";
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { api } from "@/lib/api";
|
import { api } from "@/lib/api";
|
||||||
@@ -209,39 +209,25 @@ export function VideosPanel({ isAdmin }: { isAdmin: boolean }) {
|
|||||||
setBulkProgress(null);
|
setBulkProgress(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const reader = resp.body?.getReader();
|
// #351 — consumeSseStream으로 통일
|
||||||
const decoder = new TextDecoder();
|
await consumeSseStream(resp, (raw) => {
|
||||||
if (!reader) { setRunning(false); return; }
|
const ev = raw as { type: string; [k: string]: unknown };
|
||||||
|
|
||||||
let buf = "";
|
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) break;
|
|
||||||
buf += decoder.decode(value, { stream: true });
|
|
||||||
const lines = buf.split("\n");
|
|
||||||
buf = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
|
||||||
if (!line.startsWith("data: ")) continue;
|
|
||||||
try {
|
|
||||||
const ev = JSON.parse(line.slice(6));
|
|
||||||
if (ev.type === "processing") {
|
if (ev.type === "processing") {
|
||||||
setBulkProgress((p) => p ? { ...p, current: ev.index + 1, currentTitle: ev.title, waiting: undefined } : p);
|
setBulkProgress((p) => p ? { ...p, current: (ev.index as number) + 1, currentTitle: ev.title as string, waiting: undefined } : p);
|
||||||
} else if (ev.type === "wait") {
|
} else if (ev.type === "wait") {
|
||||||
setBulkProgress((p) => p ? { ...p, waiting: ev.delay } : p);
|
setBulkProgress((p) => p ? { ...p, waiting: ev.delay as number } : p);
|
||||||
} else if (ev.type === "done") {
|
} else if (ev.type === "done") {
|
||||||
const detail = isTranscript
|
const detail = isTranscript
|
||||||
? `${ev.source} / ${ev.length?.toLocaleString()}자`
|
? `${ev.source} / ${(ev.length as number)?.toLocaleString()}자`
|
||||||
: `${ev.restaurants}개 식당`;
|
: `${ev.restaurants}개 식당`;
|
||||||
setBulkProgress((p) => p ? { ...p, results: [...p.results, { title: ev.title, detail }] } : p);
|
setBulkProgress((p) => p ? { ...p, results: [...p.results, { title: ev.title as string, detail }] } : p);
|
||||||
} else if (ev.type === "error") {
|
} else if (ev.type === "error") {
|
||||||
setBulkProgress((p) => p ? { ...p, results: [...p.results, { title: ev.title, detail: ev.message, error: true }] } : p);
|
setBulkProgress((p) => p ? { ...p, results: [...p.results, { title: ev.title as string, detail: ev.message as string, error: true }] } : p);
|
||||||
} else if (ev.type === "complete") {
|
} else if (ev.type === "complete") {
|
||||||
setRunning(false);
|
setRunning(false);
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
} catch { /* ignore */ }
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
setRunning(false);
|
setRunning(false);
|
||||||
load();
|
load();
|
||||||
} catch {
|
} catch {
|
||||||
@@ -264,30 +250,17 @@ export function VideosPanel({ isAdmin }: { isAdmin: boolean }) {
|
|||||||
setRebuildingVectors(false);
|
setRebuildingVectors(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const reader = resp.body?.getReader();
|
// #351 — consumeSseStream으로 통일
|
||||||
const decoder = new TextDecoder();
|
await consumeSseStream(resp, (raw) => {
|
||||||
if (!reader) { setRebuildingVectors(false); return; }
|
const ev = raw as { status?: string; type?: string; [k: string]: unknown };
|
||||||
let buf = "";
|
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) break;
|
|
||||||
buf += decoder.decode(value, { stream: true });
|
|
||||||
const lines = buf.split("\n");
|
|
||||||
buf = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
|
||||||
if (!line.startsWith("data: ")) continue;
|
|
||||||
try {
|
|
||||||
const ev = JSON.parse(line.slice(6));
|
|
||||||
if (ev.status === "progress" || ev.type === "progress") {
|
if (ev.status === "progress" || ev.type === "progress") {
|
||||||
setVectorProgress({ phase: ev.phase, current: ev.current, total: ev.total, name: ev.name });
|
setVectorProgress({ phase: ev.phase as string, current: ev.current as number, total: ev.total as number, name: ev.name as string });
|
||||||
} else if (ev.status === "done" || ev.type === "done") {
|
} else if (ev.status === "done" || ev.type === "done") {
|
||||||
setVectorProgress({ phase: "done", current: ev.total, total: ev.total });
|
setVectorProgress({ phase: "done", current: ev.total as number, total: ev.total as number });
|
||||||
} else if (ev.type === "error") {
|
} else if (ev.type === "error") {
|
||||||
alert(`벡터 재생성 오류: ${ev.message}`);
|
alert(`벡터 재생성 오류: ${ev.message}`);
|
||||||
}
|
}
|
||||||
} catch { /* ignore */ }
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
setRebuildingVectors(false);
|
setRebuildingVectors(false);
|
||||||
} catch {
|
} catch {
|
||||||
setRebuildingVectors(false);
|
setRebuildingVectors(false);
|
||||||
@@ -309,30 +282,17 @@ export function VideosPanel({ isAdmin }: { isAdmin: boolean }) {
|
|||||||
setRemappingCuisine(false);
|
setRemappingCuisine(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const reader = resp.body?.getReader();
|
// #351 — consumeSseStream으로 통일
|
||||||
const decoder = new TextDecoder();
|
await consumeSseStream(resp, (raw) => {
|
||||||
if (!reader) { setRemappingCuisine(false); return; }
|
const ev = raw as { type: string; [k: string]: unknown };
|
||||||
let buf = "";
|
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) break;
|
|
||||||
buf += decoder.decode(value, { stream: true });
|
|
||||||
const lines = buf.split("\n");
|
|
||||||
buf = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
|
||||||
if (!line.startsWith("data: ")) continue;
|
|
||||||
try {
|
|
||||||
const ev = JSON.parse(line.slice(6));
|
|
||||||
if (ev.type === "processing" || ev.type === "batch_done") {
|
if (ev.type === "processing" || ev.type === "batch_done") {
|
||||||
setRemapProgress({ current: ev.current, total: ev.total, updated: ev.updated || 0 });
|
setRemapProgress({ current: ev.current as number, total: ev.total as number, updated: (ev.updated as number) || 0 });
|
||||||
} else if (ev.type === "complete") {
|
} else if (ev.type === "complete") {
|
||||||
setRemapProgress({ current: ev.total, total: ev.total, updated: ev.updated });
|
setRemapProgress({ current: ev.total as number, total: ev.total as number, updated: ev.updated as number });
|
||||||
} else if (ev.type === "error") {
|
} else if (ev.type === "error") {
|
||||||
alert(`재분류 오류: ${ev.message}`);
|
alert(`재분류 오류: ${ev.message}`);
|
||||||
}
|
}
|
||||||
} catch { /* ignore */ }
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
setRemappingCuisine(false);
|
setRemappingCuisine(false);
|
||||||
} catch {
|
} catch {
|
||||||
setRemappingCuisine(false);
|
setRemappingCuisine(false);
|
||||||
@@ -354,30 +314,17 @@ export function VideosPanel({ isAdmin }: { isAdmin: boolean }) {
|
|||||||
setRemappingFoods(false);
|
setRemappingFoods(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const reader = resp.body?.getReader();
|
// #351 — consumeSseStream으로 통일
|
||||||
const decoder = new TextDecoder();
|
await consumeSseStream(resp, (raw) => {
|
||||||
if (!reader) { setRemappingFoods(false); return; }
|
const ev = raw as { type: string; [k: string]: unknown };
|
||||||
let buf = "";
|
|
||||||
while (true) {
|
|
||||||
const { done, value } = await reader.read();
|
|
||||||
if (done) break;
|
|
||||||
buf += decoder.decode(value, { stream: true });
|
|
||||||
const lines = buf.split("\n");
|
|
||||||
buf = lines.pop() || "";
|
|
||||||
for (const line of lines) {
|
|
||||||
if (!line.startsWith("data: ")) continue;
|
|
||||||
try {
|
|
||||||
const ev = JSON.parse(line.slice(6));
|
|
||||||
if (ev.type === "processing" || ev.type === "batch_done") {
|
if (ev.type === "processing" || ev.type === "batch_done") {
|
||||||
setFoodsProgress({ current: ev.current, total: ev.total, updated: ev.updated || 0 });
|
setFoodsProgress({ current: ev.current as number, total: ev.total as number, updated: (ev.updated as number) || 0 });
|
||||||
} else if (ev.type === "complete") {
|
} else if (ev.type === "complete") {
|
||||||
setFoodsProgress({ current: ev.total, total: ev.total, updated: ev.updated });
|
setFoodsProgress({ current: ev.total as number, total: ev.total as number, updated: ev.updated as number });
|
||||||
} else if (ev.type === "error") {
|
} else if (ev.type === "error") {
|
||||||
alert(`메뉴 태그 재생성 오류: ${ev.message}`);
|
alert(`메뉴 태그 재생성 오류: ${ev.message}`);
|
||||||
}
|
}
|
||||||
} catch { /* ignore */ }
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
setRemappingFoods(false);
|
setRemappingFoods(false);
|
||||||
} catch {
|
} catch {
|
||||||
setRemappingFoods(false);
|
setRemappingFoods(false);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import { GoogleLogin } from "@react-oauth/google";
|
import { GoogleLogin } from "@react-oauth/google";
|
||||||
import LoginMenu from "@/components/LoginMenu";
|
import LoginMenu from "@/components/LoginMenu";
|
||||||
|
import LanguageSwitcher from "@/components/LanguageSwitcher";
|
||||||
import { api } from "@/lib/api";
|
import { api } from "@/lib/api";
|
||||||
import type { Restaurant, Channel, Review, Memo } from "@/lib/api";
|
import type { Restaurant, Channel, Review, Memo } from "@/lib/api";
|
||||||
import { useAuth } from "@/lib/auth-context";
|
import { useAuth } from "@/lib/auth-context";
|
||||||
@@ -719,6 +720,8 @@ export default function Home() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<div className="flex-1" />
|
<div className="flex-1" />
|
||||||
|
{/* #352 — Language switcher */}
|
||||||
|
<LanguageSwitcher />
|
||||||
{/* Desktop user area */}
|
{/* Desktop user area */}
|
||||||
{authLoading ? null : user ? (
|
{authLoading ? null : user ? (
|
||||||
<div className="flex items-center gap-2 shrink-0">
|
<div className="flex items-center gap-2 shrink-0">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { GoogleOAuthProvider } from "@react-oauth/google";
|
import { GoogleOAuthProvider } from "@react-oauth/google";
|
||||||
import { AuthProvider } from "@/lib/auth-context";
|
import { AuthProvider } from "@/lib/auth-context";
|
||||||
|
import { LocaleProvider } from "@/i18n/LocaleProvider";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
const GOOGLE_CLIENT_ID = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "";
|
const GOOGLE_CLIENT_ID = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "";
|
||||||
@@ -9,7 +10,9 @@ const GOOGLE_CLIENT_ID = process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID || "";
|
|||||||
export function Providers({ children }: { children: ReactNode }) {
|
export function Providers({ children }: { children: ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<GoogleOAuthProvider clientId={GOOGLE_CLIENT_ID}>
|
<GoogleOAuthProvider clientId={GOOGLE_CLIENT_ID}>
|
||||||
|
<LocaleProvider>
|
||||||
<AuthProvider>{children}</AuthProvider>
|
<AuthProvider>{children}</AuthProvider>
|
||||||
|
</LocaleProvider>
|
||||||
</GoogleOAuthProvider>
|
</GoogleOAuthProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
57
frontend/src/components/LanguageSwitcher.tsx
Normal file
57
frontend/src/components/LanguageSwitcher.tsx
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { useLocale } from "@/i18n/LocaleProvider";
|
||||||
|
import { LOCALES, LOCALE_LABELS } from "@/i18n/config";
|
||||||
|
|
||||||
|
// #352 — 헤더용 언어 전환 드롭다운. 44px 터치 영역 + ARIA listbox 패턴.
|
||||||
|
export default function LanguageSwitcher() {
|
||||||
|
const { locale, setLocale } = useLocale();
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="relative">
|
||||||
|
<button
|
||||||
|
onClick={() => setOpen((v) => !v)}
|
||||||
|
aria-haspopup="listbox"
|
||||||
|
aria-expanded={open}
|
||||||
|
aria-label="언어 선택 / Select language"
|
||||||
|
className="min-h-[44px] min-w-[44px] px-2 py-1.5 flex items-center gap-1 text-sm rounded-lg hover:bg-brand-50 touch-manipulation"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">{LOCALE_LABELS[locale].flag}</span>
|
||||||
|
<span className="text-xs text-gray-500 uppercase">{locale}</span>
|
||||||
|
</button>
|
||||||
|
{open && (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
aria-hidden="true"
|
||||||
|
tabIndex={-1}
|
||||||
|
className="fixed inset-0 z-40 cursor-default"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
/>
|
||||||
|
<ul
|
||||||
|
role="listbox"
|
||||||
|
aria-label="언어 목록"
|
||||||
|
className="absolute right-0 mt-1 bg-surface rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 py-1 z-50 min-w-[160px]"
|
||||||
|
>
|
||||||
|
{LOCALES.map((l) => (
|
||||||
|
<li key={l}>
|
||||||
|
<button
|
||||||
|
role="option"
|
||||||
|
aria-selected={l === locale}
|
||||||
|
onClick={() => { setLocale(l); setOpen(false); }}
|
||||||
|
className={`w-full text-left px-3 py-2 text-sm flex items-center gap-2 hover:bg-brand-50 ${
|
||||||
|
l === locale ? "font-semibold text-brand-700" : "text-gray-700"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">{LOCALE_LABELS[l].flag}</span>
|
||||||
|
<span>{LOCALE_LABELS[l].native}</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -41,8 +41,14 @@ export default function MyReviewsList({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-1 border-b">
|
{/* #343 — WAI-ARIA Tabs 패턴 */}
|
||||||
|
<div role="tablist" aria-label="내 활동" className="flex gap-1 border-b">
|
||||||
<button
|
<button
|
||||||
|
role="tab"
|
||||||
|
id="tab-reviews"
|
||||||
|
aria-selected={tab === "reviews"}
|
||||||
|
aria-controls="panel-reviews"
|
||||||
|
tabIndex={tab === "reviews" ? 0 : -1}
|
||||||
onClick={() => setTab("reviews")}
|
onClick={() => setTab("reviews")}
|
||||||
className={`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${
|
className={`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${
|
||||||
tab === "reviews"
|
tab === "reviews"
|
||||||
@@ -54,6 +60,11 @@ export default function MyReviewsList({
|
|||||||
리뷰 ({reviews.length})
|
리뷰 ({reviews.length})
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
role="tab"
|
||||||
|
id="tab-memos"
|
||||||
|
aria-selected={tab === "memos"}
|
||||||
|
aria-controls="panel-memos"
|
||||||
|
tabIndex={tab === "memos" ? 0 : -1}
|
||||||
onClick={() => setTab("memos")}
|
onClick={() => setTab("memos")}
|
||||||
className={`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${
|
className={`px-3 py-1.5 text-sm font-medium border-b-2 transition-colors ${
|
||||||
tab === "memos"
|
tab === "memos"
|
||||||
@@ -67,7 +78,8 @@ export default function MyReviewsList({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{tab === "reviews" ? (
|
{tab === "reviews" ? (
|
||||||
reviews.length === 0 ? (
|
<div role="tabpanel" id="panel-reviews" aria-labelledby="tab-reviews">
|
||||||
|
{reviews.length === 0 ? (
|
||||||
<p className="text-sm text-gray-500 py-8 text-center">
|
<p className="text-sm text-gray-500 py-8 text-center">
|
||||||
아직 작성한 리뷰가 없습니다.
|
아직 작성한 리뷰가 없습니다.
|
||||||
</p>
|
</p>
|
||||||
@@ -100,9 +112,11 @@ export default function MyReviewsList({
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)}
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
memos.length === 0 ? (
|
<div role="tabpanel" id="panel-memos" aria-labelledby="tab-memos">
|
||||||
|
{memos.length === 0 ? (
|
||||||
<p className="text-sm text-gray-500 py-8 text-center">
|
<p className="text-sm text-gray-500 py-8 text-center">
|
||||||
아직 작성한 메모가 없습니다.
|
아직 작성한 메모가 없습니다.
|
||||||
</p>
|
</p>
|
||||||
@@ -137,7 +151,8 @@ export default function MyReviewsList({
|
|||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -257,6 +257,9 @@ export default function ReviewSection({ restaurantId }: ReviewSectionProps) {
|
|||||||
<>
|
<>
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
{review.user_avatar_url && (
|
{review.user_avatar_url && (
|
||||||
|
// eslint-disable-next-line @next/next/no-img-element
|
||||||
|
// #343 — Google avatar URL은 remotePatterns에 추가됨.
|
||||||
|
// next/image 전환은 SSR/lazy 효과 미미한 5x5 아바타라 후속에서 일괄 적용.
|
||||||
<img
|
<img
|
||||||
src={review.user_avatar_url}
|
src={review.user_avatar_url}
|
||||||
alt=""
|
alt=""
|
||||||
|
|||||||
56
frontend/src/i18n/LocaleProvider.tsx
Normal file
56
frontend/src/i18n/LocaleProvider.tsx
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { DEFAULT_LOCALE, LOCALE_STORAGE_KEY, Locale, detectBrowserLocale, isLocale } from "./config";
|
||||||
|
|
||||||
|
// #352 — 메시지 파일을 정적 import (Tree-shaking 가능, 클라이언트 번들에 4언어 모두 포함되지만
|
||||||
|
// 30개 키 수준이라 부담 미미. 키가 늘어나면 동적 import로 분할 검토)
|
||||||
|
import ko from "@/messages/ko.json";
|
||||||
|
import en from "@/messages/en.json";
|
||||||
|
import ja from "@/messages/ja.json";
|
||||||
|
import es from "@/messages/es.json";
|
||||||
|
|
||||||
|
const MESSAGES: Record<Locale, typeof ko> = { ko, en, ja, es };
|
||||||
|
|
||||||
|
interface LocaleContextValue {
|
||||||
|
locale: Locale;
|
||||||
|
setLocale: (l: Locale) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { createContext, useContext } from "react";
|
||||||
|
const LocaleContext = createContext<LocaleContextValue | null>(null);
|
||||||
|
|
||||||
|
export function useLocale() {
|
||||||
|
const ctx = useContext(LocaleContext);
|
||||||
|
if (!ctx) throw new Error("useLocale must be used within LocaleProvider");
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function LocaleProvider({ children }: { children: React.ReactNode }) {
|
||||||
|
// SSR 단계는 기본 로케일로 시작 (hydration mismatch 방지)
|
||||||
|
const [locale, setLocaleState] = useState<Locale>(DEFAULT_LOCALE);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (typeof window === "undefined") return;
|
||||||
|
const saved = localStorage.getItem(LOCALE_STORAGE_KEY);
|
||||||
|
const initial: Locale = isLocale(saved) ? saved : detectBrowserLocale();
|
||||||
|
if (initial !== locale) setLocaleState(initial);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const setLocale = (l: Locale) => {
|
||||||
|
setLocaleState(l);
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
localStorage.setItem(LOCALE_STORAGE_KEY, l);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LocaleContext.Provider value={{ locale, setLocale }}>
|
||||||
|
<NextIntlClientProvider locale={locale} messages={MESSAGES[locale]}>
|
||||||
|
{children}
|
||||||
|
</NextIntlClientProvider>
|
||||||
|
</LocaleContext.Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
28
frontend/src/i18n/config.ts
Normal file
28
frontend/src/i18n/config.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// #352 i18n 뼈대 — 로케일 목록/기본값
|
||||||
|
|
||||||
|
export const LOCALES = ["ko", "en", "ja", "es"] as const;
|
||||||
|
export type Locale = (typeof LOCALES)[number];
|
||||||
|
|
||||||
|
export const DEFAULT_LOCALE: Locale = "ko";
|
||||||
|
export const LOCALE_STORAGE_KEY = "tasteby_locale";
|
||||||
|
|
||||||
|
export const LOCALE_LABELS: Record<Locale, { flag: string; label: string; native: string }> = {
|
||||||
|
ko: { flag: "🇰🇷", label: "Korean", native: "한국어" },
|
||||||
|
en: { flag: "🇺🇸", label: "English", native: "English" },
|
||||||
|
ja: { flag: "🇯🇵", label: "Japanese", native: "日本語" },
|
||||||
|
es: { flag: "🇪🇸", label: "Spanish", native: "Español" },
|
||||||
|
};
|
||||||
|
|
||||||
|
export function isLocale(value: string | null | undefined): value is Locale {
|
||||||
|
return value != null && (LOCALES as readonly string[]).includes(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 브라우저 언어 감지 → 지원 로케일이면 그것, 아니면 기본값.
|
||||||
|
* SSR-safe (typeof window 체크 호출자).
|
||||||
|
*/
|
||||||
|
export function detectBrowserLocale(): Locale {
|
||||||
|
if (typeof navigator === "undefined") return DEFAULT_LOCALE;
|
||||||
|
const code = navigator.language.split("-")[0].toLowerCase();
|
||||||
|
return isLocale(code) ? code : DEFAULT_LOCALE;
|
||||||
|
}
|
||||||
41
frontend/src/messages/en.json
Normal file
41
frontend/src/messages/en.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"header": {
|
||||||
|
"search": "Search",
|
||||||
|
"login": "Sign In",
|
||||||
|
"logout": "Sign Out",
|
||||||
|
"menu": "Menu",
|
||||||
|
"myReviews": "My Reviews",
|
||||||
|
"favorites": "Favorites"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"save": "Save",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"delete": "Delete",
|
||||||
|
"edit": "Edit",
|
||||||
|
"confirm": "OK",
|
||||||
|
"close": "Close",
|
||||||
|
"loading": "Loading...",
|
||||||
|
"submit": "Submit"
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"title": "Filter",
|
||||||
|
"cuisine": "Cuisine",
|
||||||
|
"price": "Price Range",
|
||||||
|
"region": "Region",
|
||||||
|
"channel": "Channel",
|
||||||
|
"reset": "Reset"
|
||||||
|
},
|
||||||
|
"restaurant": {
|
||||||
|
"rating": "Rating",
|
||||||
|
"address": "Address",
|
||||||
|
"phone": "Phone",
|
||||||
|
"website": "Website",
|
||||||
|
"closed": "Permanently Closed",
|
||||||
|
"tempClosed": "Temporarily Closed"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"title": "Reviews",
|
||||||
|
"write": "Write a Review",
|
||||||
|
"noReviews": "No reviews yet"
|
||||||
|
}
|
||||||
|
}
|
||||||
41
frontend/src/messages/es.json
Normal file
41
frontend/src/messages/es.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"header": {
|
||||||
|
"search": "Buscar",
|
||||||
|
"login": "Iniciar sesión",
|
||||||
|
"logout": "Cerrar sesión",
|
||||||
|
"menu": "Menú",
|
||||||
|
"myReviews": "Mis reseñas",
|
||||||
|
"favorites": "Favoritos"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"save": "Guardar",
|
||||||
|
"cancel": "Cancelar",
|
||||||
|
"delete": "Eliminar",
|
||||||
|
"edit": "Editar",
|
||||||
|
"confirm": "Aceptar",
|
||||||
|
"close": "Cerrar",
|
||||||
|
"loading": "Cargando...",
|
||||||
|
"submit": "Enviar"
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"title": "Filtro",
|
||||||
|
"cuisine": "Tipo de cocina",
|
||||||
|
"price": "Rango de precios",
|
||||||
|
"region": "Región",
|
||||||
|
"channel": "Canal",
|
||||||
|
"reset": "Restablecer"
|
||||||
|
},
|
||||||
|
"restaurant": {
|
||||||
|
"rating": "Calificación",
|
||||||
|
"address": "Dirección",
|
||||||
|
"phone": "Teléfono",
|
||||||
|
"website": "Sitio web",
|
||||||
|
"closed": "Cerrado permanentemente",
|
||||||
|
"tempClosed": "Cerrado temporalmente"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"title": "Reseñas",
|
||||||
|
"write": "Escribir una reseña",
|
||||||
|
"noReviews": "Aún no hay reseñas"
|
||||||
|
}
|
||||||
|
}
|
||||||
41
frontend/src/messages/ja.json
Normal file
41
frontend/src/messages/ja.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"header": {
|
||||||
|
"search": "検索",
|
||||||
|
"login": "ログイン",
|
||||||
|
"logout": "ログアウト",
|
||||||
|
"menu": "メニュー",
|
||||||
|
"myReviews": "マイレビュー",
|
||||||
|
"favorites": "お気に入り"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"save": "保存",
|
||||||
|
"cancel": "キャンセル",
|
||||||
|
"delete": "削除",
|
||||||
|
"edit": "編集",
|
||||||
|
"confirm": "確認",
|
||||||
|
"close": "閉じる",
|
||||||
|
"loading": "読み込み中...",
|
||||||
|
"submit": "送信"
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"title": "フィルター",
|
||||||
|
"cuisine": "料理ジャンル",
|
||||||
|
"price": "価格帯",
|
||||||
|
"region": "地域",
|
||||||
|
"channel": "チャンネル",
|
||||||
|
"reset": "リセット"
|
||||||
|
},
|
||||||
|
"restaurant": {
|
||||||
|
"rating": "評価",
|
||||||
|
"address": "住所",
|
||||||
|
"phone": "電話",
|
||||||
|
"website": "ウェブサイト",
|
||||||
|
"closed": "閉店",
|
||||||
|
"tempClosed": "一時休業"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"title": "レビュー",
|
||||||
|
"write": "レビューを書く",
|
||||||
|
"noReviews": "まだレビューがありません"
|
||||||
|
}
|
||||||
|
}
|
||||||
41
frontend/src/messages/ko.json
Normal file
41
frontend/src/messages/ko.json
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"header": {
|
||||||
|
"search": "검색",
|
||||||
|
"login": "로그인",
|
||||||
|
"logout": "로그아웃",
|
||||||
|
"menu": "메뉴",
|
||||||
|
"myReviews": "내 리뷰",
|
||||||
|
"favorites": "즐겨찾기"
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"save": "저장",
|
||||||
|
"cancel": "취소",
|
||||||
|
"delete": "삭제",
|
||||||
|
"edit": "수정",
|
||||||
|
"confirm": "확인",
|
||||||
|
"close": "닫기",
|
||||||
|
"loading": "로딩 중...",
|
||||||
|
"submit": "제출"
|
||||||
|
},
|
||||||
|
"filter": {
|
||||||
|
"title": "필터",
|
||||||
|
"cuisine": "음식 종류",
|
||||||
|
"price": "가격대",
|
||||||
|
"region": "지역",
|
||||||
|
"channel": "채널",
|
||||||
|
"reset": "초기화"
|
||||||
|
},
|
||||||
|
"restaurant": {
|
||||||
|
"rating": "평점",
|
||||||
|
"address": "주소",
|
||||||
|
"phone": "전화",
|
||||||
|
"website": "웹사이트",
|
||||||
|
"closed": "폐업",
|
||||||
|
"tempClosed": "임시휴업"
|
||||||
|
},
|
||||||
|
"review": {
|
||||||
|
"title": "리뷰",
|
||||||
|
"write": "리뷰 작성",
|
||||||
|
"noReviews": "아직 리뷰가 없습니다"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user