From 10cb3ae1dfafd4a2f4713adf3e8456811f3e74fb Mon Sep 17 00:00:00 2001 From: gahusb Date: Sat, 16 May 2026 17:31:22 +0900 Subject: [PATCH] =?UTF-8?q?docs(insta-trends):=20=EC=85=80=ED=94=84=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B3=B4=EA=B0=95=20=E2=80=94=20LLM=20?= =?UTF-8?q?=EB=B6=84=EB=A5=98=20=EC=BA=90=EC=8B=9C=20=EC=9C=84=EC=B9=98,?= =?UTF-8?q?=20days=20=EC=BF=BC=EB=A6=AC=20=EC=9D=98=EB=AF=B8=20=EB=AA=85?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/superpowers/specs/2026-05-16-insta-trends-design.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 |