Skip to content

feat(youtube): canonical sr_youtube_article tables and repository - #120

Merged
DGuang21 merged 1 commit into
mainfrom
feat/youtube-article-p0
Sep 10, 2026
Merged

DGuang21 merged 1 commit into
mainfrom
feat/youtube-article-p0

Conversation

@wulujia

@wulujia wulujia commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

做了什么

为 YouTube AI 整理稿新增两张表和仓储,是整个功能的第一步(P0)。字幕和文章本身是 R2 对象,表里只放指针、版本、状态和门控结果。

  • sr_youtube_article:视频级,一行对应一个(video_id,source_hash,prompt_version)。字幕一变就是新行,旧文章不会盖到新字幕上。
  • sr_youtube_article_ref:书签级,bookmark_id 唯一,记录书签抓取时看到的字幕版本。权限始终由书签决定,这张表和 R2 key 都不当权限用。
  • YoutubeArticleReporecordEvaluation()(不覆盖已进入 generating/ready 的行)、linkBookmark()findForBookmark()unlinkBookmark()countRefs()
  • 迁移 prisma/migrations/20260909000000_add_youtube_article,与托管后端 pg_migrations 同名同内容。

为什么用 video_id 而不是 bookmark_id:sr_bookmark 唯一键是(target_url,private_user),托管收藏时书签本来就是每个用户一份。

验证

  • 本仓库 lint 配置检查无问题;类型通过托管后端的 tsc 一并检查。
  • 没有连真实数据库执行迁移。

发布

先合这个 PR,再把托管后端 unnoo/slax_reader_backend 的 public-api 指针换到 main。对应后端 PR 在同名分支 feat/youtube-article-p0

细节见 20260909-youtube-article-p0.md

🤖 Generated with Claude Code

https://claude.ai/code/session_018BfjDnY5W2Jbkh6i4atg31

Job tables for the derived YouTube AI article: pointers, versions, status
and the eligibility result only; captions and articles stay in R2 under
youtube/canonical/. sr_youtube_article is one row per
(video_id, source_hash, prompt_version) shared by every bookmark of the
video; sr_youtube_article_ref records which caption version each bookmark
saw. Bookmarks are per user here (sr_bookmark is unique on target_url +
private_user), so video_id is the canonical identity, not bookmark_id.
Visibility is always decided by the bookmark.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BfjDnY5W2Jbkh6i4atg31
@DGuang21
DGuang21 merged commit 023f04f into main Sep 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants