From a1f98b0b534290feeaec561ca9f64c5947ffb66a Mon Sep 17 00:00:00 2001 From: "hehihoho3@gmail.com" Date: Tue, 4 Aug 2026 17:06:35 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=B4=EC=9D=8C=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?=ED=9B=84=20=EC=8B=A4=EC=A0=9C=20=EA=B8=B8=EC=9D=B4=20=EA=B8=B0?= =?UTF-8?q?=EC=A4=80=20=EC=B9=B4=EB=93=9C=20=EC=9E=A5=EC=88=98=EB=A5=BC=20?= =?UTF-8?q?=EC=99=B8=EB=B6=80=EC=97=90=EC=84=9C=20=EC=A3=BC=EC=9E=85=20?= =?UTF-8?q?=EA=B0=80=EB=8A=A5=ED=95=98=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build_highlight_cuts()에 quotas 파라미터 추가. 무음 제거 후 줄어든 타임라인에 맞춰 카드 장수를 계산한 후 넘길 수 있다. quotas를 넘기지 않으면 기존 동작(원본 길이 기준) 그대로여야 한다 — 기존 호출부에는 변화 없다. Co-Authored-By: Claude Opus 5 (1M context) --- capcut_agent/recommend.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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)