diff --git a/capcut_agent/recommend.py b/capcut_agent/recommend.py index 20fe441..fa5e49c 100644 --- a/capcut_agent/recommend.py +++ b/capcut_agent/recommend.py @@ -223,20 +223,18 @@ def _time_based_picks(cuts, comments, quotas) -> List[List[dict]]: return out -def build_highlight_cuts(hl, comments, *, key=None): +def build_highlight_cuts(hl, comments, *, key=None, quotas=None): """하이라이트 하나 → (cuts[], need, ai_failed). 모드는 컷 모양으로 판별한다. + quotas: 컷별 카드 장수를 밖에서 정해 넘길 때 쓴다(무음 제거 후 실제 길이 기준). + 안 넘기면 `quotas_for(cuts)` — 원본 컷 길이 기준. Returns: ([{"i","sec","bottom","quota","picks"}], need, ai_failed) - need = Σ quota — 기존 int(total//3) 을 대체한다(컷 경계에 맞추는 쪽이 맞다). - ai_failed = Gemini 호출이 **실패**했는가(429·타임아웃·파싱). 통짜 모드는 Gemini 를 - 안 부르므로 항상 False. 호출부는 이 값으로만 경고를 띄운다 — 실패해도 cuts 는 - 타임스탬프만으로 채워져 비지 않으므로, cuts 가 비었는지로는 실패를 알 수 없다. - Gemini 실패는 여기서 흡수된다(ai_pick_cuts 가 None 을 준다) — 예외를 올리지 않는다. + need = Σ quota. Gemini 실패는 ai_failed=True 로 알린다(예외는 안 올린다). """ cuts = (hl.get("paste") or {}).get("cuts") or [] if not cuts: return [], 0, False - quotas = quotas_for(cuts) + quotas = list(quotas) if quotas is not None else quotas_for(cuts) ai_failed = False if is_time_based(cuts): picks = _time_based_picks(cuts, comments, quotas)