diff --git a/scripts/backfill_body.py b/scripts/backfill_body.py index f903939..0c9c85a 100644 --- a/scripts/backfill_body.py +++ b/scripts/backfill_body.py @@ -52,15 +52,10 @@ async def backfill( stats = {"scanned": 0, "matched": 0, "updated": 0, "skipped": 0, "failed": 0} async with AsyncSessionLocal() as session: - # 1) 找短 body 文章 - stmt = ( - select(Article) - .where((Article.body_text.is_(None)) | (Article.body_text == "") | (Article.translation_status != "ok")) - # 简化:只看 body 短的(无论翻译状态) - ) + # 1) 找短 body 文章(不管翻译状态 — 已翻译的也要回填,重置让 worker 用完整 body 重译) + stmt = select(Article) if source_slug: stmt = stmt.join(Source, Source.id == Article.source_id).where(Source.slug == source_slug) - # 全部扫一次(在内存里过滤 short body,避免 SQL 长度函数复杂) rows = (await session.execute(stmt.order_by(Article.id.desc()))).scalars() all_articles = list(rows) # 过滤 short body