fix: youtube transcript formatter crashes on a non-dict segment (#1745)

This commit is contained in:
Afonso Coutinho
2026-06-03 05:29:08 +01:00
committed by GitHub
parent 6e38d3f2ef
commit 063e7114e3
2 changed files with 22 additions and 0 deletions
+2
View File
@@ -168,6 +168,8 @@ def format_transcript_for_context(
if segments:
ctx += "Timestamped Transcript:\n"
for seg in segments:
if not isinstance(seg, dict):
continue
ctx += f"[{seg['timestamp']}] {seg['text']}\n"
# Check length — fall back to plain text if too long
if len(ctx) > 12000: