feat: redesigned UI — AI Digest hero, keyboard nav (j/k/↑↓), dark/light mode, description-based summaries

This commit is contained in:
Gan, Jimmy
2026-06-24 01:17:56 +08:00
parent 7b485abfbb
commit 404d57f0b1
3 changed files with 175 additions and 303 deletions
+23 -5
View File
@@ -16,16 +16,17 @@ MODEL = os.environ.get("DEEPSEEK_MODEL", "deepseek-chat")
SYSTEM_PROMPT = "You are a professional video summarizing assistant. Create highly concise, structured summaries from video transcripts. Your output must be in Chinese if the transcript is Chinese, otherwise in English."
PROMPT = """Read the following YouTube video transcript and write a super-concise, structured summary.
PROMPT = """Read the following YouTube video information and write a super-concise, structured summary.
Guidelines:
1. **Core Hook (1 sentence in bold)**: Explain exactly what this video is about and its main conclusion or thesis.
2. **Key Takeaways (max 4-5 bullet points)**: Summarize the most important points, arguments, or steps. Focus on information density. Skip fluff, intros, sponsor segments, and generic remarks.
3. **Actionable Idea / Final Verdict**: A single line explaining who this is for or a key action item.
Keep the entire summary under 150 words. Be extremely direct so I can decide in 10 seconds if I should watch the full video or skip it. Use the same language as the transcript (likely Chinese or English).
The input may be a full transcript or just a title+description. Extract maximum value from whatever is provided.
Keep the entire summary under 150 words. Use the same language as the source (Chinese or English).
Transcript:
Content:
{transcript}"""
COOKIES_PATH = None
@@ -62,10 +63,27 @@ def download_transcript(video_id: str) -> str:
return None
async def summarize_video(video_id: str) -> str:
# 1. Fetch transcript
# 1. Try transcript, fall back to description
transcript = download_transcript(video_id)
if not transcript:
# Fallback: use video description from YouTube API
try:
from auth import get_credentials
from googleapiclient.discovery import build
creds = get_credentials()
youtube = build("youtube", "v3", credentials=creds)
resp = youtube.videos().list(part="snippet", id=video_id).execute()
items = resp.get("items", [])
if items:
desc = items[0]["snippet"].get("description", "")
title = items[0]["snippet"].get("title", "")
if desc:
transcript = f"Title: {title}\n\nDescription: {desc[:3000]}"
except Exception as e:
log.warning(f"Description fallback failed for {video_id}: {e}")
if not transcript:
# Save placeholder transcript / status
async with aiosqlite.connect(DB_PATH) as db:
await db.execute(
"UPDATE videos SET transcript = ?, summary = ? WHERE video_id = ?",