sprint: fixes batch — saveNote history, DeepSeek retry, channel rotation, test fixes, docker env, blocking transcript, sync errors

This commit is contained in:
Gan, Jimmy
2026-06-28 17:08:32 +08:00
parent 5c641903c9
commit 77c6a9d963
6 changed files with 285 additions and 131 deletions
+4 -4
View File
@@ -62,9 +62,9 @@ def download_transcript(video_id: str) -> str:
log.warning(f"Failed to fetch transcript for {video_id}: {e}")
return None
async def summarize_video(video_id: str) -> str:
# 1. Try transcript, fall back to description
transcript = download_transcript(video_id)
async def summarize_video(video_id: str) -> str | None:
# 1. Try transcript, fall back to description (offload sync call to thread)
transcript = await asyncio.to_thread(download_transcript, video_id)
if not transcript:
# Fallback: use video description from YouTube API
@@ -120,7 +120,7 @@ async def summarize_video(video_id: str) -> str:
summary = data["choices"][0]["message"]["content"]
except Exception as e:
log.error(f"DeepSeek API request failed for {video_id}: {e}")
summary = f"Error generating summary: {e}"
return None # Leave summary NULL for retry on next sync
# 3. Save transcript & summary to db
async with aiosqlite.connect(DB_PATH) as db: