From 404d57f0b12e4547625d68c8728df6522533bbf8 Mon Sep 17 00:00:00 2001 From: "Gan, Jimmy" Date: Wed, 24 Jun 2026 01:17:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20redesigned=20UI=20=E2=80=94=20AI=20Dige?= =?UTF-8?q?st=20hero,=20keyboard=20nav=20(j/k/=E2=86=91=E2=86=93),=20dark/?= =?UTF-8?q?light=20mode,=20description-based=20summaries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/summarizer.py | 28 +- frontend/src/app.css | 28 ++ frontend/src/routes/YoutubeDashboard.svelte | 422 ++++++-------------- 3 files changed, 175 insertions(+), 303 deletions(-) diff --git a/backend/summarizer.py b/backend/summarizer.py index babc530..7c2ceeb 100644 --- a/backend/summarizer.py +++ b/backend/summarizer.py @@ -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 = ?", diff --git a/frontend/src/app.css b/frontend/src/app.css index b5c61c9..b64e627 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -1,3 +1,31 @@ @tailwind base; @tailwind components; @tailwind utilities; + +:root { + --bg-primary: #030712; + --bg-secondary: #111827; + --bg-tertiary: #1f2937; + --text-primary: #f3f4f6; + --text-secondary: #9ca3af; + --text-muted: #6b7280; + --border: #1f2937; + --accent: #ef4444; + --accent-hover: #dc2626; + --card-bg: #111827; +} + +:root.light { + --bg-primary: #f9fafb; + --bg-secondary: #ffffff; + --bg-tertiary: #f3f4f6; + --text-primary: #111827; + --text-secondary: #4b5563; + --text-muted: #9ca3af; + --border: #e5e7eb; + --accent: #dc2626; + --accent-hover: #b91c1c; + --card-bg: #ffffff; +} + +html { background: var(--bg-primary); color: var(--text-primary); } diff --git a/frontend/src/routes/YoutubeDashboard.svelte b/frontend/src/routes/YoutubeDashboard.svelte index 3ce520b..7bd5a9b 100644 --- a/frontend/src/routes/YoutubeDashboard.svelte +++ b/frontend/src/routes/YoutubeDashboard.svelte @@ -1,15 +1,20 @@ -
- -
+
+ +
- T YouTube - text feed + T YouTube + text feed
- -
- {#if syncMessage} - {syncMessage} - {/if} - +
- -
- -