/auto/analyze 결과에 컷별 추천(cuts[]) 추가
댓글 매칭 후 recommend.build_highlight_cuts()를 호출해 하이라이트별 cuts/need를 SSE result에 실어 보낸다. Gemini 호출이 블로킹이라 asyncio.to_thread로 스레드에서 돌리고, 실패해도 기존 matched/candidates로 화면이 폴백하도록 warnings에만 기록하고 드래프트 생성은 막지 않는다. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
005beba4c3
commit
90ff2b174f
@ -23,6 +23,7 @@ from capcut_agent.pipeline import process_bg_template, process_paste
|
||||
from capcut_agent.paste import parse_paste
|
||||
from capcut_agent.draft import DEFAULT_DRAFT_ROOT, list_drafts, repair_layers
|
||||
from capcut_agent import comments as hlab
|
||||
from capcut_agent import recommend
|
||||
from capcut_agent import plan as autoplan
|
||||
from capcut_agent import prompts as prompt_store
|
||||
from capcut_agent.correct import GeminiQuotaError, has_gemini_key
|
||||
@ -530,6 +531,17 @@ async def auto_stream(aid: str) -> StreamingResponse:
|
||||
matched = hlab.match_window(comments, h["start"], h["end"])
|
||||
h["matched"] = matched
|
||||
h["candidates"] = hlab.top_liked(no_ts, set(matched), len(no_ts))
|
||||
# 컷별 추천 — 실패해도 위의 matched/candidates 로 화면이 돌아간다.
|
||||
# Gemini 호출이 섞여 있어 블로킹이므로 스레드로 뺀다.
|
||||
try:
|
||||
cuts, need = await asyncio.to_thread(
|
||||
recommend.build_highlight_cuts, h, comments)
|
||||
if cuts:
|
||||
h["cuts"], h["need"] = cuts, need
|
||||
except Exception as exc: # noqa: BLE001 — 추천 실패가 생성을 막으면 안 된다
|
||||
warnings.append(
|
||||
f"ID {h.get('id')} 컷별 추천 실패 — 기존 방식으로 표시 "
|
||||
f"({type(exc).__name__}: {exc})")
|
||||
yield _sse({"type": "result", "highlights": highlights,
|
||||
"comments": comments, "warnings": warnings})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user