feat(news): F0 — schema, config y métodos DB del monitor RSS (inerte)
news_seen table (CREATE TABLE IF NOT EXISTS, sin migración) + índices. Config NEWS_* (NEWS_ENABLED=false por defecto) + propiedad news_chat_id (fallback al 1er TELEGRAM_ALLOWED_USERS). Métodos ResearchDB: source_seeded, record_news_item, mark_news_notified, get_recent_news. Todo inerte: nada lo invoca aún. feedparser ya estaba en requirements (6.0.12 >= 6.0). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
727662294c
commit
fd814a3ccf
@@ -57,6 +57,20 @@ class Settings(BaseSettings):
|
||||
# the write path. A `/generate blog en dry` arg forces dryrun per-call.
|
||||
seo_autofill: str = Field("off", env="SEO_AUTOFILL")
|
||||
|
||||
# News monitor (RSS de noticias UAP/OVNI) — inerte hasta NEWS_ENABLED=true.
|
||||
NEWS_ENABLED: bool = Field(False, env="NEWS_ENABLED")
|
||||
NEWS_POLL_INTERVAL_HOURS: int = Field(6, env="NEWS_POLL_INTERVAL_HOURS")
|
||||
# Chat al que el monitor empuja novedades; si None -> 1er TELEGRAM_ALLOWED_USERS
|
||||
# (ver propiedad news_chat_id).
|
||||
NEWS_CHAT_ID: Optional[int] = Field(None, env="NEWS_CHAT_ID")
|
||||
NEWS_KEYWORDS: str = Field(
|
||||
"ovni,ovnis,uap,ufo,desclasificado,desclasificacion,declassified,"
|
||||
"avistamiento,sighting,extraterrestre,non-human,nhi,grusch,pentagono,"
|
||||
"pentagon,aaro,pursue,fenomeno aereo,whistleblower",
|
||||
env="NEWS_KEYWORDS",
|
||||
)
|
||||
NEWS_MAX_ITEMS: int = Field(15, env="NEWS_MAX_ITEMS")
|
||||
|
||||
# Alerts
|
||||
cost_alert_threshold: float = Field(0.15, env="COST_ALERT_THRESHOLD")
|
||||
|
||||
@@ -70,6 +84,15 @@ class Settings(BaseSettings):
|
||||
return []
|
||||
return [int(uid.strip()) for uid in self.telegram_allowed_users.split(",") if uid.strip()]
|
||||
|
||||
@property
|
||||
def news_chat_id(self) -> Optional[int]:
|
||||
"""Chat destino del monitor de noticias: NEWS_CHAT_ID explícito o, si no
|
||||
está definido, el primer TELEGRAM_ALLOWED_USERS."""
|
||||
if self.NEWS_CHAT_ID is not None:
|
||||
return self.NEWS_CHAT_ID
|
||||
ids = self.allowed_user_ids
|
||||
return ids[0] if ids else None
|
||||
|
||||
@property
|
||||
def seo_autofill_enabled(self) -> bool:
|
||||
"""True when autofill should run (either live 'on' or 'dryrun')."""
|
||||
|
||||
Reference in New Issue
Block a user