chore(kb): notițe youtube mai, fix email tools, update newsletter/anaf-monitor
Adaugă 4 notițe YouTube (llama.cpp, Mario Zechner, bonificatie impozit, AI scaffolding) + notă coaching grok. Actualizează index KB. Fix email_digest și email_forward. Update newsletter cercetasi + cron jobs. ANAF monitor hashes/snapshots/versions la zi. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,12 +127,29 @@ async def check_and_send(config, send_callback) -> None:
|
||||
return
|
||||
|
||||
channel = config.get("newsletter_cercetasi.channel", "echo-core")
|
||||
sent = False
|
||||
try:
|
||||
await send_callback(channel, summary)
|
||||
sent = True
|
||||
log.info("Newsletter #%d/%d summary sent to channel '%s'", next_n, current_year, channel)
|
||||
except Exception as e:
|
||||
log.error("Send failed for newsletter #%d/%d — will retry next check: %s", next_n, current_year, e)
|
||||
|
||||
# Trimite și pe WhatsApp dacă e configurat
|
||||
owner = config.get("whatsapp.owner", "")
|
||||
if owner and sent:
|
||||
owner_jid = f"{owner}@s.whatsapp.net"
|
||||
bridge_url = config.get("whatsapp.bridge_url", "http://127.0.0.1:8098")
|
||||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
for chunk in [summary[i:i+4096] for i in range(0, len(summary), 4096)]:
|
||||
await client.post(f"{bridge_url}/send", json={"to": owner_jid, "text": chunk}, timeout=15)
|
||||
log.info("Newsletter #%d/%d summary sent to WhatsApp", next_n, current_year)
|
||||
except Exception as e:
|
||||
log.error("WhatsApp send failed for newsletter #%d/%d: %s", next_n, current_year, e)
|
||||
|
||||
if sent:
|
||||
state["last_sent"] = next_n
|
||||
state["year"] = current_year
|
||||
state["last_sent_at"] = datetime.now(timezone.utc).isoformat()
|
||||
_write_state(state)
|
||||
log.info("Newsletter #%d/%d summary sent to channel '%s'", next_n, current_year, channel)
|
||||
except Exception as e:
|
||||
log.error("Send failed for newsletter #%d/%d — will retry next check: %s", next_n, current_year, e)
|
||||
|
||||
Reference in New Issue
Block a user