Refactor AI daily report pipeline

This commit is contained in:
Mimikko-zeus
2026-06-04 15:21:56 +08:00
parent 94e18ce22d
commit 5a98696255
64 changed files with 4778 additions and 1316 deletions

53
ai_daily_report/models.py Normal file
View File

@@ -0,0 +1,53 @@
from dataclasses import dataclass, field
from typing import Any
@dataclass(frozen=True)
class SourceConfig:
name: str
type: str
role: str = "supplement"
priority: int = 100
required: bool = False
enabled: bool = True
timeout_seconds: int = 25
retries: int = 0
min_items: int = 0
url: str = ""
@dataclass
class SourceResult:
source: str
role: str
ok: bool
status: str
items: list[dict[str, Any]] = field(default_factory=list)
error: str | None = None
elapsed_ms: int = 0
retry_count: int = 0
fetched_at: str = ""
@dataclass
class NewsItem:
id: str
source_group: str
source_label: str
source_role: str
source_priority: int
title_raw: str
title_norm: str
summary_raw: str
url: str
canonical_url: str
published_at: str | None = None
collected_at: str = ""
origin_type: str = ""
section_hint: str = ""
language_hint: str = ""
title: str | None = None
summary: str | None = None
section: str | None = None
quality_flags: list[str] = field(default_factory=list)
duplicate_sources: list[dict[str, Any]] = field(default_factory=list)