fix: proxy support for transcript download, scroll-based mark-read, enable agent worker

This commit is contained in:
Gan, Jimmy
2026-07-09 03:39:08 +08:00
parent 672ad58ca4
commit 575fdabbc0
2 changed files with 26 additions and 10 deletions
+4
View File
@@ -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: def download_transcript(video_id: str) -> str:
try: try:
session = requests.Session() 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({ session.headers.update({
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"Accept-Language": "en-US,en;q=0.9" "Accept-Language": "en-US,en;q=0.9"
+22 -10
View File
@@ -225,21 +225,33 @@
$effect(() => { if (activeTab) loadVideos(); }); $effect(() => { if (activeTab) loadVideos(); });
$effect(() => { $effect(() => {
// Mark previous video as read when navigating away // Scroll to top when switching videos
if (selectedVideo && summaryPanel) { if (selectedVideo && summaryPanel) {
tick().then(() => summaryPanel.scrollTop = 0); tick().then(() => summaryPanel.scrollTop = 0);
} }
const prevId = prevSelectedId; const prevId = prevSelectedId;
prevSelectedId = selectedVideo?.video_id || null; prevSelectedId = selectedVideo?.video_id || null;
// NOTE: auto-mark-read is now handled by scroll-to-bottom detection (see below)
if (prevId && prevId !== selectedVideo?.video_id && activeTab === 'pending') { // and explicit user actions (r/Enter key or Read button).
// 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);
}
}
}); });
// 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(() => { $effect(() => {
if (activeTab === 'agent') loadAgentQueue(); if (activeTab === 'agent') loadAgentQueue();
}); });
@@ -545,7 +557,7 @@
</aside> </aside>
<!-- Right: summary panel --> <!-- Right: summary panel -->
<main bind:this={summaryPanel} id="summary-panel" class="flex-1 overflow-y-auto" style="background:var(--bg-primary);min-height:0"> <main bind:this={summaryPanel} onscroll={handleSummaryScroll} id="summary-panel" class="flex-1 overflow-y-auto" style="background:var(--bg-primary);min-height:0">
{#if activeTab === '🤖 Agent'} {#if activeTab === '🤖 Agent'}
<div class="p-6 max-w-3xl mx-auto"> <div class="p-6 max-w-3xl mx-auto">
<h2 class="text-sm font-black tracking-wider mb-4" style="color:var(--accent)">🤖 Agent Queue</h2> <h2 class="text-sm font-black tracking-wider mb-4" style="color:var(--accent)">🤖 Agent Queue</h2>