05/31 Phase 5

This commit is contained in:
2026-05-31 16:49:18 -04:00
parent 9c846159ef
commit b3d495e57c
9 changed files with 793 additions and 2 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env python3
"""
Cron script: generate daily AI financial insight via Groq.
Run by systemd timer pfm-aiinsight.timer at midnight daily.
"""
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from app import create_app
from app.services.ai_service import generate_daily_insight
app = create_app()
if __name__ == '__main__':
with app.app_context():
print('[ai_insight] Generating daily insight...')
content = generate_daily_insight()
if content:
preview = content[:200].replace('\n', ' ')
print(f'[ai_insight] Done: {preview}...')
else:
print('[ai_insight] Failed or skipped (already generated today).')
sys.exit(1)