Ajustes do Gemini
This commit is contained in:
@@ -101,7 +101,15 @@ class VideoPipeline:
|
||||
if not context.transcription:
|
||||
raise RuntimeError("Transcricao nao disponivel")
|
||||
|
||||
highlights_raw = self.highlighter.generate_highlights(context.transcription)
|
||||
try:
|
||||
highlights_raw = self.highlighter.generate_highlights(context.transcription)
|
||||
except Exception:
|
||||
logger.exception(
|
||||
"Falha ao gerar destaques com Gemini; aplicando fallback padrao."
|
||||
)
|
||||
context.highlight_windows = [self._build_fallback_highlight(context)]
|
||||
return
|
||||
|
||||
windows: List[HighlightWindow] = []
|
||||
|
||||
for item in highlights_raw:
|
||||
@@ -120,18 +128,7 @@ class VideoPipeline:
|
||||
windows.append(HighlightWindow(start=start, end=end, summary=summary))
|
||||
|
||||
if not windows:
|
||||
last_end = (
|
||||
context.transcription.segments[-1].end
|
||||
if context.transcription.segments
|
||||
else 0
|
||||
)
|
||||
windows.append(
|
||||
HighlightWindow(
|
||||
start=0.0,
|
||||
end=max(last_end, 10.0),
|
||||
summary="Sem destaque identificado; fallback automatico.",
|
||||
)
|
||||
)
|
||||
windows.append(self._build_fallback_highlight(context))
|
||||
|
||||
context.highlight_windows = windows
|
||||
|
||||
@@ -148,6 +145,20 @@ class VideoPipeline:
|
||||
for window, title in zip(context.highlight_windows, titles):
|
||||
window.title = title.strip()
|
||||
|
||||
def _build_fallback_highlight(self, context: PipelineContext) -> HighlightWindow:
|
||||
if not context.transcription:
|
||||
raise RuntimeError("Transcricao nao disponivel para criar fallback")
|
||||
|
||||
last_end = (
|
||||
context.transcription.segments[-1].end
|
||||
if context.transcription.segments
|
||||
else 0.0
|
||||
)
|
||||
return HighlightWindow(
|
||||
start=0.0,
|
||||
end=max(last_end, 10.0),
|
||||
summary="Sem destaque identificado; fallback automatico.",
|
||||
)
|
||||
|
||||
def _render_clips(self, context: PipelineContext) -> None:
|
||||
if not context.workspace or not context.highlight_windows or not context.transcription:
|
||||
|
||||
Reference in New Issue
Block a user