diff --git a/docs/superpowers/specs/2026-05-16-insta-trends-design.md b/docs/superpowers/specs/2026-05-16-insta-trends-design.md index 20cac58..94e5027 100644 --- a/docs/superpowers/specs/2026-05-16-insta-trends-design.md +++ b/docs/superpowers/specs/2026-05-16-insta-trends-design.md @@ -50,7 +50,7 @@ insta-lab 운영 첫 사이클(2026-05-16 머지·배포 완료)에서 다음 - 라이브러리: `pytrends` (PyPI, MIT) - `TrendReq(hl='ko-KR', tz=540).trending_searches(pn='south_korea')` 호출 → 일일 트렌딩 키워드 리스트 - 각 키워드에 대해 Claude Haiku 1회 호출로 카테고리 분류 (`economy` / `psychology` / `celebrity` / 사용자 추가 카테고리 / `uncategorized`) -- LLM 분류 비용 절감을 위해 분류 결과를 1일 캐시 (같은 키워드 재호출 시 cache hit) +- LLM 분류 비용 절감을 위해 분류 결과를 1일 캐시 — `trend_collector` 모듈 레벨 `_category_cache: dict[str, tuple[str, float]]` (keyword → (category, expires_ts)), 컨테이너 lifetime 동안 유효. 같은 키워드 재요청 시 cache hit. 캐시는 영속화하지 않음 (재시작 시 첫 호출은 LLM 재분류) - `trending_keywords` 테이블에 source='google_trends', score=traffic 정규화값 ### 3-3. 통합 저장 @@ -121,7 +121,7 @@ def extract_with_weights(weights: dict[str, float], total_limit: int) -> list[Ke | 메서드 | 경로 | 설명 | |--------|------|------| | POST | `/api/insta/trends/collect` | 두 source 모두 수집 (BackgroundTask) → `{task_id}` | -| GET | `/api/insta/trends` | 트렌드 조회. query: `source` (`naver_popular`/`google_trends`/`all`), `category`, `days` (default 1) | +| GET | `/api/insta/trends` | 트렌드 조회. query: `source` (`naver_popular`/`google_trends`/`all`), `category`, `days` (default 1, 의미: `suggested_at >= now() - days*24h`). 정렬 `suggested_at DESC, score DESC` | | GET | `/api/insta/preferences` | 가중치 조회 → `{categories: [{category, weight, updated_at}]}` | | PUT | `/api/insta/preferences` | body `{categories: {economy: 0.6, ...}}` → upsert |