fix: 去重合并多来源后同步到 events/Qdrant/MySQL,新增 sync-sources 回填命令

- dedup/pipeline: 合并 source_ids 后自动同步已生成的 events JSON 和 Qdrant payload
- 新增 sync_sources_from_deduped / uv run en-news sync-sources,用于历史数据回填
- sync-sources 会扫描 deduped 多来源唯一篇,更新 events、Qdrant、MySQL news_event.sources
- docs: 补充 sync-sources 使用说明
This commit is contained in:
2026-08-23 10:55:23 +08:00
parent cf74e5e7f5
commit 9e4f5b4c75
4 changed files with 178 additions and 0 deletions
+20
View File
@@ -312,6 +312,26 @@ def report():
raise typer.Exit(code=1)
@app.command()
def sync_sources():
"""M3/M9 辅助:把 deduped 已合并的多来源同步到 events/Qdrant/MySQL"""
from dedup.pipeline import sync_sources_from_deduped
try:
stats = sync_sources_from_deduped()
typer.echo(
f"\n✅ 来源同步完成: 扫描 {stats['deduped_scanned']} 个唯一篇, "
f"多来源 {stats['multi_source']} 个, "
f"events 更新 {stats['events_updated']}, "
f"Qdrant 更新 {stats['qdrant_updated']}, "
f"MySQL 更新 {stats['db_updated']}"
)
except Exception as e:
logger.exception("来源同步失败")
typer.echo(f"❌ 来源同步出错: {e}", err=True)
raise typer.Exit(code=1)
@app.command()
def pipeline(
skip_report: bool = typer.Option(