From 575fdabbc018bf967118312942d437b6fa9b5a94 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Thu, 9 Jul 2026 03:39:08 +0800 Subject: [PATCH] fix: proxy support for transcript download, scroll-based mark-read, enable agent worker --- backend/summarizer.py | 4 +++ frontend/src/routes/YoutubeDashboard.svelte | 32 ++++++++++++++------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/backend/summarizer.py b/backend/summarizer.py index cbdd0eb..d18ecc1 100644 --- a/backend/summarizer.py +++ b/backend/summarizer.py @@ -44,6 +44,10 @@ for p in [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__) def download_transcript(video_id: str) -> str: try: session = requests.Session() + # Respect HTTP_PROXY/HTTPS_PROXY env vars + proxy = proxy_from_env() + if proxy: + session.proxies = {"http": proxy, "https": proxy} session.headers.update({ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "Accept-Language": "en-US,en;q=0.9" diff --git a/frontend/src/routes/YoutubeDashboard.svelte b/frontend/src/routes/YoutubeDashboard.svelte index e86877d..44edd14 100644 --- a/frontend/src/routes/YoutubeDashboard.svelte +++ b/frontend/src/routes/YoutubeDashboard.svelte @@ -225,21 +225,33 @@ $effect(() => { if (activeTab) loadVideos(); }); $effect(() => { - // Mark previous video as read when navigating away + // Scroll to top when switching videos if (selectedVideo && summaryPanel) { tick().then(() => summaryPanel.scrollTop = 0); } const prevId = prevSelectedId; prevSelectedId = selectedVideo?.video_id || null; - - if (prevId && prevId !== selectedVideo?.video_id && activeTab === 'pending') { - // Look up the previous video to check it had a valid summary - const prevVideo = videos.find(v => v.video_id === prevId); - if (prevVideo && prevVideo.summary && !prevVideo.summary.includes('Error') && !prevVideo.summary.includes('📺 Short clip')) { - updateStatus(prevId, 'read', true); - } - } + // NOTE: auto-mark-read is now handled by scroll-to-bottom detection (see below) + // and explicit user actions (r/Enter key or Read button). }); + + // Scroll-based auto-mark-read: mark video as read when user scrolls to bottom of summary + let scrollReadTimer = $state(null); + function handleSummaryScroll() { + if (!summaryPanel || !selectedVideo || activeTab !== 'pending') return; + const threshold = 100; // px from bottom + const atBottom = (summaryPanel.scrollHeight - summaryPanel.scrollTop - summaryPanel.clientHeight) < threshold; + if (atBottom) { + // Debounce to avoid rapid-fire updates + if (scrollReadTimer) clearTimeout(scrollReadTimer); + scrollReadTimer = setTimeout(() => { + const sv = selectedVideo; + if (sv && sv.summary && !sv.summary.includes('Error') && !sv.summary.includes('📺 Short clip')) { + updateStatus(sv.video_id, 'read', true); + } + }, 500); + } + } $effect(() => { if (activeTab === 'agent') loadAgentQueue(); }); @@ -545,7 +557,7 @@ -
+
{#if activeTab === '🤖 Agent'}

🤖 Agent Queue